From: Phil E. <l2...@us...> - 2005-04-09 09:30:45
|
Update of /cvsroot/pythoncard/PythonCard/tools/standaloneBuilder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31166 Modified Files: customDialogs.py newProjectWizardPage4.rsrc.py outputWindow.py outputWindow.rsrc.py standaloneBuilder.py standaloneBuilder.rsrc.py Added Files: changelog.txt helpAbout.rsrc.py readme.txt Log Message: Few more fixes to standaloneBuilder app Index: standaloneBuilder.rsrc.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/standaloneBuilder/standaloneBuilder.rsrc.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** standaloneBuilder.rsrc.py 1 Apr 2005 09:58:50 -0000 1.1 --- standaloneBuilder.rsrc.py 9 Apr 2005 09:30:36 -0000 1.2 *************** *** 3,9 **** 'backgrounds': [ {'type':'Background', ! 'name':'PM', ! 'title':'PythonCard Project Manager', 'size':(800, 594), 'statusBar':1, --- 3,10 ---- 'backgrounds': [ {'type':'Background', ! 'name':'standaloneBuilder', ! 'title':'PythonCard standaloneBuilder', 'size':(800, 594), + 'position':(-1, -1), 'statusBar':1, *************** *** 236,239 **** --- 237,241 ---- 'position':(535, 120), 'size':(40, -1), + 'backgroundColor':(255, 255, 255), 'max':100, 'min':0, *************** *** 245,248 **** --- 247,251 ---- 'position':(630, 120), 'size':(40, -1), + 'backgroundColor':(255, 255, 255), 'max':100, 'min':1, *************** *** 254,257 **** --- 257,261 ---- 'position':(710, 120), 'size':(40, -1), + 'backgroundColor':(255, 255, 255), 'max':100, 'min':1, --- NEW FILE: readme.txt --- This is the README file for the PythonCard standaloneBuilder tool --- NEW FILE: helpAbout.rsrc.py --- {'type':'CustomDialog', 'name':'dlgAbout', 'title':'About standaloneBuilder:', 'position':(129, 133), 'size':(680, 370), 'components': [ {'type':'Button', 'name':'AboutBtn', 'position':(10, 5), 'size':(-1, 32), 'label':'About', }, {'type':'Button', 'name':'AuthorBtn', 'position':(90, 5), 'size':(-1, 32), 'label':'Author', }, {'type':'Button', 'name':'LicenseBtn', 'position':(170, 5), 'size':(-1, 32), 'label':'License', }, {'type':'HtmlWindow', 'name':'HtmlWindow', 'position':(5, 40), 'size':(668, 255), 'backgroundColor':(255, 255, 255), }, {'type':'Button', 'id':5100, 'name':'btnOK', 'position':(590, 305), 'size':(-1, 32), 'label':'Close', }, ] # end components } # end CustomDialog --- NEW FILE: changelog.txt --- standaloneBuilder version Version 0.1.1 release date TBA --------------------------------------------------------------------------- - Help --> About dialog now works - The rebuild process now works 100% reliably - the project changelog.txt file can now be maintained from within the standaloneBuilder app pitself Index: outputWindow.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/standaloneBuilder/outputWindow.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** outputWindow.py 1 Apr 2005 09:58:50 -0000 1.1 --- outputWindow.py 9 Apr 2005 09:30:36 -0000 1.2 *************** *** 38,44 **** def addLine(self, text): self.components.returnedText.text += str(text) ! self.Refresh() ! self.Update() ! wx.Yield() def on_closeBtn_mouseClick(self, event): --- 38,44 ---- def addLine(self, text): self.components.returnedText.text += str(text) ! #self.Refresh() ! #self.Update() ! #wx.Yield() def on_closeBtn_mouseClick(self, event): Index: customDialogs.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/standaloneBuilder/customDialogs.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** customDialogs.py 1 Apr 2005 09:58:50 -0000 1.1 --- customDialogs.py 9 Apr 2005 09:30:36 -0000 1.2 *************** *** 103,107 **** print "OnCloseWindow" self.Destroy() ! class newProjectWizard(CustomDialog): """Displays a wizard for creating a new project""" --- 103,136 ---- print "OnCloseWindow" self.Destroy() ! ! class HTMLHelp(CustomDialog): ! """Displays an HTML based about box""" ! ! def __init__(self, aBg, links=None): ! path = os.path.join(aBg.application.applicationDirectory, 'helpAbout') ! aDialogRsrc = resource.ResourceFile(model.internationalResourceName(path)).getResource() ! CustomDialog.__init__(self, aBg, aDialogRsrc) ! self.parent = aBg ! #self.components.versionText.text = 'Version %s' % self.parent.pimpversion ! ! # links is a 3-element list giving the HTML files to use for the About, Author ! # and License buttons ! if links is None: links = ['doc/about.html', 'doc/author.html', 'doc/license.html'] ! self.links = links ! ! self.components.HtmlWindow.text = self.links[0] ! ! def on_btnOK_mouseClick(self, event): ! event.Skip() ! ! def on_AboutBtn_mouseClick(self, event): ! self.components.HtmlWindow.text = self.links[0] ! ! def on_AuthorBtn_mouseClick(self, event): ! self.components.HtmlWindow.text = self.links[1] ! ! def on_LicenseBtn_mouseClick(self, event): ! self.components.HtmlWindow.text = self.links[2] ! class newProjectWizard(CustomDialog): """Displays a wizard for creating a new project""" *************** *** 171,174 **** --- 200,204 ---- else: self.components.nextBtn.enabled = True + self.components.projectName.SetFocus() if self.pgCnt == 2: *************** *** 179,182 **** --- 209,213 ---- else: self.components.nextBtn.enabled = True + self.components.projectDesc.SetFocus() if self.pgCnt == 3: *************** *** 187,190 **** --- 218,222 ---- else: self.components.nextBtn.enabled = True + self.components.baseDir.SetFocus() if self.pgCnt == self.maxPages: *************** *** 192,195 **** --- 224,228 ---- else: self.components.nextBtn.label = 'Next >' + self.components.nextBtn.SetFocus() def on_backBtn_mouseClick(self, event): *************** *** 233,237 **** title = 'Select project base directory' basepath = self.parent.cfg.get('ConfigData', 'projects') ! result = dialog.directoryDialog(self, title, basepath) if result.accepted: self.components.baseDir.text = result.path --- 266,270 ---- title = 'Select project base directory' basepath = self.parent.cfg.get('ConfigData', 'projects') ! result = dialog.directoryDialog(self, title, basepath, wx.DD_NEW_DIR_BUTTON) if result.accepted: self.components.baseDir.text = result.path *************** *** 353,376 **** self.parent = aBg ! try: ! self.components.buildPath.text = self.parent.project.get('Project', 'buildfilespath') ! self.components.distPath.text = self.parent.project.get('Project', 'distfilespath') ! self.components.pixmapsPath.text = self.parent.project.get('Project', 'pixmapspath') ! self.components.tarballPath.text = self.parent.project.get('Project', 'tarballspath') ! self.components.appPublisher.text = self.parent.project.get('Project', 'publisher') ! self.components.appURL.text = self.parent.project.get('Project', 'appurl') ! self.components.appLicence.text = self.parent.project.get('Project', 'applicence') ! self.components.asciiChk.checked = self.parent.project.getboolean('Project', 'ascii') ! self.components.striplibsChk.checked = self.parent.project.getboolean('Project', 'striplib') ! self.components.consoleChk.checked = self.parent.project.getboolean('Project', 'console') # best to have a coonsole for new projects! ! self.components.optimizeChk.checked = self.parent.project.getboolean('Project', 'optimize') ! self.components.compressChk.checked = self.parent.project.getboolean('Project', 'compress') ! self.components.debugChk.checked = self.parent.project.getboolean('Project', 'debug') ! if self.parent.project.getboolean('Project', 'onedir'): ! self.components.buildType.stringSelection = 'Single directory' ! else: ! self.components.buildType.stringSelection = 'Single file' ! except: ! pass def on_buildPathBtn_mouseClick(self, event): --- 386,409 ---- self.parent = aBg ! #try: ! self.components.buildPath.text = self.parent.project.get('Project', 'buildfilespath') ! self.components.distPath.text = self.parent.project.get('Project', 'distfilespath') ! self.components.pixmapsPath.text = self.parent.project.get('Project', 'pixmapspath') ! self.components.tarballPath.text = self.parent.project.get('Project', 'tarballspath') ! self.components.appPublisher.text = self.parent.project.get('Project', 'publisher') ! self.components.appURL.text = self.parent.project.get('Project', 'appurl') ! self.components.appLicence.text = self.parent.project.get('Project', 'applicence') ! self.components.asciiChk.checked = self.parent.project.getboolean('Project', 'ascii') ! self.components.striplibsChk.checked = self.parent.project.getboolean('Project', 'striplib') ! self.components.consoleChk.checked = self.parent.project.getboolean('Project', 'console') # best to have a coonsole for new projects! ! self.components.optimizeChk.checked = self.parent.project.getboolean('Project', 'optimize') ! self.components.compressChk.checked = self.parent.project.getboolean('Project', 'compress') ! self.components.debugChk.checked = self.parent.project.getboolean('Project', 'debug') ! if self.parent.project.getboolean('Project', 'onedir'): ! self.components.buildType.stringSelection = 'Single directory' ! else: ! self.components.buildType.stringSelection = 'Single file' ! #except: ! # pass def on_buildPathBtn_mouseClick(self, event): *************** *** 446,476 **** print 'Cancel button!' event.Skip() - - class HTMLHelp(CustomDialog): - """Displays an HTML based about box""" - - def __init__(self, aBg, links=None): - path = os.path.join(aBg.stack.app.applicationDirectory, 'helpAbout') - aDialogRsrc = res.ResourceFile(model.internationalResourceName(path)).getResource() - CustomDialog.__init__(self, aBg, aDialogRsrc) - self.parent = aBg - self.components.versionText.text = 'Version %s' % self.parent.pimpversion - - # links is a 3-element list giving the HTML files to use for the About, Author - # and License buttons - if links is None: links = ['doc/about.html', 'doc/author.html', 'doc/license.html'] - self.links = links - - self.components.HtmlWindow.text = self.links[0] - - def on_btnOK_mouseClick(self, event): - event.Skip() - - def on_AboutBtn_mouseClick(self, event): - self.components.HtmlWindow.text = self.links[0] - - def on_AuthorBtn_mouseClick(self, event): - self.components.HtmlWindow.text = self.links[1] - - def on_LicenseBtn_mouseClick(self, event): - self.components.HtmlWindow.text = self.links[2] --- 479,480 ---- Index: standaloneBuilder.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/standaloneBuilder/standaloneBuilder.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** standaloneBuilder.py 1 Apr 2005 09:58:50 -0000 1.1 --- standaloneBuilder.py 9 Apr 2005 09:30:36 -0000 1.2 *************** *** 60,64 **** import outputWindow ! class standaloneBuilder(model.Background): ############################################################################## --- 60,64 ---- import outputWindow ! class PM(model.Background): ############################################################################## *************** *** 110,140 **** def on_menuToolsLogAdd_command(self, event): # add a new changelog entry ! logString = ' (' ! logString += str(self.components.fixNumber.value) ! logString += ') ' ! result = dialog.multilineTextEntryDialog(self, ! 'Add Changelog Entry', ! 'Enter the new text below, and click OK:') if result.accepted: ! logString += result.text ! chglog = os.path.join(self.components.baseDir.text, 'changelog.txt') ! fd = open(chglog, 'r') # open for appending ! logfile = fd.readlines() ! print logfile ! bull = raw_input() ! fd.close() ! fd = open(chglog, 'w') # open for writing ! logfile.insert(2, logString) ! fd.write(string.join(logfile)) ! fd.close() def on_menuToolsLogEdit_command(self, event): # edit changelog, create it if it doesn't exist template = {} ! template['projectName'] = self.components.projectName.text ! template['majorVersion'] = self.components.majorVersion.value ! template['minorVersion'] = self.components.minorVersion.value ! template['fixNumber'] = self.components.fixNumber.value chglog = os.path.join(self.components.baseDir.text, 'changelog.txt') --- 110,169 ---- def on_menuToolsLogAdd_command(self, event): + template = {} + template['name'] = self.components.projectName.text + template['major'] = self.components.majorVersion.value + template['minor'] = self.components.minorVersion.value + template['fix'] = self.components.fixNumber.value + + chglog = os.path.join(self.components.baseDir.text, 'changelog.txt') + + if not os.path.exists(chglog): + fd = open(chglog, 'w') + tmplfile = os.path.join('templates', 'changelog.txt') + chglogData = open(tmplfile, 'r').read() + chglogData = chglogData % template + fd.write(chglogData) + fd.close() + # add a new changelog entry ! result = dialog.multilineTextEntryDialog(self, 'Add Changelog Entry', 'Enter the new text below, and click OK:') ! if result.accepted: ! fmtstring = string.split(wrap_string(result.text, 65), '\n') ! infd = open(chglog, 'r') ! outfd = open(chglog + '-new', 'w') ! ! # keep the top 2 lines of the existing file ! outfd.write(infd.readline()) ! outfd.write(infd.readline()) ! ! # write out the new entry ! for cnt in range(len(fmtstring)): ! if fmtstring[cnt] != '': ! if cnt == 0: ! outfd.write(' - ' + fmtstring[cnt] + '\n') ! else: ! outfd.write(' ' + fmtstring[cnt] + '\n') ! ! # then write out all the remaining entries ! ln = infd.readline() ! while ln: ! outfd.write(ln) ! ln = infd.readline() ! ! infd.close() ! outfd.close() ! ! os.unlink(chglog) ! os.rename(chglog + '-new', chglog) ! def on_menuToolsLogEdit_command(self, event): # edit changelog, create it if it doesn't exist template = {} ! template['name'] = self.components.projectName.text ! template['major'] = self.components.majorVersion.value ! template['minor'] = self.components.minorVersion.value ! template['fix'] = self.components.fixNumber.value chglog = os.path.join(self.components.baseDir.text, 'changelog.txt') *************** *** 143,147 **** fd = open(chglog, 'w') tmplfile = os.path.join('templates', 'changelog.txt') ! chglogData = open(tmplfile, 'r').read() % template fd.write(chglogData) fd.close() --- 172,177 ---- fd = open(chglog, 'w') tmplfile = os.path.join('templates', 'changelog.txt') ! chglogData = open(tmplfile, 'r').read() ! chglogData = chglogData % template fd.write(chglogData) fd.close() *************** *** 151,156 **** def on_doHelpAbout_command(self, event): ! # put your About box here ! pass ########################################################################## --- 181,187 ---- def on_doHelpAbout_command(self, event): ! dlg = HTMLHelp(self) ! dlg.showModal() ! dlg.destroy() ########################################################################## *************** *** 159,195 **** ########################################################################## def on_newBtn_command(self, event): if self.documentChanged: save = self.saveChanges() ! print 'save came back as %s' % save ! if save == "Cancel": ! pass # don't do anything, just go back to editing ! elif save == "No": ! self.newFile() # any changes will be lost else: if self.documentPath is None: ! if self.on_menuFileSaveAs_select(None): self.newFile() else: self.saveFile(self.documentPath) ! dlg = newProjectWizard(self) ! dlg.ShowModal() ! result = dlg.getResult() ! dlg.Destroy() ! self.newFile(result) ! else: ! # don't need to save, so launch the new project wizard ! dlg = newProjectWizard(self) ! dlg.ShowModal() ! result = dlg.getResult() ! dlg.Destroy() ! self.newFile(result) 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 == "Cancel": return # don't do anything, just go back to editing ! elif save == "No": pass # any changes will be lost else: --- 190,222 ---- ########################################################################## def on_newBtn_command(self, event): + print 'in newBtn, self.documentChanged is [%s]' % self.documentChanged 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() ! result = dlg.getResult() ! if result.accepted: self.newFile(result) ! dlg.Destroy() def on_openBtn_command(self, event): + print 'in openBtn, self.documentChanged is [%s]' % self.documentChanged # 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: *************** *** 200,203 **** --- 227,231 ---- self.saveFile(self.documentPath) + #launch a file open dialog wildcard = "Project files (*.pmr)|*.pmr;*.PMR|All files (*.*)|*.*" result = dialog.openFileDialog(wildcard=wildcard) *************** *** 233,237 **** if result.paths[0] != self.components.projectIcon.text: self.components.projectIcon.text = result.paths[0] ! self.documentChanged = 1 def on_baseDirBtn_mouseClick(self, event): --- 261,265 ---- if result.paths[0] != self.components.projectIcon.text: self.components.projectIcon.text = result.paths[0] ! self.documentChanged = True def on_baseDirBtn_mouseClick(self, event): *************** *** 243,247 **** if result.path != old: self.components.baseDir.text = result.path ! self.documentChanged = 1 def on_mainScriptBtn_mouseClick(self, event): --- 271,275 ---- if result.path != old: self.components.baseDir.text = result.path ! self.documentChanged = True def on_mainScriptBtn_mouseClick(self, event): *************** *** 253,257 **** if result.accepted: p = os.path.basename(result.paths[0]) - print result.__dict__ if p != old: if p in self.components.scriptList.items: --- 281,284 ---- *************** *** 261,265 **** else: self.components.mainScript.text = p ! self.documentChanged = 1 def on_scriptAddBtn_mouseClick(self, event): --- 288,292 ---- else: self.components.mainScript.text = p ! self.documentChanged = True def on_scriptAddBtn_mouseClick(self, event): *************** *** 285,289 **** current.append(path) current.sort() ! self.documentChanged = 1 if self.documentChanged: self.components.scriptList.items = current --- 312,316 ---- current.append(path) current.sort() ! self.documentChanged = True if self.documentChanged: self.components.scriptList.items = current *************** *** 385,391 **** if self.documentChanged: save = self.saveChanges() ! if save == "Cancel": return # don't do anything, just go back to editing ! elif save == "No": pass # any changes will be lost else: --- 412,418 ---- 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: *************** *** 396,399 **** --- 423,435 ---- self.saveFile(self.documentPath) + # give a warning message if the debug and/or console options + # are switched on in project properties. + if self.project.getboolean('Project', 'console') or self.project.getboolean('Project', 'debug'): + txt = 'Please note that you currently have either the debug and/or the console option(s)' + txt += ' switched on in the properties for this project.\n\nYou should switch these off' + txt += ' prior to building the final version of your application' + title = 'Project options warning!' + bull = dialog.alertDialog(self, wrap_string(txt, 70), title) + # window for progress marks and output messages self.outputWindow.Show() *************** *** 404,461 **** self.outputWindow.Update() self.outputWindow.Refresh() ! specfile = self.components.projectName.text + '.spec' ! specfile = os.path.join(self.components.baseDir.text, specfile) ! self.buildSpecFile(specfile) self.outputWindow.components.txt1b.visible = True # rebuild the versioninfo file self.outputWindow.components.txt2a.visible = True self.outputWindow.Update() ! VINFO = open(os.path.join('templates', 'versioninfo.txt')).read() ! vinfo = {} ! #print self.project.__dict__ ! vinfo['major'] = self.project.get('Project', 'majorversion') ! vinfo['minor'] = self.project.get('Project', 'minorversion') ! vinfo['fix'] = self.project.get('Project', 'fixnumber') ! vinfo['build'] = str('%04d' % self.project.getint('Project', 'build')) ! vinfo['name'] = self.project.get('Project', 'name') ! vinfo['date'] = time.strftime('%Y%b%d').upper() ! vinfo['publisher'] = self.project.get('Project', 'publisher') ! vinfo['desc'] = self.project.get('Project', 'projectdesc') ! ! versionfile = os.path.join(self.components.baseDir.text, 'versioninfo.txt') ! fd = open(versionfile, 'w') ! fd.write(VINFO % vinfo) ! fd.close() self.outputWindow.components.txt2b.visible = True ! # rebuild the application. installer doesn't take too kindly to ! # having its stdin/stdout/stderr manipulated, so we have to redirect ! # all output to a temporary file and read the results from there ! # when done self.outputWindow.components.txt3a.visible = True self.outputWindow.Update() ! builder = os.path.join(self.cfg.get('ConfigData', 'installerpath'), 'Build.py') tfile = 'pmbuild.out' ! buildCommand = builder + ' ' + specfile + ' -o ' + os.path.join(self.components.baseDir.text, self.project.get('Project','buildfilespath')) ! buildCommand += ' > ' + tfile ! os.system(buildCommand) fd = open(tfile, 'r') result = fd.readline() while result: self.outputWindow.addLine(result) result = fd.readline() fd.close() - self.outputWindow.components.txt3b.visible = True - self.outputWindow.Update() ! # rebuild the Inno script file ! self.outputWindow.components.txt4a.visible = True ! self.outputWindow.Update() inno = [] ! innofile = self.components.projectName.text + '-new.iss' innofile = os.path.join(self.components.baseDir.text, innofile) ! inno.append('; script auto-generated by PROJECTMANAGER - do not edit!') inno.append('') inno.append('[Setup]') --- 440,526 ---- self.outputWindow.Update() self.outputWindow.Refresh() ! self.buildSpecFile() self.outputWindow.components.txt1b.visible = True # rebuild the versioninfo file self.outputWindow.components.txt2a.visible = True + self.outputWindow.Refresh() self.outputWindow.Update() ! self.buildVersionFile() self.outputWindow.components.txt2b.visible = True ! # rebuild the application self.outputWindow.components.txt3a.visible = True + self.outputWindow.components.txt3c.visible = True self.outputWindow.Update() ! self.buildApplication() ! self.outputWindow.components.txt3c.visible = False ! self.outputWindow.components.txt3b.visible = True ! self.outputWindow.Update() ! ! # rebuild the Inno script file ! self.outputWindow.components.txt4a.visible = True ! self.outputWindow.components.txt4c.visible = True ! self.outputWindow.Update() ! self.buildInnoFile() ! ! # rebuild the distributable ! self.buildDistFile() ! self.outputWindow.components.txt4c.visible = False ! self.outputWindow.components.txt4b.visible = True ! self.outputWindow.Update() ! self.outputWindow.Raise() ! ! # increment the build number to finish ! build = self.project.getint('Project', 'build') ! build += 1 ! self.project.set('Project', 'build', str(build)) ! self.statusBar.text = self.updateStatusBar() ! self.documentChanged = True ! ! def buildDistFile(self): ! # rebuild the distributable ! innofile = self.components.projectName.text + '.iss' ! innofile = os.path.join(self.components.baseDir.text, innofile) tfile = 'pmbuild.out' ! ! batchinfo = {} ! batchinfo['compilerpath'] = self.cfg.get('ConfigData', 'compilerpath') ! batchinfo['specpath'] = innofile ! batchinfo['tfile'] = tfile ! ! pbatch = """@echo off ! "%(compilerpath)s" "%(specpath)s" > %(tfile)s 2>&1 ! """ % batchinfo ! ! fd = open('pmbuild.bat', 'w') ! fd.write(pbatch) ! fd.close() ! ! os.system('pmbuild.bat') ! fd = open(tfile, 'r') + msgline = '' + capturing = False result = fd.readline() while result: + if capturing: msgline += '\n\n' + result + if result.startswith('Successful compile'): + msgline = result + capturing = True self.outputWindow.addLine(result) result = fd.readline() fd.close() ! if msgline != '': ! title = 'Build successful!' ! bull = dialog.alertDialog(self, wrap_string(msgline, 90), title) + def buildInnoFile(self): + # rebuild the Inno Setup spec file inno = [] ! innofile = self.components.projectName.text + '.iss' innofile = os.path.join(self.components.baseDir.text, innofile) ! inno.append('; script auto-generated by standaloneBuilder - do not edit!') inno.append('') inno.append('[Setup]') *************** *** 467,478 **** inno.append('AppVerName=%s' % appverstring) inno.append('AppPublisher=%s' % self.project.get('Project', 'publisher')) ! inno.append('AppPublisherURL=%s' % self.project.get('Project', 'appurl')) ! inno.append('AppSupportURL=%s' % self.project.get('Project', 'appurl')) ! inno.append('AppUpdatesURL=%s' % self.project.get('Project', 'appurl')) inno.append('DefaultDirName={pf}%s' % (chr(92) + self.project.get('Project', 'name'))) inno.append('DefaultGroupName=%s' % self.project.get('Project', 'name')) inno.append('AllowNoIcons=yes') ! licencefile = os.path.join(self.project.get('Project', 'basepath'),self.project.get('Project', 'applicence')) ! inno.append('LicenseFile=%s' % licencefile) infofile = os.path.join(self.project.get('Project', 'basepath'), 'changelog.txt') inno.append('InfoBeforeFile=%s' % infofile) --- 532,553 ---- inno.append('AppVerName=%s' % appverstring) inno.append('AppPublisher=%s' % self.project.get('Project', 'publisher')) ! ! if self.project.get('Project', 'appurl') != '': ! inno.append('AppPublisherURL=%s' % self.project.get('Project', 'appurl')) ! ! if self.project.get('Project', 'appurl') != '': ! inno.append('AppSupportURL=%s' % self.project.get('Project', 'appurl')) ! ! if self.project.get('Project', 'appurl') != '': ! inno.append('AppUpdatesURL=%s' % self.project.get('Project', 'appurl')) ! inno.append('DefaultDirName={pf}%s' % (chr(92) + self.project.get('Project', 'name'))) inno.append('DefaultGroupName=%s' % self.project.get('Project', 'name')) inno.append('AllowNoIcons=yes') ! ! if self.project.get('Project', 'applicence') != '': ! licencefile = os.path.join(self.project.get('Project', 'basepath'),self.project.get('Project', 'applicence')) ! inno.append('LicenseFile=%s' % licencefile) ! infofile = os.path.join(self.project.get('Project', 'basepath'), 'changelog.txt') inno.append('InfoBeforeFile=%s' % infofile) *************** *** 507,517 **** fd.close() ! # rebuild the distributable ! self.outputWindow.components.txt4b.visible = True ! self.outputWindow.Update() tfile = 'pmbuild.out' ! cmd = '"%s" "%s" > %s' % (self.cfg.get('ConfigData', 'compilerpath'), innofile, tfile) ! print cmd ! os.system(cmd) fd = open(tfile, 'r') result = fd.readline() --- 582,598 ---- fd.close() ! def buildApplication(self): ! # rebuild the application. installer doesn't take too kindly to ! # having its stdin/stdout/stderr manipulated, so we have to redirect ! # all output to a temporary file and read the results from there ! # when done ! builder = os.path.join(self.cfg.get('ConfigData', 'installerpath'), 'Build.py') tfile = 'pmbuild.out' ! specfile = self.components.projectName.text + '.spec' ! specfile = os.path.join(self.components.baseDir.text, specfile) ! buildCommand = builder + ' ' + specfile + ' -o ' + os.path.join(self.components.baseDir.text, self.project.get('Project','buildfilespath')) ! buildCommand += ' > ' + tfile ! print 'running [%s]' % buildCommand ! os.system(buildCommand) fd = open(tfile, 'r') result = fd.readline() *************** *** 520,549 **** result = fd.readline() fd.close() ! #stdin, stdout, stderr = os.popen3(cmd) ! #result = stdout.readline() ! #result2 = stderr.readline() ! #while result or result2: ! # self.outputWindow.addLine(result) ! # self.outputWindow.addLine(result2) ! #stdin.close() ! #stdout.close() ! #stderr.close() ! #print cmd ! # increment the build number to finish ! build = self.project.getint('Project', 'build') ! build += 1 ! self.project.set('Project', 'build', str(build)) ! self.statusBar.text = self.updateStatusBar() ! self.documentChanged = True - def buildSpecFile(self, specfile): spec = [] versionfile = self.project.get('Project', 'basepath') + os.sep + 'versioninfo.txt' spec.append("p = '%s%s' # defines project root directory" % (self.project.get('Project', 'basepath'), os.sep)) spec.append("a = Analysis([os.path.join(HOMEPATH,'support\\_mountzlib.py'),") spec.append(" os.path.join(HOMEPATH,'support\\useUnicode.py'),") ! spec.append(" p + 'pimp.py'],") spec.append(" pathex=['%s'])" % self.cfg.get('ConfigData', 'installerpath')) spec.append("pyz = PYZ(a.pure)") --- 601,636 ---- result = fd.readline() fd.close() ! ! def buildVersionFile(self): ! # build a versioninfo file and write it to disk ! VINFO = open(os.path.join('templates', 'versioninfo.txt')).read() ! vinfo = {} ! vinfo['major'] = self.project.get('Project', 'majorversion') ! vinfo['minor'] = self.project.get('Project', 'minorversion') ! vinfo['fix'] = self.project.get('Project', 'fixnumber') ! vinfo['build'] = self.project.getint('Project', 'build') ! vinfo['name'] = self.project.get('Project', 'name') ! vinfo['date'] = time.strftime('%Y%b%d').upper() ! vinfo['publisher'] = self.project.get('Project', 'publisher') ! vinfo['desc'] = self.project.get('Project', 'projectdesc') ! vinfo['companyname'] = self.cfg.get('ConfigData', 'companyname') + versionfile = os.path.join(self.components.baseDir.text, 'versioninfo.txt') + fd = open(versionfile, 'w') + fd.write(VINFO % vinfo) + fd.close() ! def buildSpecFile(self): ! # build a spec file and write it to disk ! specfile = self.components.projectName.text + '.spec' ! specfile = os.path.join(self.components.baseDir.text, specfile) spec = [] versionfile = self.project.get('Project', 'basepath') + os.sep + 'versioninfo.txt' + spec.append("p = '%s%s' # defines project root directory" % (self.project.get('Project', 'basepath'), os.sep)) spec.append("a = Analysis([os.path.join(HOMEPATH,'support\\_mountzlib.py'),") spec.append(" os.path.join(HOMEPATH,'support\\useUnicode.py'),") ! spec.append(" p + '%s']," % self.components.mainScript.text) spec.append(" pathex=['%s'])" % self.cfg.get('ConfigData', 'installerpath')) spec.append("pyz = PYZ(a.pure)") *************** *** 591,595 **** def on_releaseBtn_mouseClick(self, event): ! pass def on_specBtn_mouseClick(self, event): --- 678,689 ---- def on_releaseBtn_mouseClick(self, event): ! # under Linux, need to build a tarball and put it in the tarballs ! # folder, under windows we do a final rebuild using the same ! # code as above. In either case, we increment the minor portion ! # of the version number by 1 ! if sys.platform.startswith('linux'): ! pass ! else: ! pass def on_specBtn_mouseClick(self, event): *************** *** 634,640 **** break ! print 'using config file %s' % self.CONFIG_FILE ! ! # create a default config the very first time we run standaloneBuilder if not os.path.exists(self.CONFIG_FILE): self.createConfig() --- 728,732 ---- break ! # create a default config the very first time we run projectmanager if not os.path.exists(self.CONFIG_FILE): self.createConfig() *************** *** 646,654 **** def createConfig(self): title = 'Initial setup' ! txt = 'Since this is the first time you have run standaloneBuilder, you need to configure ' txt += 'the program according to your preferences. Most users should find that the ' txt += 'default settings are satisfactory. On this system, settings will be stored ' txt += 'in "%s". In the preferences dialog, you can click the "?" buttons to get ' % self.CONFIG_FILE ! txt += 'help with any of the options. Click OK to begin configuring standaloneBuilder.' bull = dialog.alertDialog(self, wrap_string(txt, 60), title) --- 738,746 ---- def createConfig(self): title = 'Initial setup' ! txt = 'Since this is the first time you have run projectmanager, you need to configure ' txt += 'the program according to your preferences. Most users should find that the ' txt += 'default settings are satisfactory. On this system, settings will be stored ' txt += 'in "%s". In the preferences dialog, you can click the "?" buttons to get ' % self.CONFIG_FILE ! txt += 'help with any of the options. Click OK to begin configuring projectmanager.' bull = dialog.alertDialog(self, wrap_string(txt, 60), title) *************** *** 682,685 **** --- 774,778 ---- self.cfg.set('ConfigData', 'compilerpath', '') self.cfg.set('ConfigData', 'publisher', '') + self.cfg.set('ConfigData', 'companyname', '') if sys.platform.startswith('linux') or sys.platform.startswith('freebsd'): *************** *** 694,698 **** if dlg.ShowModal() != wx.ID_OK: title = 'Preferences not saved!' ! txt = 'You must configure your preferences before using standaloneBuilder' bull = dialog.alertDialog(self, wrap_string(txt, 60), title) dlg.destroy() --- 787,791 ---- if dlg.ShowModal() != wx.ID_OK: title = 'Preferences not saved!' ! txt = 'You must configure your preferences before using projectmanager' bull = dialog.alertDialog(self, wrap_string(txt, 60), title) dlg.destroy() *************** *** 729,733 **** x.append(path) x.sort() ! self.documentChanged = 1 return x --- 822,826 ---- x.append(path) x.sort() ! self.documentChanged = True return x *************** *** 737,741 **** if selected != item: newlist.append(item) ! if newlist != items: self.documentChanged = 1 return newlist --- 830,834 ---- if selected != item: newlist.append(item) ! if newlist != items: self.documentChanged = True return newlist *************** *** 769,779 **** self.project.set('Project', 'pixmapspath', 'pixmaps') self.project.set('Project', 'tarballspath', 'tarballs') ! self.project.set('Project', 'onedir', 1) ! self.project.set('Project', 'ascii', 0) ! self.project.set('Project', 'striplib', 0) ! self.project.set('Project', 'console', 1) # best to have a coonsole for new projects! ! self.project.set('Project', 'optimize', 1) ! self.project.set('Project', 'compress', 0) ! self.project.set('Project', 'debug', 0) x = os.path.join('build', '%s.iss' % self.components.projectName.text) --- 862,879 ---- self.project.set('Project', 'pixmapspath', 'pixmaps') self.project.set('Project', 'tarballspath', 'tarballs') ! self.project.set('Project', 'onedir', '1') ! self.project.set('Project', 'ascii', '0') ! self.project.set('Project', 'striplib', '0') ! self.project.set('Project', 'console', '1') # best to have a console for new projects! ! self.project.set('Project', 'optimize', '1') ! self.project.set('Project', 'compress', '0') ! self.project.set('Project', 'debug', '0') ! self.project.set('Project', 'publisher', self.cfg.get('ConfigData', 'publisher')) ! self.project.set('Project', 'appurl', '') ! ! # 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) *************** *** 783,793 **** self.project.set('Project', 'specfile', x) ! self.project.set('Otherfiles', '1', os.path.join('doc', 'about.html')) ! self.project.set('Otherfiles', '2', os.path.join('doc', 'author.html')) ! self.project.set('Otherfiles', '3', os.path.join('doc', 'gpl.txt')) for comp in self.components.keys(): self.components[comp].enabled = 1 ! def UI2Project(self): # update the project object --- 883,970 ---- self.project.set('Project', 'specfile', x) ! self.project.set('Otherfiles', '0', os.path.join('doc', 'about.html')) ! self.project.set('Otherfiles', '1', os.path.join('doc', 'author.html')) ! self.project.set('Otherfiles', '2', os.path.join('doc', 'gpl.txt')) ! self.project.set('Otherfiles', '3', os.path.join('doc', 'gpl.html')) ! self.project.set('Otherfiles', '4', 'changelog.txt') ! self.project.set('Otherfiles', '5', 'readme.txt') ! ! self.createProject() ! self.Project2UI() for comp in self.components.keys(): self.components[comp].enabled = 1 ! ! def createProject(self): ! # create all the folders and other gubbins ! basepath = self.project.get('Project', 'basepath') ! ! os.mkdir(os.path.join(basepath, self.project.get('Project', 'buildfilespath'))) ! os.mkdir(os.path.join(basepath, self.project.get('Project', 'distfilespath'))) ! os.mkdir(os.path.join(basepath, self.project.get('Project', 'pixmapspath'))) ! os.mkdir(os.path.join(basepath, self.project.get('Project', 'tarballspath'))) ! os.mkdir(os.path.join(basepath, self.project.get('Project', 'docfilespath'))) ! ! # copy in various things from templates ! templatedir = os.path.dirname(os.path.abspath(__file__)) ! templatedir = os.path.join(templatedir, 'templates') ! ! vinfo = {} ! vinfo['major'] = self.project.get('Project', 'majorversion') ! vinfo['minor'] = self.project.get('Project', 'minorversion') ! vinfo['fix'] = self.project.get('Project', 'fixnumber') ! vinfo['build'] = str('%04d' % self.project.getint('Project', 'build')) ! vinfo['name'] = self.project.get('Project', 'name') ! vinfo['date'] = time.strftime('%Y%b%d').upper() ! vinfo['publisher'] = self.project.get('Project', 'publisher') ! vinfo['desc'] = self.project.get('Project', 'projectdesc') ! vinfo['appurl'] = self.project.get('Project', 'appurl') ! ! # HTML about page ! VINFO = open(os.path.join(templatedir, 'about.html')).read() ! afile = os.path.join(basepath, self.project.get('Project', 'docfilespath')) ! afile = os.path.join(afile, 'about.html') ! fd = open(afile, 'w') ! fd.write(VINFO % vinfo) ! fd.close() ! ! # HTML author page ! VINFO = open(os.path.join(templatedir, 'author.html')).read() ! afile = os.path.join(basepath, self.project.get('Project', 'docfilespath')) ! afile = os.path.join(afile, 'author.html') ! fd = open(afile, 'w') ! fd.write(VINFO % vinfo) ! fd.close() ! ! # HTML GPL license text page ! VINFO = open(os.path.join(templatedir, 'gpl.html')).read() ! afile = os.path.join(basepath, self.project.get('Project', 'docfilespath')) ! afile = os.path.join(afile, 'gpl.html') ! fd = open(afile, 'w') ! fd.write(VINFO % vinfo) ! fd.close() ! ! # plaintext GPL license text page ! VINFO = open(os.path.join(templatedir, 'gpl.txt')).read() ! afile = os.path.join(basepath, self.project.get('Project', 'docfilespath')) ! afile = os.path.join(afile, 'gpl.txt') ! fd = open(afile, 'w') ! fd.write(VINFO % vinfo) ! fd.close() ! ! # changelog template ! VINFO = open(os.path.join(templatedir, 'changelog.txt')).read() ! afile = os.path.join(basepath, 'changelog.txt') ! fd = open(afile, 'w') ! fd.write(VINFO % vinfo) ! fd.close() ! ! # readme template ! VINFO = open(os.path.join(templatedir, 'readme.txt')).read() ! afile = os.path.join(basepath, 'readme.txt') ! fd = open(afile, 'w') ! fd.write(VINFO % vinfo) ! fd.close() ! def UI2Project(self): # update the project object *************** *** 941,945 **** msg = "The text in the %s file has changed.\n\nDo you want to save the changes?" % filename result = dialog.messageDialog(self, msg, 'textEditor', wx.ICON_EXCLAMATION | wx.YES_NO | wx.CANCEL) ! print 'result is %s' % result return result.returned --- 1118,1122 ---- msg = "The text in the %s file has changed.\n\nDo you want to save the changes?" % filename result = dialog.messageDialog(self, msg, 'textEditor', wx.ICON_EXCLAMATION | wx.YES_NO | wx.CANCEL) ! print 'result is [%s]' % result return result.returned *************** *** 964,968 **** self.project.read(path) self.documentPath = path ! self.documentChanged = 0 self.SetTitle(os.path.split(path)[-1] + ' - ' + self.startTitle) self.Project2UI() --- 1141,1145 ---- self.project.read(path) self.documentPath = path ! self.documentChanged = False self.SetTitle(os.path.split(path)[-1] + ' - ' + self.startTitle) self.Project2UI() *************** *** 979,983 **** string += str(self.components.fixNumber.value) string += ' (Build ' + self.project.get('Project', 'build') + ')' - print string return string --- 1156,1159 ---- *************** *** 989,993 **** f.close() self.documentPath = path ! self.documentChanged = 0 self.SetTitle(os.path.split(path)[-1] + ' - ' + self.startTitle) self.statusBar.text = self.updateStatusBar() --- 1165,1169 ---- f.close() self.documentPath = path ! self.documentChanged = False self.SetTitle(os.path.split(path)[-1] + ' - ' + self.startTitle) self.statusBar.text = self.updateStatusBar() *************** *** 996,999 **** if __name__ == '__main__': ! app = model.Application(standaloneBuilder) app.MainLoop() --- 1172,1175 ---- if __name__ == '__main__': ! app = model.Application(PM) app.MainLoop() Index: outputWindow.rsrc.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/standaloneBuilder/outputWindow.rsrc.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** outputWindow.rsrc.py 1 Apr 2005 09:58:50 -0000 1.1 --- outputWindow.rsrc.py 9 Apr 2005 09:30:36 -0000 1.2 *************** *** 8,26 **** 'visible':0, - 'menubar': {'type':'MenuBar', - 'menus': [ - {'type':'Menu', - 'name':'menuFile', - 'label':'&File', - 'items': [ - {'type':'MenuItem', - 'name':'menuFileExit', - 'label':'E&xit', - 'command':'exit', - }, - ] - }, - ] - }, 'components': [ --- 8,11 ---- *************** *** 44,47 **** --- 29,39 ---- {'type':'StaticText', + 'name':'txt4c', + 'position':(145, 70), + 'text':'please wait...', + 'visible':False, + }, + + {'type':'StaticText', 'name':'txt4b', 'position':(145, 70), *************** *** 59,62 **** --- 51,61 ---- {'type':'StaticText', + 'name':'txt3c', + 'position':(145, 50), + 'text':'please wait...', + 'visible':False, + }, + + {'type':'StaticText', 'name':'txt3b', 'position':(145, 50), Index: newProjectWizardPage4.rsrc.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/standaloneBuilder/newProjectWizardPage4.rsrc.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** newProjectWizardPage4.rsrc.py 1 Apr 2005 09:58:50 -0000 1.1 --- newProjectWizardPage4.rsrc.py 9 Apr 2005 09:30:36 -0000 1.2 *************** *** 57,60 **** --- 57,74 ---- }, + {'type':'StaticText', + 'name':'page4text5', + 'position':(175, 125), + 'text':'After the project has been created, you should open the project properties page and', + 'userdata':'page4', + }, + + {'type':'StaticText', + 'name':'page4text6', + 'position':(175, 140), + 'text':'ensure that the settings are to your liking.', + 'userdata':'page4', + }, + ] # end components } # end CustomDialog |