From: Kevin A. <ka...@us...> - 2004-08-12 19:15:02
|
Update of /cvsroot/pythoncard/PythonCard/tools/codeEditor/scriptlets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15782/codeEditor/scriptlets Modified Files: documentWordCount.py insertDialog.py selectionWordCount.py Log Message: getCommandLineArgs moved to util.py runOptionsDialog moved to templates.dialogs.runOptionsDialog.py 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: documentWordCount.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/codeEditor/scriptlets/documentWordCount.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** documentWordCount.py 8 Apr 2004 20:56:55 -0000 1.5 --- documentWordCount.py 12 Aug 2004 19:14:21 -0000 1.6 *************** *** 1,2 **** --- 1,3 ---- + import wx from PythonCard import dialog, util *************** *** 14,16 **** filename = os.path.basename(bg.documentPath) ! dialog.MessageDialog(bg, "Document: %s\n" % filename + "%d chars, %d words, %d lines" % wordCount(util.normalizeEOL(bg.components.document.text)), 'Word Count', dialog.ICON_INFORMATION, dialog.BUTTON_OK) --- 15,17 ---- filename = os.path.basename(bg.documentPath) ! dialog.MessageDialog(bg, "Document: %s\n" % filename + "%d chars, %d words, %d lines" % wordCount(util.normalizeEOL(bg.components.document.text)), 'Word Count', wx.ICON_INFORMATION | wx.OK) Index: insertDialog.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/codeEditor/scriptlets/insertDialog.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** insertDialog.py 8 Apr 2004 20:56:55 -0000 1.7 --- insertDialog.py 12 Aug 2004 19:14:21 -0000 1.8 *************** *** 2,58 **** alertDialogTemplate = """result = dialog.alertDialog(self, 'a message', 'a title') ! if result['accepted']: ! returned = result['returned'] """ colorDialogTemplate = """result = dialog.colorDialog(self) ! if result['accepted']: ! color = result['color'] """ directoryDialogTemplate = """result = dialog.directoryDialog(self, 'Choose a directory', '') ! if result['accepted']: ! path = result['path'] """ findDialogTemplate = """result = dialog.findDialog(self) ! if result['accepted']: ! searchText = result['searchText'] ! wholeWordsOnly = result['wholeWordsOnly'] ! caseSensitive = result['caseSensitive'] """ fontDialogTemplate = """result = dialog.fontDialog(self) ! if result['accepted']: ! color = result['color'] ! font = result['font'] """ messageDialogTemplate = """result = dialog.messageDialog(self, 'a message', 'a title', ! dialog.ICON_INFORMATION, ! dialog.BUTTON_YES_NO | dialog.BUTTON_NO_DEFAULT | dialog.BUTTON_CANCEL) ! if result['accepted']: ! returned = result['returned'] """ multipleChoiceDialogTemplate = """result = dialog.multipleChoiceDialog(self, "title", "message", ['one', 'two', 'three']) ! if result['accepted']: ! sel = result['selection'] """ openFileDialogTemplate = """wildcard = "JPG files (*.jpg;*.jpeg)|*.jpg;*.jpeg;*.JPG;*.JPEG|GIF files (*.gif)|*.gif;*.GIF|All Files (*.*)|*.*" result = dialog.openFileDialog(self, 'Open', '', '', wildcard ) ! if result['accepted']: ! path = result['paths'][0] """ saveFileDialogTemplate = """wildcard = "JPG files (*.jpg;*.jpeg)|*.jpg;*.jpeg;*.JPG;*.JPEG|GIF files (*.gif)|*.gif;*.GIF|All Files (*.*)|*.*" result = dialog.saveFileDialog(self, 'Save', '', '', wildcard ) ! if result['accepted']: ! path = result['paths'][0] """ scrolledMessageDialogTemplate = """dialog.scrolledMessageDialog(self, 'message', 'title') ! if result['accepted']: # you don't really need the accepted test, since there isn't a result # to check for a scrolledMessageDialog --- 2,57 ---- alertDialogTemplate = """result = dialog.alertDialog(self, 'a message', 'a title') ! if result.accepted: ! returned = result.returnedString """ colorDialogTemplate = """result = dialog.colorDialog(self) ! if result.accepted: ! color = result.color """ directoryDialogTemplate = """result = dialog.directoryDialog(self, 'Choose a directory', '') ! if result.accepted: ! path = result.path """ findDialogTemplate = """result = dialog.findDialog(self) ! if result.accepted: ! searchText = result.text ! wholeWordsOnly = result.wholeword ! caseSensitive = result.casesensitive """ fontDialogTemplate = """result = dialog.fontDialog(self) ! if result.accepted: ! color = result.color ! font = result.font """ messageDialogTemplate = """result = dialog.messageDialog(self, 'a message', 'a title', ! wx.ICON_INFORMATION | wx.YES_NO | wx.NO_DEFAULT | wx.CANCEL) ! if result.accepted: ! returned = result.returnedString """ multipleChoiceDialogTemplate = """result = dialog.multipleChoiceDialog(self, "title", "message", ['one', 'two', 'three']) ! if result.accepted: ! sel = result.selection """ openFileDialogTemplate = """wildcard = "JPG files (*.jpg;*.jpeg)|*.jpg;*.jpeg;*.JPG;*.JPEG|GIF files (*.gif)|*.gif;*.GIF|All Files (*.*)|*.*" result = dialog.openFileDialog(self, 'Open', '', '', wildcard ) ! if result.accepted: ! path = result.paths[0] """ saveFileDialogTemplate = """wildcard = "JPG files (*.jpg;*.jpeg)|*.jpg;*.jpeg;*.JPG;*.JPEG|GIF files (*.gif)|*.gif;*.GIF|All Files (*.*)|*.*" result = dialog.saveFileDialog(self, 'Save', '', '', wildcard ) ! if result.accepted: ! path = result.paths[0] """ scrolledMessageDialogTemplate = """dialog.scrolledMessageDialog(self, 'message', 'title') ! if result.accepted: # you don't really need the accepted test, since there isn't a result # to check for a scrolledMessageDialog *************** *** 61,72 **** singleChoiceDialogTemplate = """result = dialog.singleChoiceDialog(self, "title", "message", ['one', 'two', 'three']) ! if result['accepted']: ! sel = result['selection'] """ textEntryDialogTemplate = """result = dialog.textEntryDialog(self, 'title', 'message', 'text') ! if result['accepted']: ! returned = result['returned'] ! text = result['text'] """ --- 60,71 ---- singleChoiceDialogTemplate = """result = dialog.singleChoiceDialog(self, "title", "message", ['one', 'two', 'three']) ! if result.accepted: ! sel = result.selection """ textEntryDialogTemplate = """result = dialog.textEntryDialog(self, 'title', 'message', 'text') ! if result.accepted: ! returned = result.returnedString ! text = result.text """ *************** *** 80,85 **** result = dialog.singleChoiceDialog(None, "Dialogs", "Pick a dialog:", dialogsList) ! if result['accepted']: ! dialogText = eval(result['selection'] + 'Template') # could get the current indent and insert the appropriate # number of spaces before each line of the template here --- 79,84 ---- result = dialog.singleChoiceDialog(None, "Dialogs", "Pick a dialog:", dialogsList) ! if result.accepted: ! dialogText = eval(result.selection + 'Template') # could get the current indent and insert the appropriate # number of spaces before each line of the template here Index: selectionWordCount.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/codeEditor/scriptlets/selectionWordCount.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** selectionWordCount.py 8 Apr 2004 20:56:55 -0000 1.6 --- selectionWordCount.py 12 Aug 2004 19:14:21 -0000 1.7 *************** *** 1,2 **** --- 1,3 ---- + import wx from PythonCard import dialog, util *************** *** 15,17 **** text = util.normalizeEOL(bg.components.document.GetSelectedText()) ! dialog.MessageDialog(bg, "Document: %s\n" % filename + "%d chars, %d words, %d lines" % wordCount(text), 'Word Count', dialog.ICON_INFORMATION, dialog.BUTTON_OK) --- 16,18 ---- text = util.normalizeEOL(bg.components.document.GetSelectedText()) ! dialog.MessageDialog(bg, "Document: %s\n" % filename + "%d chars, %d words, %d lines" % wordCount(text), 'Word Count', wx.ICON_INFORMATION | wx.OK) |