From: Kevin A. <ka...@us...> - 2004-08-12 19:19:35
|
Update of /cvsroot/pythoncard/PythonCard/samples/life In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16511/life Modified Files: life.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: life.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/life/life.py,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** life.py 10 May 2004 00:45:19 -0000 1.38 --- life.py 12 Aug 2004 19:18:53 -0000 1.39 *************** *** 314,319 **** directory = os.path.join(self.application.applicationDirectory, 'patterns') result = dialog.openFileDialog(None, "Import which file?", directory, '', wildcard) ! if result['accepted']: ! path = result['paths'][0] os.chdir(os.path.dirname(path)) self.filename = path --- 314,319 ---- directory = os.path.join(self.application.applicationDirectory, 'patterns') result = dialog.openFileDialog(None, "Import which file?", directory, '', wildcard) ! if result.accepted: ! path = result.paths[0] os.chdir(os.path.dirname(path)) self.filename = path *************** *** 335,340 **** wildcard = "All files (*.*)|*.*" result = dialog.saveFileDialog(None, "Save As", path, filename, wildcard) ! if result['accepted']: ! path = result['paths'][0] fileType = graphic.bitmapType(path) print fileType, path --- 335,340 ---- wildcard = "All files (*.*)|*.*" result = dialog.saveFileDialog(None, "Save As", path, filename, wildcard) ! if result.accepted: ! path = result.paths[0] fileType = graphic.bitmapType(path) print fileType, path *************** *** 342,350 **** bmp = self.components.bufOff.getBitmap() bmp.SaveFile(path, fileType) ! return 1 except: ! return 0 else: ! return 0 def on_menuEditCopy_select(self, event): --- 342,350 ---- bmp = self.components.bufOff.getBitmap() bmp.SaveFile(path, fileType) ! return True except: ! return False else: ! return False def on_menuEditCopy_select(self, event): *************** *** 384,389 **** if automata == 'menuAutomataLife': result = dialog.textEntryDialog(self, 'Number of steps', 'Steps (-1 means continuous):', '-1') ! if result['accepted']: ! steps = int(result['text']) self.keepDrawing = True startTime = time.time() --- 384,389 ---- if automata == 'menuAutomataLife': result = dialog.textEntryDialog(self, 'Number of steps', 'Steps (-1 means continuous):', '-1') ! if result.accepted: ! steps = int(result.text) self.keepDrawing = True startTime = time.time() |