From: Kevin A. <ka...@us...> - 2004-08-12 19:19:35
|
Update of /cvsroot/pythoncard/PythonCard/samples/dialogs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16511/dialogs Modified Files: dialogs.py minimalDialog.py Log Message: dialog.py is now a thin wrapper around wx.lib.dialogs.py all dialog results now use DialogResults class instead of dictionary e.g. result.accepted instead of result['accepted'] see dialogs sample and other samples and tools for examples of change Index: minimalDialog.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dialogs/minimalDialog.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** minimalDialog.py 15 Apr 2004 23:59:29 -0000 1.6 --- minimalDialog.py 12 Aug 2004 19:18:51 -0000 1.7 *************** *** 6,10 **** from PythonCard import model - import os class MinimalDialog(model.CustomDialog): --- 6,9 ---- *************** *** 17,23 **** def minimalDialog(parent, txt): dlg = MinimalDialog(parent, txt) ! dlg.showModal() ! result = {'accepted':dlg.accepted()} ! result['text'] = dlg.components.field1.text dlg.destroy() return result --- 16,21 ---- def minimalDialog(parent, txt): dlg = MinimalDialog(parent, txt) ! result = dlg.showModal() ! result.text = dlg.components.field1.text dlg.destroy() return result Index: dialogs.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dialogs/dialogs.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** dialogs.py 5 May 2004 16:53:25 -0000 1.21 --- dialogs.py 12 Aug 2004 19:18:50 -0000 1.22 *************** *** 24,47 **** def on_buttonMultipleChoice_mouseClick(self, event): result = dialog.multipleChoiceDialog(self, "title", "message", ['one', 'two', 'three']) ! self.components.fldResults.text = "multipleChoiceDialog result:\naccepted: %s\nSelection: %s" % (result['accepted'], result['selection']) def on_buttonSingleChoice_mouseClick(self, event): result = dialog.singleChoiceDialog(self, "title", "message", ['one', 'two', 'three']) ! self.components.fldResults.text = "singleChoiceDialog result:\naccepted: %s\nSelection: %s" % (result['accepted'], result['selection']) def on_buttonFind_mouseClick(self, event): result = dialog.findDialog(self) ! self.components.fldResults.text = "findDialog result:\naccepted: %s\nText: %s\nWhole word only: %s\nCase sensitive: %s" % (result['accepted'], ! result['searchText'], ! result['wholeWordsOnly'], ! result['caseSensitive']) def on_buttonColor_mouseClick(self, event): result = dialog.colorDialog(self) ! self.components.fldResults.text = "colorDialog result:\naccepted: %s\nColor: %s" % (result['accepted'], result['color']) def on_buttonFont_mouseClick(self, event): result = dialog.fontDialog(self) ! self.components.fldResults.text = "fontDialog result:\naccepted: %s\nColor: %s\nFont: %s" % (result['accepted'], result['color'], result['font']) def on_buttonFile_mouseClick(self, event): --- 24,47 ---- def on_buttonMultipleChoice_mouseClick(self, event): result = dialog.multipleChoiceDialog(self, "title", "message", ['one', 'two', 'three']) ! self.components.fldResults.text = "multipleChoiceDialog result:\naccepted: %s\nSelection: %s" % (result.accepted, result.selection) def on_buttonSingleChoice_mouseClick(self, event): result = dialog.singleChoiceDialog(self, "title", "message", ['one', 'two', 'three']) ! self.components.fldResults.text = "singleChoiceDialog result:\naccepted: %s\nSelection: %s" % (result.accepted, result.selection) def on_buttonFind_mouseClick(self, event): result = dialog.findDialog(self) ! self.components.fldResults.text = "findDialog result:\naccepted: %s\nText: %s\nWhole word only: %s\nCase sensitive: %s" % (result.accepted, ! result.text, ! result.wholeword, ! result.casesensitive) def on_buttonColor_mouseClick(self, event): result = dialog.colorDialog(self) ! self.components.fldResults.text = "colorDialog result:\naccepted: %s\nColor: %s" % (result.accepted, result.color) def on_buttonFont_mouseClick(self, event): result = dialog.fontDialog(self) ! self.components.fldResults.text = "fontDialog result:\naccepted: %s\nColor: %s\nFont: %s" % (result.accepted, result.color, result.font) def on_buttonFile_mouseClick(self, event): *************** *** 49,53 **** # wildcard = '*.py' result = dialog.fileDialog(self, 'Open', '', '', wildcard ) ! self.components.fldResults.text = "fileDialog result:\naccepted: %s\npaths: %s" % (result['accepted'], result['paths']) def on_buttonOpenFile_mouseClick(self, event): --- 49,53 ---- # wildcard = '*.py' result = dialog.fileDialog(self, 'Open', '', '', wildcard ) ! self.components.fldResults.text = "fileDialog result:\naccepted: %s\npaths: %s" % (result.accepted, result.paths) def on_buttonOpenFile_mouseClick(self, event): *************** *** 55,59 **** # wildcard = '*.py' result = dialog.openFileDialog(wildcard=wildcard) ! self.components.fldResults.text = "openFileDialog result:\naccepted: %s\npaths: %s" % (result['accepted'], result['paths']) def on_buttonSaveFile_mouseClick(self, event): --- 55,59 ---- # wildcard = '*.py' result = dialog.openFileDialog(wildcard=wildcard) ! self.components.fldResults.text = "openFileDialog result:\naccepted: %s\npaths: %s" % (result.accepted, result.paths) def on_buttonSaveFile_mouseClick(self, event): *************** *** 61,69 **** # wildcard = '*.py' result = dialog.saveFileDialog(wildcard=wildcard) ! self.components.fldResults.text = "saveFileDialog result:\naccepted: %s\npaths: %s" % (result['accepted'], result['paths']) def on_buttonDir_mouseClick(self, event): result = dialog.directoryDialog(self, 'Choose a directory', 'a') ! self.components.fldResults.text = "directoryDialog result:\naccepted: %s\npath: %s" % (result['accepted'], result['path']) """ --- 61,69 ---- # wildcard = '*.py' result = dialog.saveFileDialog(wildcard=wildcard) ! self.components.fldResults.text = "saveFileDialog result:\naccepted: %s\npaths: %s" % (result.accepted, result.paths) def on_buttonDir_mouseClick(self, event): result = dialog.directoryDialog(self, 'Choose a directory', 'a') ! self.components.fldResults.text = "directoryDialog result:\naccepted: %s\npath: %s" % (result.accepted, result.path) """ *************** *** 77,96 **** ICON_INFORMATION # Shows an information (i) icon. ! BUTTON_OK # Show an OK button. ! BUTTON_CANCEL # Show a Cancel button. ! BUTTON_YES_NO # Show Yes and No buttons. ! BUTTON_YES_DEFAULT # Used with wxYES_NO, makes Yes button the default - which is the default behaviour. ! BUTTON_NO_DEFAULT # Used with wxYES_NO, makes No button the default. """ def on_buttonMessage_mouseClick(self, event): """ result = dialog.messageDialog(self, 'a message', 'a title', ! dialog.ICON_ERROR, dialog.BUTTON_YES_NO) """ result = dialog.messageDialog(self, 'a message', 'a title', ! dialog.ICON_INFORMATION, ! dialog.BUTTON_YES_NO | dialog.BUTTON_NO_DEFAULT | dialog.BUTTON_CANCEL) #result = dialog.messageDialog(self, 'a message', 'a title') ! self.components.fldResults.text = "messageDialog result:\naccepted: %s\nreturned: %s" % (result['accepted'], result['returned']) # you can pass in an additional aStyle parameter --- 77,95 ---- ICON_INFORMATION # Shows an information (i) icon. ! OK # Show an OK button. ! CANCEL # Show a Cancel button. ! YES_NO # Show Yes and No buttons. ! YES_DEFAULT # Used with wxYES_NO, makes Yes button the default - which is the default behaviour. ! NO_DEFAULT # Used with wxYES_NO, makes No button the default. """ def on_buttonMessage_mouseClick(self, event): """ result = dialog.messageDialog(self, 'a message', 'a title', ! wx.ICON_ERROR | wx.YES_NO) """ result = dialog.messageDialog(self, 'a message', 'a title', ! wx.ICON_INFORMATION | wx.YES_NO | wx.NO_DEFAULT | wx.CANCEL) #result = dialog.messageDialog(self, 'a message', 'a title') ! self.components.fldResults.text = "messageDialog result:\naccepted: %s\nreturnedString: %s" % (result.accepted, result.returnedString) # you can pass in an additional aStyle parameter *************** *** 105,111 **** 'A window title', 'What is your favorite language?', ! 'Python', dialog.TEXT_MULTILINE) """ ! self.components.fldResults.text = "textEntryDialog result:\naccepted: %s\nreturned: %s\ntext: %s" % (result['accepted'], result['returned'], result['text']) def on_buttonScrolledMessage_mouseClick(self, event): --- 104,110 ---- 'A window title', 'What is your favorite language?', ! 'Python', wx.TEXT_MULTILINE) """ ! self.components.fldResults.text = "textEntryDialog result:\naccepted: %s\nreturnedString: %s\ntext: %s" % (result.accepted, result.returnedString, result.text) def on_buttonScrolledMessage_mouseClick(self, event): *************** *** 118,130 **** msg = "Can't find the file dialogs.py" result = dialog.scrolledMessageDialog(self, msg, filename) ! self.components.fldResults.text = "scrolledMessageDialog result:\naccepted: %s" % (result['accepted']) def on_buttonAlert_mouseClick(self, event): result = dialog.alertDialog(self, 'a message', 'a title') ! self.components.fldResults.text = "alertDialog result:\naccepted: %s\nreturned: %s" % (result['accepted'], result['returned']) def on_buttonMinimalDialog_mouseClick(self, event): result = minimalDialog.minimalDialog(self, 'hello minimal') ! self.components.fldResults.text = "minimalDialog result:\naccepted: %s\ntext: %s" % (result['accepted'], result['text']) --- 117,129 ---- msg = "Can't find the file dialogs.py" result = dialog.scrolledMessageDialog(self, msg, filename) ! self.components.fldResults.text = "scrolledMessageDialog result:\naccepted: %s" % (result.accepted) def on_buttonAlert_mouseClick(self, event): result = dialog.alertDialog(self, 'a message', 'a title') ! self.components.fldResults.text = "alertDialog result:\naccepted: %s\nreturnedString: %s" % (result.accepted, result.returnedString) def on_buttonMinimalDialog_mouseClick(self, event): result = minimalDialog.minimalDialog(self, 'hello minimal') ! self.components.fldResults.text = "minimalDialog result:\naccepted: %s\ntext: %s" % (result.accepted, result.text) |