From: Phil E. <l2...@us...> - 2005-05-05 12:50:39
|
Update of /cvsroot/pythoncard/PythonCard/tools/standaloneBuilder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14867 Modified Files: changelog.txt standaloneBuilder.py standaloneBuilder.rsrc.py Log Message: Added a 'Run' button to the main window and fixed a bug with the way the project licence file was added when using the new project wizard Index: changelog.txt =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/standaloneBuilder/changelog.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** changelog.txt 26 Apr 2005 12:39:12 -0000 1.5 --- changelog.txt 5 May 2005 12:50:24 -0000 1.6 *************** *** 1,4 **** --- 1,10 ---- standaloneBuilder version Version 0.1.1 release date TBA -------------------------------------------------------- + - Fixed a bug where the project licence file name was being added + incorrectly when running the new project wizard + - Moved the check for whether the project needs to be saved into a + single function + - Added a run button and stole the run options dialog from the + resource editor :-) - Added a workaround for a GTK bug which affects the fileSaveDialog - Fixed an UnboundLocalError when rebuilding projects Index: standaloneBuilder.rsrc.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/standaloneBuilder/standaloneBuilder.rsrc.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** standaloneBuilder.rsrc.py 26 Apr 2005 12:39:12 -0000 1.4 --- standaloneBuilder.rsrc.py 5 May 2005 12:50:24 -0000 1.5 *************** *** 457,460 **** --- 457,468 ---- {'type':'Button', + 'name':'runBtn', + 'position':(270, 475), + 'size':(-1, 22), + 'label':'Run...', + 'toolTip':'Run the application', + }, + + {'type':'Button', 'name':'rebuildBtn', 'position':(695, 475), Index: standaloneBuilder.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/standaloneBuilder/standaloneBuilder.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** standaloneBuilder.py 26 Apr 2005 12:39:12 -0000 1.8 --- standaloneBuilder.py 5 May 2005 12:50:24 -0000 1.9 *************** *** 66,69 **** --- 66,70 ---- from wxPython.html import wxHtmlEasyPrinting from PythonCard import dialog, model + from PythonCard.templates.dialogs import runOptionsDialog # local imports *************** *** 93,96 **** --- 94,100 ---- self.components.quitBtn.enabled = 1 self.documentChanged = False + self.cmdLineArgs = {'debugmenu':False, 'logging':False, 'messagewatcher':False, + 'namespaceviewer':False, 'propertyeditor':False, + 'shell':False, 'otherargs':''} if sys.platform.startswith('win32'): *************** *** 190,206 **** ########################################################################## def on_newBtn_command(self, event): ! if self.documentChanged: ! save = self.saveChanges() ! if save == wx.ID_CANCEL: ! return # don't do anything, just go back to editing ! elif save == wx.ID_NO: ! pass # any changes will be lost ! else: ! if self.documentPath is None: ! if not self.on_menuFileSaveAs_select(None): return ! else: ! self.saveFile(self.documentPath) ! ! # launch the new project wizard dlg = newProjectWizard(self) dlg.ShowModal() --- 194,198 ---- ########################################################################## def on_newBtn_command(self, event): ! if not self.saveIfRequired(): return dlg = newProjectWizard(self) dlg.ShowModal() *************** *** 210,229 **** def on_openBtn_command(self, event): ! # should probably have an alert dialog here ! # warning about saving the current file before opening another one ! if self.documentChanged: ! save = self.saveChanges() ! if save == wx.ID_CANCEL: ! return # don't do anything, just go back to editing ! elif save == wx.ID_NO: ! pass # any changes will be lost ! else: ! if self.documentPath is None: ! # if the user cancels out of the Save As then go back to editing ! if not self.on_menuFileSaveAs_select(None): return ! else: ! self.saveFile(self.documentPath) ! ! #launch a file open dialog wildcard = "Project files (*.pmr)|*.pmr;*.PMR|All files (*.*)|*.*" result = dialog.openFileDialog(wildcard=wildcard) --- 202,206 ---- def on_openBtn_command(self, event): ! if not self.saveIfRequired(): return wildcard = "Project files (*.pmr)|*.pmr;*.PMR|All files (*.*)|*.*" result = dialog.openFileDialog(wildcard=wildcard) *************** *** 476,493 **** os.system(editor + ' ' + spec) def on_rebuildBtn_mouseClick(self, event): # save the project if required ! if self.documentChanged: ! save = self.saveChanges() ! if save == wx.ID_CANCEL: ! return # don't do anything, just go back to editing ! elif save == wx.ID_NO: ! pass # any changes will be lost ! else: ! if self.documentPath is None: ! # if the user cancels out of the Save As then go back to editing ! if not self.on_menuFileSaveAs_select(None): return ! else: ! self.saveFile(self.documentPath) # rebuild under Linux just involves making a tarball of the source --- 453,476 ---- os.system(editor + ' ' + spec) + def on_runBtn_mouseClick(self, event): + # save the project if required + ret = self.saveIfRequired() + if not ret: return + + result = runOptionsDialog.runOptionsDialog(self, self.cmdLineArgs) + if result.accepted: + self.cmdLineArgs['debugmenu'] = result.debugmenu + self.cmdLineArgs['logging'] = result.logging + self.cmdLineArgs['messagewatcher'] = result.messagewatcher + self.cmdLineArgs['namespaceviewer'] = result.namespaceviewer + self.cmdLineArgs['propertyeditor'] = result.propertyeditor + self.cmdLineArgs['shell'] = result.shell + self.cmdLineArgs['otherargs'] = result.otherargs + + self.runScript(False) + def on_rebuildBtn_mouseClick(self, event): # save the project if required ! if not self.saveIfRequired(): return # rebuild under Linux just involves making a tarball of the source *************** *** 607,610 **** --- 590,668 ---- # ############################################################################## + def runScript(self, useInterpreter): + item = self.pathJoin(self.components.mainScript.text) + item = os.path.join(self.components.baseDir.text, item) + item = os.path.join(self.cfg.get('ConfigData', 'projects'), item) + # pinched this code from the resource editor - thanks, Kevin! + #path = os.path.join(self.cfg.get('ConfigData', 'projects'), self.components.baseDir.text) + #path, filename = os.path.split(self.filename) + path, filename = os.path.split(item) + name = filename.split('.')[0] + if os.path.exists(os.path.join(path, name + ".pyw")): + filename = '"' + os.path.join(path, name + ".pyw") + '"' + else: + filename = '"' + os.path.join(path, name + ".py") + '"' + # the args should come from a dialog or menu items that are checked/unchecked + args = self.getCommandLineArgs() + + if useInterpreter: + interp = ' -i ' + else: + interp = ' ' + + if sys.platform.startswith('win'): + # KEA 2002-03-06 + # always launch with console in the resourceEditor for debugging purposes + python = os.path.join(os.path.dirname(sys.executable), 'python.exe') + if ' ' in python: + pythonQuoted = '"' + python + '"' + else: + pythonQuoted = python + if useInterpreter and os.name != 'nt': + os.spawnv(os.P_NOWAIT, python, [pythonQuoted, interp, filename, args]) + else: + os.spawnv(os.P_NOWAIT, python, [pythonQuoted, interp, filename, args]) + else: + if ' ' in sys.executable: + python = '"' + sys.executable + '"' + else: + python = sys.executable + os.system(python + interp + filename + args + ' &') + + def saveIfRequired(self): + # save the project if required + retflag = True + if self.documentChanged: + save = self.saveChanges() + if save == wx.ID_CANCEL: + retflag = False # don't do anything, just go back to editing + elif save == wx.ID_NO: + pass # any changes will be lost + else: + if self.documentPath is None: + # if the user cancels out of the Save As then go back to editing + if not self.on_menuFileSaveAs_select(None): retflag = False + else: + self.saveFile(self.documentPath) + return retflag + + def getCommandLineArgs(self): + args = ' ' + if self.cmdLineArgs['debugmenu']: + args += '-d ' + if self.cmdLineArgs['logging']: + args += '-l ' + if self.cmdLineArgs['messagewatcher']: + args += '-m ' + if self.cmdLineArgs['namespaceviewer']: + args += '-n ' + if self.cmdLineArgs['propertyeditor']: + args += '-p ' + if self.cmdLineArgs['shell']: + args += '-s ' + if self.cmdLineArgs['otherargs'] != '': + args += self.cmdLineArgs['otherargs'] + return args + def getRelativePath(self, root, path): # remove the root part of an absolute path *************** *** 716,723 **** self.project.set('Project', 'status', 'open') ! # license file has to be the full path ! lfile = os.path.join(wizResult.baseDir, 'doc') ! lfile = os.path.join(lfile, 'gpl.txt') ! self.project.set('Project', 'applicence', lfile) x = os.path.join('build', '%s.iss' % self.components.projectName.text) --- 774,778 ---- self.project.set('Project', 'status', 'open') ! self.project.set('Project', 'applicence', 'doc,gpl.txt') x = os.path.join('build', '%s.iss' % self.components.projectName.text) |