From: Kevin A. <ka...@us...> - 2004-05-10 00:45:34
|
Update of /cvsroot/pythoncard/PythonCard/tools/codeEditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16543/tools/codeEditor Modified Files: codeEditor.py Log Message: removed Stack class, changed self.stack.app references to self.application changed childWindow, Background, and CustomDialog inits so stack arg isn't passed in. only did minimal testing of tools and samples Index: codeEditor.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/codeEditor/codeEditor.py,v retrieving revision 1.113 retrieving revision 1.114 diff -C2 -d -r1.113 -r1.114 *** codeEditor.py 5 May 2004 18:07:09 -0000 1.113 --- codeEditor.py 10 May 2004 00:45:23 -0000 1.114 *************** *** 100,104 **** log.info('codeEditor filename: ' + filename) if not os.path.exists(filename): ! filename = os.path.abspath(os.path.join(self.stack.app.startingDirectory, sys.argv[1])) #print filename if os.path.isfile(filename): --- 100,104 ---- log.info('codeEditor filename: ' + filename) if not os.path.exists(filename): ! filename = os.path.abspath(os.path.join(self.application.startingDirectory, sys.argv[1])) #print filename if os.path.isfile(filename): *************** *** 306,311 **** if config is not None: STCStyleEditor.initSTC(self.components.document, config, 'python') ! if self.stack.app.shell is not None: ! STCStyleEditor.initSTC(self.stack.app.shell, config, 'python') def setEditorStyle(self): --- 306,311 ---- if config is not None: STCStyleEditor.initSTC(self.components.document, config, 'python') ! if self.application.shell is not None: ! STCStyleEditor.initSTC(self.application.shell, config, 'python') def setEditorStyle(self): *************** *** 543,547 **** def on_menuFileNewWindow_select(self, event): app = os.path.split(sys.argv[0])[-1] ! filename = os.path.join(self.stack.app.applicationDirectory, app) python = sys.executable if ' ' in python: --- 543,547 ---- def on_menuFileNewWindow_select(self, event): app = os.path.split(sys.argv[0])[-1] ! filename = os.path.join(self.application.applicationDirectory, app) python = sys.executable if ' ' in python: *************** *** 553,559 **** # a File->Exit would iterate through each? """ ! path = os.path.join(self.stack.app.applicationDirectory, 'codeEditor') rsrc = resource.ResourceFile(model.internationalResourceName(path)).getResource() ! self.childWindow = CodeEditor(self.stack, self, rsrc.stack.backgrounds[0]) """ --- 553,559 ---- # a File->Exit would iterate through each? """ ! path = os.path.join(self.application.applicationDirectory, 'codeEditor') rsrc = resource.ResourceFile(model.internationalResourceName(path)).getResource() ! self.childWindow = CodeEditor(self, rsrc.stack.backgrounds[0]) """ *************** *** 894,931 **** self.loadShell() ! if self.stack.app.shell is not None: ! self.stack.app.shellFrame.visible = not self.stack.app.shellFrame.visible def on_menuScriptletNamespace_select(self, event): self.loadNamespace() ! if self.stack.app.namespace is not None: ! self.stack.app.namespaceFrame.visible = not self.stack.app.namespaceFrame.visible def on_menuScriptletSaveUserConfiguration_select(self, event): ! if self.stack.app.mw is not None: ! configuration.setOption('messageWatcherPosition', self.stack.app.mw.position) ! configuration.setOption('messageWatcherSize', self.stack.app.mw.size) configuration.setOption('showMessageWatcher', 0) ! if self.stack.app.namespaceFrame is not None: ! configuration.setOption('namespacePosition', self.stack.app.namespaceFrame.position) ! configuration.setOption('namespaceSize', self.stack.app.namespaceFrame.size) configuration.setOption('showNamespace', 0) ! if self.stack.app.pw is not None: ! configuration.setOption('propertyEditorPosition', self.stack.app.pw.position) ! configuration.setOption('propertyEditorSize', self.stack.app.pw.size) configuration.setOption('showPropertyEditor', 0) ! if self.stack.app.shellFrame is not None: ! configuration.setOption('shellPosition', self.stack.app.shellFrame.position) ! configuration.setOption('shellSize', self.stack.app.shellFrame.size) configuration.setOption('showShell', 0) configuration.saveConfig() def on_menuScriptletSaveShellSelection_select(self, event): ! if self.stack.app.shell is not None: ! txt = self.stack.app.shell.GetSelectedText() lines = [] for line in txt.splitlines(): ! lines.append(self.stack.app.shell.lstripPrompt(line)) # this is the quick way to convert a list back into a string # appending to strings can be slow because it creates a new string --- 894,931 ---- self.loadShell() ! if self.application.shell is not None: ! self.application.shellFrame.visible = not self.application.shellFrame.visible def on_menuScriptletNamespace_select(self, event): self.loadNamespace() ! if self.application.namespace is not None: ! self.application.namespaceFrame.visible = not self.application.namespaceFrame.visible def on_menuScriptletSaveUserConfiguration_select(self, event): ! if self.application.mw is not None: ! configuration.setOption('messageWatcherPosition', self.application.mw.position) ! configuration.setOption('messageWatcherSize', self.application.mw.size) configuration.setOption('showMessageWatcher', 0) ! if self.application.namespaceFrame is not None: ! configuration.setOption('namespacePosition', self.application.namespaceFrame.position) ! configuration.setOption('namespaceSize', self.application.namespaceFrame.size) configuration.setOption('showNamespace', 0) ! if self.application.pw is not None: ! configuration.setOption('propertyEditorPosition', self.application.pw.position) ! configuration.setOption('propertyEditorSize', self.application.pw.size) configuration.setOption('showPropertyEditor', 0) ! if self.application.shellFrame is not None: ! configuration.setOption('shellPosition', self.application.shellFrame.position) ! configuration.setOption('shellSize', self.application.shellFrame.size) configuration.setOption('showShell', 0) configuration.saveConfig() def on_menuScriptletSaveShellSelection_select(self, event): ! if self.application.shell is not None: ! txt = self.application.shell.GetSelectedText() lines = [] for line in txt.splitlines(): ! lines.append(self.application.shell.lstripPrompt(line)) # this is the quick way to convert a list back into a string # appending to strings can be slow because it creates a new string *************** *** 935,939 **** #wildcard = "Python files (*.py)|*.py|All Files (*.*)|*.*" wildcard = self.resource.strings.scriptletWildcard ! scriptletsDir = os.path.join(self.stack.app.applicationDirectory, 'scriptlets') result = dialog.saveFileDialog(None, self.resource.strings.saveAs, scriptletsDir, 'scriptlet.py', wildcard) if result['accepted']: --- 935,939 ---- #wildcard = "Python files (*.py)|*.py|All Files (*.*)|*.*" wildcard = self.resource.strings.scriptletWildcard ! scriptletsDir = os.path.join(self.application.applicationDirectory, 'scriptlets') result = dialog.saveFileDialog(None, self.resource.strings.saveAs, scriptletsDir, 'scriptlet.py', wildcard) if result['accepted']: *************** *** 948,952 **** try: command = 'execfile(%r)' % filename ! self.stack.app.shell.run(command=command, prompt=0, verbose=0) except: pass --- 948,952 ---- try: command = 'execfile(%r)' % filename ! self.application.shell.run(command=command, prompt=0, verbose=0) except: pass *************** *** 956,964 **** #curDir = os.getcwd() ! if self.stack.app.shell is not None: #wildcard = "Python files (*.py)|*.py|All Files (*.*)|*.*" wildcard = self.resource.strings.scriptletWildcard # wildcard = '*.py' ! scriptletsDir = os.path.join(self.stack.app.applicationDirectory, 'scriptlets') result = dialog.openFileDialog(self, self.resource.strings.openFile, scriptletsDir, '', wildcard) if result['accepted']: --- 956,964 ---- #curDir = os.getcwd() ! if self.application.shell is not None: #wildcard = "Python files (*.py)|*.py|All Files (*.*)|*.*" wildcard = self.resource.strings.scriptletWildcard # wildcard = '*.py' ! scriptletsDir = os.path.join(self.application.applicationDirectory, 'scriptlets') result = dialog.openFileDialog(self, self.resource.strings.openFile, scriptletsDir, '', wildcard) if result['accepted']: *************** *** 988,992 **** def on_runMacro_command(self, event): name = event.target.name[len('menuScriptlet'):] ! #scriptletsDir = os.path.join(self.stack.app.applicationDirectory, 'scriptlets') #filename = os.path.join(scriptletsDir, name + '.py') for macro in self.macros: --- 988,992 ---- def on_runMacro_command(self, event): name = event.target.name[len('menuScriptlet'):] ! #scriptletsDir = os.path.join(self.application.applicationDirectory, 'scriptlets') #filename = os.path.join(scriptletsDir, name + '.py') for macro in self.macros: *************** *** 1185,1189 **** def on_findFiles_command(self, event): ! fn = self.stack.app.applicationDirectory fn = os.path.join(fn, os.pardir, "findfiles", "findfiles.py") fn = os.path.normpath(fn) --- 1185,1189 ---- def on_findFiles_command(self, event): ! fn = self.application.applicationDirectory fn = os.path.join(fn, os.pardir, "findfiles", "findfiles.py") fn = os.path.normpath(fn) |