Thu, 30 Aug 2012 17:18:56 +0200
Corrected PEP-8 related issues.
--- a/PluginProjectPyramid.py Thu Aug 30 15:36:06 2012 +0200 +++ b/PluginProjectPyramid.py Thu Aug 30 17:18:56 2012 +0200 @@ -42,6 +42,7 @@ pyramidPluginObject = None + def createPyramidPage(configDlg): """ Module function to create the Pyramid configuration page. @@ -53,6 +54,7 @@ page = PyramidPage(pyramidPluginObject) return page + def getConfigData(): """ Module function returning data as required by the configuration dialog. @@ -61,15 +63,16 @@ """ if e5App().getObject("UserInterface").versionIsNewer('5.0.99', '20120101'): return { - "pyramidPage" : \ - [QCoreApplication.translate("ProjectPyramidPlugin", "Pyramid"), - os.path.join("ProjectPyramid", "icons", + "pyramidPage": \ + [QCoreApplication.translate("ProjectPyramidPlugin", "Pyramid"), + os.path.join("ProjectPyramid", "icons", "pyramid.png"), createPyramidPage, None, None], } else: return {} + def apiFiles(language): """ Module function to return the API files made available by this plugin. @@ -84,6 +87,7 @@ apis = [] return apis + def prepareUninstall(): """ Module function to prepare for an uninstallation. @@ -97,11 +101,11 @@ Class implementing the Pyramid project plugin. """ lexerAssociations = { - "*.mako": "Pygments|HTML+Mako", - "*.pt": "Pygments|HTML+Genshi", - "*.txt": "Pygments|Genshi", - "*.html": "Pygments|HTML+Genshi", - "*.htm": "Pygments|HTML+Genshi", + "*.mako": "Pygments|HTML+Mako", + "*.pt": "Pygments|HTML+Genshi", + "*.txt": "Pygments|Genshi", + "*.html": "Pygments|HTML+Genshi", + "*.htm": "Pygments|HTML+Genshi", } def __init__(self, ui): @@ -115,11 +119,11 @@ self.__initialize() self.__defaults = { - "VirtualEnvironmentPy2" : "", - "VirtualEnvironmentPy3" : "", - "Python2ConsoleType": "python", - "Python3ConsoleType": "python", - "PyramidDocUrl": "http://docs.pylonsproject.org/en/latest/docs/pyramid.html", + "VirtualEnvironmentPy2": "", + "VirtualEnvironmentPy3": "", + "Python2ConsoleType": "python", + "Python3ConsoleType": "python", + "PyramidDocUrl": "http://docs.pylonsproject.org/en/latest/docs/pyramid.html", } if isWindowsPlatform(): self.__defaults["ConsoleCommandNoClose"] = "cmd.exe /k" @@ -180,11 +184,11 @@ self.__mainMenu = self.__object.initMenu() - self.__e5project.registerProjectType("Pyramid", self.trUtf8("Pyramid"), - self.fileTypesCallback, - lexerAssociationCallback = self.lexerAssociationCallback, - binaryTranslationsCallback = self.binaryTranslationsCallback) - Preferences.setProjectBrowserFlagsDefault("Pyramid", + self.__e5project.registerProjectType("Pyramid", self.trUtf8("Pyramid"), + self.fileTypesCallback, + lexerAssociationCallback=self.lexerAssociationCallback, + binaryTranslationsCallback=self.binaryTranslationsCallback) + Preferences.setProjectBrowserFlagsDefault("Pyramid", SourcesBrowserFlag | \ FormsBrowserFlag | \ TranslationsBrowserFlag | \ @@ -279,15 +283,15 @@ """ if self.__e5project.getProjectType() == "Pyramid": fileTypes = { - "*.mako": "FORMS", - "*.mak": "FORMS", - "*.pt": "FORMS", - "*.html": "FORMS", - "*.htm": "FORMS", + "*.mako": "FORMS", + "*.mak": "FORMS", + "*.pt": "FORMS", + "*.html": "FORMS", + "*.htm": "FORMS", "*.js": "SOURCES", - "*.pot": "TRANSLATIONS", - "*.po": "TRANSLATIONS", - "*.mo": "TRANSLATIONS", + "*.pot": "TRANSLATIONS", + "*.po": "TRANSLATIONS", + "*.mo": "TRANSLATIONS", } else: fileTypes = {}
--- a/ProjectPyramid/ConfigurationPage/PyramidPage.py Thu Aug 30 15:36:06 2012 +0200 +++ b/ProjectPyramid/ConfigurationPage/PyramidPage.py Thu Aug 30 17:18:56 2012 +0200 @@ -43,7 +43,7 @@ consoleList.append("xterm -e") else: consoleList.append("konsole -e") - consoleList.append("@konsole --workdir . -e") + consoleList.append("@konsole --workdir . -e") # KDE4 konsole spawns consoleList.append("gnome-terminal -x") consoleList.append("xterm -e") @@ -96,28 +96,28 @@ """ Public slot to save the Pyramid configuration. """ - self.__plugin.setPreferences("ConsoleCommand", + self.__plugin.setPreferences("ConsoleCommand", self.consoleCommandCombo.currentText()) - self.__plugin.setPreferences("ConsoleCommandNoClose", + self.__plugin.setPreferences("ConsoleCommandNoClose", self.consoleCommandNoCloseCombo.currentText()) - self.__plugin.setPreferences("VirtualEnvironmentPy2", + self.__plugin.setPreferences("VirtualEnvironmentPy2", self.virtualEnvPy2Edit.text()) - self.__plugin.setPreferences("VirtualEnvironmentPy3", + self.__plugin.setPreferences("VirtualEnvironmentPy3", self.virtualEnvPy3Edit.text()) - self.__plugin.setPreferences("Python2ConsoleType", + self.__plugin.setPreferences("Python2ConsoleType", self.py2ShellCombo.itemData(self.py2ShellCombo.currentIndex())) - self.__plugin.setPreferences("Python3ConsoleType", + self.__plugin.setPreferences("Python3ConsoleType", self.py3ShellCombo.itemData(self.py3ShellCombo.currentIndex())) - self.__plugin.setPreferences("PyramidDocUrl", + self.__plugin.setPreferences("PyramidDocUrl", self.urlEdit.text()) @pyqtSlot() def on_virtualEnvPy3Button_clicked(self): """ - Private slot to select the virtual environment for Python 3 via a + Private slot to select the virtual environment for Python 3 via a directory selection dialog. """ vDir = self.virtualEnvPy3Edit.text() @@ -135,7 +135,7 @@ @pyqtSlot() def on_virtualEnvPy2Button_clicked(self): """ - Private slot to select the virtual environment for Python 2 via a + Private slot to select the virtual environment for Python 2 via a directory selection dialog. """ vDir = self.virtualEnvPy2Edit.text()
--- a/ProjectPyramid/CreateParametersDialog.py Thu Aug 30 15:36:06 2012 +0200 +++ b/ProjectPyramid/CreateParametersDialog.py Thu Aug 30 17:18:56 2012 +0200 @@ -101,8 +101,8 @@ indicating to simulate the creation (boolean) """ return ( - self.scaffoldCombo.currentText().split(":")[0], - self.nameEdit.text(), - self.overwriteCheckBox.isChecked(), + self.scaffoldCombo.currentText().split(":")[0], + self.nameEdit.text(), + self.overwriteCheckBox.isChecked(), self.simulateCheckBox.isChecked() )
--- a/ProjectPyramid/FormSelectionDialog.py Thu Aug 30 15:36:06 2012 +0200 +++ b/ProjectPyramid/FormSelectionDialog.py Thu Aug 30 17:18:56 2012 +0200 @@ -17,7 +17,7 @@ """ Class implementing a dialog to select the template type. """ - def __init__(self, parent = None): + def __init__(self, parent=None): """ Constructor @@ -27,7 +27,7 @@ self.setupUi(self) self.__templates = { - "html5" : [self.trUtf8("Standard HTML 5 template"), + "html5": [self.trUtf8("Standard HTML 5 template"), '''<!DOCTYPE html>\n''' ''' <head>\n''' ''' <title></title>\n''' @@ -38,8 +38,8 @@ ''' <body>\n''' ''' </body>\n''' '''</html>\n''' - ], - "simple" : [self.trUtf8("Standard HTML template"), + ], + "simple": [self.trUtf8("Standard HTML template"), '''<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"\n''' ''' "http://www.w3.org/TR/html4/strict.dtd">\n''' ''' <head>\n''' @@ -51,8 +51,8 @@ ''' <body>\n''' ''' </body>\n''' '''</html>\n''' - ], - "complex" : [self.trUtf8("Chameleon template"), + ], + "complex": [self.trUtf8("Chameleon template"), '''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"\n''' ''' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n''' '''<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"\n''' @@ -95,8 +95,8 @@ ''' </div>\n''' '''</body>\n''' '''</html>\n''' - ], - "sections" : [self.trUtf8("Mako template with sections"), + ], + "sections": [self.trUtf8("Mako template with sections"), '''## -*- coding: utf-8 -*-\n''' '''\n''' '''<!DOCTYPE html>\n''' @@ -124,7 +124,7 @@ '''<%def name="heading()"><h1>${c.heading or 'No Title'}</h1></%def>\n''' '''<%def name="breadcrumbs()"></%def>\n''' '''<%def name="footer()"><p><a href="#top">Top ^</a></p></%def>\n''' - ], + ], } self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok)
--- a/ProjectPyramid/Project.py Thu Aug 30 15:36:06 2012 +0200 +++ b/ProjectPyramid/Project.py Thu Aug 30 17:18:56 2012 +0200 @@ -40,7 +40,7 @@ """ Class implementing the Pyramid project support. """ - def __init__(self, plugin, parent = None): + def __init__(self, plugin, parent=None): """ Constructor @@ -67,7 +67,7 @@ self.selectProjectAct = E5Action(self.trUtf8('Current Pyramid Project'), "", 0, 0, - self,'pyramid_current_project') + self, 'pyramid_current_project') self.selectProjectAct.setStatusTip(self.trUtf8( 'Selects the current Pyramid project')) self.selectProjectAct.setWhatsThis(self.trUtf8( @@ -83,9 +83,9 @@ ############################### self.createProjectAct = E5Action(self.trUtf8('Create Pyramid Project'), - self.trUtf8('Create Pyramid &Project'), + self.trUtf8('Create Pyramid &Project'), 0, 0, - self,'pyramid_create_project') + self, 'pyramid_create_project') self.createProjectAct.setStatusTip(self.trUtf8( 'Creates a new Pyramid project')) self.createProjectAct.setWhatsThis(self.trUtf8( @@ -100,9 +100,9 @@ ############################## self.runServerAct = E5Action(self.trUtf8('Run Server'), - self.trUtf8('Run &Server'), + self.trUtf8('Run &Server'), 0, 0, - self,'pyramid_run_server') + self, 'pyramid_run_server') self.runServerAct.setStatusTip(self.trUtf8( 'Starts the Pyramid Web server')) self.runServerAct.setWhatsThis(self.trUtf8( @@ -114,9 +114,9 @@ self.actions.append(self.runServerAct) self.runLoggingServerAct = E5Action(self.trUtf8('Run Server with Logging'), - self.trUtf8('Run Server with &Logging'), + self.trUtf8('Run Server with &Logging'), 0, 0, - self,'pyramid_run_logging_server') + self, 'pyramid_run_logging_server') self.runLoggingServerAct.setStatusTip(self.trUtf8( 'Starts the Pyramid Web server with logging')) self.runLoggingServerAct.setWhatsThis(self.trUtf8( @@ -128,9 +128,9 @@ self.actions.append(self.runLoggingServerAct) self.runBrowserAct = E5Action(self.trUtf8('Run Web-Browser'), - self.trUtf8('Run &Web-Browser'), + self.trUtf8('Run &Web-Browser'), 0, 0, - self,'pyramid_run_browser') + self, 'pyramid_run_browser') self.runBrowserAct.setStatusTip(self.trUtf8( 'Starts the default Web-Browser with the URL of the Pyramid Web server')) self.runBrowserAct.setWhatsThis(self.trUtf8( @@ -142,9 +142,9 @@ self.actions.append(self.runBrowserAct) self.runPythonShellAct = E5Action(self.trUtf8('Start Pyramid Python Console'), - self.trUtf8('Start Pyramid &Python Console'), + self.trUtf8('Start Pyramid &Python Console'), 0, 0, - self,'pyramid_python_console') + self, 'pyramid_python_console') self.runPythonShellAct.setStatusTip(self.trUtf8( 'Starts an interactive Python interpreter')) self.runPythonShellAct.setWhatsThis(self.trUtf8( @@ -159,9 +159,9 @@ ############################## self.setupDevelopAct = E5Action(self.trUtf8('Setup Development Environment'), - self.trUtf8('Setup &Development Environment'), + self.trUtf8('Setup &Development Environment'), 0, 0, - self,'pyramid_setup_development') + self, 'pyramid_setup_development') self.setupDevelopAct.setStatusTip(self.trUtf8( 'Setup the Pyramid project in development mode')) self.setupDevelopAct.setWhatsThis(self.trUtf8( @@ -177,9 +177,9 @@ ############################### self.initializeDbAct = E5Action(self.trUtf8('Initialize Database'), - self.trUtf8('Initialize &Database'), + self.trUtf8('Initialize &Database'), 0, 0, - self,'pyramid_initialize_database') + self, 'pyramid_initialize_database') self.initializeDbAct.setStatusTip(self.trUtf8( 'Initializes (or re-initializes) the database of the current' ' Pyramid project')) @@ -196,9 +196,9 @@ ############################### self.showViewsAct = E5Action(self.trUtf8('Show Matching Views'), - self.trUtf8('Show Matching &Views'), + self.trUtf8('Show Matching &Views'), 0, 0, - self,'pyramid_show_views') + self, 'pyramid_show_views') self.showViewsAct.setStatusTip(self.trUtf8( 'Show views matching a given URL')) self.showViewsAct.setWhatsThis(self.trUtf8( @@ -209,9 +209,9 @@ self.actions.append(self.showViewsAct) self.showRoutesAct = E5Action(self.trUtf8('Show Routes'), - self.trUtf8('Show &Routes'), + self.trUtf8('Show &Routes'), 0, 0, - self,'pyramid_show_routes') + self, 'pyramid_show_routes') self.showRoutesAct.setStatusTip(self.trUtf8( 'Show all URL dispatch routes used by a Pyramid application')) self.showRoutesAct.setWhatsThis(self.trUtf8( @@ -223,9 +223,9 @@ self.actions.append(self.showRoutesAct) self.showTweensAct = E5Action(self.trUtf8('Show Tween Objects'), - self.trUtf8('Show &Tween Objects'), + self.trUtf8('Show &Tween Objects'), 0, 0, - self,'pyramid_show_routes') + self, 'pyramid_show_routes') self.showTweensAct.setStatusTip(self.trUtf8( 'Show all implicit and explicit tween objects used by a Pyramid application')) self.showTweensAct.setWhatsThis(self.trUtf8( @@ -241,9 +241,9 @@ ################################## self.buildDistroAct = E5Action(self.trUtf8('Build Distribution'), - self.trUtf8('Build &Distribution'), + self.trUtf8('Build &Distribution'), 0, 0, - self,'pyramid_build_distribution') + self, 'pyramid_build_distribution') self.buildDistroAct.setStatusTip(self.trUtf8( 'Builds a distribution file for the Pyramid project')) self.buildDistroAct.setWhatsThis(self.trUtf8( @@ -259,9 +259,9 @@ ################################## self.documentationAct = E5Action(self.trUtf8('Documentation'), - self.trUtf8('D&ocumentation'), + self.trUtf8('D&ocumentation'), 0, 0, - self,'pyramid_documentation') + self, 'pyramid_documentation') self.documentationAct.setStatusTip(self.trUtf8( 'Shows the help viewer with the Pyramid documentation')) self.documentationAct.setWhatsThis(self.trUtf8( @@ -276,9 +276,9 @@ ############################## self.aboutPyramidAct = E5Action(self.trUtf8('About Pyramid'), - self.trUtf8('About P&yramid'), + self.trUtf8('About P&yramid'), 0, 0, - self,'pyramid_about') + self, 'pyramid_about') self.aboutPyramidAct.setStatusTip(self.trUtf8( 'Shows some information about Pyramid')) self.aboutPyramidAct.setWhatsThis(self.trUtf8( @@ -333,7 +333,7 @@ if self.__e5project.getProjectType() == "Pyramid": self.__formsBrowser = \ e5App().getObject("ProjectBrowser").getProjectBrowser("forms") - self.__formsBrowser.addHookMethodAndMenuEntry("newForm", + self.__formsBrowser.addHookMethodAndMenuEntry("newForm", self.newForm, self.trUtf8("New template...")) if self.__e5project.getProjectLanguage() == "Python2": @@ -342,16 +342,16 @@ self.__projectLanguageAdded) self.__translationsBrowser = \ e5App().getObject("ProjectBrowser").getProjectBrowser("translations") - self.__translationsBrowser.addHookMethodAndMenuEntry("extractMessages", + self.__translationsBrowser.addHookMethodAndMenuEntry("extractMessages", self.extractMessages, self.trUtf8("Extract Messages")) - self.__translationsBrowser.addHookMethodAndMenuEntry("releaseAll", + self.__translationsBrowser.addHookMethodAndMenuEntry("releaseAll", self.compileCatalogs, self.trUtf8("Compile All Catalogs")) - self.__translationsBrowser.addHookMethodAndMenuEntry("releaseSelected", - self.compileSelectedCatalogs, + self.__translationsBrowser.addHookMethodAndMenuEntry("releaseSelected", + self.compileSelectedCatalogs, self.trUtf8("Compile Selected Catalogs")) - self.__translationsBrowser.addHookMethodAndMenuEntry("generateAll", + self.__translationsBrowser.addHookMethodAndMenuEntry("generateAll", self.updateCatalogs, self.trUtf8("Update All Catalogs")) - self.__translationsBrowser.addHookMethodAndMenuEntry("generateSelected", + self.__translationsBrowser.addHookMethodAndMenuEntry("generateSelected", self.updateSelectedCatalogs, self.trUtf8("Update Selected Catalogs")) self.__hooksInstalled = True @@ -411,7 +411,7 @@ res = E5MessageBox.yesNo(self.__ui, self.trUtf8("New Form"), self.trUtf8("""The file already exists! Overwrite it?"""), - icon = E5MessageBox.Warning) + icon=E5MessageBox.Warning) if not res: # user selected to not overwrite return @@ -572,7 +572,7 @@ def __findProjects(self): """ - Private method to determine the relative path of all Pyramid + Private method to determine the relative path of all Pyramid projects (= top level dirs). @return list of projects (list of string) @@ -627,7 +627,7 @@ if self.__currentProject is None: raise PyramidNoProjectSelectedException else: - return os.path.join(self.__e5project.getProjectPath(), + return os.path.join(self.__e5project.getProjectPath(), self.__currentProject) def __setCurrentProject(self, project): @@ -656,7 +656,7 @@ outputDir = config.get("init_catalog", "output_dir") domain = config.get("init_catalog", "domain") self.__e5project.pdata["TRANSLATIONPATTERN"] = [ - os.path.join(project, outputDir, "%language%", + os.path.join(project, outputDir, "%language%", "LC_MESSAGES", "{0}.po".format(domain)) ] @@ -685,7 +685,7 @@ ## slots below implement run functions ################################################################## - def __runServer(self, logging = False): + def __runServer(self, logging=False): """ Private slot to start the Pyramid Web server. @@ -825,9 +825,8 @@ args.append("setup.py") args.append("develop") - dia = PyramidDialog(title, - msgSuccess = \ - self.trUtf8("Pyramid development environment setup successfully.")) + dia = PyramidDialog(title, + msgSuccess=self.trUtf8("Pyramid development environment setup successfully.")) res = dia.startProcess(cmd, args, wd) if res: dia.exec_() @@ -860,9 +859,8 @@ if formats: args.append("--formats={0}".format(','.join(formats))) - dia = PyramidDialog(title, - msgSuccess = \ - self.trUtf8("Python distribution file built successfully.")) + dia = PyramidDialog(title, + msgSuccess=self.trUtf8("Python distribution file built successfully.")) res = dia.startProcess(cmd, args, projectPath) if res: dia.exec_() @@ -905,9 +903,8 @@ args = [] args.append("development.ini") - dia = PyramidDialog(title, - msgSuccess = \ - self.trUtf8("Database initialized successfully.")) + dia = PyramidDialog(title, + msgSuccess=self.trUtf8("Database initialized successfully.")) res = dia.startProcess(cmd, args, projectPath) if res: dia.exec_() @@ -1077,9 +1074,8 @@ args.append("setup.py") args.append("extract_messages") - dia = PyramidDialog(title, - msgSuccess = \ - self.trUtf8("\nMessages extracted successfully.")) + dia = PyramidDialog(title, + msgSuccess=self.trUtf8("\nMessages extracted successfully.")) res = dia.startProcess(cmd, args, projectPath) if res: dia.exec_() @@ -1125,9 +1121,8 @@ args.append("-l") args.append(code) - dia = PyramidDialog(title, - msgSuccess = \ - self.trUtf8("\nMessage catalog initialized successfully.")) + dia = PyramidDialog(title, + msgSuccess=self.trUtf8("\nMessage catalog initialized successfully.")) res = dia.startProcess(cmd, args, projectPath) if res: dia.exec_() @@ -1157,9 +1152,8 @@ args.append("setup.py") args.append("compile_catalog") - dia = PyramidDialog(title, - msgSuccess = \ - self.trUtf8("\nMessage catalogs compiled successfully.")) + dia = PyramidDialog(title, + msgSuccess=self.trUtf8("\nMessage catalogs compiled successfully.")) res = dia.startProcess(cmd, args, projectPath) if res: dia.exec_() @@ -1205,9 +1199,8 @@ self.trUtf8('No locales detected. Aborting...')) return - dia = PyramidDialog(title, - msgSuccess = \ - self.trUtf8("\nMessage catalogs compiled successfully.")) + dia = PyramidDialog(title, + msgSuccess=self.trUtf8("\nMessage catalogs compiled successfully.")) res = dia.startBatchProcesses(argsLists, projectPath) if res: dia.exec_() @@ -1239,9 +1232,8 @@ args.append("setup.py") args.append("update_catalog") - dia = PyramidDialog(title, - msgSuccess = \ - self.trUtf8("\nMessage catalogs updated successfully.")) + dia = PyramidDialog(title, + msgSuccess=self.trUtf8("\nMessage catalogs updated successfully.")) res = dia.startProcess(cmd, args, projectPath) if res: dia.exec_() @@ -1281,9 +1273,8 @@ self.trUtf8('No locales detected. Aborting...')) return - dia = PyramidDialog(title, - msgSuccess = \ - self.trUtf8("\nMessage catalogs updated successfully.")) + dia = PyramidDialog(title, + msgSuccess=self.trUtf8("\nMessage catalogs updated successfully.")) res = dia.startBatchProcesses(argsLists, projectPath) if res: dia.exec_()
--- a/ProjectPyramid/PyramidDialog.py Thu Aug 30 15:36:06 2012 +0200 +++ b/ProjectPyramid/PyramidDialog.py Thu Aug 30 17:18:56 2012 +0200 @@ -28,9 +28,9 @@ shows the output of the process. The dialog is modal, which causes a synchronized execution of the process. """ - def __init__(self, text, fixed = False, linewrap = True, - msgSuccess = None, msgError = None, - parent = None): + def __init__(self, text, fixed=False, linewrap=True, + msgSuccess=None, msgError=None, + parent=None): """ Constructor @@ -170,7 +170,7 @@ self.inputGroup.show() return procStarted - def startBatchProcesses(self, argsLists, workingDir = None): + def startBatchProcesses(self, argsLists, workingDir=None): """ Public slot used to start a batch of processes.