Author: visnov Date: Tue Feb 24 15:49:14 2009 New Revision: 55725 URL: http://svn.opensuse.org/viewcvs/yast?rev=55725&view=rev Log: my small Python UI library, right now can do main window and wizard window Added: branches/tmp/visnov/ branches/tmp/visnov/python-ui/ branches/tmp/visnov/python-ui/main.py branches/tmp/visnov/python-ui/widget_library.py Added: branches/tmp/visnov/python-ui/main.py URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/visnov/python-ui/main.py?rev=55725&view=auto ============================================================================== --- branches/tmp/visnov/python-ui/main.py (added) +++ branches/tmp/visnov/python-ui/main.py Tue Feb 24 15:49:14 2009 @@ -0,0 +1,9 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +import yui +from widget_library import * + +if __name__== "__main__": + td = WizardDialog() + td.run() + Added: branches/tmp/visnov/python-ui/widget_library.py URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/visnov/python-ui/widget_library.py?rev=55725&view=auto ============================================================================== --- branches/tmp/visnov/python-ui/widget_library.py (added) +++ branches/tmp/visnov/python-ui/widget_library.py Tue Feb 24 15:49:14 2009 @@ -0,0 +1,57 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +import yui + +class MainDialog: + def __init__(self): + self.factory = yui.YUI.widgetFactory() + self.optionalFactory = yui.YUI.optionalWidgetFactory() + self.dialog = self.factory.createMainDialog() + self.setupWidgets(self.dialog) + + def __del__(self): + self.dialog.destroy() + + def run(self): + etype=-1 + while etype != yui.YEvent.CancelEvent: + event = self.dialog.waitForEvent() + etype = event.eventType() + res = self.handleEvent( event ) + if res != None: + return res; + + def setupWidgets(self, dialog): + pass + +# need to handle this better + def handleEvent(self, event): + return None + +class WizardDialog(MainDialog): + + def setupWidgets(self, dialog): + self.wizard = self.optionalFactory.createWizard( dialog, self.backButton(), self.abortButton(), self.nextButton() ) + self.abortID = yui.YStringWidgetID( "abort" ) + self.wizard.abortButton().setId( self.abortID ) + self.nextID = yui.YStringWidgetID( "next" ) + self.wizard.nextButton().setId( self.nextID ) + self.backID = yui.YStringWidgetID( "back" ) + self.wizard.backButton().setId( self.backID ) + + def backButton(self): + return "Back" + + def nextButton(self): + return "Next" + + def abortButton(self): + return "Abort" + + def handleEvent(self, event): + if event.eventType() == yui.YEvent.WidgetEvent: + eventId = event.widget().id().toString(); + if eventId == "back" or eventId == "next" or eventId == "abort": + return "eventId"; + else: + return MainDialog.handleEvent(self,event) -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org