Fri, 25 Oct 2013 18:51:52 +0200
Fixed code style issues.
--- a/ChangeLog Sat Sep 28 13:34:57 2013 +0200 +++ b/ChangeLog Fri Oct 25 18:51:52 2013 +0200 @@ -1,5 +1,8 @@ ChangeLog --------- +Version 1.3.1: +- fixed code style issues + Version 1.3.0 - bug fixes - added a menu entry to call a translations editor from the translations viewer @@ -20,7 +23,8 @@ - first stable release Version 0.4.0 -- bug fix related to uninstalling the plug-in via the external plug-in uninstaller +- bug fix related to uninstalling the plug-in via the external plug-in + uninstaller Version 0.3.0 - bug fixes
--- a/PluginProjectPyramid.py Sat Sep 28 13:34:57 2013 +0200 +++ b/PluginProjectPyramid.py Fri Oct 25 18:51:52 2013 +0200 @@ -26,11 +26,12 @@ author = "Detlev Offenbach <detlev@die-offenbachs.de>" autoactivate = True deactivateable = True -version = "1.3.0" +version = "1.3.1" className = "ProjectPyramidPlugin" packageName = "ProjectPyramid" shortDescription = "Project support for Pyramid projects." -longDescription = """This plugin implements project support for Pyramid projects.""" +longDescription = \ + """This plugin implements project support for Pyramid projects.""" needsRestart = False pyqtApi = 2 # End-of-Header @@ -44,6 +45,7 @@ """ Module function to create the Pyramid configuration page. + @param configDlg reference to the configuration dialog @return reference to the configuration page """ global pyramidPluginObject @@ -60,11 +62,10 @@ """ if e5App().getObject("UserInterface").versionIsNewer('5.0.99', '20120101'): return { - "pyramidPage": \ - [QCoreApplication.translate("ProjectPyramidPlugin", "Pyramid"), - os.path.join("ProjectPyramid", "icons", - "pyramid.png"), - createPyramidPage, None, None], + "pyramidPage": [ + QCoreApplication.translate("ProjectPyramidPlugin", "Pyramid"), + os.path.join("ProjectPyramid", "icons", "pyramid.png"), + createPyramidPage, None, None], } else: return {} @@ -74,6 +75,7 @@ """ Module function to return the API files made available by this plugin. + @param language language to get APIs for (string) @return list of API filenames (list of string) """ if language in ["Python3", "Python2"]: @@ -122,7 +124,8 @@ "VirtualEnvironmentPy3": "", "Python2ConsoleType": "python", "Python3ConsoleType": "python", - "PyramidDocUrl": "http://docs.pylonsproject.org/en/latest/docs/pyramid.html", + "PyramidDocUrl": "http://docs.pylonsproject.org/en/latest/" + "docs/pyramid.html", "TranslationsEditor": "", } if isWindowsPlatform(): @@ -159,7 +162,8 @@ if self.__ui.versionIsNewer('5.0.99', '20120101'): error = "" else: - error = self.trUtf8("eric5 version is too old, {0}, {1} or newer needed.")\ + error = self.trUtf8( + "eric5 version is too old, {0}, {1} or newer needed.")\ .format("5.1.0", "20120101") return False @@ -187,41 +191,45 @@ if self.__supportedVariants: try: - self.__e5project.registerProjectType("Pyramid", self.trUtf8("Pyramid"), + self.__e5project.registerProjectType( + "Pyramid", self.trUtf8("Pyramid"), self.fileTypesCallback, lexerAssociationCallback=self.lexerAssociationCallback, binaryTranslationsCallback=self.binaryTranslationsCallback, progLanguages=self.__supportedVariants[:]) except TypeError: # for backward compatibility - self.__e5project.registerProjectType("Pyramid", self.trUtf8("Pyramid"), + self.__e5project.registerProjectType( + "Pyramid", self.trUtf8("Pyramid"), self.fileTypesCallback, lexerAssociationCallback=self.lexerAssociationCallback, binaryTranslationsCallback=self.binaryTranslationsCallback) - from Project.ProjectBrowser import SourcesBrowserFlag, FormsBrowserFlag, \ - TranslationsBrowserFlag, OthersBrowserFlag - Preferences.setProjectBrowserFlagsDefault("Pyramid", - SourcesBrowserFlag | \ - FormsBrowserFlag | \ - TranslationsBrowserFlag | \ - OthersBrowserFlag, + from Project.ProjectBrowser import SourcesBrowserFlag, \ + FormsBrowserFlag, TranslationsBrowserFlag, OthersBrowserFlag + Preferences.setProjectBrowserFlagsDefault( + "Pyramid", + SourcesBrowserFlag | FormsBrowserFlag | + TranslationsBrowserFlag | OthersBrowserFlag, ) if self.__e5project.isOpen(): self.__projectOpened() self.__object.projectOpenedHooks() - e5App().getObject("Project").projectOpened.connect(self.__projectOpened) - e5App().getObject("Project").projectClosed.connect(self.__projectClosed) - e5App().getObject("Project").newProject.connect(self.__projectOpened) + e5App().getObject("Project").projectOpened.connect( + self.__projectOpened) + e5App().getObject("Project").projectClosed.connect( + self.__projectClosed) + e5App().getObject("Project").newProject.connect( + self.__projectOpened) e5App().getObject("Project").projectOpenedHooks.connect( self.__object.projectOpenedHooks) e5App().getObject("Project").projectClosedHooks.connect( - self.__object.projectClosedHooks) + self.__object.projectClosedHooks) e5App().getObject("Project").newProjectHooks.connect( - self.__object.projectOpenedHooks) + self.__object.projectOpenedHooks) return None, True @@ -231,9 +239,12 @@ """ e5App().unregisterPluginObject("ProjectPyramid") - e5App().getObject("Project").projectOpened.disconnect(self.__projectOpened) - e5App().getObject("Project").projectClosed.disconnect(self.__projectClosed) - e5App().getObject("Project").newProject.disconnect(self.__projectOpened) + e5App().getObject("Project").projectOpened.disconnect( + self.__projectOpened) + e5App().getObject("Project").projectClosed.disconnect( + self.__projectClosed) + e5App().getObject("Project").newProject.disconnect( + self.__projectOpened) e5App().getObject("Project").projectOpenedHooks.disconnect( self.__object.projectOpenedHooks) @@ -256,8 +267,8 @@ if self.__ui is not None: loc = self.__ui.getLocale() if loc and loc != "C": - locale_dir = \ - os.path.join(os.path.dirname(__file__), "ProjectPyramid", "i18n") + locale_dir = os.path.join( + os.path.dirname(__file__), "ProjectPyramid", "i18n") translation = "pyramid_%s" % loc translator = QTranslator(None) loaded = translator.load(translation, locale_dir) @@ -265,8 +276,8 @@ self.__translator = translator e5App().installTranslator(self.__translator) else: - print("Warning: translation file '{0}' could not be loaded.".format( - translation)) + print("Warning: translation file '{0}' could not be" + " loaded.".format(translation)) print("Using default.") def __projectOpened(self): @@ -277,7 +288,8 @@ projectAct = self.__ui.getMenuBarAction("project") actions = self.__ui.menuBar().actions() insertAct = actions[actions.index(projectAct) + 1] - self.__mainAct = self.__ui.menuBar().insertMenu(insertAct, self.__mainMenu) + self.__mainAct = self.__ui.menuBar().insertMenu( + insertAct, self.__mainMenu) def __projectClosed(self): """ @@ -290,7 +302,8 @@ def fileTypesCallback(self): """ - Public method get the filetype associations of the Pyramid project type. + Public method get the filetype associations of the Pyramid project + type. @return dictionary with file type associations """ @@ -312,11 +325,12 @@ def lexerAssociationCallback(self, filename): """ - Public method to get the lexer association of the Pyramid project type for - a file. + Public method to get the lexer association of the Pyramid project type + for a file. @param filename name of the file (string) - @return name of the lexer (string) (Pygments lexers are prefixed with 'Pygments|') + @return name of the lexer (string) (Pygments lexers are prefixed with + 'Pygments|') """ for pattern, language in self.lexerAssociations.items(): if fnmatch.fnmatch(filename, pattern): @@ -341,11 +355,10 @@ Public method to retrieve the various settings. @param key the key of the value to get - @param prefClass preferences class used as the storage area @return the requested setting """ - return Preferences.Prefs.settings.value(self.PreferencesKey + "/" + key, - self.__defaults[key]) + return Preferences.Prefs.settings.value( + self.PreferencesKey + "/" + key, self.__defaults[key]) def setPreferences(self, key, value): """ @@ -353,9 +366,9 @@ @param key the key of the setting to be set (string) @param value the value to be set - @param prefClass preferences class used as the storage area """ - Preferences.Prefs.settings.setValue(self.PreferencesKey + "/" + key, value) + Preferences.Prefs.settings.setValue( + self.PreferencesKey + "/" + key, value) if key in ["VirtualEnvironmentPy2", "VirtualEnvironmentPy3"]: self.__reregisterProjectType() @@ -376,14 +389,18 @@ self.__supportedVariants = supportedVariants if self.__supportedVariants: try: - self.__e5project.registerProjectType("Pyramid", + self.__e5project.registerProjectType( + "Pyramid", self.trUtf8("Pyramid"), self.fileTypesCallback, lexerAssociationCallback=self.lexerAssociationCallback, - binaryTranslationsCallback=self.binaryTranslationsCallback, + binaryTranslationsCallback= + self.binaryTranslationsCallback, progLanguages=self.__supportedVariants[:]) except TypeError: # for backward compatibility - self.__e5project.registerProjectType("Pyramid", + self.__e5project.registerProjectType( + "Pyramid", self.trUtf8("Pyramid"), self.fileTypesCallback, lexerAssociationCallback=self.lexerAssociationCallback, - binaryTranslationsCallback=self.binaryTranslationsCallback) + binaryTranslationsCallback= + self.binaryTranslationsCallback)
--- a/PluginPyramid.e4p Sat Sep 28 13:34:57 2013 +0200 +++ b/PluginPyramid.e4p Fri Oct 25 18:51:52 2013 +0200 @@ -262,16 +262,22 @@ <value> <dict> <key> + <string>DocstringType</string> + </key> + <value> + <string>eric</string> + </value> + <key> <string>ExcludeFiles</string> </key> <value> - <string>*/ThirdParty/*, */coverage/*, */Ui_*.py, */Examples/*, */*_rc.py</string> + <string>*/Ui_*.py</string> </value> <key> <string>ExcludeMessages</string> </key> <value> - <string>E24, E501, W293</string> + <string>E24, W293, N802, N803, N807, N808, N821</string> </value> <key> <string>FixCodes</string> @@ -283,7 +289,13 @@ <string>FixIssues</string> </key> <value> - <bool>True</bool> + <bool>False</bool> + </value> + <key> + <string>HangClosing</string> + </key> + <value> + <bool>False</bool> </value> <key> <string>IncludeMessages</string> @@ -292,6 +304,18 @@ <string></string> </value> <key> + <string>MaxLineLength</string> + </key> + <value> + <int>79</int> + </value> + <key> + <string>NoFixCodes</string> + </key> + <value> + <string>E501</string> + </value> + <key> <string>RepeatMessages</string> </key> <value>
--- a/ProjectPyramid/ConfigurationPage/PyramidPage.py Sat Sep 28 13:34:57 2013 +0200 +++ b/ProjectPyramid/ConfigurationPage/PyramidPage.py Fri Oct 25 18:51:52 2013 +0200 @@ -12,7 +12,8 @@ from E5Gui.E5Completers import E5DirCompleter from E5Gui import E5FileDialog -from Preferences.ConfigurationPages.ConfigurationPageBase import ConfigurationPageBase +from Preferences.ConfigurationPages.ConfigurationPageBase import \ + ConfigurationPageBase from .Ui_PyramidPage import Ui_PyramidPage import Utilities @@ -86,24 +87,26 @@ """ Public slot to save the Pyramid configuration. """ - self.__plugin.setPreferences("ConsoleCommand", - self.consoleCommandCombo.currentText()) + self.__plugin.setPreferences( + "ConsoleCommand", self.consoleCommandCombo.currentText()) - self.__plugin.setPreferences("VirtualEnvironmentPy2", - self.virtualEnvPy2Edit.text()) - self.__plugin.setPreferences("VirtualEnvironmentPy3", - self.virtualEnvPy3Edit.text()) + self.__plugin.setPreferences( + "VirtualEnvironmentPy2", self.virtualEnvPy2Edit.text()) + 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.urlEdit.text()) + self.__plugin.setPreferences( + "PyramidDocUrl", self.urlEdit.text()) - self.__plugin.setPreferences("TranslationsEditor", - self.translationsEdit.text()) + self.__plugin.setPreferences( + "TranslationsEditor", self.translationsEdit.text()) @pyqtSlot() def on_virtualEnvPy3Button_clicked(self): @@ -121,7 +124,8 @@ E5FileDialog.Options(E5FileDialog.Option(0))) if virtualEnv: - self.virtualEnvPy3Edit.setText(Utilities.toNativeSeparators(virtualEnv)) + self.virtualEnvPy3Edit.setText(Utilities.toNativeSeparators( + virtualEnv)) @pyqtSlot() def on_virtualEnvPy2Button_clicked(self): @@ -139,12 +143,14 @@ E5FileDialog.Options(E5FileDialog.Option(0))) if virtualEnv: - self.virtualEnvPy2Edit.setText(Utilities.toNativeSeparators(virtualEnv)) + self.virtualEnvPy2Edit.setText(Utilities.toNativeSeparators( + virtualEnv)) @pyqtSlot() def on_translationsButton_clicked(self): """ - Private slot to select the translations editor via a file selection dialog. + Private slot to select the translations editor via a file selection + dialog. """ editor = E5FileDialog.getOpenFileName( self,
--- a/ProjectPyramid/CreateParametersDialog.py Sat Sep 28 13:34:57 2013 +0200 +++ b/ProjectPyramid/CreateParametersDialog.py Fri Oct 25 18:51:52 2013 +0200 @@ -61,7 +61,8 @@ self.scaffoldCombo.addItem(scaffold.strip()) self.scaffoldCombo.setCurrentIndex(0) else: - E5MessageBox.critical(None, + E5MessageBox.critical( + None, self.trUtf8('Process Generation Error'), errMsg) @@ -88,7 +89,7 @@ Private slot to update the dialog. """ self.__okButton.setEnabled( - bool(self.scaffoldCombo.currentText()) and \ + bool(self.scaffoldCombo.currentText()) and bool(self.nameEdit.text()) )
--- a/ProjectPyramid/DistributionTypeSelectionDialog.py Sat Sep 28 13:34:57 2013 +0200 +++ b/ProjectPyramid/DistributionTypeSelectionDialog.py Fri Oct 25 18:51:52 2013 +0200 @@ -12,12 +12,14 @@ from E5Gui import E5MessageBox -from .Ui_DistributionTypeSelectionDialog import Ui_DistributionTypeSelectionDialog +from .Ui_DistributionTypeSelectionDialog import \ + Ui_DistributionTypeSelectionDialog import Preferences -class DistributionTypeSelectionDialog(QDialog, Ui_DistributionTypeSelectionDialog): +class DistributionTypeSelectionDialog( + QDialog, Ui_DistributionTypeSelectionDialog): """ Class implementing a dialog to select the distribution file formats. """ @@ -25,7 +27,8 @@ """ Constructor - @param project reference to the project object (ProjectPyramid.Project.Project) + @param project reference to the project object + (ProjectPyramid.Project.Project) @param projectPath path of the Pyramid project (string) @param parent reference to the parent widget (QWidget) """ @@ -52,20 +55,24 @@ else: if not finished: errMsg = self.trUtf8( - "The python setup.py command did not finish within 30s.") + "The python setup.py command did not finish within" + " 30s.") else: errMsg = self.trUtf8("Could not start the pcreate executable.") if not errMsg: for line in output.splitlines(): line = line.strip() if line.startswith("--formats="): - format, description = line.replace("--formats=", "").split(None, 1) - itm = QListWidgetItem("{0} ({1})".format(format, description), - self.formatsList) + format, description = line.replace("--formats=", "")\ + .split(None, 1) + itm = QListWidgetItem( + "{0} ({1})".format(format, description), + self.formatsList) itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable) itm.setCheckState(Qt.Unchecked) else: - E5MessageBox.critical(None, + E5MessageBox.critical( + None, self.trUtf8('Process Generation Error'), errMsg)
--- a/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.PluginProjectPyramid.html Sat Sep 28 13:34:57 2013 +0200 +++ b/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.PluginProjectPyramid.html Fri Oct 25 18:51:52 2013 +0200 @@ -196,7 +196,8 @@ <h4>ProjectPyramidPlugin.fileTypesCallback</h4> <b>fileTypesCallback</b>(<i></i>) <p> - Public method get the filetype associations of the Pyramid project type. + Public method get the filetype associations of the Pyramid project + type. </p><dl> <dt>Returns:</dt> <dd> @@ -211,9 +212,6 @@ <dt><i>key</i></dt> <dd> the key of the value to get -</dd><dt><i>prefClass</i></dt> -<dd> -preferences class used as the storage area </dd> </dl><dl> <dt>Returns:</dt> @@ -224,8 +222,8 @@ <h4>ProjectPyramidPlugin.lexerAssociationCallback</h4> <b>lexerAssociationCallback</b>(<i>filename</i>) <p> - Public method to get the lexer association of the Pyramid project type for - a file. + Public method to get the lexer association of the Pyramid project type + for a file. </p><dl> <dt><i>filename</i></dt> <dd> @@ -234,7 +232,8 @@ </dl><dl> <dt>Returns:</dt> <dd> -name of the lexer (string) (Pygments lexers are prefixed with 'Pygments|') +name of the lexer (string) (Pygments lexers are prefixed with + 'Pygments|') </dd> </dl><a NAME="ProjectPyramidPlugin.setPreferences" ID="ProjectPyramidPlugin.setPreferences"></a> <h4>ProjectPyramidPlugin.setPreferences</h4> @@ -248,9 +247,6 @@ </dd><dt><i>value</i></dt> <dd> the value to be set -</dd><dt><i>prefClass</i></dt> -<dd> -preferences class used as the storage area </dd> </dl> <div align="right"><a href="#top">Up</a></div> @@ -261,6 +257,11 @@ <p> Module function to return the API files made available by this plugin. </p><dl> +<dt><i>language</i></dt> +<dd> +language to get APIs for (string) +</dd> +</dl><dl> <dt>Returns:</dt> <dd> list of API filenames (list of string) @@ -274,6 +275,11 @@ <p> Module function to create the Pyramid configuration page. </p><dl> +<dt><i>configDlg</i></dt> +<dd> +reference to the configuration dialog +</dd> +</dl><dl> <dt>Returns:</dt> <dd> reference to the configuration page
--- a/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.ConfigurationPage.PyramidPage.html Sat Sep 28 13:34:57 2013 +0200 +++ b/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.ConfigurationPage.PyramidPage.html Fri Oct 25 18:51:52 2013 +0200 @@ -91,7 +91,8 @@ <h4>PyramidPage.on_translationsButton_clicked</h4> <b>on_translationsButton_clicked</b>(<i></i>) <p> - Private slot to select the translations editor via a file selection dialog. + Private slot to select the translations editor via a file selection + dialog. </p><a NAME="PyramidPage.on_virtualEnvPy2Button_clicked" ID="PyramidPage.on_virtualEnvPy2Button_clicked"></a> <h4>PyramidPage.on_virtualEnvPy2Button_clicked</h4> <b>on_virtualEnvPy2Button_clicked</b>(<i></i>)
--- a/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.DistributionTypeSelectionDialog.html Sat Sep 28 13:34:57 2013 +0200 +++ b/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.DistributionTypeSelectionDialog.html Fri Oct 25 18:51:52 2013 +0200 @@ -76,7 +76,8 @@ </p><dl> <dt><i>project</i></dt> <dd> -reference to the project object (ProjectPyramid.Project.Project) +reference to the project object + (ProjectPyramid.Project.Project) </dd><dt><i>projectPath</i></dt> <dd> path of the Pyramid project (string)
--- a/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.Project.html Sat Sep 28 13:34:57 2013 +0200 +++ b/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.Project.html Fri Oct 25 18:51:52 2013 +0200 @@ -217,7 +217,8 @@ <h4>Project.__buildDistribution</h4> <b>__buildDistribution</b>(<i></i>) <p> - Private slot to build a distribution file for the current Pyramid project. + Private slot to build a distribution file for the current Pyramid + project. </p><a NAME="Project.__createProject" ID="Project.__createProject"></a> <h4>Project.__createProject</h4> <b>__createProject</b>(<i></i>) @@ -248,9 +249,9 @@ </dl><dl> <dt>Returns:</dt> <dd> -list of full executable names, if the executable file is accessible - via the searchpath defined by the PATH environment variable, or an - empty list otherwise. +list of full executable names, if the executable file is + accessible via the searchpath defined by the PATH environment + variable, or an empty list otherwise. </dd> </dl><a NAME="Project.__getInitDbCommand" ID="Project.__getInitDbCommand"></a> <h4>Project.__getInitDbCommand</h4> @@ -326,7 +327,8 @@ </dl><dl> <dt>Raises <b>PyramidNoProjectSelectedException</b>:</dt> <dd> -raised, if no project is selected +raised, if no project is + selected </dd> </dl><a NAME="Project.__projectFilteredList" ID="Project.__projectFilteredList"></a> <h4>Project.__projectFilteredList</h4> @@ -366,7 +368,8 @@ </dl><dl> <dt>Raises <b>PyramidNoProjectSelectedException</b>:</dt> <dd> -raised, if no project is selected +raised, if no project is + selected </dd> </dl><a NAME="Project.__pyramidInfo" ID="Project.__pyramidInfo"></a> <h4>Project.__pyramidInfo</h4> @@ -403,12 +406,7 @@ <b>__selectProject</b>(<i></i>) <p> Private method to select a Pyramid project to work with. -</p><dl> -<dt>Returns:</dt> -<dd> -selected project (string) -</dd> -</dl><a NAME="Project.__serverProcFinished" ID="Project.__serverProcFinished"></a> +</p><a NAME="Project.__serverProcFinished" ID="Project.__serverProcFinished"></a> <h4>Project.__serverProcFinished</h4> <b>__serverProcFinished</b>(<i></i>) <p> @@ -427,7 +425,8 @@ <h4>Project.__setupDevelop</h4> <b>__setupDevelop</b>(<i></i>) <p> - Private slot to set up the development environment for the current project. + Private slot to set up the development environment for the current + project. </p><a NAME="Project.__showDocumentation" ID="Project.__showDocumentation"></a> <h4>Project.__showDocumentation</h4> <b>__showDocumentation</b>(<i></i>)
--- a/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.PyramidDialog.html Sat Sep 28 13:34:57 2013 +0200 +++ b/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.PyramidDialog.html Fri Oct 25 18:51:52 2013 +0200 @@ -168,7 +168,8 @@ <h4>PyramidDialog.finish</h4> <b>finish</b>(<i></i>) <p> - Public slot called when the process finished or the user pressed the button. + Public slot called when the process finished or the user pressed the + button. </p><a NAME="PyramidDialog.keyPressEvent" ID="PyramidDialog.keyPressEvent"></a> <h4>PyramidDialog.keyPressEvent</h4> <b>keyPressEvent</b>(<i>evt</i>) @@ -247,7 +248,8 @@ </dl><dl> <dt>Returns:</dt> <dd> -flag indicating a successful start of the first process (boolean) +flag indicating a successful start of the first process + (boolean) </dd> </dl><a NAME="PyramidDialog.startProcess" ID="PyramidDialog.startProcess"></a> <h4>PyramidDialog.startProcess</h4>
--- a/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.PyramidRoutesDialog.html Sat Sep 28 13:34:57 2013 +0200 +++ b/ProjectPyramid/Documentation/source/Plugin_Project_Pyramid.ProjectPyramid.PyramidRoutesDialog.html Fri Oct 25 18:51:52 2013 +0200 @@ -106,7 +106,8 @@ </p><dl> <dt><i>project</i></dt> <dd> -reference to the project object (ProjectPyramid.Project.Project) +reference to the project object + (ProjectPyramid.Project.Project) </dd><dt><i>parent</i></dt> <dd> reference to the parent widget (QWidget) @@ -149,7 +150,8 @@ <h4>PyramidRoutesDialog.finish</h4> <b>finish</b>(<i></i>) <p> - Public slot called when the process finished or the user pressed the button. + Public slot called when the process finished or the user pressed the + button. </p><a NAME="PyramidRoutesDialog.keyPressEvent" ID="PyramidRoutesDialog.keyPressEvent"></a> <h4>PyramidRoutesDialog.keyPressEvent</h4> <b>keyPressEvent</b>(<i>evt</i>) @@ -196,10 +198,7 @@ <p> Public slot used to start the process. </p><dl> -<dt><i>command</i></dt> -<dd> -command to start (string) -</dd><dt><i>projectPath</i></dt> +<dt><i>projectPath</i></dt> <dd> path to the Pyramid project (string) </dd>
--- a/ProjectPyramid/FormSelectionDialog.py Sat Sep 28 13:34:57 2013 +0200 +++ b/ProjectPyramid/FormSelectionDialog.py Fri Oct 25 18:51:52 2013 +0200 @@ -27,7 +27,8 @@ 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 +39,9 @@ ''' <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,29 +53,40 @@ ''' <body>\n''' ''' </body>\n''' '''</html>\n''' - ], - "complex": [self.trUtf8("Chameleon template"), - '''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"\n''' + ], + "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''' + '''<html xmlns="http://www.w3.org/1999/xhtml"''' + ''' xml:lang="en"\n''' ''' xmlns:tal="http://xml.zope.org/namespaces/tal">\n''' - ''' xmlns:metal="http://xml.zope.org/namespaces/metal">\n''' + ''' xmlns:metal="http://xml.zope.org/namespaces/''' + '''metal">\n''' '''<head>\n''' - ''' <title>The Pyramid Web Application Development Framework</title>\n''' + ''' <title>The Pyramid Web Application Development''' + ''' Framework</title>\n''' ''' <meta http-equiv="Content-Type"\n''' ''' content="text/html;charset=UTF-8"/>\n''' - ''' <meta name="keywords" content="python web application" />\n''' - ''' <meta name="description" content="pyramid web application" />\n''' + ''' <meta name="keywords" content="python web application"''' + ''' />\n''' + ''' <meta name="description" content="pyramid web''' + ''' application" />\n''' ''' <link rel="shortcut icon"\n''' - ''' href="${request.static_url('site:static/favicon.ico')}" />\n''' + ''' href="${request.static_url('site:static/''' + '''favicon.ico')}" />\n''' ''' <link rel="stylesheet"\n''' - ''' href="${request.static_url('site:static/pylons.css')}"\n''' + ''' href="${request.static_url('site:static/''' + '''pylons.css')}"\n''' ''' type="text/css" media="screen" charset="utf-8" />\n''' ''' <link rel="stylesheet"\n''' - ''' href="http://static.pylonsproject.org/fonts/nobile/stylesheet.css"\n''' + ''' href="http://static.pylonsproject.org/fonts/nobile/''' + '''stylesheet.css"\n''' ''' media="screen" />\n''' ''' <link rel="stylesheet"\n''' - ''' href="http://static.pylonsproject.org/fonts/neuton/stylesheet.css"\n''' + ''' href="http://static.pylonsproject.org/fonts/neuton/''' + '''stylesheet.css"\n''' ''' media="screen" />\n''' ''' <!--[if lte IE 6]>\n''' ''' <link rel="stylesheet"\n''' @@ -91,12 +104,14 @@ ''' </div>\n''' ''' </div>\n''' ''' <div id="footer">\n''' - ''' <div class="footer">© Copyright 2012, Somebody.</div>\n''' + ''' <div class="footer">© Copyright 2012, Somebody.''' + '''</div>\n''' ''' </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''' @@ -121,10 +136,12 @@ '''<%def name="header()"><a name="top"></a></%def>\n''' '''<%def name="tabs()"></%def>\n''' '''<%def name="menu()"></%def>\n''' - '''<%def name="heading()"><h1>${c.heading or 'No Title'}</h1></%def>\n''' + '''<%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''' - ], + '''<%def name="footer()"><p><a href="#top">Top ^</a></p>''' + '''</%def>\n''' + ], } self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok)
--- a/ProjectPyramid/Project.py Sat Sep 28 13:34:57 2013 +0200 +++ b/ProjectPyramid/Project.py Fri Oct 25 18:51:52 2013 +0200 @@ -12,7 +12,8 @@ import re from PyQt4.QtCore import QObject, QFileInfo, QProcess, QTimer, QUrl -from PyQt4.QtGui import QMenu, QDialog, QInputDialog, QDesktopServices, QLineEdit +from PyQt4.QtGui import QMenu, QDialog, QInputDialog, QDesktopServices, \ + QLineEdit from E5Gui.E5Application import e5App from E5Gui import E5MessageBox, E5FileDialog @@ -62,10 +63,11 @@ """ self.actions = [] - self.selectProjectAct = E5Action(self.trUtf8('Current Pyramid Project'), - "", - 0, 0, - self, 'pyramid_current_project') + self.selectProjectAct = E5Action( + self.trUtf8('Current Pyramid Project'), + "", + 0, 0, + self, 'pyramid_current_project') self.selectProjectAct.setStatusTip(self.trUtf8( 'Selects the current Pyramid project')) self.selectProjectAct.setWhatsThis(self.trUtf8( @@ -80,10 +82,11 @@ ## create actions below ## ############################### - self.createProjectAct = E5Action(self.trUtf8('Create Pyramid Project'), - self.trUtf8('Create Pyramid &Project'), - 0, 0, - self, 'pyramid_create_project') + self.createProjectAct = E5Action( + self.trUtf8('Create Pyramid Project'), + self.trUtf8('Create Pyramid &Project'), + 0, 0, + self, 'pyramid_create_project') self.createProjectAct.setStatusTip(self.trUtf8( 'Creates a new Pyramid project')) self.createProjectAct.setWhatsThis(self.trUtf8( @@ -97,10 +100,11 @@ ## run actions below ## ############################## - self.runServerAct = E5Action(self.trUtf8('Run Server'), - self.trUtf8('Run &Server'), - 0, 0, - self, 'pyramid_run_server') + self.runServerAct = E5Action( + self.trUtf8('Run Server'), + self.trUtf8('Run &Server'), + 0, 0, + self, 'pyramid_run_server') self.runServerAct.setStatusTip(self.trUtf8( 'Starts the Pyramid Web server')) self.runServerAct.setWhatsThis(self.trUtf8( @@ -111,10 +115,11 @@ self.runServerAct.triggered[()].connect(self.__runServer) self.actions.append(self.runServerAct) - self.runLoggingServerAct = E5Action(self.trUtf8('Run Server with Logging'), - self.trUtf8('Run Server with &Logging'), - 0, 0, - self, 'pyramid_run_logging_server') + self.runLoggingServerAct = E5Action( + self.trUtf8('Run Server with Logging'), + self.trUtf8('Run Server with &Logging'), + 0, 0, + self, 'pyramid_run_logging_server') self.runLoggingServerAct.setStatusTip(self.trUtf8( 'Starts the Pyramid Web server with logging')) self.runLoggingServerAct.setWhatsThis(self.trUtf8( @@ -125,12 +130,14 @@ self.runLoggingServerAct.triggered[()].connect(self.__runLoggingServer) self.actions.append(self.runLoggingServerAct) - self.runBrowserAct = E5Action(self.trUtf8('Run Web-Browser'), - self.trUtf8('Run &Web-Browser'), - 0, 0, - self, 'pyramid_run_browser') + self.runBrowserAct = E5Action( + self.trUtf8('Run Web-Browser'), + self.trUtf8('Run &Web-Browser'), + 0, 0, + self, 'pyramid_run_browser') self.runBrowserAct.setStatusTip(self.trUtf8( - 'Starts the default Web-Browser with the URL of the Pyramid Web server')) + 'Starts the default Web-Browser with the URL of the Pyramid Web' + ' server')) self.runBrowserAct.setWhatsThis(self.trUtf8( """<b>Run Web-Browser</b>""" """<p>Starts the default Web-Browser with the URL of the """ @@ -139,10 +146,11 @@ self.runBrowserAct.triggered[()].connect(self.__runBrowser) self.actions.append(self.runBrowserAct) - self.runPythonShellAct = E5Action(self.trUtf8('Start Pyramid Python Console'), - self.trUtf8('Start Pyramid &Python Console'), - 0, 0, - self, 'pyramid_python_console') + self.runPythonShellAct = E5Action( + self.trUtf8('Start Pyramid Python Console'), + self.trUtf8('Start Pyramid &Python Console'), + 0, 0, + self, 'pyramid_python_console') self.runPythonShellAct.setStatusTip(self.trUtf8( 'Starts an interactive Python interpreter')) self.runPythonShellAct.setWhatsThis(self.trUtf8( @@ -156,10 +164,11 @@ ## setup actions below ## ############################## - self.setupDevelopAct = E5Action(self.trUtf8('Setup Development Environment'), - self.trUtf8('Setup &Development Environment'), - 0, 0, - self, 'pyramid_setup_development') + self.setupDevelopAct = E5Action( + self.trUtf8('Setup Development Environment'), + self.trUtf8('Setup &Development Environment'), + 0, 0, + self, 'pyramid_setup_development') self.setupDevelopAct.setStatusTip(self.trUtf8( 'Setup the Pyramid project in development mode')) self.setupDevelopAct.setWhatsThis(self.trUtf8( @@ -174,17 +183,18 @@ ## database actions below ## ############################### - self.initializeDbAct = E5Action(self.trUtf8('Initialize Database'), - self.trUtf8('Initialize &Database'), - 0, 0, - self, 'pyramid_initialize_database') + self.initializeDbAct = E5Action( + self.trUtf8('Initialize Database'), + self.trUtf8('Initialize &Database'), + 0, 0, + self, 'pyramid_initialize_database') self.initializeDbAct.setStatusTip(self.trUtf8( 'Initializes (or re-initializes) the database of the current' ' Pyramid project')) self.initializeDbAct.setWhatsThis(self.trUtf8( """<b>Initialize Database</b>""" - """<p>Initializes (or re-initializes) the database of the current""" - """ Pyramid project.</p>""" + """<p>Initializes (or re-initializes) the database of the""" + """ current Pyramid project.</p>""" )) self.initializeDbAct.triggered[()].connect(self.__initializeDatabase) self.actions.append(self.initializeDbAct) @@ -193,10 +203,11 @@ ## show actions below ## ############################### - self.showViewsAct = E5Action(self.trUtf8('Show Matching Views'), - self.trUtf8('Show Matching &Views'), - 0, 0, - self, 'pyramid_show_views') + self.showViewsAct = E5Action( + self.trUtf8('Show Matching Views'), + self.trUtf8('Show Matching &Views'), + 0, 0, + self, 'pyramid_show_views') self.showViewsAct.setStatusTip(self.trUtf8( 'Show views matching a given URL')) self.showViewsAct.setWhatsThis(self.trUtf8( @@ -206,10 +217,11 @@ self.showViewsAct.triggered[()].connect(self.__showMatchingViews) self.actions.append(self.showViewsAct) - self.showRoutesAct = E5Action(self.trUtf8('Show Routes'), - self.trUtf8('Show &Routes'), - 0, 0, - self, 'pyramid_show_routes') + self.showRoutesAct = E5Action( + self.trUtf8('Show Routes'), + self.trUtf8('Show &Routes'), + 0, 0, + self, 'pyramid_show_routes') self.showRoutesAct.setStatusTip(self.trUtf8( 'Show all URL dispatch routes used by a Pyramid application')) self.showRoutesAct.setWhatsThis(self.trUtf8( @@ -220,12 +232,14 @@ self.showRoutesAct.triggered[()].connect(self.__showRoutes) self.actions.append(self.showRoutesAct) - self.showTweensAct = E5Action(self.trUtf8('Show Tween Objects'), - self.trUtf8('Show &Tween Objects'), - 0, 0, - self, 'pyramid_show_routes') + self.showTweensAct = E5Action( + self.trUtf8('Show Tween Objects'), + self.trUtf8('Show &Tween Objects'), + 0, 0, + self, 'pyramid_show_routes') self.showTweensAct.setStatusTip(self.trUtf8( - 'Show all implicit and explicit tween objects used by a Pyramid application')) + 'Show all implicit and explicit tween objects used by a Pyramid' + ' application')) self.showTweensAct.setWhatsThis(self.trUtf8( """<b>Show Tween Objects</b>""" """<p>Show all implicit and explicit tween objects used by a""" @@ -238,10 +252,11 @@ ## distribution actions below ## ################################## - self.buildDistroAct = E5Action(self.trUtf8('Build Distribution'), - self.trUtf8('Build &Distribution'), - 0, 0, - self, 'pyramid_build_distribution') + self.buildDistroAct = E5Action( + self.trUtf8('Build Distribution'), + self.trUtf8('Build &Distribution'), + 0, 0, + self, 'pyramid_build_distribution') self.buildDistroAct.setStatusTip(self.trUtf8( 'Builds a distribution file for the Pyramid project')) self.buildDistroAct.setWhatsThis(self.trUtf8( @@ -256,10 +271,11 @@ ## documentation action below ## ################################## - self.documentationAct = E5Action(self.trUtf8('Documentation'), - self.trUtf8('D&ocumentation'), - 0, 0, - self, 'pyramid_documentation') + self.documentationAct = E5Action( + self.trUtf8('Documentation'), + self.trUtf8('D&ocumentation'), + 0, 0, + self, 'pyramid_documentation') self.documentationAct.setStatusTip(self.trUtf8( 'Shows the help viewer with the Pyramid documentation')) self.documentationAct.setWhatsThis(self.trUtf8( @@ -273,10 +289,11 @@ ## about action below ## ############################## - self.aboutPyramidAct = E5Action(self.trUtf8('About Pyramid'), - self.trUtf8('About P&yramid'), - 0, 0, - self, 'pyramid_about') + self.aboutPyramidAct = E5Action( + self.trUtf8('About Pyramid'), + self.trUtf8('About P&yramid'), + 0, 0, + self, 'pyramid_about') self.aboutPyramidAct.setStatusTip(self.trUtf8( 'Shows some information about Pyramid')) self.aboutPyramidAct.setWhatsThis(self.trUtf8( @@ -333,9 +350,10 @@ editor = self.__plugin.getPreferences("TranslationsEditor") try: if editor: - self.__translationsBrowser.addHookMethodAndMenuEntry("open", - self.openPOEditor, - self.trUtf8("Open with {0}").format(os.path.basename(editor))) + self.__translationsBrowser.addHookMethodAndMenuEntry( + "open", self.openPOEditor, + self.trUtf8("Open with {0}").format( + os.path.basename(editor))) else: self.__translationsBrowser.removeHookMethod("open") except KeyError: @@ -349,26 +367,31 @@ if self.__e5project.getProjectType() == "Pyramid": self.__formsBrowser = \ e5App().getObject("ProjectBrowser").getProjectBrowser("forms") - self.__formsBrowser.addHookMethodAndMenuEntry("newForm", - self.newForm, self.trUtf8("New template...")) + self.__formsBrowser.addHookMethodAndMenuEntry( + "newForm", self.newForm, self.trUtf8("New template...")) if self.__e5project.getProjectLanguage() == "Python2": # Babel and lingua are not yet available for Python 3 self.__e5project.projectLanguageAddedByCode.connect( self.__projectLanguageAdded) self.__translationsBrowser = \ - e5App().getObject("ProjectBrowser").getProjectBrowser("translations") - self.__translationsBrowser.addHookMethodAndMenuEntry("extractMessages", - self.extractMessages, self.trUtf8("Extract Messages")) - self.__translationsBrowser.addHookMethodAndMenuEntry("releaseAll", - self.compileCatalogs, self.trUtf8("Compile All Catalogs")) - self.__translationsBrowser.addHookMethodAndMenuEntry("releaseSelected", - self.compileSelectedCatalogs, + e5App().getObject("ProjectBrowser")\ + .getProjectBrowser("translations") + self.__translationsBrowser.addHookMethodAndMenuEntry( + "extractMessages", self.extractMessages, + self.trUtf8("Extract Messages")) + self.__translationsBrowser.addHookMethodAndMenuEntry( + "releaseAll", self.compileCatalogs, + self.trUtf8("Compile All Catalogs")) + self.__translationsBrowser.addHookMethodAndMenuEntry( + "releaseSelected", self.compileSelectedCatalogs, self.trUtf8("Compile Selected Catalogs")) - self.__translationsBrowser.addHookMethodAndMenuEntry("generateAll", - self.updateCatalogs, self.trUtf8("Update All Catalogs")) - self.__translationsBrowser.addHookMethodAndMenuEntry("generateSelected", - self.updateSelectedCatalogs, self.trUtf8("Update Selected Catalogs")) + self.__translationsBrowser.addHookMethodAndMenuEntry( + "generateAll", self.updateCatalogs, + self.trUtf8("Update All Catalogs")) + self.__translationsBrowser.addHookMethodAndMenuEntry( + "generateSelected", self.updateSelectedCatalogs, + self.trUtf8("Update Selected Catalogs")) self.__hooksInstalled = True @@ -433,9 +456,11 @@ fname += ex if os.path.exists(fname): - res = E5MessageBox.yesNo(self.__ui, + res = E5MessageBox.yesNo( + self.__ui, self.trUtf8("New Form"), - self.trUtf8("""The file already exists! Overwrite it?"""), + self.trUtf8("""The file already exists! Overwrite""" + """ it?"""), icon=E5MessageBox.Warning) if not res: # user selected to not overwrite @@ -446,11 +471,12 @@ f.write(template) f.close() except IOError as e: - E5MessageBox.critical(self, + E5MessageBox.critical( + self.__ui, self.trUtf8("New Form"), - self.trUtf8("<p>The new form file <b>{0}</b> could not be" - " created.<br/>" - "Problem: {1}</p>").format(fname, e)) + self.trUtf8("<p>The new form file <b>{0}</b> could" + " not be created.<br/> Problem: {1}</p>") + .format(fname, e)) return self.__e5project.appendFile(fname) @@ -474,9 +500,9 @@ the environment. @param file filename of the executable (string) - @return list of full executable names, if the executable file is accessible - via the searchpath defined by the PATH environment variable, or an - empty list otherwise. + @return list of full executable names, if the executable file is + accessible via the searchpath defined by the PATH environment + variable, or an empty list otherwise. """ paths = [] @@ -532,9 +558,9 @@ l0 = "" if variant.lower() in l0.lower() or \ "{0}.".format(variant[-1]) in l0 or \ - (variant == "Python2" and \ - "python3" not in l0.lower() and \ - "python" in l0.lower()): + (variant == "Python2" and + "python3" not in l0.lower() and + "python" in l0.lower()): variants.append(variant) break @@ -618,11 +644,13 @@ version = self.getPyramidVersion() url = "http://www.pylonsproject.org/projects/pyramid/about" - msgBox = E5MessageBox.E5MessageBox(E5MessageBox.Question, + msgBox = E5MessageBox.E5MessageBox( + E5MessageBox.Question, self.trUtf8("About Pyramid"), self.trUtf8( - "<p>Pyramid is a high-level Python Web framework that encourages rapid " - "development and clean, pragmatic design.</p>" + "<p>Pyramid is a high-level Python Web framework that" + " encourages rapid development and clean, pragmatic" + " design.</p>" "<p><table>" "<tr><td>Version:</td><td>{0}</td></tr>" "<tr><td>URL:</td><td><a href=\"{1}\">" @@ -696,19 +724,22 @@ args.append("--scaffold={0}".format(scaffold)) args.append(project) dlg = PyramidDialog(self.trUtf8("Create Pyramid Project"), - linewrap=False, parent=self.__ui) + linewrap=False, parent=self.__ui) if dlg.startProcess(cmd, args, self.__e5project.getProjectPath()): dlg.exec_() if dlg.normalExit() and not simulate: - # search for files created by pcreate and add them to the project - projectPath = os.path.join(self.__e5project.getProjectPath(), project) + # search for files created by pcreate and add them to the + # project + projectPath = os.path.join( + self.__e5project.getProjectPath(), project) for entry in os.walk(projectPath): for fileName in entry[2]: fullName = os.path.join(entry[0], fileName) self.__e5project.appendFile(fullName) # create the base directory for translations - i18nPath = os.path.join(projectPath, project.lower(), "i18n") + i18nPath = os.path.join( + projectPath, project.lower(), "i18n") if not os.path.exists(i18nPath): os.makedirs(i18nPath) self.__e5project.setDirty(True) @@ -737,8 +768,6 @@ def __selectProject(self): """ Private method to select a Pyramid project to work with. - - @return selected project (string) """ projects = self.__findProjects() if len(projects) == 0: @@ -767,7 +796,8 @@ """ Private method to calculate the full path of the Pyramid project. - @exception PyramidNoProjectSelectedException raised, if no project is selected + @exception PyramidNoProjectSelectedException raised, if no project is + selected @return path of the project (string) """ if self.__currentProject is None: @@ -806,7 +836,7 @@ domain = config.get("init_catalog", "domain") self.__e5project.pdata["TRANSLATIONPATTERN"] = [ os.path.join(project, outputDir, "%language%", - "LC_MESSAGES", "{0}.po".format(domain)) + "LC_MESSAGES", "{0}.po".format(domain)) ] if self.__currentProject is None: @@ -819,7 +849,8 @@ """ Private method to get the name of the current Pyramid project. - @exception PyramidNoProjectSelectedException raised, if no project is selected + @exception PyramidNoProjectSelectedException raised, if no project is + selected @return name of the project (string) """ if self.__currentProject is None: @@ -846,10 +877,11 @@ try: projectPath = self.__projectPath() except PyramidNoProjectSelectedException: - E5MessageBox.warning(self.__ui, + E5MessageBox.warning( + self.__ui, self.trUtf8('Run Server'), - self.trUtf8('No current Pyramid project selected or no Pyramid ' - 'project created yet. Aborting...')) + self.trUtf8('No current Pyramid project selected or no' + ' Pyramid project created yet. Aborting...')) return args = Utilities.parseOptionString(consoleCmd) @@ -873,7 +905,8 @@ self.__serverProc.start(args[0], args[1:]) serverProcStarted = self.__serverProc.waitForStarted() if not serverProcStarted: - E5MessageBox.critical(self.__ui, + E5MessageBox.critical( + self.__ui, self.trUtf8('Process Generation Error'), self.trUtf8('The Pyramid server could not be started.')) @@ -901,10 +934,11 @@ try: projectPath = self.__projectPath() except PyramidNoProjectSelectedException: - E5MessageBox.warning(self.__ui, + E5MessageBox.warning( + self.__ui, self.trUtf8('Run Web-Browser'), - self.trUtf8('No current Pyramid project selected or no Pyramid project' - ' created yet. Aborting...')) + self.trUtf8('No current Pyramid project selected or no Pyramid' + ' project created yet. Aborting...')) return config = configparser.ConfigParser() @@ -913,10 +947,11 @@ url = QUrl("http://localhost:{0}".format(port)) res = QDesktopServices.openUrl(url) if not res: - E5MessageBox.critical(self.__ui, + E5MessageBox.critical( + self.__ui, self.trUtf8('Run Web-Browser'), - self.trUtf8('Could not start the web-browser for the URL "{0}".')\ - .format(url.toString())) + self.trUtf8('Could not start the web-browser for the URL' + ' "{0}".').format(url.toString())) def __runPythonShell(self): """ @@ -928,10 +963,11 @@ try: projectPath = self.__projectPath() except PyramidNoProjectSelectedException: - E5MessageBox.warning(self.__ui, + E5MessageBox.warning( + self.__ui, self.trUtf8('Start Pyramid Python Console'), - self.trUtf8('No current Pyramid project selected or no Pyramid ' - 'project created yet. Aborting...')) + self.trUtf8('No current Pyramid project selected or no' + ' Pyramid project created yet. Aborting...')) return args = Utilities.parseOptionString(consoleCmd) @@ -939,17 +975,22 @@ args.append(self.getPyramidCommand("pshell")) language = self.__e5project.getProjectLanguage() if language == "Python2": - consoleType = self.__plugin.getPreferences("Python2ConsoleType") + consoleType = self.__plugin.getPreferences( + "Python2ConsoleType") else: - consoleType = self.__plugin.getPreferences("Python3ConsoleType") + consoleType = self.__plugin.getPreferences( + "Python3ConsoleType") args.append("--python-shell={0}".format(consoleType)) args.append(os.path.join(projectPath, "development.ini")) - started, pid = QProcess.startDetached(args[0], args[1:], projectPath) + started, pid = QProcess.startDetached( + args[0], args[1:], projectPath) if not started: - E5MessageBox.critical(self.__ui, + E5MessageBox.critical( + self.__ui, self.trUtf8('Process Generation Error'), - self.trUtf8('The Pyramid Shell process could not be started.')) + self.trUtf8('The Pyramid Shell process could not be' + ' started.')) ################################################################## ## slots below implement setup functions @@ -957,16 +998,18 @@ def __setupDevelop(self): """ - Private slot to set up the development environment for the current project. + Private slot to set up the development environment for the current + project. """ title = self.trUtf8("Setup Development Environment") try: wd = self.__projectPath() except PyramidNoProjectSelectedException: - E5MessageBox.warning(self.__ui, + E5MessageBox.warning( + self.__ui, title, - self.trUtf8('No current Pyramid project selected or no Pyramid project' - ' created yet. Aborting...')) + self.trUtf8('No current Pyramid project selected or no Pyramid' + ' project created yet. Aborting...')) return cmd = self.getPythonCommand() @@ -974,8 +1017,10 @@ 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_() @@ -986,19 +1031,22 @@ def __buildDistribution(self): """ - Private slot to build a distribution file for the current Pyramid project. + Private slot to build a distribution file for the current Pyramid + project. """ title = self.trUtf8("Build Distribution File") try: projectPath = self.__projectPath() except PyramidNoProjectSelectedException: - E5MessageBox.warning(self.__ui, + E5MessageBox.warning( + self.__ui, title, - self.trUtf8('No current Pyramid project selected or no Pyramid project' - ' created yet. Aborting...')) + self.trUtf8('No current Pyramid project selected or no Pyramid' + ' project created yet. Aborting...')) return - from .DistributionTypeSelectionDialog import DistributionTypeSelectionDialog + from .DistributionTypeSelectionDialog import \ + DistributionTypeSelectionDialog dlg = DistributionTypeSelectionDialog(self, projectPath, self.__ui) if dlg.exec_() == QDialog.Accepted: @@ -1010,8 +1058,10 @@ 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_() @@ -1030,10 +1080,11 @@ cmd = "initialize_{0}_db".format(self.__project()) return self.getPyramidCommand(cmd) except PyramidNoProjectSelectedException: - E5MessageBox.warning(self.__ui, + E5MessageBox.warning( + self.__ui, self.trUtf8("Initialize Database"), - self.trUtf8('No current Pyramid project selected or no Pyramid project' - ' created yet. Aborting...')) + self.trUtf8('No current Pyramid project selected or no Pyramid' + ' project created yet. Aborting...')) return "" def __initializeDatabase(self): @@ -1044,17 +1095,19 @@ try: projectPath = self.__projectPath() except PyramidNoProjectSelectedException: - E5MessageBox.warning(self.__ui, + E5MessageBox.warning( + self.__ui, title, - self.trUtf8('No current Pyramid project selected or no Pyramid project' - ' created yet. Aborting...')) + self.trUtf8('No current Pyramid project selected or no Pyramid' + ' project created yet. Aborting...')) return cmd = self.__getInitDbCommand() args = [] args.append("development.ini") - dia = PyramidDialog(title, + dia = PyramidDialog( + title, msgSuccess=self.trUtf8("Database initialized successfully.")) res = dia.startProcess(cmd, args, projectPath) if res: @@ -1072,10 +1125,11 @@ try: projectPath = self.__projectPath() except PyramidNoProjectSelectedException: - E5MessageBox.warning(self.__ui, + E5MessageBox.warning( + self.__ui, title, - self.trUtf8('No current Pyramid project selected or no Pyramid project' - ' created yet. Aborting...')) + self.trUtf8('No current Pyramid project selected or no Pyramid' + ' project created yet. Aborting...')) return url, ok = QInputDialog.getText( @@ -1105,10 +1159,11 @@ try: projectPath = self.__projectPath() except PyramidNoProjectSelectedException: - E5MessageBox.warning(self.__ui, + E5MessageBox.warning( + self.__ui, title, - self.trUtf8('No current Pyramid project selected or no Pyramid project' - ' created yet. Aborting...')) + self.trUtf8('No current Pyramid project selected or no Pyramid' + ' project created yet. Aborting...')) return from .PyramidRoutesDialog import PyramidRoutesDialog @@ -1126,10 +1181,11 @@ try: projectPath = self.__projectPath() except PyramidNoProjectSelectedException: - E5MessageBox.warning(self.__ui, + E5MessageBox.warning( + self.__ui, title, - self.trUtf8('No current Pyramid project selected or no Pyramid project' - ' created yet. Aborting...')) + self.trUtf8('No current Pyramid project selected or no Pyramid' + ' project created yet. Aborting...')) return cmd = self.getPyramidCommand("ptweens") @@ -1216,10 +1272,11 @@ try: projectPath = self.__projectPath() except PyramidNoProjectSelectedException: - E5MessageBox.warning(self.__ui, + E5MessageBox.warning( + self.__ui, title, - self.trUtf8('No current Pyramid project selected or no Pyramid project' - ' created yet. Aborting...')) + self.trUtf8('No current Pyramid project selected or no Pyramid' + ' project created yet. Aborting...')) return cmd = self.getPythonCommand() @@ -1227,7 +1284,8 @@ args.append("setup.py") args.append("extract_messages") - dia = PyramidDialog(title, + dia = PyramidDialog( + title, msgSuccess=self.trUtf8("\nMessages extracted successfully.")) res = dia.startProcess(cmd, args, projectPath) if res: @@ -1242,14 +1300,17 @@ try: lowerProject = self.__project().lower() except PyramidNoProjectSelectedException: - E5MessageBox.warning(self.__ui, + E5MessageBox.warning( + self.__ui, title, - self.trUtf8('No current Pyramid project selected or no Pyramid' - ' project created yet. Aborting...')) + self.trUtf8('No current Pyramid project selected or no' + ' Pyramid project created yet.' + ' Aborting...')) return self.__e5project.appendFile(os.path.join( - projectPath, lowerProject, "locale", "%s.pot" % lowerProject)) + projectPath, lowerProject, "locale", + "{0}.pot".format(lowerProject))) def __projectLanguageAdded(self, code): """ @@ -1257,14 +1318,16 @@ @param code language code of the new language (string) """ - title = self.trUtf8("Initializing message catalog for '{0}'").format(code) + title = self.trUtf8("Initializing message catalog for '{0}'")\ + .format(code) try: projectPath = self.__projectPath() except PyramidNoProjectSelectedException: - E5MessageBox.warning(self.__ui, + E5MessageBox.warning( + self.__ui, title, - self.trUtf8('No current Pyramid project selected or no Pyramid project' - ' created yet. Aborting...')) + self.trUtf8('No current Pyramid project selected or no Pyramid' + ' project created yet. Aborting...')) return cmd = self.getPythonCommand() @@ -1274,8 +1337,10 @@ 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_() @@ -1294,10 +1359,11 @@ try: projectPath = self.__projectPath() except PyramidNoProjectSelectedException: - E5MessageBox.warning(self.__ui, + E5MessageBox.warning( + self.__ui, title, - self.trUtf8('No current Pyramid project selected or no Pyramid project' - ' created yet. Aborting...')) + self.trUtf8('No current Pyramid project selected or no Pyramid' + ' project created yet. Aborting...')) return cmd = self.getPythonCommand() @@ -1305,8 +1371,10 @@ 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_() @@ -1327,15 +1395,17 @@ try: projectPath = self.__projectPath() except PyramidNoProjectSelectedException: - E5MessageBox.warning(self.__ui, + E5MessageBox.warning( + self.__ui, title, - self.trUtf8('No current Pyramid project selected or no Pyramid project' - ' created yet. Aborting...')) + self.trUtf8('No current Pyramid project selected or no Pyramid' + ' project created yet. Aborting...')) return argsLists = [] - for filename in self.__normalizeList(self.__projectFilteredList(filenames)): + for filename in self.__normalizeList( + self.__projectFilteredList(filenames)): locale = self.__getLocale(filename) if locale: args = [] @@ -1347,13 +1417,16 @@ argsLists.append(args) if len(argsLists) == 0: - E5MessageBox.warning(self.__ui, + E5MessageBox.warning( + self.__ui, title, 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_() @@ -1374,10 +1447,11 @@ try: projectPath = self.__projectPath() except PyramidNoProjectSelectedException: - E5MessageBox.warning(self.__ui, + E5MessageBox.warning( + self.__ui, title, - self.trUtf8('No current Pyramid project selected or no Pyramid project' - ' created yet. Aborting...')) + self.trUtf8('No current Pyramid project selected or no Pyramid' + ' project created yet. Aborting...')) return cmd = self.getPythonCommand() @@ -1385,7 +1459,8 @@ args.append("setup.py") args.append("update_catalog") - dia = PyramidDialog(title, + dia = PyramidDialog( + title, msgSuccess=self.trUtf8("\nMessage catalogs updated successfully.")) res = dia.startProcess(cmd, args, projectPath) if res: @@ -1401,15 +1476,17 @@ try: projectPath = self.__projectPath() except PyramidNoProjectSelectedException: - E5MessageBox.warning(self.__ui, + E5MessageBox.warning( + self.__ui, title, - self.trUtf8('No current Pyramid project selected or no Pyramid project' - ' created yet. Aborting...')) + self.trUtf8('No current Pyramid project selected or no Pyramid' + ' project created yet. Aborting...')) return argsLists = [] - for filename in self.__normalizeList(self.__projectFilteredList(filenames)): + for filename in self.__normalizeList( + self.__projectFilteredList(filenames)): locale = self.__getLocale(filename) if locale: args = [] @@ -1421,12 +1498,14 @@ argsLists.append(args) if len(argsLists) == 0: - E5MessageBox.warning(self.__ui, + E5MessageBox.warning( + self.__ui, title, self.trUtf8('No locales detected. Aborting...')) return - dia = PyramidDialog(title, + dia = PyramidDialog( + title, msgSuccess=self.trUtf8("\nMessage catalogs updated successfully.")) res = dia.startBatchProcesses(argsLists, projectPath) if res: @@ -1446,7 +1525,9 @@ wd = "" started, pid = QProcess.startDetached(editor, [poFile], wd) if not started: - E5MessageBox.critical(None, + E5MessageBox.critical( + None, self.trUtf8('Process Generation Error'), - self.trUtf8('The translations editor process ({0}) could not' - ' be started.').format(os.path.basename(editor))) + self.trUtf8('The translations editor process ({0}) could' + ' not be started.').format( + os.path.basename(editor)))
--- a/ProjectPyramid/PyramidDialog.py Sat Sep 28 13:34:57 2013 +0200 +++ b/ProjectPyramid/PyramidDialog.py Fri Oct 25 18:51:52 2013 +0200 @@ -73,7 +73,8 @@ def finish(self): """ - Public slot called when the process finished or the user pressed the button. + Public slot called when the process finished or the user pressed the + button. """ if self.proc is not None and \ self.proc.state() != QProcess.NotRunning: @@ -89,7 +90,8 @@ self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Close).setFocus(Qt.OtherFocusReason) + self.buttonBox.button(QDialogButtonBox.Close).setFocus( + Qt.OtherFocusReason) if self.argsLists: args = self.argsLists[0][:] @@ -140,7 +142,8 @@ self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setFocus(Qt.OtherFocusReason) + self.buttonBox.button(QDialogButtonBox.Cancel).setFocus( + Qt.OtherFocusReason) if showArgs: self.resultbox.append(command + ' ' + ' '.join(args)) @@ -159,7 +162,8 @@ if not procStarted: self.buttonBox.setFocus() self.inputGroup.setEnabled(False) - E5MessageBox.critical(self, + E5MessageBox.critical( + self, self.trUtf8('Process Generation Error'), self.trUtf8( 'The process {0} could not be started. ' @@ -177,7 +181,8 @@ @param argsLists list of lists of arguments for the processes (list of list of string) @param workingDir working directory for the process (string) - @return flag indicating a successful start of the first process (boolean) + @return flag indicating a successful start of the first process + (boolean) """ self.argsLists = argsLists[:] self.workingDir = workingDir @@ -217,8 +222,8 @@ """ if self.proc is not None: out = str(self.proc.readAllStandardOutput(), - Preferences.getSystem("IOEncoding"), - 'replace') + Preferences.getSystem("IOEncoding"), + 'replace') self.resultbox.insertPlainText(out) self.resultbox.ensureCursorVisible() @@ -233,8 +238,8 @@ """ if self.proc is not None: err = str(self.proc.readAllStandardError(), - Preferences.getSystem("IOEncoding"), - 'replace') + Preferences.getSystem("IOEncoding"), + 'replace') self.errorGroup.show() self.errors.insertPlainText(err) self.errors.ensureCursorVisible()
--- a/ProjectPyramid/PyramidRoutesDialog.py Sat Sep 28 13:34:57 2013 +0200 +++ b/ProjectPyramid/PyramidRoutesDialog.py Fri Oct 25 18:51:52 2013 +0200 @@ -27,7 +27,8 @@ """ Constructor - @param project reference to the project object (ProjectPyramid.Project.Project) + @param project reference to the project object + (ProjectPyramid.Project.Project) @param parent reference to the parent widget (QWidget) """ super().__init__(parent) @@ -45,7 +46,8 @@ def finish(self): """ - Public slot called when the process finished or the user pressed the button. + Public slot called when the process finished or the user pressed the + button. """ if self.proc is not None and \ self.proc.state() != QProcess.NotRunning: @@ -63,7 +65,8 @@ self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Close).setFocus(Qt.OtherFocusReason) + self.buttonBox.button(QDialogButtonBox.Close).setFocus( + Qt.OtherFocusReason) def on_buttonBox_clicked(self, button): """ @@ -122,7 +125,6 @@ """ Public slot used to start the process. - @param command command to start (string) @param projectPath path to the Pyramid project (string) @return flag indicating a successful start of the process """ @@ -136,7 +138,8 @@ self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) - self.buttonBox.button(QDialogButtonBox.Cancel).setFocus(Qt.OtherFocusReason) + self.buttonBox.button(QDialogButtonBox.Cancel).setFocus( + Qt.OtherFocusReason) self.proc = QProcess() @@ -155,7 +158,8 @@ if not procStarted: self.buttonBox.setFocus() self.inputGroup.setEnabled(False) - E5MessageBox.critical(self, + E5MessageBox.critical( + self, self.trUtf8('Process Generation Error'), self.trUtf8( 'The process {0} could not be started. ' @@ -175,8 +179,8 @@ """ if self.proc is not None: out = str(self.proc.readAllStandardOutput(), - Preferences.getSystem("IOEncoding"), - 'replace') + Preferences.getSystem("IOEncoding"), + 'replace') self.buffer += out def __readStderr(self): @@ -188,8 +192,8 @@ """ if self.proc is not None: err = str(self.proc.readAllStandardError(), - Preferences.getSystem("IOEncoding"), - 'replace') + Preferences.getSystem("IOEncoding"), + 'replace') self.errorGroup.show() self.errors.insertPlainText(err) self.errors.ensureCursorVisible()