def __init__(self, **kw): message = kw['message'] image = kw['image'] del kw['message'] del kw['image'] super(MsgDialog, self).__init__(**kw) image.setPadding((12, 6)) contents = cimarron.getEngine().HBox() contents.addChild(image) contents.addChild(message) self.setContents(contents)
def __init__(self, message=_("<big><b>You are about to do something dangerous.</b></big>\n\nAre you sure you want to proceed?"), yea=_("_Proceed"), nay=_("_Abort"), **kw): ui = cimarron.getEngine() nay = ui.Button(label=nay, stockImage="no", value=0) yea = ui.Button(label=yea, stockImage="ok", value=1) msg = ui.Label(label=message, useMarkup=True, lineWrap=True) image = ui.Image(fromStock=("dialog_warning", "dialog")) super(WarningDialog, self).__init__(message=msg, image=image, buttons=(nay, yea), default=nay, **kw )
def __init__(self, **kw): ui = cimarron.getEngine() msg = kw.pop('message', None) or \ _("<big><b>You are about to do something strange or time-consuming.</b></big>\n\nAre you sure you want to proceed?") yea = kw.pop('yea', None) or _("_Proceed") nay = kw.pop('nay', None) or _("_Abort") nay = ui.Button(label=nay, stockImage="no", value=0) yea = ui.Button(label=yea, stockImage="ok", value=1) msg = ui.Label(label=msg, useMarkup=True, lineWrap=True) image = ui.Image(stock=("dialog_question", "dialog")) super(QuestionDialog, self).__init__(msg, image, buttons=(nay, yea), default=yea, **kw )
# -*- coding: ISO-8859-1 -*- from Generic.Composite import Composite from ViewController import ViewController from Modeling.EditingContext import EditingContext from cimarron import getEngine, Failed # get the engine ui= getEngine () from Utils import Debug # Debug.sections.append ('ConsistencyController') class ConsistencyController (ViewController, Composite): """ Controller that warns the user that is trying to close the window when the data is dirty. It also has a NoteBook. """ __kwargs= ('windowTitle', 'model', 'modelClass') def __init__ (self, *args, **kwargs): # already takes care of model and modelClass params via setModel{,Class}() # self.editingContext= NewEditingContext () self.editingContext= EditingContext () self._processArgs(ConsistencyController, kwargs) def buildView (self): self.win= ui.Window (parent=self.getParent(), title=self.getWindowTitle ()) self.win.addDelegation (self) v= ui.VBox (parent=self.win) self.tabbook= ui.Notebook (parent=v)
msg = ui.Label(label=msg, useMarkup=True, lineWrap=True) image = ui.Image(stock=("dialog_question", "dialog")) super(QuestionDialog, self).__init__(msg, image, buttons=(nay, yea), default=yea, **kw ) def run(self): return super(QuestionDialog, self).run() == 1 if 0: ui= cimarron.getEngine () # stock button lists ok= ui.Button (stock='ok', value=True) cancel= ui.Button (stock='cancel', value=False) close= ui.Button (stock='close', value=0) yes= ui.Button (stock='yes', value=0) no= ui.Button (stock='no', value=0) stockOkCancel= [ok, cancel] stockOk= [ok] stockClose= [close] stockCancel= [cancel] stockYesNo= [yes, no] # types warning= 'WARNING'
def setUp(self): self.ui = cimarron.getEngine() self.app = self.ui.Application() self.win = self.ui.Window(parent=self.app) self.box = self.ui.HBox(parent=self.win)
def setUp(self): self.ui = cimarron.getEngine() self.obj2 = self.obj = self.ui.Application()
def main(): eng = None if len(sys.argv) > 1: eng = sys.argv[1] cimarron.setEngine(eng) ui = cimarron.getEngine() app = ui.Application() win = ui.Window(parent=app, title='Test Window') nbk = ui.Notebook(parent=win) vbox = ui.VBox() nbk.appendPage(child=vbox, label='Why should tabs have short labels?') about = ui.Label(label=u'This example © 2004 the PAPO team') nbk.appendPage(child=about, label='''What was the question again?''') misc_frame = ui.Frame(label='HBox', borderWidth=4, parent=vbox) misc_hbox = ui.HBox(parent=misc_frame) image = ui.Image(parent=misc_hbox, tip=u'Image') image.setFromStock('dialog_info', 'dialog') label = ui.Label( parent=misc_hbox, tip=u'Label', useMarkup=True, label='<span size="xx-large"><b>A big, fat, label</b></span>') entry_frame = ui.Frame(parent=vbox, label='VBox', borderWidth=4) entry_hbox = ui.VBox(parent=entry_frame) tentry = ui.TextEntry(parent=entry_hbox, tip='TextEntry') nentry = ui.NumEntry(parent=entry_hbox, tip="NumEntry", range=(0, 100), increments=(1, 10)) class DateModel(object): def __init__(self, value=None): self.setValue(value) def setValue(self, value, *ignore): self._value = value def getValue(self, *ignore): return self._value dateModel = DateModel() dentry = ui.DateEntry( parent=entry_hbox, tip='DateEntry', valueLoader=dateModel.getValue, action=dateModel.setValue, ) bbox_frame = ui.Frame(parent=vbox, label='HButtonBox', borderWidth=4) bbox = ui.HButtonBox(parent=bbox_frame) b1 = ui.Button(image="/usr/share/pixmaps/other/Shout.png", parent=bbox, tip="button that pops up a dialog") b2 = ui.Button(label="another button", parent=bbox, tip="button") bb1 = ui.BoolEntry(parent=bbox, label=u"a boolentry", defaultValue=False, tip="boolentry") bb2 = ui.BoolEntry(parent=bbox, label=u"«inconsistent»\nboolentry", tip="troolentry :)") leftButton = ui.Button(label=u'_Argh!', defaultValue=0) leftButton.setImage('/usr/share/pixmaps/other/Shout.png') rightButton = ui.Button(label=u'_Muere, maldito!', defaultValue=1) msg = ui.WarningDialog( parent=win, title=u'Bang! Bang! Estás liquidado...', message= u'<big><b>Todos tus archivos han sido eliminados.</b></big>\n\nY ahora, ¿¡qué hacemos!?', yea="_Seguir", nay="_Abandonar") def handler(*a): if msg.run(): win.pushStatus('Siguiendo...', timeout=2, icon="error") else: win.pushStatus('Abandonando...', timeout=2, icon="warn") b1.setAction(handler) table = ui.Table(size=(3, 3), homogeneous=False, parent=vbox) table.attach(ui.Button(label="1"), 0, 1, 0, 1) table.attach(ui.Button(label="2"), 1, 2, 1, 2) table.attach(ui.Button(label="3"), 2, 3, 2, 3) dlgt = exampleWindowDelegate() win.addDelegation(dlgt) win.pushStatus('Listo.') win.show() win2 = ui.Window(parent=app, title='another window') l2 = ui.Label(label='Please close the other windows first', parent=win2) win2.addDelegation(dlgt, 1) win2.show() app.run()
# -*- coding: ISO-8859-1 -*- from Generic.Composite import Composite from ViewController import ViewController from Modeling.EditingContext import EditingContext from cimarron import getEngine, Failed # get the engine ui = getEngine() from Utils import Debug # Debug.sections.append ('ConsistencyController') class ConsistencyController(ViewController, Composite): """ Controller that warns the user that is trying to close the window when the data is dirty. It also has a NoteBook. """ __kwargs = ('windowTitle', 'model', 'modelClass') def __init__(self, *args, **kwargs): # already takes care of model and modelClass params via setModel{,Class}() # self.editingContext= NewEditingContext () self.editingContext = EditingContext() self._processArgs(ConsistencyController, kwargs) def buildView(self): self.win = ui.Window(parent=self.getParent(), title=self.getWindowTitle()) self.win.addDelegation(self)
def main(): eng=None if len(sys.argv) > 1: eng = sys.argv[1] cimarron.setEngine(eng) ui = cimarron.getEngine() app = ui.Application() win = ui.Window(parent=app, title='Test Window') nbk = ui.Notebook(parent=win) vbox = ui.VBox() nbk.appendPage(child=vbox, label='Why should tabs have short labels?') about = ui.Label(label=u'This example © 2004 the PAPO team') nbk.appendPage(child=about, label='''What was the question again?''') misc_frame = ui.Frame(label='HBox', borderWidth=4, parent=vbox ) misc_hbox = ui.HBox(parent=misc_frame) image = ui.Image(parent=misc_hbox, tip=u'Image') image.setFromStock('dialog_info', 'dialog') label = ui.Label(parent=misc_hbox, tip=u'Label', useMarkup=True, label='<span size="xx-large"><b>A big, fat, label</b></span>') entry_frame = ui.Frame(parent=vbox, label='VBox', borderWidth=4) entry_hbox = ui.VBox(parent=entry_frame) tentry = ui.TextEntry(parent=entry_hbox, tip='TextEntry') nentry = ui.NumEntry(parent=entry_hbox, tip="NumEntry", range=(0, 100), increments=(1, 10)) class DateModel (object): def __init__ (self, value=None): self.setValue (value) def setValue (self, value, *ignore): self._value= value def getValue (self, *ignore): return self._value dateModel= DateModel () dentry = ui.DateEntry(parent=entry_hbox, tip='DateEntry', valueLoader= dateModel.getValue, action= dateModel.setValue, ) bbox_frame = ui.Frame(parent=vbox, label='HButtonBox', borderWidth=4) bbox = ui.HButtonBox(parent=bbox_frame) b1 = ui.Button(image="/usr/share/pixmaps/other/Shout.png", parent=bbox, tip="button that pops up a dialog") b2 = ui.Button(label="another button", parent=bbox, tip="button") bb1 = ui.BoolEntry(parent=bbox, label=u"a boolentry", defaultValue=False, tip="boolentry") bb2 = ui.BoolEntry(parent=bbox, label=u"«inconsistent»\nboolentry", tip="troolentry :)") leftButton = ui.Button(label=u'_Argh!', defaultValue=0) leftButton.setImage ('/usr/share/pixmaps/other/Shout.png') rightButton = ui.Button(label=u'_Muere, maldito!', defaultValue=1) msg = ui.WarningDialog(parent=win, title=u'Bang! Bang! Estás liquidado...', message=u'<big><b>Todos tus archivos han sido eliminados.</b></big>\n\nY ahora, ¿¡qué hacemos!?', yea="_Seguir", nay="_Abandonar") def handler(*a): if msg.run(): win.pushStatus('Siguiendo...', timeout=2, icon="error") else: win.pushStatus('Abandonando...', timeout=2, icon="warn") b1.setAction (handler) table = ui.Table(size=(3,3), homogeneous=False, parent=vbox) table.attach(ui.Button(label="1"),0,1,0,1) table.attach(ui.Button(label="2"),1,2,1,2) table.attach(ui.Button(label="3"),2,3,2,3) dlgt = exampleWindowDelegate() win.addDelegation(dlgt) win.pushStatus('Listo.') win.show() win2 = ui.Window(parent=app, title='another window') l2 = ui.Label(label='Please close the other windows first', parent=win2) win2.addDelegation(dlgt, 1) win2.show() app.run()