Tue, 08 Oct 2013 19:47:37 +0200
Continued to shorten the code lines to max. 79 characters.
--- a/Project/AddDirectoryDialog.py Tue Oct 08 19:46:25 2013 +0200 +++ b/Project/AddDirectoryDialog.py Tue Oct 08 19:47:37 2013 +0200 @@ -44,24 +44,35 @@ self.ppath = pro.ppath self.targetDirEdit.setText(self.ppath) self.startdir = startdir - self.on_filterComboBox_highlighted('(*.py)') # enable all dialog elements + self.on_filterComboBox_highlighted('(*.py)') + # enable all dialog elements if filter == 'source': # it is a source file - self.filterComboBox.addItem(self.trUtf8("Source Files"), "SOURCES") + self.filterComboBox.addItem( + self.trUtf8("Source Files"), "SOURCES") elif filter == 'form': - self.filterComboBox.addItem(self.trUtf8("Forms Files"), "FORMS") + self.filterComboBox.addItem( + self.trUtf8("Forms Files"), "FORMS") elif filter == 'resource': - self.filterComboBox.addItem(self.trUtf8("Resource Files"), "RESOURCES") + self.filterComboBox.addItem( + self.trUtf8("Resource Files"), "RESOURCES") elif filter == 'interface': - self.filterComboBox.addItem(self.trUtf8("Interface Files"), "INTERFACES") + self.filterComboBox.addItem( + self.trUtf8("Interface Files"), "INTERFACES") elif filter == 'others': - self.filterComboBox.addItem(self.trUtf8("Other Files (*)"), "OTHERS") + self.filterComboBox.addItem( + self.trUtf8("Other Files (*)"), "OTHERS") self.on_filterComboBox_highlighted('(*)') else: - self.filterComboBox.addItem(self.trUtf8("Source Files"), "SOURCES") - self.filterComboBox.addItem(self.trUtf8("Forms Files"), "FORMS") - self.filterComboBox.addItem(self.trUtf8("Resource Files"), "RESOURCES") - self.filterComboBox.addItem(self.trUtf8("Interface Files"), "INTERFACES") - self.filterComboBox.addItem(self.trUtf8("Other Files (*)"), "OTHERS") + self.filterComboBox.addItem( + self.trUtf8("Source Files"), "SOURCES") + self.filterComboBox.addItem( + self.trUtf8("Forms Files"), "FORMS") + self.filterComboBox.addItem( + self.trUtf8("Resource Files"), "RESOURCES") + self.filterComboBox.addItem( + self.trUtf8("Interface Files"), "INTERFACES") + self.filterComboBox.addItem( + self.trUtf8("Other Files (*)"), "OTHERS") self.filterComboBox.setCurrentIndex(0) @pyqtSlot(str) @@ -87,7 +98,7 @@ Private slot to display a directory selection dialog. @param textEdit field for the display of the selected directory name - (QLineEdit) + (QLineEdit) """ startdir = textEdit.text() if not startdir and self.startdir is not None:
--- a/Project/AddFileDialog.py Tue Oct 08 19:46:25 2013 +0200 +++ b/Project/AddFileDialog.py Tue Oct 08 19:47:37 2013 +0200 @@ -46,7 +46,8 @@ self.filter = filter self.ppath = pro.ppath self.startdir = startdir - self.filetypes = pro.pdata["FILETYPES"] # save a reference to the filetypes dict + self.filetypes = pro.pdata["FILETYPES"] + # save a reference to the filetypes dict if self.filter is not None: self.sourcecodeCheckBox.hide() @@ -178,9 +179,9 @@ """ Public slot to retrieve the dialogs data. - @return tuple of three values (list of string, string, boolean) giving the - source files, the target directory and a flag telling, whether - the files shall be added as source code + @return tuple of three values (list of string, string, boolean) + giving the source files, the target directory and a flag + telling, whether the files shall be added as source code """ return ( [Utilities.toNativeSeparators(f) for f in
--- a/Project/AddFoundFilesDialog.py Tue Oct 08 19:46:25 2013 +0200 +++ b/Project/AddFoundFilesDialog.py Tue Oct 08 19:47:37 2013 +0200 @@ -25,7 +25,8 @@ """ Constructor - @param files list of files, that have been found for addition (list of strings) + @param files list of files, that have been found for addition + (list of strings) @param parent parent widget of this dialog (QWidget) @param name name of this dialog (string) """ @@ -39,7 +40,8 @@ self.addAllButton.setToolTip(self.trUtf8("Add all files.")) self.addSelectedButton = self.buttonBox.addButton( self.trUtf8("Add Selected"), QDialogButtonBox.AcceptRole) - self.addSelectedButton.setToolTip(self.trUtf8("Add selected files only.")) + self.addSelectedButton.setToolTip( + self.trUtf8("Add selected files only.")) self.fileList.addItems(files)
--- a/Project/CreateDialogCodeDialog.py Tue Oct 08 19:46:25 2013 +0200 +++ b/Project/CreateDialogCodeDialog.py Tue Oct 08 19:47:37 2013 +0200 @@ -9,10 +9,10 @@ import os -from PyQt4.QtCore import QMetaObject, QByteArray, QRegExp, Qt, pyqtSlot, QMetaMethod, \ - qVersion -from PyQt4.QtGui import QWidget, QSortFilterProxyModel, QStandardItemModel, QDialog, \ - QBrush, QStandardItem, QDialogButtonBox, QAction +from PyQt4.QtCore import QMetaObject, QByteArray, QRegExp, Qt, pyqtSlot, \ + QMetaMethod, qVersion +from PyQt4.QtGui import QWidget, QSortFilterProxyModel, QStandardItemModel, \ + QDialog, QBrush, QStandardItem, QDialogButtonBox, QAction from PyQt4 import uic from E5Gui.E5Application import e5App @@ -31,9 +31,11 @@ """ Class implementing a dialog to generate code for a Qt4/Qt5 dialog. """ - DialogClasses = {"QDialog", "QWidget", "QMainWindow", "QWizard", "QWizardPage", + DialogClasses = { + "QDialog", "QWidget", "QMainWindow", "QWizard", "QWizardPage", "QDockWidget", "QFrame", "QGroupBox", "QScrollArea", "QMdiArea", - "QTabWidget", "QToolBox", "QStackedWidget"} + "QTabWidget", "QToolBox", "QStackedWidget" + } Separator = 25 * "=" def __init__(self, formName, project, parent=None): @@ -55,7 +57,8 @@ self.formFile = formName filename, ext = os.path.splitext(self.formFile) - self.srcFile = '{0}{1}'.format(filename, self.project.getDefaultSourceExtension()) + self.srcFile = '{0}{1}'.format( + filename, self.project.getDefaultSourceExtension()) self.slotsModel = QStandardItemModel() self.proxyModel = QSortFilterProxyModel() @@ -81,8 +84,8 @@ else: exts = None from Utilities import ModuleParser - self.__module = ModuleParser.readModule(self.srcFile, extensions=exts, - caching=False) + self.__module = ModuleParser.readModule( + self.srcFile, extensions=exts, caching=False) except ImportError: pass @@ -92,7 +95,8 @@ classesList = [] vagueClassesList = [] for cls in list(self.__module.classes.values()): - if not set(cls.super).isdisjoint(CreateDialogCodeDialog.DialogClasses): + if not set(cls.super).isdisjoint( + CreateDialogCodeDialog.DialogClasses): classesList.append(cls.name) else: vagueClassesList.append(cls.name) @@ -100,7 +104,8 @@ self.classNameCombo.addItems(classesList) if vagueClassesList: if classesList: - self.classNameCombo.addItem(CreateDialogCodeDialog.Separator) + self.classNameCombo.addItem( + CreateDialogCodeDialog.Separator) self.classNameCombo.addItems(sorted(vagueClassesList)) if os.path.exists(self.srcFile) and \ @@ -109,8 +114,9 @@ self.__initError = True E5MessageBox.critical(self, self.trUtf8("Create Dialog Code"), - self.trUtf8("""The file <b>{0}</b> exists but does not contain""" - """ any classes.""").format(self.srcFile)) + self.trUtf8( + """The file <b>{0}</b> exists but does not contain""" + """ any classes.""").format(self.srcFile)) self.okButton.setEnabled(self.classNameCombo.count() > 0) @@ -136,8 +142,9 @@ except (AttributeError, ImportError) as err: E5MessageBox.critical(self, self.trUtf8("uic error"), - self.trUtf8("""<p>There was an error loading the form <b>{0}</b>.</p>""" - """<p>{1}</p>""").format(self.formFile, str(err))) + self.trUtf8( + """<p>There was an error loading the form <b>{0}</b>""" + """.</p><p>{1}</p>""").format(self.formFile, str(err))) return "" def __className(self): @@ -152,8 +159,9 @@ except (AttributeError, ImportError) as err: E5MessageBox.critical(self, self.trUtf8("uic error"), - self.trUtf8("""<p>There was an error loading the form <b>{0}</b>.</p>""" - """<p>{1}</p>""").format(self.formFile, str(err))) + self.trUtf8( + """<p>There was an error loading the form <b>{0}</b>""" + """.</p><p>{1}</p>""").format(self.formFile, str(err))) return "" def __signatures(self): @@ -172,8 +180,9 @@ for meth in list(cls.methods.values()): if meth.name.startswith("on_"): if meth.pyqtSignature is not None: - sig = ", ".join([bytes(QMetaObject.normalizedType(t)).decode() \ - for t in meth.pyqtSignature.split(",")]) + sig = ", ".join( + [bytes(QMetaObject.normalizedType(t)).decode() + for t in meth.pyqtSignature.split(",")]) signatures.append("{0}({1})".format(meth.name, sig)) else: signatures.append(meth.name) @@ -198,7 +207,8 @@ mapped = mapped.replace("*", "") # 3. replace QString and QStringList - mapped = mapped.replace("QStringList", "list").replace("QString", "str") + mapped = mapped.replace("QStringList", "list")\ + .replace("QString", "str") # 4. replace double by float mapped = mapped.replace("double", "float") @@ -233,7 +243,8 @@ if metaMethod.methodType() == QMetaMethod.Signal: if qVersion() >= "5.0.0": itm2 = QStandardItem("on_{0}_{1}".format( - name, bytes(metaMethod.methodSignature()).decode())) + name, + bytes(metaMethod.methodSignature()).decode())) else: itm2 = QStandardItem("on_{0}_{1}".format( name, metaMethod.signature())) @@ -241,16 +252,19 @@ if self.__module is not None: if qVersion() >= "5.0.0": method = "on_{0}_{1}".format( - name, bytes(metaMethod.methodSignature()).decode()\ - .split("(")[0]) + name, + bytes(metaMethod.methodSignature())\ + .decode().split("(")[0]) else: method = "on_{0}_{1}".format( name, metaMethod.signature().split("(")[0]) method2 = "{0}({1})".format(method, - ", ".join([self.__mapType(t) - for t in metaMethod.parameterTypes()])) + ", ".join( + [self.__mapType(t) + for t in metaMethod.parameterTypes()])) - if method2 in signatureList or method in signatureList: + if method2 in signatureList or \ + method in signatureList: itm2.setFlags(Qt.ItemFlags(Qt.ItemIsEnabled)) itm2.setCheckState(Qt.Checked) itm2.setForeground(QBrush(Qt.blue)) @@ -267,26 +281,29 @@ parameterNames[index] = \ QByteArray("p{0:d}".format(index)) methNamesSig = \ - ", ".join([bytes(n).decode() for n in parameterNames]) + ", ".join( + [bytes(n).decode() for n in parameterNames]) if methNamesSig: if qVersion() >= "5.0.0": - pythonSignature = "on_{0}_{1}(self, {2})".format( - name, - bytes(metaMethod.methodSignature()).decode()\ - .split("(")[0], - methNamesSig) + pythonSignature = \ + "on_{0}_{1}(self, {2})".format( + name, + bytes(metaMethod.methodSignature())\ + .decode().split("(")[0], + methNamesSig) else: - pythonSignature = "on_{0}_{1}(self, {2})".format( - name, - metaMethod.signature().split("(")[0], - methNamesSig) + pythonSignature = \ + "on_{0}_{1}(self, {2})".format( + name, + metaMethod.signature().split("(")[0], + methNamesSig) else: if qVersion() >= "5.0.0": pythonSignature = "on_{0}_{1}(self)".format( name, - bytes(metaMethod.methodSignature()).decode()\ - .split("(")[0]) + bytes(metaMethod.methodSignature())\ + .decode().split("(")[0]) else: pythonSignature = "on_{0}_{1}(self)".format( name, @@ -305,8 +322,9 @@ except (AttributeError, ImportError) as err: E5MessageBox.critical(self, self.trUtf8("uic error"), - self.trUtf8("""<p>There was an error loading the form <b>{0}</b>.</p>""" - """<p>{1}</p>""").format(self.formFile, str(err))) + self.trUtf8( + """<p>There was an error loading the form <b>{0}</b>""" + """.</p><p>{1}</p>""").format(self.formFile, str(err))) def __generateCode(self): """ @@ -342,40 +360,48 @@ try: if self.project.getProjectLanguage() == "Python2": if self.project.getProjectType() == "PySide": - tmplName = os.path.join(getConfig('ericCodeTemplatesDir'), - "impl_pyside.py2.tmpl") + tmplName = os.path.join( + getConfig('ericCodeTemplatesDir'), + "impl_pyside.py2.tmpl") elif self.project.getProjectType() == "PyQt5": - tmplName = os.path.join(getConfig('ericCodeTemplatesDir'), - "impl_pyqt5.py2.tmpl") + tmplName = os.path.join( + getConfig('ericCodeTemplatesDir'), + "impl_pyqt5.py2.tmpl") else: - tmplName = os.path.join(getConfig('ericCodeTemplatesDir'), - "impl_pyqt.py2.tmpl") + tmplName = os.path.join( + getConfig('ericCodeTemplatesDir'), + "impl_pyqt.py2.tmpl") else: if self.project.getProjectType() == "PySide": - tmplName = os.path.join(getConfig('ericCodeTemplatesDir'), - "impl_pyside.py.tmpl") + tmplName = os.path.join( + getConfig('ericCodeTemplatesDir'), + "impl_pyside.py.tmpl") elif self.project.getProjectType() == "PyQt5": - tmplName = os.path.join(getConfig('ericCodeTemplatesDir'), - "impl_pyqt5.py.tmpl") + tmplName = os.path.join( + getConfig('ericCodeTemplatesDir'), + "impl_pyqt5.py.tmpl") else: - tmplName = os.path.join(getConfig('ericCodeTemplatesDir'), - "impl_pyqt.py.tmpl") + tmplName = os.path.join( + getConfig('ericCodeTemplatesDir'), + "impl_pyqt.py.tmpl") tmplFile = open(tmplName, 'r', encoding="utf-8") template = tmplFile.read() tmplFile.close() except IOError as why: E5MessageBox.critical(self, self.trUtf8("Code Generation"), - self.trUtf8("""<p>Could not open the code template file "{0}".</p>""" - """<p>Reason: {1}</p>""")\ + self.trUtf8( + """<p>Could not open the code template file""" + """ "{0}".</p><p>Reason: {1}</p>""")\ .format(tmplName, str(why))) return objName = self.__objectName() if objName: template = template\ - .replace("$FORMFILE$", - os.path.splitext(os.path.basename(self.formFile))[0])\ + .replace( + "$FORMFILE$", + os.path.splitext(os.path.basename(self.formFile))[0])\ .replace("$FORMCLASS$", objName)\ .replace("$CLASSNAME$", self.classNameCombo.currentText())\ .replace("$SUPERCLASS$", self.__className()) @@ -399,8 +425,9 @@ except IOError as why: E5MessageBox.critical(self, self.trUtf8("Code Generation"), - self.trUtf8("""<p>Could not open the source file "{0}".</p>""" - """<p>Reason: {1}</p>""")\ + self.trUtf8( + """<p>Could not open the source file "{0}".</p>""" + """<p>Reason: {1}</p>""")\ .format(self.srcFile, str(why))) return @@ -444,12 +471,14 @@ slotsCode.append('{0}\n'.format(indentStr)) slotsCode.append('{0}{1}\n'.format( indentStr, - pyqtSignatureFormat.format(child.data(pyqtSignatureRole)))) + pyqtSignatureFormat.format( + child.data(pyqtSignatureRole)))) slotsCode.append('{0}def {1}:\n'.format( indentStr, child.data(pythonSignatureRole))) slotsCode.append('{0}"""\n'.format(indentStr * 2)) - slotsCode.append('{0}Slot documentation goes here.\n'.format( - indentStr * 2)) + slotsCode.append( + '{0}Slot documentation goes here.\n'.format( + indentStr * 2)) slotsCode.append('{0}"""\n'.format(indentStr * 2)) slotsCode.append('{0}# {1}: not implemented yet\n'.format( indentStr * 2, "TODO")) @@ -488,7 +517,8 @@ @param index index of the activated item (integer) """ - if self.classNameCombo.currentText() == CreateDialogCodeDialog.Separator: + if (self.classNameCombo.currentText() == + CreateDialogCodeDialog.Separator): self.okButton.setEnabled(False) self.filterEdit.clear() self.slotsModel.clear() @@ -531,7 +561,8 @@ """ Private slot to handle the buttonBox clicked signal. - @param button reference to the button that was clicked (QAbstractButton) + @param button reference to the button that was clicked + (QAbstractButton) """ if button == self.okButton: self.__generateCode()
--- a/Project/DebuggerPropertiesDialog.py Tue Oct 08 19:46:25 2013 +0200 +++ b/Project/DebuggerPropertiesDialog.py Tue Oct 08 19:47:37 2013 +0200 @@ -25,7 +25,8 @@ class DebuggerPropertiesDialog(QDialog, Ui_DebuggerPropertiesDialog): """ - Class implementing a dialog for entering project specific debugger settings. + Class implementing a dialog for entering project specific debugger + settings. """ def __init__(self, project, parent=None, name=None): """ @@ -42,26 +43,32 @@ self.debugClientCompleter = E5FileCompleter(self.debugClientEdit) self.interpreterCompleter = E5FileCompleter(self.interpreterEdit) - self.translationLocalCompleter = E5DirCompleter(self.translationLocalEdit) + self.translationLocalCompleter = E5DirCompleter( + self.translationLocalEdit) self.project = project if self.project.debugProperties["INTERPRETER"]: - self.interpreterEdit.setText(self.project.debugProperties["INTERPRETER"]) + self.interpreterEdit.setText( + self.project.debugProperties["INTERPRETER"]) else: - if self.project.pdata["PROGLANGUAGE"][0] in ["Python", "Python2", "Python3"]: + if self.project.pdata["PROGLANGUAGE"][0] in \ + ["Python", "Python2", "Python3"]: self.interpreterEdit.setText(sys.executable) elif self.project.pdata["PROGLANGUAGE"][0] == "Ruby": self.interpreterEdit.setText("/usr/bin/ruby") if self.project.debugProperties["DEBUGCLIENT"]: - self.debugClientEdit.setText(self.project.debugProperties["DEBUGCLIENT"]) + self.debugClientEdit.setText( + self.project.debugProperties["DEBUGCLIENT"]) else: if self.project.pdata["PROGLANGUAGE"][0] in ["Python", "Python2"]: - debugClient = os.path.join(getConfig('ericDir'), - "DebugClients", "Python", "DebugClient.py") + debugClient = os.path.join( + getConfig('ericDir'), + "DebugClients", "Python", "DebugClient.py") elif self.project.pdata["PROGLANGUAGE"][0] == "Python3": - debugClient = os.path.join(getConfig('ericDir'), - "DebugClients", "Python3", "DebugClient.py") + debugClient = os.path.join( + getConfig('ericDir'), + "DebugClients", "Python3", "DebugClient.py") elif self.project.pdata["PROGLANGUAGE"][0] == "Ruby": debugClient = os.path.join(getConfig('ericDir'), "DebugClients", "Ruby", "DebugClient.rb") @@ -112,7 +119,8 @@ """ Private slot to handle the Debug Client selection. """ - filters = self.project.dbgFilters[self.project.pdata["PROGLANGUAGE"][0]] + filters = self.project.dbgFilters[ + self.project.pdata["PROGLANGUAGE"][0]] filters += self.trUtf8("All Files (*)") file = E5FileDialog.getOpenFileName( self, @@ -130,7 +138,8 @@ self.project.debugProperties["INTERPRETER"] = \ self.interpreterEdit.text() if not self.project.debugProperties["INTERPRETER"]: - if self.project.pdata["PROGLANGUAGE"][0] in ["Python", "Python2", "Python3"]: + if self.project.pdata["PROGLANGUAGE"][0] in \ + ["Python", "Python2", "Python3"]: self.project.debugProperties["INTERPRETER"] = sys.executable elif self.project.pdata["PROGLANGUAGE"][0] == "Ruby": self.project.debugProperties["INTERPRETER"] = "/usr/bin/ruby" @@ -139,11 +148,13 @@ self.debugClientEdit.text() if not self.project.debugProperties["DEBUGCLIENT"]: if self.project.pdata["PROGLANGUAGE"][0] in ["Python", "Python2"]: - debugClient = os.path.join(getConfig('ericDir'), - "DebugClients", "Python", "DebugClient.py") + debugClient = os.path.join( + getConfig('ericDir'), + "DebugClients", "Python", "DebugClient.py") elif self.project.pdata["PROGLANGUAGE"][0] == "Python3": - debugClient = os.path.join(getConfig('ericDir'), - "DebugClients", "Python3", "DebugClient.py") + debugClient = os.path.join( + getConfig('ericDir'), + "DebugClients", "Python3", "DebugClient.py") elif self.project.pdata["PROGLANGUAGE"][0] == "Ruby": debugClient = os.path.join(getConfig('ericDir'), "DebugClients", "Ruby", "DebugClient.rb")
--- a/Project/FiletypeAssociationDialog.py Tue Oct 08 19:46:25 2013 +0200 +++ b/Project/FiletypeAssociationDialog.py Tue Oct 08 19:47:37 2013 +0200 @@ -29,14 +29,17 @@ self.filetypeAssociationList.headerItem().setText( self.filetypeAssociationList.columnCount(), "") - self.filetypeAssociationList.header().setSortIndicator(0, Qt.AscendingOrder) + self.filetypeAssociationList.header().setSortIndicator( + 0, Qt.AscendingOrder) # keep these lists in sync - self.filetypes = ["SOURCES", "FORMS", "TRANSLATIONS", "RESOURCES", "INTERFACES", - "OTHERS", "__IGNORE__"] + self.filetypes = ["SOURCES", "FORMS", "TRANSLATIONS", "RESOURCES", + "INTERFACES", "OTHERS", "__IGNORE__"] self.filetypeStrings = [self.trUtf8("Sources"), self.trUtf8("Forms"), - self.trUtf8("Translations"), self.trUtf8("Resources"), - self.trUtf8("Interfaces"), self.trUtf8("Others"), + self.trUtf8("Translations"), + self.trUtf8("Resources"), + self.trUtf8("Interfaces"), + self.trUtf8("Others"), self.trUtf8("Ignore")] self.filetypeCombo.addItems(self.filetypeStrings) @@ -55,14 +58,16 @@ """ Private method to resort the tree. """ - self.filetypeAssociationList.sortItems(self.filetypeAssociationList.sortColumn(), + self.filetypeAssociationList.sortItems( + self.filetypeAssociationList.sortColumn(), self.filetypeAssociationList.header().sortIndicatorOrder()) def __reformat(self): """ Private method to reformat the tree. """ - self.filetypeAssociationList.header().resizeSections(QHeaderView.ResizeToContents) + self.filetypeAssociationList.header().resizeSections( + QHeaderView.ResizeToContents) self.filetypeAssociationList.header().setStretchLastSection(True) def __createItem(self, pattern, filetype): @@ -78,7 +83,8 @@ def on_filetypeAssociationList_currentItemChanged(self, itm, prevItm): """ - Private slot to handle the currentItemChanged signal of the association list. + Private slot to handle the currentItemChanged signal of the + association list. @param itm reference to the new current item (QTreeWidgetItem) @param prevItm reference to the previous current item (QTreeWidgetItem) @@ -89,7 +95,8 @@ self.deleteAssociationButton.setEnabled(False) else: self.filePatternEdit.setText(itm.text(0)) - self.filetypeCombo.setCurrentIndex(self.filetypeCombo.findText(itm.text(1))) + self.filetypeCombo.setCurrentIndex( + self.filetypeCombo.findText(itm.text(1))) self.deleteAssociationButton.setEnabled(True) @pyqtSlot() @@ -116,7 +123,8 @@ @pyqtSlot() def on_deleteAssociationButton_clicked(self): """ - Private slot to delete the currently selected association of the listbox. + Private slot to delete the currently selected association of the + listbox. """ for itm in self.filetypeAssociationList.selectedItems(): itm = self.filetypeAssociationList.takeTopLevelItem( @@ -142,11 +150,13 @@ self.deleteAssociationButton.setEnabled(False) else: self.deleteAssociationButton.setEnabled( - self.filetypeAssociationList.selectedItems()[0].text(0) == txt) + self.filetypeAssociationList.selectedItems()[0].text(0) \ + == txt) def transferData(self): """ - Public slot to transfer the associations into the projects data structure. + Public slot to transfer the associations into the projects data + structure. """ self.project.pdata["FILETYPES"] = {} for index in range(self.filetypeAssociationList.topLevelItemCount()):
--- a/Project/LexerAssociationDialog.py Tue Oct 08 19:46:25 2013 +0200 +++ b/Project/LexerAssociationDialog.py Tue Oct 08 19:47:37 2013 +0200 @@ -29,7 +29,8 @@ super().__init__(parent) self.setupUi(self) - self.editorLexerList.headerItem().setText(self.editorLexerList.columnCount(), "") + self.editorLexerList.headerItem().setText( + self.editorLexerList.columnCount(), "") header = self.editorLexerList.header() if qVersion() >= "5.0.0": header.setSectionResizeMode(QHeaderView.ResizeToContents) @@ -45,8 +46,9 @@ self.extras = ["-----------", self.trUtf8("Alternative")] import QScintilla.Lexers - languages = \ - [''] + sorted(QScintilla.Lexers.getSupportedLanguages().keys()) + self.extras + languages = [''] + \ + sorted(QScintilla.Lexers.getSupportedLanguages().keys()) + \ + self.extras self.editorLexerCombo.addItems(languages) from pygments.lexers import get_all_lexers @@ -91,7 +93,8 @@ @pyqtSlot() def on_deleteLexerButton_clicked(self): """ - Private slot to delete the currently selected lexer association of the list. + Private slot to delete the currently selected lexer association of the + list. """ itmList = self.editorLexerList.selectedItems() if itmList: @@ -108,7 +111,8 @@ Private slot to handle the clicked signal of the lexer association list. @param itm reference to the selecte item (QTreeWidgetItem) - @param column column the item was clicked or activated (integer) (ignored) + @param column column the item was clicked or activated (integer) + (ignored) """ if itm is None: self.editorFileExtEdit.clear() @@ -129,10 +133,12 @@ def on_editorLexerList_itemActivated(self, itm, column): """ - Private slot to handle the activated signal of the lexer association list. + Private slot to handle the activated signal of the lexer association + list. @param itm reference to the selecte item (QTreeWidgetItem) - @param column column the item was clicked or activated (integer) (ignored) + @param column column the item was clicked or activated (integer) + (ignored) """ self.on_editorLexerList_itemClicked(itm, column) @@ -152,7 +158,8 @@ def transferData(self): """ - Public slot to transfer the associations into the projects data structure. + Public slot to transfer the associations into the projects data + structure. """ self.project.pdata["LEXERASSOCS"] = {} for index in range(self.editorLexerList.topLevelItemCount()):
--- a/Project/NewDialogClassDialog.py Tue Oct 08 19:46:25 2013 +0200 +++ b/Project/NewDialogClassDialog.py Tue Oct 08 19:47:37 2013 +0200 @@ -22,7 +22,8 @@ """ Class implementing a dialog to ente the data for a new dialog class file. """ - def __init__(self, defaultClassName, defaultFile, defaultPath, parent=None): + def __init__(self, defaultClassName, defaultFile, defaultPath, + parent=None): """ Constructor
--- a/Project/Project.py Tue Oct 08 19:46:25 2013 +0200 +++ b/Project/Project.py Tue Oct 08 19:47:37 2013 +0200 @@ -15,8 +15,8 @@ import copy import zipfile -from PyQt4.QtCore import QFile, QFileInfo, pyqtSignal, QCryptographicHash, QIODevice, \ - QByteArray, QObject, Qt +from PyQt4.QtCore import QFile, QFileInfo, pyqtSignal, QCryptographicHash, \ + QIODevice, QByteArray, QObject, Qt from PyQt4.QtGui import QCursor, QLineEdit, QToolBar, QDialog, QInputDialog, \ QApplication, QMenu, QAction from PyQt4.Qsci import QsciScintilla @@ -40,8 +40,8 @@ @signal dirty(int) emitted when the dirty state changes @signal projectLanguageAdded(str) emitted after a new language was added - @signal projectLanguageAddedByCode(str) emitted after a new language was added. - The language code is sent by this signal. + @signal projectLanguageAddedByCode(str) emitted after a new language was + added. The language code is sent by this signal. @signal projectLanguageRemoved(str) emitted after a language was removed @signal projectFormAdded(str) emitted after a new form was added @signal projectFormRemoved(str) emitted after a form was removed @@ -50,40 +50,43 @@ @signal projectSourceRemoved(str) emitted after a source was removed @signal projectInterfaceAdded(str) emitted after a new IDL file was added @signal projectInterfaceRemoved(str) emitted after a IDL file was removed - @signal projectResourceAdded(str) emitted after a new resource file was added + @signal projectResourceAdded(str) emitted after a new resource file was + added @signal projectResourceRemoved(str) emitted after a resource was removed @signal projectOthersAdded(str) emitted after a file or directory was added - to the OTHERS project data area + to the OTHERS project data area @signal projectOthersRemoved(str) emitted after a file was removed from the - OTHERS project data area - @signal projectAboutToBeCreated() emitted just before the project will be created - @signal newProjectHooks() emitted after a new project was generated but before - the newProject() signal is sent + OTHERS project data area + @signal projectAboutToBeCreated() emitted just before the project will be + created + @signal newProjectHooks() emitted after a new project was generated but + before the newProject() signal is sent @signal newProject() emitted after a new project was generated @signal sourceFile(str) emitted after a project file was read to - open the main script - @signal projectOpenedHooks() emitted after a project file was read but before the - projectOpened() signal is sent + open the main script + @signal projectOpenedHooks() emitted after a project file was read but + before the projectOpened() signal is sent @signal projectOpened() emitted after a project file was read - @signal projectClosedHooks() emitted after a project file was closed but before the - projectClosed() signal is sent + @signal projectClosedHooks() emitted after a project file was closed but + before the projectClosed() signal is sent @signal projectClosed() emitted after a project was closed @signal projectFileRenamed(str, str) emitted after a file of the project - has been renamed - @signal projectPropertiesChanged() emitted after the project properties were changed - @signal directoryRemoved(str) emitted after a directory has been removed from - the project + has been renamed + @signal projectPropertiesChanged() emitted after the project properties + were changed + @signal directoryRemoved(str) emitted after a directory has been removed + from the project @signal prepareRepopulateItem(str) emitted before an item of the model is - repopulated + repopulated @signal completeRepopulateItem(str) emitted after an item of the model was - repopulated - @signal vcsStatusMonitorStatus(str, str) emitted to signal the status of the - monitoring thread (ok, nok, op, off) and a status message + repopulated + @signal vcsStatusMonitorStatus(str, str) emitted to signal the status of + the monitoring thread (ok, nok, op, off) and a status message @signal reinitVCS() emitted after the VCS has been reinitialized - @signal showMenu(str, QMenu) emitted when a menu is about to be shown. The name - of the menu and a reference to the menu are given. - @signal lexerAssociationsChanged() emitted after the lexer associations have been - changed + @signal showMenu(str, QMenu) emitted when a menu is about to be shown. The + name of the menu and a reference to the menu are given. + @signal lexerAssociationsChanged() emitted after the lexer associations + have been changed @signal projectChanged() emitted to signal a change of the project """ dirty = pyqtSignal(int) @@ -237,8 +240,10 @@ self.__projectTypes["Other"] = self.trUtf8("Other") self.__projectProgLanguages = { - "Python2": ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", "Console", "Other"], - "Python3": ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", "Console", "Other"], + "Python2": ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", + "Console", "Other"], + "Python3": ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", + "Console", "Other"], "Ruby": ["Qt4", "Qt4C", "Console", "Other"], } @@ -247,15 +252,18 @@ self.__projectTypes["PySide"] = self.trUtf8("PySide GUI") self.__projectTypes["PySideC"] = self.trUtf8("PySide Console") if pyside2: - self.__projectProgLanguages["Python2"].extend(["PySide", "PySideC"]) + self.__projectProgLanguages["Python2"].extend( + ["PySide", "PySideC"]) if pyside3: - self.__projectProgLanguages["Python3"].extend(["PySide", "PySideC"]) + self.__projectProgLanguages["Python3"].extend( + ["PySide", "PySideC"]) def getProjectTypes(self, progLanguage=""): """ Public method to get the list of supported project types. - @param progLanguage programming language to get project types for (string) + @param progLanguage programming language to get project types for + (string) @return reference to the dictionary of project types. """ if progLanguage and progLanguage in self.__projectProgLanguages: @@ -290,8 +298,8 @@ @param description more verbose type name (display string) (string) @keyparam fileTypeCallback reference to a method returning a dictionary of filetype associations. - @keyparam binaryTranslationsCallback reference to a method returning the - name of the binary translation file given the name of the raw + @keyparam binaryTranslationsCallback reference to a method returning + the name of the binary translation file given the name of the raw translation file @keyparam lexerAssociationCallback reference to a method returning the lexer type to be used for syntax highlighting given the name of @@ -304,8 +312,9 @@ if progLanguage not in self.__projectProgLanguages: E5MessageBox.critical(self.ui, self.trUtf8("Registering Project Type"), - self.trUtf8("""<p>The Programming Language <b>{0}</b> is not""" - """ supported.</p>""")\ + self.trUtf8( + """<p>The Programming Language <b>{0}</b> is not""" + """ supported.</p>""")\ .format(progLanguage) ) return @@ -313,9 +322,10 @@ if type_ in self.__projectProgLanguages[progLanguage]: E5MessageBox.critical(self.ui, self.trUtf8("Registering Project Type"), - self.trUtf8("""<p>The Project type <b>{0}</b> is already""" - """ registered with Programming Language""" - """ <b>{1}</b>.</p>""")\ + self.trUtf8( + """<p>The Project type <b>{0}</b> is already""" + """ registered with Programming Language""" + """ <b>{1}</b>.</p>""")\ .format(type_, progLanguage) ) return @@ -330,7 +340,8 @@ self.__projectTypes[type_] = description self.__fileTypeCallbacks[type_] = fileTypeCallback self.__lexerAssociationCallbacks[type_] = lexerAssociationCallback - self.__binaryTranslationsCallbacks[type_] = binaryTranslationsCallback + self.__binaryTranslationsCallbacks[type_] = \ + binaryTranslationsCallback if progLanguages: for progLanguage in progLanguages: self.__projectProgLanguages[progLanguage].append(type_) @@ -368,7 +379,8 @@ self.translationsRoot = "" # the translations prefix self.name = "" self.opened = False - self.subdirs = [""] # record the project dir as a relative path (i.e. empty path) + self.subdirs = [""] # record the project dir as a relative path + # (i.e. empty path) self.otherssubdirs = [] self.vcs = None self.vcsRequested = False @@ -417,13 +429,14 @@ Public method to get data out of the project data store. @param category category of the data to get (string, one of - PROJECTTYPESPECIFICDATA, CHECKERSPARMS, PACKAGERSPARMS, DOCUMENTATIONPARMS - or OTHERTOOLSPARMS) + PROJECTTYPESPECIFICDATA, CHECKERSPARMS, PACKAGERSPARMS, + DOCUMENTATIONPARMS or OTHERTOOLSPARMS) @param key key of the data entry to get (string). @return a copy of the requested data or None """ - if category in ["PROJECTTYPESPECIFICDATA", "CHECKERSPARMS", "PACKAGERSPARMS", - "DOCUMENTATIONPARMS", "OTHERTOOLSPARMS"] and \ + if category in ["PROJECTTYPESPECIFICDATA", "CHECKERSPARMS", + "PACKAGERSPARMS", "DOCUMENTATIONPARMS", + "OTHERTOOLSPARMS"] and \ key in self.pdata[category]: return copy.deepcopy(self.pdata[category][key]) else: @@ -434,14 +447,15 @@ Public method to store data in the project data store. @param category category of the data to get (string, one of - PROJECTTYPESPECIFICDATA, CHECKERSPARMS, PACKAGERSPARMS, DOCUMENTATIONPARMS - or OTHERTOOLSPARMS) + PROJECTTYPESPECIFICDATA, CHECKERSPARMS, PACKAGERSPARMS, + DOCUMENTATIONPARMS or OTHERTOOLSPARMS) @param key key of the data entry to get (string). @param data data to be stored @return flag indicating success (boolean) """ - if category not in ["PROJECTTYPESPECIFICDATA", "CHECKERSPARMS", "PACKAGERSPARMS", - "DOCUMENTATIONPARMS", "OTHERTOOLSPARMS"]: + if category not in ["PROJECTTYPESPECIFICDATA", "CHECKERSPARMS", + "PACKAGERSPARMS", "DOCUMENTATIONPARMS", + "OTHERTOOLSPARMS"]: return False # test for changes of data and save them in the project @@ -465,7 +479,8 @@ def initFileTypes(self): """ - Public method to initialize the filetype associations with default values. + Public method to initialize the filetype associations with default + values. """ self.pdata["FILETYPES"] = {} if self.pdata["MIXEDLANGUAGE"][0]: @@ -475,7 +490,8 @@ for ext in self.sourceExtensions[sourceKey]: self.pdata["FILETYPES"]["*{0}".format(ext)] = "SOURCES" self.pdata["FILETYPES"]["*.idl"] = "INTERFACES" - if self.pdata["PROJECTTYPE"][0] in ["Qt4", "PyQt5", "E4Plugin", "PySide"]: + if self.pdata["PROJECTTYPE"][0] in ["Qt4", "PyQt5", "E4Plugin", + "PySide"]: self.pdata["FILETYPES"]["*.ui"] = "FORMS" self.pdata["FILETYPES"]["*.ui.h"] = "FORMS" if self.pdata["PROJECTTYPE"][0] in ["Qt4", "Qt4C", "E4Plugin", @@ -488,8 +504,10 @@ self.pdata["FILETYPES"]["*.ts"] = "TRANSLATIONS" self.pdata["FILETYPES"]["*.qm"] = "TRANSLATIONS" try: - if self.__fileTypeCallbacks[self.pdata["PROJECTTYPE"][0]] is not None: - ftypes = self.__fileTypeCallbacks[self.pdata["PROJECTTYPE"][0]]() + if self.__fileTypeCallbacks[ + self.pdata["PROJECTTYPE"][0]] is not None: + ftypes = \ + self.__fileTypeCallbacks[self.pdata["PROJECTTYPE"][0]]() self.pdata["FILETYPES"].update(ftypes) except KeyError: pass @@ -497,7 +515,8 @@ def updateFileTypes(self): """ - Public method to update the filetype associations with new default values. + Public method to update the filetype associations with new default + values. """ if self.pdata["PROJECTTYPE"][0] in ["Qt4", "Qt4C", "E4Plugin", "PyQt5", "PyQt5C", @@ -507,8 +526,10 @@ if "*.qm" not in self.pdata["FILETYPES"]: self.pdata["FILETYPES"]["*.qm"] = "TRANSLATIONS" try: - if self.__fileTypeCallbacks[self.pdata["PROJECTTYPE"][0]] is not None: - ftypes = self.__fileTypeCallbacks[self.pdata["PROJECTTYPE"][0]]() + if self.__fileTypeCallbacks[ + self.pdata["PROJECTTYPE"][0]] is not None: + ftypes = \ + self.__fileTypeCallbacks[self.pdata["PROJECTTYPE"][0]]() for pattern, ftype in list(ftypes.items()): if pattern not in self.pdata["FILETYPES"]: self.pdata["FILETYPES"][pattern] = ftype @@ -645,7 +666,8 @@ QApplication.restoreOverrideCursor() E5MessageBox.critical(self.ui, self.trUtf8("Read project file"), - self.trUtf8("<p>The project file <b>{0}</b> could not be read.</p>")\ + self.trUtf8( + "<p>The project file <b>{0}</b> could not be read.</p>")\ .format(fn)) return False @@ -660,7 +682,8 @@ self.translationsRoot = \ self.pdata["TRANSLATIONPATTERN"][0].split("%language%")[0] elif len(self.pdata["MAINSCRIPT"]) == 1: - self.translationsRoot = os.path.splitext(self.pdata["MAINSCRIPT"][0])[0] + self.translationsRoot = os.path.splitext( + self.pdata["MAINSCRIPT"][0])[0] if os.path.isdir(os.path.join(self.ppath, self.translationsRoot)): dn = self.translationsRoot else: @@ -670,7 +693,8 @@ self.name = os.path.splitext(os.path.basename(fn))[0] - # check, if the files of the project still exist in the project directory + # check, if the files of the project still exist in the + # project directory self.__checkFilesExist("SOURCES") self.__checkFilesExist("FORMS") self.__checkFilesExist("INTERFACES") @@ -710,15 +734,17 @@ Private method to save the project infos to a project file. @param fn optional filename of the project file to be written (string). - If fn is None, the filename stored in the project object - is used. This is the 'save' action. If fn is given, this filename - is used instead of the one in the project object. This is the - 'save as' action. + If fn is None, the filename stored in the project object + is used. This is the 'save' action. If fn is given, this filename + is used instead of the one in the project object. This is the + 'save as' action. @return flag indicating success """ if self.vcs is not None: - self.pdata["VCSOPTIONS"] = [copy.deepcopy(self.vcs.vcsGetOptions())] - self.pdata["VCSOTHERDATA"] = [copy.deepcopy(self.vcs.vcsGetOtherData())] + self.pdata["VCSOPTIONS"] = [ + copy.deepcopy(self.vcs.vcsGetOptions())] + self.pdata["VCSOTHERDATA"] = [ + copy.deepcopy(self.vcs.vcsGetOtherData())] if not self.pdata["HASH"][0]: hash = str(QCryptographicHash.hash( @@ -733,13 +759,15 @@ f = QFile(fn) if f.open(QIODevice.WriteOnly): from E5XML.ProjectWriter import ProjectWriter - ProjectWriter(f, os.path.splitext(os.path.basename(fn))[0]).writeXML() + ProjectWriter(f, os.path.splitext( + os.path.basename(fn))[0]).writeXML() res = True else: E5MessageBox.critical(self.ui, self.trUtf8("Save project file"), - self.trUtf8("<p>The project file <b>{0}</b> could not be written.</p>")\ - .format(fn)) + self.trUtf8( + "<p>The project file <b>{0}</b> could not be" + " written.</p>").format(fn)) res = False if res: @@ -772,8 +800,9 @@ else: E5MessageBox.critical(self.ui, self.trUtf8("Read user project properties"), - self.trUtf8("<p>The user specific project properties file <b>{0}</b>" - " could not be read.</p>").format(fn)) + self.trUtf8( + "<p>The user specific project properties file" + " <b>{0}</b> could not be read.</p>").format(fn)) def __writeUserProperties(self): """ @@ -788,12 +817,14 @@ f = QFile(fn) if f.open(QIODevice.WriteOnly): from E5XML.UserProjectWriter import UserProjectWriter - UserProjectWriter(f, os.path.splitext(os.path.basename(fn))[0]).writeXML() + UserProjectWriter( + f, os.path.splitext(os.path.basename(fn))[0]).writeXML() f.close() else: E5MessageBox.critical(self.ui, self.trUtf8("Save user project properties"), - self.trUtf8("<p>The user specific project properties file <b>{0}</b>" + self.trUtf8( + "<p>The user specific project properties file <b>{0}</b>" " could not be written.</p>").format(fn)) def __showContextMenuSession(self): @@ -808,8 +839,10 @@ fn = os.path.join(self.getProjectManagementDir(), '{0}.e4s'.format(fn)) enable = os.path.exists(fn) - self.sessActGrp.findChild(QAction, "project_load_session").setEnabled(enable) - self.sessActGrp.findChild(QAction, "project_delete_session").setEnabled(enable) + self.sessActGrp.findChild( + QAction, "project_load_session").setEnabled(enable) + self.sessActGrp.findChild( + QAction, "project_delete_session").setEnabled(enable) def __readSession(self, quiet=False, indicator=""): """ @@ -840,7 +873,8 @@ if not quiet: E5MessageBox.critical(self.ui, self.trUtf8("Read project session"), - self.trUtf8("<p>The project session file <b>{0}</b> could not be" + self.trUtf8( + "<p>The project session file <b>{0}</b> could not be" " read.</p>").format(fn)) def __writeSession(self, quiet=False, indicator=""): @@ -865,13 +899,15 @@ f = QFile(fn) if f.open(QIODevice.WriteOnly): from E5XML.SessionWriter import SessionWriter - SessionWriter(f, os.path.splitext(os.path.basename(fn))[0]).writeXML() + SessionWriter( + f, os.path.splitext(os.path.basename(fn))[0]).writeXML() f.close() else: if not quiet: E5MessageBox.critical(self.ui, self.trUtf8("Save project session"), - self.trUtf8("<p>The project session file <b>{0}</b> could not be" + self.trUtf8( + "<p>The project session file <b>{0}</b> could not be" " written.</p>").format(fn)) def __deleteSession(self): @@ -886,15 +922,17 @@ fname, ext = os.path.splitext(os.path.basename(self.pfile)) - for fn in [os.path.join(self.getProjectManagementDir(), "{0}.e4s".format(fname))]: + for fn in [os.path.join( + self.getProjectManagementDir(), "{0}.e4s".format(fname))]: if os.path.exists(fn): try: os.remove(fn) except OSError: E5MessageBox.critical(self.ui, self.trUtf8("Delete project session"), - self.trUtf8("<p>The project session file <b>{0}</b> could not be" - " deleted.</p>").format(fn)) + self.trUtf8( + "<p>The project session file <b>{0}</b> could" + " not be deleted.</p>").format(fn)) def __readTasks(self): """ @@ -919,7 +957,8 @@ else: E5MessageBox.critical(self.ui, self.trUtf8("Read tasks"), - self.trUtf8("<p>The tasks file <b>{0}</b> could not be read.</p>")\ + self.trUtf8( + "<p>The tasks file <b>{0}</b> could not be read.</p>")\ .format(fn)) def writeTasks(self): @@ -937,12 +976,14 @@ if not ok: E5MessageBox.critical(self.ui, self.trUtf8("Save tasks"), - self.trUtf8("<p>The tasks file <b>{0}</b> could not be written.</p>") + self.trUtf8( + "<p>The tasks file <b>{0}</b> could not be written.</p>") .format(fn)) return from E5XML.TasksWriter import TasksWriter - TasksWriter(f, True, os.path.splitext(os.path.basename(fn))[0]).writeXML() + TasksWriter( + f, True, os.path.splitext(os.path.basename(fn))[0]).writeXML() f.close() def __showContextMenuDebugger(self): @@ -957,10 +998,10 @@ fn = os.path.join(self.getProjectManagementDir(), '{0}.e4d'.format(fn)) enable = os.path.exists(fn) - self.dbgActGrp.findChild(QAction, "project_debugger_properties_load")\ - .setEnabled(enable) - self.dbgActGrp.findChild(QAction, "project_debugger_properties_delete")\ - .setEnabled(enable) + self.dbgActGrp.findChild( + QAction, "project_debugger_properties_load").setEnabled(enable) + self.dbgActGrp.findChild( + QAction, "project_debugger_properties_delete").setEnabled(enable) def __readDebugProperties(self, quiet=False): """ @@ -989,8 +1030,9 @@ if not quiet: E5MessageBox.critical(self.ui, self.trUtf8("Read debugger properties"), - self.trUtf8("<p>The project debugger properties file <b>{0}</b> could" - " not be read.</p>").format(fn)) + self.trUtf8( + "<p>The project debugger properties file <b>{0}</b>" + " could not be read.</p>").format(fn)) def __writeDebugProperties(self, quiet=False): """ @@ -1012,16 +1054,16 @@ f = QFile(fn) if f.open(QIODevice.WriteOnly): from E5XML.DebuggerPropertiesWriter import DebuggerPropertiesWriter - DebuggerPropertiesWriter(f, os.path.splitext(os.path.basename(fn))[0])\ - .writeXML() + DebuggerPropertiesWriter( + f, os.path.splitext(os.path.basename(fn))[0]).writeXML() f.close() else: if not quiet: E5MessageBox.critical(self.ui, self.trUtf8("Save debugger properties"), - self.trUtf8("<p>The project debugger properties file <b>{0}</b> could" - " not be written.</p>") - .format(fn)) + self.trUtf8( + "<p>The project debugger properties file <b>{0}</b>" + " could not be written.</p>").format(fn)) def __deleteDebugProperties(self): """ @@ -1035,15 +1077,17 @@ fname, ext = os.path.splitext(os.path.basename(self.pfile)) - for fn in [os.path.join(self.getProjectManagementDir(), "{0}.e4d".format(fname))]: + for fn in [os.path.join(self.getProjectManagementDir(), + "{0}.e4d".format(fname))]: if os.path.exists(fn): try: os.remove(fn) except OSError: E5MessageBox.critical(self.ui, self.trUtf8("Delete debugger properties"), - self.trUtf8("<p>The project debugger properties file <b>{0}</b>" - " could not be deleted.</p>") + self.trUtf8( + "<p>The project debugger properties file" + " <b>{0}</b> could not be deleted.</p>") .format(fn)) def __initDebugProperties(self): @@ -1102,8 +1146,8 @@ should be cleared (boolean) @keyparam tracePython flag to indicate if the Python library should be traced as well (boolean) - @keyparam autoContinue flag indicating, that the debugger should not stop - at the first executable line (boolean) + @keyparam autoContinue flag indicating, that the debugger should not + stop at the first executable line (boolean) """ self.dbgCmdline = argv self.dbgWd = wd @@ -1136,7 +1180,8 @@ self.pdata["TRANSLATIONPATTERN"][0] == '': E5MessageBox.critical(self.ui, self.trUtf8("Add Language"), - self.trUtf8("You have to specify a translation pattern first.")) + self.trUtf8( + "You have to specify a translation pattern first.")) return from .AddLanguageDialog import AddLanguageDialog @@ -1144,23 +1189,25 @@ if dlg.exec_() == QDialog.Accepted: lang = dlg.getSelectedLanguage() if self.pdata["PROJECTTYPE"][0] in \ - ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", "PySide", "PySideC"]: - langFile = self.pdata["TRANSLATIONPATTERN"][0].replace("%language%", lang) + ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", "PySide", + "PySideC"]: + langFile = self.pdata["TRANSLATIONPATTERN"][0]\ + .replace("%language%", lang) self.appendFile(langFile) self.projectLanguageAddedByCode.emit(lang) def __binaryTranslationFile(self, langFile): """ - Private method to calculate the filename of the binary translations file - given the name of the raw translations file. + Private method to calculate the filename of the binary translations + file given the name of the raw translations file. @param langFile name of the raw translations file (string) @return name of the binary translations file (string) """ qmFile = "" try: - if self.__binaryTranslationsCallbacks[self.pdata["PROJECTTYPE"][0]] \ - is not None: + if self.__binaryTranslationsCallbacks[ + self.pdata["PROJECTTYPE"][0]] is not None: qmFile = self.__binaryTranslationsCallbacks[ self.pdata["PROJECTTYPE"][0]](langFile) except KeyError: @@ -1227,7 +1274,8 @@ except IOError: E5MessageBox.critical(self.ui, self.trUtf8("Delete translation"), - self.trUtf8("<p>The selected translation file <b>{0}</b> could not be" + self.trUtf8( + "<p>The selected translation file <b>{0}</b> could not be" " deleted.</p>").format(langFile)) return @@ -1246,8 +1294,9 @@ except IOError: E5MessageBox.critical(self.ui, self.trUtf8("Delete translation"), - self.trUtf8("<p>The selected translation file <b>{0}</b> could not be" - " deleted.</p>").format(qmFile)) + self.trUtf8( + "<p>The selected translation file <b>{0}</b> could" + " not be deleted.</p>").format(qmFile)) return def appendFile(self, fn, isSourceFile=False, updateModel=True): @@ -1256,8 +1305,9 @@ @param fn filename to be added to the project (string) @param isSourceFile flag indicating that this is a source file - even if it doesn't have the source extension (boolean) - @param updateModel flag indicating an update of the model is requested (boolean) + even if it doesn't have the source extension (boolean) + @param updateModel flag indicating an update of the model is + requested (boolean) """ dirty = False @@ -1277,7 +1327,8 @@ if fnmatch.fnmatch(bfn, '*.ts') or fnmatch.fnmatch(bfn, '*.qm'): filetype = "TRANSLATIONS" else: - for pattern in reversed(sorted(self.pdata["FILETYPES"].keys())): + for pattern in reversed( + sorted(self.pdata["FILETYPES"].keys())): if fnmatch.fnmatch(bfn, pattern): filetype = self.pdata["FILETYPES"][pattern] break @@ -1306,7 +1357,8 @@ if newfn not in self.pdata["INTERFACES"]: self.pdata["INTERFACES"].append(newfn) self.projectInterfaceAdded.emit(newfn) - updateModel and self.__model.addNewItem("INTERFACES", newfn) + updateModel and \ + self.__model.addNewItem("INTERFACES", newfn) dirty = True else: updateModel and self.repopulateItem(newfn) @@ -1366,7 +1418,8 @@ if os.path.exists(targetfile): res = E5MessageBox.yesNo(self.ui, self.trUtf8("Add file"), - self.trUtf8("<p>The file <b>{0}</b> already" + self.trUtf8( + "<p>The file <b>{0}</b> already" " exists.</p><p>Overwrite it?</p>") .format(targetfile), icon=E5MessageBox.Warning) @@ -1377,8 +1430,10 @@ except IOError as why: E5MessageBox.critical(self.ui, self.trUtf8("Add file"), - self.trUtf8("<p>The selected file <b>{0}</b> could not be" - " added to <b>{1}</b>.</p><p>Reason: {2}</p>") + self.trUtf8( + "<p>The selected file <b>{0}</b> could" + " not be added to <b>{1}</b>.</p>" + "<p>Reason: {2}</p>") .format(fn, target, str(why))) continue @@ -1390,7 +1445,8 @@ def __addSingleDirectory(self, filetype, source, target, quiet=False): """ - Private method used to add all files of a single directory to the project. + Private method used to add all files of a single directory to the + project. @param filetype type of files to add (string) @param source source directory (string) @@ -1419,13 +1475,15 @@ " any files belonging to the selected category.</p>")) return - if not Utilities.samepath(target, source) and not os.path.isdir(target): + if not Utilities.samepath(target, source) and \ + not os.path.isdir(target): try: os.makedirs(target) except IOError as why: E5MessageBox.critical(self.ui, self.trUtf8("Add directory"), - self.trUtf8("<p>The target directory <b>{0}</b> could not be" + self.trUtf8( + "<p>The target directory <b>{0}</b> could not be" " created.</p><p>Reason: {1}</p>") .format(target, str(why))) return @@ -1441,12 +1499,14 @@ if os.path.exists(targetfile): res = E5MessageBox.yesNo(self.ui, self.trUtf8("Add directory"), - self.trUtf8("<p>The file <b>{0}</b> already exists.</p>" - "<p>Overwrite it?</p>") + self.trUtf8( + "<p>The file <b>{0}</b> already exists.</p>" + "<p>Overwrite it?</p>") .format(targetfile), icon=E5MessageBox.Warning) if not res: - continue # don't overwrite, carry on with next file + continue # don't overwrite, carry on + # with next file shutil.copy(file, target) except EnvironmentError: @@ -1485,7 +1545,8 @@ if startdir is None: startdir = self.ppath from .AddDirectoryDialog import AddDirectoryDialog - dlg = AddDirectoryDialog(self, filter, self.parent(), startdir=startdir) + dlg = AddDirectoryDialog( + self, filter, self.parent(), startdir=startdir) if dlg.exec_() == QDialog.Accepted: filetype, source, target, recursive = dlg.getData() if target == '': @@ -1563,7 +1624,8 @@ def addSourceDir(self): """ - Public slot to add all source files of a directory to the current project. + Public slot to add all source files of a directory to the current + project. """ self.addDirectory('source') @@ -1575,13 +1637,15 @@ def addIdlDir(self): """ - Public slot to add all IDL interfaces of a directory to the current project. + Public slot to add all IDL interfaces of a directory to the current + project. """ self.addDirectory('interface') def addResourceDir(self): """ - Public slot to add all Qt resource files of a directory to the current project. + Public slot to add all Qt resource files of a directory to the current + project. """ self.addDirectory('resource') @@ -1644,7 +1708,8 @@ except OSError as msg: E5MessageBox.critical(self.ui, self.trUtf8("Rename File"), - self.trUtf8("""<p>The file <b>{0}</b> could not be renamed.<br />""" + self.trUtf8( + """<p>The file <b>{0}</b> could not be renamed.<br />""" """Reason: {1}</p>""").format(oldfn, str(msg))) return False @@ -1707,7 +1772,8 @@ for entry in self.pdata[key][:]: if entry.startswith(olddn): entry = entry.replace(olddn, newdn) - self.appendFile(os.path.join(self.ppath, entry), key == "SOURCES") + self.appendFile(os.path.join(self.ppath, entry), + key == "SOURCES") self.setDirty(True) def moveDirectory(self, olddn, newdn): @@ -1748,7 +1814,8 @@ The file is not deleted from the project directory. @param fn filename to be removed from the project - @param updateModel flag indicating an update of the model is requested (boolean) + @param updateModel flag indicating an update of the model is + requested (boolean) """ fn = self.getRelativePath(fn) dirty = True @@ -1794,7 +1861,8 @@ dn2 = dn + os.sep else: dn2 = dn - for key in ["SOURCES", "FORMS", "INTERFACES", "RESOURCES", "TRANSLATIONS", ]: + for key in ["SOURCES", "FORMS", "INTERFACES", "RESOURCES", + "TRANSLATIONS", ]: for entry in self.pdata[key][:]: if entry.startswith(dn2): self.pdata[key].remove(entry) @@ -1824,14 +1892,16 @@ if os.path.isfile(fn2): os.remove(fn2) pat = os.path.join( - self.ppath, head, "__pycache__", "{0}.*{1}".format(tail, ext)) + self.ppath, head, + "__pycache__", "{0}.*{1}".format(tail, ext)) for f in glob.glob(pat): os.remove(f) except EnvironmentError: E5MessageBox.critical(self.ui, self.trUtf8("Delete file"), - self.trUtf8("<p>The selected file <b>{0}</b> could not be deleted.</p>") - .format(fn)) + self.trUtf8( + "<p>The selected file <b>{0}</b> could not be" + " deleted.</p>").format(fn)) return False self.removeFile(fn) @@ -1913,7 +1983,8 @@ self.menuDiagramAct.setEnabled(True) self.menuApidocAct.setEnabled(True) self.menuPackagersAct.setEnabled(True) - self.pluginGrp.setEnabled(self.pdata["PROJECTTYPE"][0] == "E4Plugin") + self.pluginGrp.setEnabled( + self.pdata["PROJECTTYPE"][0] == "E4Plugin") self.addLanguageAct.setEnabled( len(self.pdata["TRANSLATIONPATTERN"]) > 0 and \ self.pdata["TRANSLATIONPATTERN"][0] != '') @@ -1921,7 +1992,8 @@ self.projectAboutToBeCreated.emit() hash = str(QCryptographicHash.hash( - QByteArray(self.ppath.encode("utf-8")), QCryptographicHash.Sha1).toHex(), + QByteArray(self.ppath.encode("utf-8")), + QCryptographicHash.Sha1).toHex(), encoding="utf-8") self.pdata["HASH"] = [hash] @@ -1932,22 +2004,26 @@ except EnvironmentError: E5MessageBox.critical(self.ui, self.trUtf8("Create project directory"), - self.trUtf8("<p>The project directory <b>{0}</b> could not" + self.trUtf8( + "<p>The project directory <b>{0}</b> could not" " be created.</p>") .format(self.ppath)) self.vcs = self.initVCS() return # create an empty __init__.py file to make it a Python package # (only for Python and Python3) - if self.pdata["PROGLANGUAGE"][0] in ["Python", "Python2", "Python3"]: + if self.pdata["PROGLANGUAGE"][0] in \ + ["Python", "Python2", "Python3"]: fn = os.path.join(self.ppath, "__init__.py") f = open(fn, "w", encoding="utf-8") f.close() self.appendFile(fn, True) # create an empty main script file, if a name was given - if len(self.pdata["MAINSCRIPT"]) and self.pdata["MAINSCRIPT"][0]: + if len(self.pdata["MAINSCRIPT"]) and \ + self.pdata["MAINSCRIPT"][0]: if not os.path.isabs(self.pdata["MAINSCRIPT"][0]): - ms = os.path.join(self.ppath, self.pdata["MAINSCRIPT"][0]) + ms = os.path.join( + self.ppath, self.pdata["MAINSCRIPT"][0]) else: ms = self.pdata["MAINSCRIPT"][0] f = open(ms, "w") @@ -1959,7 +2035,8 @@ if not os.path.isdir(tpd): os.makedirs(tpd) if self.pdata["TRANSLATIONSBINPATH"]: - tpd = os.path.join(self.ppath, self.pdata["TRANSLATIONSBINPATH"][0]) + tpd = os.path.join( + self.ppath, self.pdata["TRANSLATIONSBINPATH"][0]) if not os.path.isdir(tpd): os.makedirs(tpd) @@ -1984,7 +2061,8 @@ except IOError as err: E5MessageBox.critical(self.ui, self.trUtf8("Create main script"), - self.trUtf8("<p>The mainscript <b>{0}</b> could not" + self.trUtf8( + "<p>The mainscript <b>{0}</b> could not" " be created.<br/>Reason: {1}</p>") .format(self.ppath, str(err))) self.appendFile(ms) @@ -2000,7 +2078,8 @@ self.newProjectAddFiles(ms) # create an empty __init__.py file to make it a Python package # if none exists (only for Python and Python3) - if self.pdata["PROGLANGUAGE"][0] in ["Python", "Python2", "Python3"]: + if self.pdata["PROGLANGUAGE"][0] in \ + ["Python", "Python2", "Python3"]: fn = os.path.join(self.ppath, "__init__.py") if not os.path.exists(fn): f = open(fn, "w", encoding="utf-8") @@ -2042,7 +2121,8 @@ # edit VCS command options vcores = E5MessageBox.yesNo(self.ui, self.trUtf8("New Project"), - self.trUtf8("""Would you like to edit the VCS""" + self.trUtf8( + """Would you like to edit the VCS""" """ command options?""")) if vcores: from VCS.CommandOptionsDialog import \ @@ -2054,7 +2134,8 @@ if res == 0: apres = E5MessageBox.yesNo(self.ui, self.trUtf8("New project"), - self.trUtf8("Shall the project file be added" + self.trUtf8( + "Shall the project file be added" " to the repository?"), yesDefault=True) if apres: @@ -2066,7 +2147,8 @@ break # put the project under VCS control - if self.vcs is None and self.vcsSoftwareAvailable() and self.vcsRequested: + if self.vcs is None and self.vcsSoftwareAvailable() and \ + self.vcsRequested: vcsSystemsDict = e5App().getObject("PluginManager")\ .getPluginDisplayStrings("version_control") vcsSystemsDisplay = [self.trUtf8("None")] @@ -2076,11 +2158,12 @@ vcsSelected, ok = QInputDialog.getItem( None, self.trUtf8("New Project"), - self.trUtf8("Select version control system for the project"), + self.trUtf8( + "Select version control system for the project"), vcsSystemsDisplay, 0, False) if ok and vcsSelected != self.trUtf8("None"): - for vcsSystem, vcsSystemDisplay in list(vcsSystemsDict.items()): + for vcsSystem, vcsSystemDisplay in vcsSystemsDict.items(): if vcsSystemDisplay == vcsSelected: break else: @@ -2101,8 +2184,9 @@ # edit VCS command options vcores = E5MessageBox.yesNo(self.ui, self.trUtf8("New Project"), - self.trUtf8("""Would you like to edit the VCS command""" - """ options?""")) + self.trUtf8( + """Would you like to edit the VCS command""" + """ options?""")) if vcores: codlg = vcsCommandOptionsDialog(self.vcs) if codlg.exec_() == QDialog.Accepted: @@ -2149,7 +2233,8 @@ if "%language%" in pattern: pattern = pattern.replace("%language%", "*") else: - tpd = self.pdata["TRANSLATIONPATTERN"][0].split("%language%")[0] + tpd = self.pdata["TRANSLATIONPATTERN"][0].split( + "%language%")[0] else: pattern = "*.ts" tslist.extend(Utilities.direntries(tpd, True, pattern)) @@ -2163,14 +2248,16 @@ os.path.basename(tslist[0]).split('_')[0] self.pdata["TRANSLATIONPATTERN"] = \ [os.path.join(os.path.dirname(tslist[0]), - "{0}_%language%{1}".format(os.path.basename(tslist[0]).split('_')[0], + "{0}_%language%{1}".format( + os.path.basename(tslist[0]).split('_')[0], os.path.splitext(tslist[0])[1]))] else: pattern, ok = QInputDialog.getText( None, self.trUtf8("Translation Pattern"), - self.trUtf8("Enter the path pattern for translation files " - "(use '%language%' in place of the language code):"), + self.trUtf8( + "Enter the path pattern for translation files " + "(use '%language%' in place of the language code):"), QLineEdit.Normal, tslist[0]) if pattern: @@ -2178,7 +2265,8 @@ if self.pdata["TRANSLATIONPATTERN"]: self.pdata["TRANSLATIONPATTERN"][0] = \ self.getRelativePath(self.pdata["TRANSLATIONPATTERN"][0]) - pattern = self.pdata["TRANSLATIONPATTERN"][0].replace("%language%", "*") + pattern = self.pdata["TRANSLATIONPATTERN"][0]\ + .replace("%language%", "*") for ts in tslist: if fnmatch.fnmatch(ts, pattern): self.pdata["TRANSLATIONS"].append(ts) @@ -2186,7 +2274,8 @@ if self.pdata["TRANSLATIONSBINPATH"]: tpd = os.path.join(self.ppath, self.pdata["TRANSLATIONSBINPATH"][0]) - pattern = os.path.basename(self.pdata["TRANSLATIONPATTERN"][0])\ + pattern = os.path.basename( + self.pdata["TRANSLATIONPATTERN"][0])\ .replace("%language%", "*") pattern = self.__binaryTranslationFile(pattern) qmlist = Utilities.direntries(tpd, True, pattern) @@ -2195,10 +2284,13 @@ self.projectLanguageAdded.emit(qm) if len(self.pdata["MAINSCRIPT"]) == 0 or \ len(self.pdata["MAINSCRIPT"][0]) == 0: - if self.pdata["PROGLANGUAGE"][0] in ["Python", "Python2", "Python3"]: - self.pdata["MAINSCRIPT"] = ['{0}.py'.format(mainscriptname)] + if self.pdata["PROGLANGUAGE"][0] in \ + ["Python", "Python2", "Python3"]: + self.pdata["MAINSCRIPT"] = [ + '{0}.py'.format(mainscriptname)] elif self.pdata["PROGLANGUAGE"][0] == "Ruby": - self.pdata["MAINSCRIPT"] = ['{0}.rb'.format(mainscriptname)] + self.pdata["MAINSCRIPT"] = [ + '{0}.rb'.format(mainscriptname)] self.setDirty(True) QApplication.restoreOverrideCursor() @@ -2235,13 +2327,15 @@ self.subdirs.append(tp) if self.pdata["TRANSLATIONSBINPATH"]: - tp = os.path.join(self.ppath, self.pdata["TRANSLATIONSBINPATH"][0]) + tp = os.path.join( + self.ppath, self.pdata["TRANSLATIONSBINPATH"][0]) if not os.path.isdir(tp): os.makedirs(tp) if tp != self.ppath and tp not in self.subdirs: self.subdirs.append(tp) - self.pluginGrp.setEnabled(self.pdata["PROJECTTYPE"][0] == "E4Plugin") + self.pluginGrp.setEnabled( + self.pdata["PROJECTTYPE"][0] == "E4Plugin") self.__model.projectPropertiesChanged() self.projectPropertiesChanged.emit() @@ -2251,8 +2345,8 @@ Private slot to display the user specific properties dialog. """ vcsSystem = self.pdata["VCS"] and self.pdata["VCS"][0] or None - vcsSystemOverride = \ - self.pudata["VCSOVERRIDE"] and self.pudata["VCSOVERRIDE"][0] or None + vcsSystemOverride = self.pudata["VCSOVERRIDE"] and \ + self.pudata["VCSOVERRIDE"][0] or None from .UserPropertiesDialog import UserPropertiesDialog dlg = UserPropertiesDialog(self) @@ -2277,8 +2371,10 @@ # start the VCS monitor thread if self.vcs is not None: self.vcs.startStatusMonitor(self) - self.vcs.vcsStatusMonitorData.connect(self.__model.changeVCSStates) - self.vcs.vcsStatusMonitorStatus.connect(self.__statusMonitorStatus) + self.vcs.vcsStatusMonitorData.connect( + self.__model.changeVCSStates) + self.vcs.vcsStatusMonitorStatus.connect( + self.__statusMonitorStatus) self.vcs.vcsStatusChanged.connect(self.__vcsStatusChanged) self.reinitVCS.emit() @@ -2314,7 +2410,8 @@ """ Public method to retrieve a lexer association. - @param filename filename used to determine the associated lexer language (string) + @param filename filename used to determine the associated lexer + language (string) @return the requested lexer language (string) """ # try user settings first @@ -2349,7 +2446,8 @@ fn = E5FileDialog.getOpenFileName( self.parent(), self.trUtf8("Open project"), - Preferences.getMultiProject("Workspace") or Utilities.getHomeDir(), + Preferences.getMultiProject("Workspace") or \ + Utilities.getHomeDir(), self.trUtf8("Project Files (*.e4p)")) QApplication.processEvents() @@ -2385,23 +2483,28 @@ # check, if project is version controlled pluginManager = e5App().getObject("PluginManager") for indicator, vcsData in \ - list(pluginManager.getVcsSystemIndicators().items()): - if os.path.exists(os.path.join(self.ppath, indicator)): + pluginManager.getVcsSystemIndicators().items(): + if os.path.exists( + os.path.join(self.ppath, indicator)): if len(vcsData) > 1: vcsList = [] - for vcsSystemStr, vcsSystemDisplay in vcsData: + for vcsSystemStr, vcsSystemDisplay in \ + vcsData: vcsList.append(vcsSystemDisplay) QApplication.restoreOverrideCursor() res, vcs_ok = QInputDialog.getItem( None, self.trUtf8("New Project"), - self.trUtf8("Select Version Control System"), + self.trUtf8( + "Select Version Control System"), vcsList, 0, False) - QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) + QApplication.setOverrideCursor( + QCursor(Qt.WaitCursor)) QApplication.processEvents() if vcs_ok: - for vcsSystemStr, vcsSystemDisplay in vcsData: + for vcsSystemStr, vcsSystemDisplay in \ + vcsData: if res == vcsSystemDisplay: vcsSystem = vcsSystemStr break @@ -2415,7 +2518,8 @@ self.vcs = self.initVCS() self.setDirty(True) if self.vcs is not None and \ - self.vcs.vcsRegisteredState(self.ppath) != self.vcs.canBeCommitted: + (self.vcs.vcsRegisteredState(self.ppath) != + self.vcs.canBeCommitted): self.pdata["VCS"] = ['None'] self.vcs = self.initVCS() self.closeAct.setEnabled(True) @@ -2434,7 +2538,8 @@ self.menuDiagramAct.setEnabled(True) self.menuApidocAct.setEnabled(True) self.menuPackagersAct.setEnabled(True) - self.pluginGrp.setEnabled(self.pdata["PROJECTTYPE"][0] == "E4Plugin") + self.pluginGrp.setEnabled( + self.pdata["PROJECTTYPE"][0] == "E4Plugin") self.addLanguageAct.setEnabled( len(self.pdata["TRANSLATIONPATTERN"]) > 0 and \ self.pdata["TRANSLATIONPATTERN"][0] != '') @@ -2456,7 +2561,8 @@ # open the main script if len(self.pdata["MAINSCRIPT"]) == 1: self.sourceFile.emit( - os.path.join(self.ppath, self.pdata["MAINSCRIPT"][0])) + os.path.join( + self.ppath, self.pdata["MAINSCRIPT"][0])) # open a project session file being quiet about errors if reopen: @@ -2464,7 +2570,8 @@ elif Preferences.getProject("AutoLoadSession"): self.__readSession(quiet=True) - # open a project debugger properties file being quiet about errors + # open a project debugger properties file being quiet + # about errors if Preferences.getProject("AutoLoadDbgProperties"): self.__readDebugProperties(True) @@ -2701,7 +2808,8 @@ if reportSyntaxErrors and filesWithSyntaxErrors > 0: E5MessageBox.critical(self.ui, self.trUtf8("Syntax errors detected"), - self.trUtf8("""The project contains %n file(s) with syntax errors.""", + self.trUtf8( + """The project contains %n file(s) with syntax errors.""", "", filesWithSyntaxErrors) ) return False @@ -2731,7 +2839,8 @@ if reportSyntaxErrors and filesWithSyntaxErrors > 0: E5MessageBox.critical(self.ui, self.trUtf8("Syntax errors detected"), - self.trUtf8("""The project contains %n file(s) with syntax errors.""", + self.trUtf8( + """The project contains %n file(s) with syntax errors.""", "", filesWithSyntaxErrors) ) return False @@ -2742,7 +2851,8 @@ """ Public method to return the main script filename. - @param normalized flag indicating a normalized filename is wanted (boolean) + @param normalized flag indicating a normalized filename is wanted + (boolean) @return filename of the projects main script (string) """ if len(self.pdata["MAINSCRIPT"]): @@ -2757,11 +2867,13 @@ """ Public method to return the source script files. - @param normalized flag indicating a normalized filename is wanted (boolean) + @param normalized flag indicating a normalized filename is wanted + (boolean) @return list of the projects scripts (list of string) """ if normalized: - return [os.path.join(self.ppath, fn) for fn in self.pdata["SOURCES"]] + return [os.path.join(self.ppath, fn) for fn in + self.pdata["SOURCES"]] else: return self.pdata["SOURCES"] @@ -2866,8 +2978,9 @@ if self.ppath: if path == self.ppath: return True - elif Utilities.normcasepath(Utilities.toNativeSeparators(path)).startswith( - Utilities.normcasepath(Utilities.toNativeSeparators(self.ppath + "/"))): + elif Utilities.normcasepath(Utilities.toNativeSeparators(path))\ + .startswith(Utilities.normcasepath( + Utilities.toNativeSeparators(self.ppath + "/"))): return True else: return False @@ -2997,7 +3110,8 @@ def isProjectFile(self, fn): """ - Public method used to check, if the passed in filename belongs to the project. + Public method used to check, if the passed in filename belongs to the + project. @param fn filename to be checked (string) @return flag indicating membership (boolean) @@ -3011,7 +3125,8 @@ def __checkProjectFileGroup(self, fn, group): """ - Private method to check, if a file is in a specific file group of the project. + Private method to check, if a file is in a specific file group of the + project. @param fn filename to be checked (string) @param group group to check (string) @@ -3041,8 +3156,8 @@ def isProjectSource(self, fn): """ - Public method used to check, if the passed in filename belongs to the project - sources. + Public method used to check, if the passed in filename belongs to the + project sources. @param fn filename to be checked (string) @return flag indicating membership (boolean) @@ -3051,8 +3166,8 @@ def isProjectForm(self, fn): """ - Public method used to check, if the passed in filename belongs to the project - forms. + Public method used to check, if the passed in filename belongs to the + project forms. @param fn filename to be checked (string) @return flag indicating membership (boolean) @@ -3061,8 +3176,8 @@ def isProjectInterface(self, fn): """ - Public method used to check, if the passed in filename belongs to the project - interfaces. + Public method used to check, if the passed in filename belongs to the + project interfaces. @param fn filename to be checked (string) @return flag indicating membership (boolean) @@ -3071,8 +3186,8 @@ def isProjectResource(self, fn): """ - Public method used to check, if the passed in filename belongs to the project - resources. + Public method used to check, if the passed in filename belongs to the + project resources. @param fn filename to be checked (string) @return flag indicating membership (boolean) @@ -3137,7 +3252,8 @@ self.saveasAct = E5Action(self.trUtf8('Save project as'), UI.PixmapCache.getIcon("projectSaveAs.png"), self.trUtf8('Save &as...'), 0, 0, self, 'project_save_as') - self.saveasAct.setStatusTip(self.trUtf8('Save the current project to a new file')) + self.saveasAct.setStatusTip(self.trUtf8( + 'Save the current project to a new file')) self.saveasAct.setWhatsThis(self.trUtf8( """<b>Save as</b>""" """<p>This saves the current project to a new file.</p>""" @@ -3151,7 +3267,8 @@ UI.PixmapCache.getIcon("fileMisc.png"), self.trUtf8('Add &files...'), 0, 0, self.actGrp2, 'project_add_file') - self.addFilesAct.setStatusTip(self.trUtf8('Add files to the current project')) + self.addFilesAct.setStatusTip(self.trUtf8( + 'Add files to the current project')) self.addFilesAct.setWhatsThis(self.trUtf8( """<b>Add files...</b>""" """<p>This opens a dialog for adding files""" @@ -3161,10 +3278,11 @@ self.addFilesAct.triggered[()].connect(self.addFiles) self.actions.append(self.addFilesAct) - self.addDirectoryAct = E5Action(self.trUtf8('Add directory to project'), - UI.PixmapCache.getIcon("dirOpen.png"), - self.trUtf8('Add directory...'), 0, 0, - self.actGrp2, 'project_add_directory') + self.addDirectoryAct = E5Action( + self.trUtf8('Add directory to project'), + UI.PixmapCache.getIcon("dirOpen.png"), + self.trUtf8('Add directory...'), 0, 0, + self.actGrp2, 'project_add_directory') self.addDirectoryAct.setStatusTip( self.trUtf8('Add a directory to the current project')) self.addDirectoryAct.setWhatsThis(self.trUtf8( @@ -3175,10 +3293,11 @@ self.addDirectoryAct.triggered[()].connect(self.addDirectory) self.actions.append(self.addDirectoryAct) - self.addLanguageAct = E5Action(self.trUtf8('Add translation to project'), - UI.PixmapCache.getIcon("linguist4.png"), - self.trUtf8('Add &translation...'), 0, 0, - self.actGrp2, 'project_add_translation') + self.addLanguageAct = E5Action( + self.trUtf8('Add translation to project'), + UI.PixmapCache.getIcon("linguist4.png"), + self.trUtf8('Add &translation...'), 0, 0, + self.actGrp2, 'project_add_translation') self.addLanguageAct.setStatusTip( self.trUtf8('Add a translation to the current project')) self.addLanguageAct.setWhatsThis(self.trUtf8( @@ -3192,18 +3311,20 @@ act = E5Action(self.trUtf8('Search new files'), self.trUtf8('Searc&h new files...'), 0, 0, self.actGrp2, 'project_search_new_files') - act.setStatusTip(self.trUtf8('Search new files in the project directory.')) + act.setStatusTip(self.trUtf8( + 'Search new files in the project directory.')) act.setWhatsThis(self.trUtf8( """<b>Search new files...</b>""" - """<p>This searches for new files (sources, *.ui, *.idl) in the project""" - """ directory and registered subdirectories.</p>""" + """<p>This searches for new files (sources, *.ui, *.idl) in""" + """ the project directory and registered subdirectories.</p>""" )) act.triggered[()].connect(self.__searchNewFiles) self.actions.append(act) self.propsAct = E5Action(self.trUtf8('Project properties'), UI.PixmapCache.getIcon("projectProps.png"), - self.trUtf8('&Properties...'), 0, 0, self, 'project_properties') + self.trUtf8('&Properties...'), 0, 0, self, + 'project_properties') self.propsAct.setStatusTip(self.trUtf8('Show the project properties')) self.propsAct.setWhatsThis(self.trUtf8( """<b>Properties...</b>""" @@ -3214,12 +3335,14 @@ self.userPropsAct = E5Action(self.trUtf8('User project properties'), UI.PixmapCache.getIcon("projectUserProps.png"), - self.trUtf8('&User Properties...'), 0, 0, self, 'project_user_properties') + self.trUtf8('&User Properties...'), 0, 0, self, + 'project_user_properties') self.userPropsAct.setStatusTip(self.trUtf8( 'Show the user specific project properties')) self.userPropsAct.setWhatsThis(self.trUtf8( """<b>User Properties...</b>""" - """<p>This shows a dialog to edit the user specific project properties.</p>""" + """<p>This shows a dialog to edit the user specific project""" + """ properties.</p>""" )) self.userPropsAct.triggered[()].connect(self.__showUserProperties) self.actions.append(self.userPropsAct) @@ -3231,24 +3354,27 @@ self.trUtf8('Show the project filetype associations')) self.filetypesAct.setWhatsThis(self.trUtf8( """<b>Filetype Associations...</b>""" - """<p>This shows a dialog to edit the filetype associations of the project.""" - """ These associations determine the type (source, form, interface""" - """ or others) with a filename pattern. They are used when adding a file""" - """ to the project and when performing a search for new files.</p>""" + """<p>This shows a dialog to edit the filetype associations of""" + """ the project. These associations determine the type""" + """ (source, form, interface or others) with a filename""" + """ pattern. They are used when adding a file to the project""" + """ and when performing a search for new files.</p>""" )) - self.filetypesAct.triggered[()].connect(self.__showFiletypeAssociations) + self.filetypesAct.triggered[()].connect( + self.__showFiletypeAssociations) self.actions.append(self.filetypesAct) self.lexersAct = E5Action(self.trUtf8('Lexer Associations'), self.trUtf8('Lexer Associations...'), 0, 0, self, 'project_lexer_associatios') - self.lexersAct.setStatusTip( - self.trUtf8('Show the project lexer associations (overriding defaults)')) + self.lexersAct.setStatusTip(self.trUtf8( + 'Show the project lexer associations (overriding defaults)')) self.lexersAct.setWhatsThis(self.trUtf8( """<b>Lexer Associations...</b>""" - """<p>This shows a dialog to edit the lexer associations of the project.""" - """ These associations override the global lexer associations. Lexers""" - """ are used to highlight the editor text.</p>""" + """<p>This shows a dialog to edit the lexer associations of""" + """ the project. These associations override the global lexer""" + """ associations. Lexers are used to highlight the editor""" + """ text.</p>""" )) self.lexersAct.triggered[()].connect(self.__showLexerAssociations) self.actions.append(self.lexersAct) @@ -3261,7 +3387,8 @@ act.setStatusTip(self.trUtf8('Show the debugger properties')) act.setWhatsThis(self.trUtf8( """<b>Debugger Properties...</b>""" - """<p>This shows a dialog to edit project specific debugger settings.</p>""" + """<p>This shows a dialog to edit project specific debugger""" + """ settings.</p>""" )) act.triggered[()].connect(self.__showDebugProperties) self.actions.append(act) @@ -3367,7 +3494,8 @@ self.trUtf8('Show some code metrics for the project.')) self.codeMetricsAct.setWhatsThis(self.trUtf8( """<b>Code Metrics...</b>""" - """<p>This shows some code metrics for all Python files in the project.</p>""" + """<p>This shows some code metrics for all Python files in""" + """ the project.</p>""" )) self.codeMetricsAct.triggered[()].connect(self.__showCodeMetrics) self.actions.append(self.codeMetricsAct) @@ -3379,8 +3507,8 @@ self.trUtf8('Show code coverage information for the project.')) self.codeCoverageAct.setWhatsThis(self.trUtf8( """<b>Code Coverage...</b>""" - """<p>This shows the code coverage information for all Python files""" - """ in the project.</p>""" + """<p>This shows the code coverage information for all Python""" + """ files in the project.</p>""" )) self.codeCoverageAct.triggered[()].connect(self.__showCodeCoverage) self.actions.append(self.codeCoverageAct) @@ -3399,16 +3527,18 @@ self.graphicsGrp = createActionGroup(self) - self.applicationDiagramAct = E5Action(self.trUtf8('Application Diagram'), - self.trUtf8('&Application Diagram...'), 0, 0, - self.graphicsGrp, 'project_application_diagram') + self.applicationDiagramAct = E5Action( + self.trUtf8('Application Diagram'), + self.trUtf8('&Application Diagram...'), 0, 0, + self.graphicsGrp, 'project_application_diagram') self.applicationDiagramAct.setStatusTip( self.trUtf8('Show a diagram of the project.')) self.applicationDiagramAct.setWhatsThis(self.trUtf8( """<b>Application Diagram...</b>""" """<p>This shows a diagram of the project.</p>""" )) - self.applicationDiagramAct.triggered[()].connect(self.handleApplicationDiagram) + self.applicationDiagramAct.triggered[()].connect( + self.handleApplicationDiagram) self.actions.append(self.applicationDiagramAct) self.loadDiagramAct = E5Action(self.trUtf8('Load Diagram'), @@ -3433,8 +3563,9 @@ self.trUtf8('Create an initial PKGLIST file for an eric5 plugin.')) self.pluginPkgListAct.setWhatsThis(self.trUtf8( """<b>Create Package List</b>""" - """<p>This creates an initial list of files to include in an eric5 """ - """plugin archive. The list is created from the project file.</p>""" + """<p>This creates an initial list of files to include in an""" + """ eric5 plugin archive. The list is created from the project""" + """ file.</p>""" )) self.pluginPkgListAct.triggered[()].connect(self.__pluginCreatePkgList) self.actions.append(self.pluginPkgListAct) @@ -3447,27 +3578,29 @@ self.trUtf8('Create an eric5 plugin archive file.')) self.pluginArchiveAct.setWhatsThis(self.trUtf8( """<b>Create Plugin Archive</b>""" - """<p>This creates an eric5 plugin archive file using the list of files """ - """given in the PKGLIST file. The archive name is built from the main """ - """script name.</p>""" + """<p>This creates an eric5 plugin archive file using the list""" + """ of files given in the PKGLIST file. The archive name is""" + """ built from the main script name.</p>""" )) self.pluginArchiveAct.triggered[()].connect(self.__pluginCreateArchive) self.actions.append(self.pluginArchiveAct) - self.pluginSArchiveAct = E5Action(self.trUtf8('Create Plugin Archive (Snapshot)'), - UI.PixmapCache.getIcon("pluginArchiveSnapshot.png"), - self.trUtf8('Create Plugin Archive (&Snapshot)'), 0, 0, - self.pluginGrp, 'project_plugin_sarchive') - self.pluginSArchiveAct.setStatusTip( - self.trUtf8('Create an eric5 plugin archive file (snapshot release).')) + self.pluginSArchiveAct = E5Action( + self.trUtf8('Create Plugin Archive (Snapshot)'), + UI.PixmapCache.getIcon("pluginArchiveSnapshot.png"), + self.trUtf8('Create Plugin Archive (&Snapshot)'), 0, 0, + self.pluginGrp, 'project_plugin_sarchive') + self.pluginSArchiveAct.setStatusTip(self.trUtf8( + 'Create an eric5 plugin archive file (snapshot release).')) self.pluginSArchiveAct.setWhatsThis(self.trUtf8( """<b>Create Plugin Archive (Snapshot)</b>""" - """<p>This creates an eric5 plugin archive file using the list of files """ - """given in the PKGLIST file. The archive name is built from the main """ - """script name. The version entry of the main script is modified to """ - """reflect a snapshot release.</p>""" + """<p>This creates an eric5 plugin archive file using the list""" + """ of files given in the PKGLIST file. The archive name is""" + """ built from the main script name. The version entry of the""" + """ main script is modified to reflect a snapshot release.</p>""" )) - self.pluginSArchiveAct.triggered[()].connect(self.__pluginCreateSnapshotArchive) + self.pluginSArchiveAct.triggered[()].connect( + self.__pluginCreateSnapshotArchive) self.actions.append(self.pluginSArchiveAct) self.closeAct.setEnabled(False) @@ -3602,7 +3735,8 @@ """ Public slot to initialize the project toolbar. - @param toolbarManager reference to a toolbar manager object (E5ToolBarManager) + @param toolbarManager reference to a toolbar manager object + (E5ToolBarManager) @return the toolbar generated (QToolBar) """ tb = QToolBar(self.trUtf8("Project"), self.ui) @@ -3673,7 +3807,8 @@ def __openRecent(self, act): """ - Private method to open a project from the list of rencently opened projects. + Private method to open a project from the list of rencently opened + projects. @param act reference to the action that triggered (QAction) """ @@ -3719,7 +3854,8 @@ except OSError: newSources = [] if self.pdata["TRANSLATIONPATTERN"]: - pattern = self.pdata["TRANSLATIONPATTERN"][0].replace("%language%", "*") + pattern = self.pdata["TRANSLATIONPATTERN"][0]\ + .replace("%language%", "*") else: pattern = "*.ts" binpattern = self.__binaryTranslationFile(pattern) @@ -3756,17 +3892,23 @@ filetype = self.pdata["FILETYPES"][pattern] break - if (filetype == "SOURCES" and fn not in self.pdata["SOURCES"]) or \ - (filetype == "FORMS" and fn not in self.pdata["FORMS"]) or \ - (filetype == "INTERFACES" and fn not in self.pdata["INTERFACES"]) or \ - (filetype == "RESOURCES" and fn not in self.pdata["RESOURCES"]) or \ + if (filetype == "SOURCES" and + fn not in self.pdata["SOURCES"]) or \ + (filetype == "FORMS" and + fn not in self.pdata["FORMS"]) or \ + (filetype == "INTERFACES" and + fn not in self.pdata["INTERFACES"]) or \ + (filetype == "RESOURCES" and + fn not in self.pdata["RESOURCES"]) or \ (filetype == "OTHERS" and fn not in self.pdata["OTHERS"]): if autoInclude and AI: self.appendFile(ns) else: newFiles.append(ns) - elif filetype == "TRANSLATIONS" and fn not in self.pdata["TRANSLATIONS"]: - if fnmatch.fnmatch(ns, pattern) or fnmatch.fnmatch(ns, binpattern): + elif filetype == "TRANSLATIONS" and \ + fn not in self.pdata["TRANSLATIONS"]: + if fnmatch.fnmatch(ns, pattern) or \ + fnmatch.fnmatch(ns, binpattern): if autoInclude and AI: self.appendFile(ns) else: @@ -3802,10 +3944,12 @@ def othersAdded(self, fn, updateModel=True): """ - Public slot to be called, if something was added to the OTHERS project data area. + Public slot to be called, if something was added to the OTHERS project + data area. @param fn filename or directory name added (string) - @param updateModel flag indicating an update of the model is requested (boolean) + @param updateModel flag indicating an update of the model is requested + (boolean) """ self.projectOthersAdded.emit(fn) updateModel and self.__model.addNewItem("OTHERS", fn) @@ -3873,7 +4017,8 @@ Public method used to instantiate a vcs system. @param vcsSystem type of VCS to be used (string) - @param nooverride flag indicating to ignore an override request (boolean) + @param nooverride flag indicating to ignore an override request + (boolean) @return a reference to the vcs object """ vcs = None @@ -3912,8 +4057,9 @@ QApplication.restoreOverrideCursor() E5MessageBox.critical(self.ui, self.trUtf8("Version Control System"), - self.trUtf8("<p>The selected VCS <b>{0}</b> could not be found." - "<br/>Reverting override.</p><p>{1}</p>")\ + self.trUtf8( + "<p>The selected VCS <b>{0}</b> could not be found." + "<br/>Reverting override.</p><p>{1}</p>")\ .format(vcsSystem, msg)) self.pudata["VCSOVERRIDE"] = [] return self.initVCS(nooverride=True) @@ -3921,9 +4067,10 @@ QApplication.restoreOverrideCursor() E5MessageBox.critical(self.ui, self.trUtf8("Version Control System"), - self.trUtf8("<p>The selected VCS <b>{0}</b> could not be found.<br/>" - "Disabling version control.</p><p>{1}</p>")\ - .format(vcsSystem, msg)) + self.trUtf8( + "<p>The selected VCS <b>{0}</b> could not be" + " found.<br/>Disabling version control.</p>" + "<p>{1}</p>").format(vcsSystem, msg)) vcs = None if forProject: self.pdata["VCS"][0] = 'None' @@ -4029,7 +4176,8 @@ def __showCodeCoverage(self): """ - Private slot used to show the code coverage information for the project files. + Private slot used to show the code coverage information for the + project files. """ fn = self.getMainScript(True) if fn is None: @@ -4171,7 +4319,8 @@ """ from Graphics.UMLDialog import UMLDialog self.loadedDiagram = None - loadedDiagram = UMLDialog(UMLDialog.NoDiagram, self, parent=self.parent()) + loadedDiagram = UMLDialog(UMLDialog.NoDiagram, + self, parent=self.parent()) if loadedDiagram.load(): self.loadedDiagram = loadedDiagram self.loadedDiagram.show(fromFile=True) @@ -4281,8 +4430,8 @@ # build the list of entries lst_ = [] - for key in \ - ["SOURCES", "FORMS", "RESOURCES", "TRANSLATIONS", "INTERFACES", "OTHERS"]: + for key in ["SOURCES", "FORMS", "RESOURCES", "TRANSLATIONS", + "INTERFACES", "OTHERS"]: lst_.extend(self.pdata[key]) lst = [] for entry in lst_: @@ -4303,14 +4452,16 @@ else: newline = self.getEolString() pkglistFile = open(pkglist, "w", encoding="utf-8", newline=newline) - pkglistFile.write("\n".join([Utilities.fromNativeSeparators(f) for f in lst])) + pkglistFile.write( + "\n".join([Utilities.fromNativeSeparators(f) for f in lst])) pkglistFile.write("\n") # ensure the file ends with an empty line pkglistFile.close() except IOError as why: E5MessageBox.critical(self.ui, self.trUtf8("Create Package List"), - self.trUtf8("""<p>The file <b>PKGLIST</b> could not be created.</p>""" - """<p>Reason: {0}</p>""").format(str(why))) + self.trUtf8( + """<p>The file <b>PKGLIST</b> could not be created.</p>""" + """<p>Reason: {0}</p>""").format(str(why))) return if not "PKGLIST" in self.pdata["OTHERS"]: @@ -4334,8 +4485,9 @@ len(self.pdata["MAINSCRIPT"][0]) == 0: E5MessageBox.critical(self.ui, self.trUtf8("Create Plugin Archive"), - self.trUtf8("""The project does not have a main script defined. """ - """Aborting...""")) + self.trUtf8( + """The project does not have a main script defined. """ + """Aborting...""")) return try: @@ -4346,42 +4498,48 @@ except IOError as why: E5MessageBox.critical(self.ui, self.trUtf8("Create Plugin Archive"), - self.trUtf8("""<p>The file <b>PKGLIST</b> could not be read.</p>""" - """<p>Reason: {0}</p>""").format(str(why))) + self.trUtf8( + """<p>The file <b>PKGLIST</b> could not be read.</p>""" + """<p>Reason: {0}</p>""").format(str(why))) return - archive = \ - os.path.join(self.ppath, self.pdata["MAINSCRIPT"][0].replace(".py", ".zip")) + archive = os.path.join( + self.ppath, self.pdata["MAINSCRIPT"][0].replace(".py", ".zip")) try: archiveFile = zipfile.ZipFile(archive, "w") except IOError as why: E5MessageBox.critical(self.ui, self.trUtf8("Create Plugin Archive"), - self.trUtf8("""<p>The eric5 plugin archive file <b>{0}</b> could """ - """not be created.</p>""" - """<p>Reason: {1}</p>""").format(archive, str(why))) + self.trUtf8( + """<p>The eric5 plugin archive file <b>{0}</b> could """ + """not be created.</p>""" + """<p>Reason: {1}</p>""").format(archive, str(why))) return for name in names: if name: try: - self.__createZipDirEntries(os.path.split(name)[0], archiveFile) + self.__createZipDirEntries( + os.path.split(name)[0], archiveFile) if snapshot and name == self.pdata["MAINSCRIPT"][0]: snapshotSource, version = self.__createSnapshotSource( - os.path.join(self.ppath, self.pdata["MAINSCRIPT"][0])) + os.path.join(self.ppath, + self.pdata["MAINSCRIPT"][0])) archiveFile.writestr(name, snapshotSource) else: archiveFile.write(os.path.join(self.ppath, name), name) if name == self.pdata["MAINSCRIPT"][0]: version = self.__pluginExtractVersion( - os.path.join(self.ppath, self.pdata["MAINSCRIPT"][0])) + os.path.join(self.ppath, + self.pdata["MAINSCRIPT"][0])) except OSError as why: E5MessageBox.critical(self.ui, self.trUtf8("Create Plugin Archive"), - self.trUtf8("""<p>The file <b>{0}</b> could not be stored """ - """in the archive. Ignoring it.</p>""" - """<p>Reason: {1}</p>""")\ - .format(os.path.join(self.ppath, name), str(why))) + self.trUtf8( + """<p>The file <b>{0}</b> could not be stored """ + """in the archive. Ignoring it.</p>""" + """<p>Reason: {1}</p>""")\ + .format(os.path.join(self.ppath, name), str(why))) archiveFile.writestr("VERSION", version.encode("utf-8")) archiveFile.close() @@ -4389,16 +4547,19 @@ self.appendFile(archive) if self.ui.notificationsEnabled(): - self.ui.showNotification(UI.PixmapCache.getPixmap("pluginArchive48.png"), + self.ui.showNotification( + UI.PixmapCache.getPixmap("pluginArchive48.png"), self.trUtf8("Create Plugin Archive"), - self.trUtf8("""<p>The eric5 plugin archive file <b>{0}</b> was """ - """created successfully.</p>""")\ + self.trUtf8( + """<p>The eric5 plugin archive file <b>{0}</b> was """ + """created successfully.</p>""")\ .format(os.path.basename(archive))) else: E5MessageBox.information(self.ui, self.trUtf8("Create Plugin Archive"), - self.trUtf8("""<p>The eric5 plugin archive file <b>{0}</b> was """ - """created successfully.</p>""").format(archive)) + self.trUtf8( + """<p>The eric5 plugin archive file <b>{0}</b> was """ + """created successfully.</p>""").format(archive)) def __pluginCreateSnapshotArchive(self): """ @@ -4442,7 +4603,8 @@ self.trUtf8("Create Plugin Archive"), self.trUtf8("""<p>The plugin file <b>{0}</b> could """ """not be read.</p>""" - """<p>Reason: {1}</p>""").format(filename, str(why))) + """<p>Reason: {1}</p>""") + .format(filename, str(why))) return b"", "" lineno = 0 @@ -4450,9 +4612,10 @@ if sourcelines[lineno].startswith("version = "): # found the line to modify datestr = time.strftime("%Y%m%d") - lineend = sourcelines[lineno].replace(sourcelines[lineno].rstrip(), "") - sversion = "{0}-snapshot-{1}".format( - sourcelines[lineno].replace("version = ", "").strip()[1:-1], + lineend = sourcelines[lineno]\ + .replace(sourcelines[lineno].rstrip(), "") + sversion = "{0}-snapshot-{1}".format(sourcelines[lineno]\ + .replace("version = ", "").strip()[1:-1], datestr) sourcelines[lineno] = '{0} + "-snapshot-{1}"{2}'.format( sourcelines[lineno].rstrip(), datestr, lineend)
--- a/Project/ProjectBaseBrowser.py Tue Oct 08 19:46:25 2013 +0200 +++ b/Project/ProjectBaseBrowser.py Tue Oct 08 19:47:37 2013 +0200 @@ -10,8 +10,8 @@ import os from PyQt4.QtCore import QModelIndex, pyqtSignal, Qt -from PyQt4.QtGui import QTreeView, QCursor, QItemSelection, QItemSelectionModel, \ - QApplication, QMenu, QAbstractItemView, QDialog +from PyQt4.QtGui import QTreeView, QCursor, QItemSelection, \ + QItemSelectionModel, QApplication, QMenu, QAbstractItemView, QDialog from E5Gui.E5Application import e5App from E5Gui import E5MessageBox @@ -20,7 +20,8 @@ from .ProjectBrowserModel import ProjectBrowserSimpleDirectoryItem, \ ProjectBrowserDirectoryItem, ProjectBrowserFileItem -from .ProjectBrowserSortFilterProxyModel import ProjectBrowserSortFilterProxyModel +from .ProjectBrowserSortFilterProxyModel import \ + ProjectBrowserSortFilterProxyModel class ProjectBaseBrowser(Browser): @@ -111,7 +112,8 @@ # create the menu for multiple selected files self.multiMenu = QMenu(self) - self.multiMenu.addAction(QApplication.translate('ProjectBaseBrowser', 'Open'), + self.multiMenu.addAction( + QApplication.translate('ProjectBaseBrowser', 'Open'), self._openItem) # create the background menu @@ -271,7 +273,8 @@ def _deleteDirectory(self): """ - Protected method to delete the selected directory from the project data area. + Protected method to delete the selected directory from the project + data area. """ itmList = self.getSelectedItems() @@ -283,7 +286,8 @@ dn = self.project.getRelativePath(dn) dirs.append(dn) - from UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog + from UI.DeleteFilesConfirmationDialog import \ + DeleteFilesConfirmationDialog dlg = DeleteFilesConfirmationDialog(self.parent(), self.trUtf8("Delete directories"), self.trUtf8("Do you really want to delete these directories from" @@ -412,7 +416,8 @@ def _showContextMenuMulti(self, menu): """ - Protected slot called before the context menu (multiple selections) is shown. + Protected slot called before the context menu (multiple selections) is + shown. It enables/disables the VCS menu entries depending on the overall VCS status and the files status. @@ -453,7 +458,8 @@ for act in self.dirMultiMenuActions: act.setEnabled(True) else: - self.vcsHelper.showContextMenuDirMulti(menu, self.dirMultiMenuActions) + self.vcsHelper.showContextMenuDirMulti( + menu, self.dirMultiMenuActions) def _showContextMenuBack(self, menu): """ @@ -468,15 +474,16 @@ """ Protected method to select entries based on their VCS status. - @param local flag indicating local (i.e. non VCS controlled) file/directory - entries should be selected (boolean) + @param local flag indicating local (i.e. non VCS controlled) + file/directory entries should be selected (boolean) @param filter list of classes to check against """ if self.project.vcs is None: return if local: - compareString = QApplication.translate('ProjectBaseBrowser', "local") + compareString = \ + QApplication.translate('ProjectBaseBrowser', "local") else: compareString = self.project.vcs.vcsName() @@ -538,14 +545,16 @@ Public slot to handle the select local directories context menu entries. """ self._selectEntries(local=True, - filter=[ProjectBrowserSimpleDirectoryItem, ProjectBrowserDirectoryItem]) + filter=[ProjectBrowserSimpleDirectoryItem, + ProjectBrowserDirectoryItem]) def selectVCSDirEntries(self): """ Public slot to handle the select VCS directories context menu entries. """ self._selectEntries(local=False, - filter=[ProjectBrowserSimpleDirectoryItem, ProjectBrowserDirectoryItem]) + filter=[ProjectBrowserSimpleDirectoryItem, + ProjectBrowserDirectoryItem]) def _prepareRepopulateItem(self, name): """ @@ -572,7 +581,8 @@ if childIndex.parent() == index.parent(): break if self.isExpanded(childIndex): - self.expandedNames.append(self.model().item(childIndex).data(0)) + self.expandedNames.append( + self.model().item(childIndex).data(0)) childIndex = self.indexBelow(childIndex) def _completeRepopulateItem(self, name): @@ -588,12 +598,14 @@ if self.isExpanded(index): childIndex = self.indexBelow(index) while childIndex.isValid(): - if not childIndex.isValid() or childIndex.parent() == index.parent(): + if not childIndex.isValid() or \ + childIndex.parent() == index.parent(): break itm = self.model().item(childIndex) if itm is not None: itemData = itm.data(0) - if self.currentItemName and self.currentItemName == itemData: + if self.currentItemName and \ + self.currentItemName == itemData: self._selectSingleItem(childIndex) if itemData in self.expandedNames: self.setExpanded(childIndex, True) @@ -615,9 +627,9 @@ itm = self.model().item(self.currentIndex()) return itm - ############################################################################ + ########################################################################### ## Support for hooks below - ############################################################################ + ########################################################################### def _initHookMethods(self): """ @@ -682,4 +694,5 @@ """ Protected method to open the configuration dialog. """ - e5App().getObject("UserInterface").showPreferences("projectBrowserPage") + e5App().getObject("UserInterface")\ + .showPreferences("projectBrowserPage")
--- a/Project/ProjectBrowser.py Tue Oct 08 19:46:25 2013 +0200 +++ b/Project/ProjectBrowser.py Tue Oct 08 19:47:37 2013 +0200 @@ -139,7 +139,8 @@ self.project.projectOpened.connect(self.__projectOpened) self.project.projectClosed.connect(self.__projectClosed) self.project.newProject.connect(self.__newProject) - self.project.projectPropertiesChanged.connect(self.__projectPropertiesChanged) + self.project.projectPropertiesChanged.connect( + self.__projectPropertiesChanged) self.currentChanged.connect(self.__currentChanged) self.project.getModel().vcsStateChanged.connect(self.__vcsStateChanged) @@ -251,7 +252,8 @@ Private slot to handle the projectPropertiesChanged signal. """ if self.project.isOpen(): - flags = Preferences.getProjectBrowserFlags(self.project.getProjectType()) + flags = Preferences.getProjectBrowserFlags( + self.project.getProjectType()) else: flags = AllBrowsersFlag @@ -275,7 +277,8 @@ if not self.project.isOpen(): icon = UI.PixmapCache.getIcon("projectSources.png") else: - if self.project.pdata["PROGLANGUAGE"][0] in ["Python", "Python2", "Python3"]: + if self.project.pdata["PROGLANGUAGE"][0] in \ + ["Python", "Python2", "Python3"]: if self.project.pdata["MIXEDLANGUAGE"][0]: icon = UI.PixmapCache.getIcon("projectSourcesPyMixed.png") else: @@ -366,7 +369,8 @@ self.vcsStatusIndicator.setColor(QColor(Qt.lightGray)) else: self.vcsStatusIndicator.setColor( - Preferences.getProjectBrowserColour(self.vcsStatusColorNames[state])) + Preferences.getProjectBrowserColour( + self.vcsStatusColorNames[state])) if state not in self.vcsStatusText: self.vcsStatusIndicator.setToolTip(self.trUtf8("unknown status")) else:
--- a/Project/ProjectBrowserModel.py Tue Oct 08 19:46:25 2013 +0200 +++ b/Project/ProjectBrowserModel.py Tue Oct 08 19:47:37 2013 +0200 @@ -106,7 +106,8 @@ class ProjectBrowserSimpleDirectoryItem(BrowserItem, ProjectBrowserItemMixin): """ - Class implementing the data structure for project browser simple directory items. + Class implementing the data structure for project browser simple directory + items. """ def __init__(self, parent, projectType, text, path=""): """ @@ -165,7 +166,8 @@ return BrowserItem.lessThan(self, other, column, order) -class ProjectBrowserDirectoryItem(BrowserDirectoryItem, ProjectBrowserItemMixin): +class ProjectBrowserDirectoryItem(BrowserDirectoryItem, + ProjectBrowserItemMixin): """ Class implementing the data structure for project browser directory items. """ @@ -263,7 +265,8 @@ "Z": Preferences.getProjectBrowserColour(self.colorNames["Z"]), } - self.highLightColor = Preferences.getProjectBrowserColour("Highlighted") + self.highLightColor = \ + Preferences.getProjectBrowserColour("Highlighted") # needed by preferencesChanged() self.vcsStatusReport = {} @@ -287,7 +290,8 @@ return None elif role == Qt.BackgroundColorRole: try: - col = self.itemBackgroundColors[index.internalPointer().vcsState] + col = self.itemBackgroundColors[ + index.internalPointer().vcsState] if col.isValid(): return col else: @@ -327,14 +331,17 @@ qdir = QDir(parentItem.dirName()) if Preferences.getUI("BrowsersListHiddenFiles"): - filter = QDir.Filters(QDir.AllEntries | QDir.Hidden | QDir.NoDotAndDotDot) + filter = QDir.Filters(QDir.AllEntries | + QDir.Hidden | + QDir.NoDotAndDotDot) else: filter = QDir.Filters(QDir.AllEntries | QDir.NoDotAndDotDot) entryInfoList = qdir.entryInfoList(filter) if len(entryInfoList) > 0: if repopulate: - self.beginInsertRows(self.createIndex(parentItem.row(), 0, parentItem), + self.beginInsertRows(self.createIndex( + parentItem.row(), 0, parentItem), 0, len(entryInfoList) - 1) states = {} if self.project.vcs is not None: @@ -356,9 +363,11 @@ parentItem.getProjectTypes()[0]) if self.project.vcs is not None: fname = f.absoluteFilePath() - if states[os.path.normcase(fname)] == self.project.vcs.canBeCommitted: + if states[os.path.normcase(fname)] == \ + self.project.vcs.canBeCommitted: node.addVcsStatus(self.project.vcs.vcsName()) - self.project.clearStatusMonitorCachedState(f.absoluteFilePath()) + self.project.clearStatusMonitorCachedState( + f.absoluteFilePath()) else: node.addVcsStatus(self.trUtf8("local")) self._addItem(node, parentItem) @@ -384,7 +393,8 @@ def projectOpened(self): """ - Public method used to populate the model after a project has been opened. + Public method used to populate the model after a project has been + opened. """ self.__vcsStatus = {} states = {} @@ -393,14 +403,17 @@ if self.project.vcs is not None: for key in keys: for fn in self.project.pdata[key]: - states[os.path.normcase(os.path.join(self.project.ppath, fn))] = 0 + states[os.path.normcase( + os.path.join(self.project.ppath, fn))] = 0 self.project.vcs.clearStatusCache() - states = self.project.vcs.vcsAllRegisteredStates(states, self.project.ppath) + states = self.project.vcs.vcsAllRegisteredStates( + states, self.project.ppath) self.inRefresh = True for key in keys: - # Show the entry in bold in the others browser to make it more distinguishable + # Show the entry in bold in the others browser to make it more + # distinguishable if key == "OTHERS": bold = True else: @@ -413,8 +426,8 @@ for fn in self.project.pdata[key]: fname = os.path.join(self.project.ppath, fn) - parentItem, dt = \ - self.findParentItemByName(self.projectBrowserTypes[key], fn) + parentItem, dt = self.findParentItemByName( + self.projectBrowserTypes[key], fn) if os.path.isdir(fname): itm = ProjectBrowserDirectoryItem(parentItem, fname, self.projectBrowserTypes[key], False, bold) @@ -424,7 +437,8 @@ sourceLanguage=sourceLanguage) self._addItem(itm, parentItem) if self.project.vcs is not None: - if states[os.path.normcase(fname)] == self.project.vcs.canBeCommitted: + if states[os.path.normcase(fname)] == \ + self.project.vcs.canBeCommitted: itm.addVcsStatus(self.project.vcs.vcsName()) else: itm.addVcsStatus(self.trUtf8("local")) @@ -459,7 +473,8 @@ itm = self.findChildItem(p, 0, olditem) path = os.path.join(path, p) if itm is None: - itm = ProjectBrowserSimpleDirectoryItem(olditem, type_, p, path) + itm = ProjectBrowserSimpleDirectoryItem( + olditem, type_, p, path) self.__addVCSStatus(itm, path) if self.inRefresh: self._addItem(itm, olditem) @@ -467,7 +482,8 @@ if olditem == self.rootItem: oldindex = QModelIndex() else: - oldindex = self.createIndex(olditem.row(), 0, olditem) + oldindex = self.createIndex( + olditem.row(), 0, olditem) self.addItem(itm, oldindex) else: if type_ and type_ not in itm.getProjectTypes(): @@ -505,15 +521,16 @@ @param name name of the new item (string) @param additionalTypeStrings names of additional types (list of string) """ - # Show the entry in bold in the others browser to make it more distinguishable + # Show the entry in bold in the others browser to make it more + # distinguishable if typeString == "OTHERS": bold = True else: bold = False fname = os.path.join(self.project.ppath, name) - parentItem, dt = \ - self.findParentItemByName(self.projectBrowserTypes[typeString], name) + parentItem, dt = self.findParentItemByName( + self.projectBrowserTypes[typeString], name) if parentItem == self.rootItem: parentIndex = QModelIndex() else: @@ -636,7 +653,9 @@ return if Preferences.getUI("BrowsersListHiddenFiles"): - filter = QDir.Filters(QDir.AllEntries | QDir.Hidden | QDir.NoDotAndDotDot) + filter = QDir.Filters(QDir.AllEntries | + QDir.Hidden | + QDir.NoDotAndDotDot) else: filter = QDir.Filters(QDir.AllEntries | QDir.NoDotAndDotDot) @@ -809,8 +828,8 @@ """ Public slot to record the (non normal) VCS states. - @param statesList list of VCS state entries (list of strings) giving the - states in the first column and the path relative to the project + @param statesList list of VCS state entries (list of strings) giving + the states in the first column and the path relative to the project directory starting with the third column. The allowed status flags are: <ul>
--- a/Project/ProjectFormsBrowser.py Tue Oct 08 19:46:25 2013 +0200 +++ b/Project/ProjectFormsBrowser.py Tue Oct 08 19:47:37 2013 +0200 @@ -12,7 +12,8 @@ import shutil from PyQt4.QtCore import QThread, QFileInfo, pyqtSignal, QProcess -from PyQt4.QtGui import QDialog, QInputDialog, QApplication, QMenu, QProgressDialog +from PyQt4.QtGui import QDialog, QInputDialog, QApplication, QMenu, \ + QProgressDialog from E5Gui.E5Application import e5App from E5Gui import E5MessageBox, E5FileDialog @@ -35,17 +36,17 @@ A class used to display the forms part of the project. @signal appendStderr(str) emitted after something was received from - a QProcess on stderr + a QProcess on stderr @signal sourceFile(str) emitted to open a forms file in an editor @signal uipreview(str) emitted to preview a forms file @signal trpreview(list of str) emitted to preview form files in the - translations previewer - @signal closeSourceWindow(str) emitted after a file has been removed/deleted - from the project - @signal showMenu(str, QMenu) emitted when a menu is about to be shown. The name - of the menu and a reference to the menu are given. + translations previewer + @signal closeSourceWindow(str) emitted after a file has been + removed/deleted from the project + @signal showMenu(str, QMenu) emitted when a menu is about to be shown. The + name of the menu and a reference to the menu are given. @signal menusAboutToBeCreated() emitted when the context menus are about to - be created. This is the right moment to add or remove hook methods. + be created. This is the right moment to add or remove hook methods. """ appendStderr = pyqtSignal(str) uipreview = pyqtSignal(str) @@ -59,7 +60,8 @@ @param project reference to the project object @param parent parent widget of this browser (QWidget) """ - ProjectBaseBrowser.__init__(self, project, ProjectBrowserFormType, parent) + ProjectBaseBrowser.__init__(self, project, ProjectBrowserFormType, + parent) self.selectedItemsFilter = \ [ProjectBrowserFileItem, ProjectBrowserSimpleDirectoryItem] @@ -68,8 +70,9 @@ self.setWhatsThis(self.trUtf8( """<b>Project Forms Browser</b>""" - """<p>This allows to easily see all forms contained in the current""" - """ project. Several actions can be executed via the context menu.</p>""" + """<p>This allows to easily see all forms contained in the""" + """ current project. Several actions can be executed via the""" + """ context menu.</p>""" )) # templates for Qt4 @@ -117,18 +120,23 @@ self.menusAboutToBeCreated.emit() self.menu = QMenu(self) - if self.project.getProjectType() in ["Qt4", "PyQt5", "E4Plugin", "PySide"]: - self.menu.addAction(self.trUtf8('Compile form'), self.__compileForm) + if self.project.getProjectType() in \ + ["Qt4", "PyQt5", "E4Plugin", "PySide"]: + self.menu.addAction( + self.trUtf8('Compile form'), self.__compileForm) self.menu.addAction(self.trUtf8('Compile all forms'), self.__compileAllForms) self.menu.addAction(self.trUtf8('Generate Dialog Code...'), self.__generateDialogCode) self.menu.addSeparator() - self.menu.addAction(self.trUtf8('Open in Qt-Designer'), self.__openFile) - self.menu.addAction(self.trUtf8('Open in Editor'), self.__openFileInEditor) + self.menu.addAction( + self.trUtf8('Open in Qt-Designer'), self.__openFile) + self.menu.addAction( + self.trUtf8('Open in Editor'), self.__openFileInEditor) self.menu.addSeparator() self.menu.addAction(self.trUtf8('Preview form'), self.__UIPreview) - self.menu.addAction(self.trUtf8('Preview translations'), self.__TRPreview) + self.menu.addAction( + self.trUtf8('Preview translations'), self.__TRPreview) else: if self.hooks["compileForm"] is not None: self.menu.addAction( @@ -156,12 +164,14 @@ self.menu.addSeparator() act = self.menu.addAction(self.trUtf8('Rename file'), self._renameFile) self.menuActions.append(act) - act = self.menu.addAction(self.trUtf8('Remove from project'), self._removeFile) + act = self.menu.addAction( + self.trUtf8('Remove from project'), self._removeFile) self.menuActions.append(act) act = self.menu.addAction(self.trUtf8('Delete'), self.__deleteFile) self.menuActions.append(act) self.menu.addSeparator() - if self.project.getProjectType() in ["Qt4", "PyQt5", "E4Plugin", "PySide"]: + if self.project.getProjectType() in \ + ["Qt4", "PyQt5", "E4Plugin", "PySide"]: self.menu.addAction(self.trUtf8('New form...'), self.__newForm) else: if self.hooks["newForm"] is not None: @@ -183,8 +193,9 @@ self.menu.addAction(self.trUtf8('Configure...'), self._configure) self.backMenu = QMenu(self) - if self.project.getProjectType() in ["Qt4", "PyQt5", "E4Plugin", "PySide"] or \ - self.hooks["compileAllForms"] is not None: + if self.project.getProjectType() in \ + ["Qt4", "PyQt5", "E4Plugin", "PySide"] or \ + self.hooks["compileAllForms"] is not None: self.backMenu.addAction(self.trUtf8('Compile all forms'), self.__compileAllForms) self.backMenu.addSeparator() @@ -194,7 +205,8 @@ self.backMenu.addAction( self.hooksMenuEntries.get("newForm", self.trUtf8('New form...')), self.__newForm) - self.backMenu.addAction(self.trUtf8('Add forms...'), self.project.addUiFiles) + self.backMenu.addAction( + self.trUtf8('Add forms...'), self.project.addUiFiles) self.backMenu.addAction(self.trUtf8('Add forms directory...'), self.project.addUiDir) self.backMenu.addSeparator() @@ -208,7 +220,8 @@ # create the menu for multiple selected files self.multiMenu = QMenu(self) - if self.project.getProjectType() in ["Qt4", "PyQt5", "E4Plugin", "PySide"]: + if self.project.getProjectType() in \ + ["Qt4", "PyQt5", "E4Plugin", "PySide"]: act = self.multiMenu.addAction(self.trUtf8('Compile forms'), self.__compileSelectedForms) self.multiMenu.addSeparator() @@ -230,12 +243,14 @@ self.multiMenu.addAction( self.hooksMenuEntries.get("open", self.trUtf8('Open')), self.__openFile) - self.multiMenu.addAction(self.trUtf8('Open'), self.__openFileInEditor) + self.multiMenu.addAction( + self.trUtf8('Open'), self.__openFileInEditor) self.multiMenu.addSeparator() act = self.multiMenu.addAction(self.trUtf8('Remove from project'), self._removeFile) self.multiMenuActions.append(act) - act = self.multiMenu.addAction(self.trUtf8('Delete'), self.__deleteFile) + act = self.multiMenu.addAction( + self.trUtf8('Delete'), self.__deleteFile) self.multiMenuActions.append(act) self.multiMenu.addSeparator() self.multiMenu.addAction(self.trUtf8('Expand all directories'), @@ -246,7 +261,8 @@ self.multiMenu.addAction(self.trUtf8('Configure...'), self._configure) self.dirMenu = QMenu(self) - if self.project.getProjectType() in ["Qt4", "PyQt5", "E4Plugin", "PySide"]: + if self.project.getProjectType() in \ + ["Qt4", "PyQt5", "E4Plugin", "PySide"]: self.dirMenu.addAction(self.trUtf8('Compile all forms'), self.__compileAllForms) self.dirMenu.addSeparator() @@ -257,19 +273,23 @@ self.trUtf8('Compile all forms')), self.__compileAllForms) self.dirMenu.addSeparator() - act = self.dirMenu.addAction(self.trUtf8('Remove from project'), self._removeDir) + act = self.dirMenu.addAction( + self.trUtf8('Remove from project'), self._removeDir) self.dirMenuActions.append(act) - act = self.dirMenu.addAction(self.trUtf8('Delete'), self._deleteDirectory) + act = self.dirMenu.addAction( + self.trUtf8('Delete'), self._deleteDirectory) self.dirMenuActions.append(act) self.dirMenu.addSeparator() - if self.project.getProjectType() in ["Qt4", "PyQt5", "E4Plugin", "PySide"]: + if self.project.getProjectType() in \ + ["Qt4", "PyQt5", "E4Plugin", "PySide"]: self.dirMenu.addAction(self.trUtf8('New form...'), self.__newForm) else: if self.hooks["newForm"] is not None: self.dirMenu.addAction( self.hooksMenuEntries.get("newForm", self.trUtf8('New form...')), self.__newForm) - self.dirMenu.addAction(self.trUtf8('Add forms...'), self.__addFormFiles) + self.dirMenu.addAction( + self.trUtf8('Add forms...'), self.__addFormFiles) self.dirMenu.addAction(self.trUtf8('Add forms directory...'), self.__addFormsDirectory) self.dirMenu.addSeparator() @@ -284,7 +304,8 @@ self.dirMenu.addAction(self.trUtf8('Configure...'), self._configure) self.dirMultiMenu = QMenu(self) - if self.project.getProjectType() in ["Qt4", "PyQt5", "E4Plugin", "PySide"]: + if self.project.getProjectType() in \ + ["Qt4", "PyQt5", "E4Plugin", "PySide"]: self.dirMultiMenu.addAction(self.trUtf8('Compile all forms'), self.__compileAllForms) self.dirMultiMenu.addSeparator() @@ -305,7 +326,8 @@ self.dirMultiMenu.addAction(self.trUtf8('Collapse all directories'), self._collapseAllDirs) self.dirMultiMenu.addSeparator() - self.dirMultiMenu.addAction(self.trUtf8('Configure...'), self._configure) + self.dirMultiMenu.addAction( + self.trUtf8('Configure...'), self._configure) self.menu.aboutToShow.connect(self.__showContextMenu) self.multiMenu.aboutToShow.connect(self.__showContextMenuMulti) @@ -332,7 +354,8 @@ if index.isValid(): self._selectSingleItem(index) categories = self.getSelectedItemsCountCategorized( - [ProjectBrowserFileItem, ProjectBrowserSimpleDirectoryItem]) + [ProjectBrowserFileItem, + ProjectBrowserSimpleDirectoryItem]) cnt = categories["sum"] bfcnt = categories[str(ProjectBrowserFileItem)] @@ -498,12 +521,14 @@ if self.hooks["newForm"] is not None: self.hooks["newForm"](path) else: - if self.project.getProjectType() in ["Qt4", "PyQt5", "E4Plugin", "PySide"]: + if self.project.getProjectType() in \ + ["Qt4", "PyQt5", "E4Plugin", "PySide"]: self.__newUiForm(path) def __newUiForm(self, path): """ - Private slot to handle the New Form menu action for Qt-related projects. + Private slot to handle the New Form menu action for Qt-related + projects. @param path full directory path for the new form file (string) """ @@ -553,7 +578,8 @@ except IOError as e: E5MessageBox.critical(self, self.trUtf8("New Form"), - self.trUtf8("<p>The new form file <b>{0}</b> could not be created.<br>" + self.trUtf8( + "<p>The new form file <b>{0}</b> could not be created.<br>" "Problem: {1}</p>").format(fname, str(e))) return @@ -574,10 +600,12 @@ fn = self.project.getRelativePath(fn2) files.append(fn) - from UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog + from UI.DeleteFilesConfirmationDialog import \ + DeleteFilesConfirmationDialog dlg = DeleteFilesConfirmationDialog(self.parent(), self.trUtf8("Delete forms"), - self.trUtf8("Do you really want to delete these forms from the project?"), + self.trUtf8( + "Do you really want to delete these forms from the project?"), files) if dlg.exec_() == QDialog.Accepted: @@ -585,9 +613,9 @@ self.closeSourceWindow.emit(fn2) self.project.deleteFile(fn) - ############################################################################ + ########################################################################### ## Methods to handle the various compile commands - ############################################################################ + ########################################################################### def __readStdout(self): """ @@ -649,7 +677,8 @@ self.trUtf8("The compilation of the form file" " was successful.")) else: - ui.showNotification(UI.PixmapCache.getPixmap("designer48.png"), + ui.showNotification( + UI.PixmapCache.getPixmap("designer48.png"), self.trUtf8("Form Compilation"), self.trUtf8("The compilation of the form file" " was successful.")) @@ -658,12 +687,15 @@ if not self.noDialog: E5MessageBox.information(self, self.trUtf8("Form Compilation"), - self.trUtf8("<p>The compilation of the form file failed.</p>" + self.trUtf8( + "<p>The compilation of the form file failed.</p>" "<p>Reason: {0}</p>").format(str(msg))) else: - ui.showNotification(UI.PixmapCache.getPixmap("designer48.png"), + ui.showNotification( + UI.PixmapCache.getPixmap("designer48.png"), self.trUtf8("Form Compilation"), - self.trUtf8("<p>The compilation of the form file failed.</p>" + self.trUtf8( + "<p>The compilation of the form file failed.</p>" "<p>Reason: {0}</p>").format(str(msg))) else: if not self.noDialog: @@ -689,7 +721,8 @@ args = [] self.buf = "" - if self.project.pdata["PROGLANGUAGE"][0] in ["Python", "Python2", "Python3"]: + if self.project.pdata["PROGLANGUAGE"][0] in \ + ["Python", "Python2", "Python3"]: if self.project.getProjectType() in ["Qt4", "E4Plugin"]: self.uicompiler = 'pyuic4' if Utilities.isWindowsPlatform(): @@ -722,7 +755,8 @@ ofn, ext = os.path.splitext(fn) fn = os.path.join(self.project.ppath, fn) - if self.project.pdata["PROGLANGUAGE"][0] in ["Python", "Python2", "Python3"]: + if self.project.pdata["PROGLANGUAGE"][0] in \ + ["Python", "Python2", "Python3"]: dirname, filename = os.path.split(ofn) self.compiledFile = os.path.join(dirname, "Ui_" + filename + ".py") args.append("-x") @@ -869,7 +903,8 @@ # ignore the request for non Qt GUI projects return - progress = QProgressDialog(self.trUtf8("Determining changed forms..."), + progress = QProgressDialog( + self.trUtf8("Determining changed forms..."), None, 0, 100) progress.setMinimumDuration(0) i = 0 @@ -896,7 +931,8 @@ QApplication.processEvents() if changedForms: - progress.setLabelText(self.trUtf8("Compiling changed forms...")) + progress.setLabelText( + self.trUtf8("Compiling changed forms...")) progress.setMaximum(len(changedForms)) i = 0 progress.setValue(i) @@ -921,9 +957,9 @@ """ ProjectBaseBrowser.handlePreferencesChanged(self) - ############################################################################ + ########################################################################### ## Support for hooks below - ############################################################################ + ########################################################################### def _initHookMethods(self): """
--- a/Project/ProjectInterfacesBrowser.py Tue Oct 08 19:46:25 2013 +0200 +++ b/Project/ProjectInterfacesBrowser.py Tue Oct 08 19:47:37 2013 +0200 @@ -4,7 +4,8 @@ # """ -Module implementing the a class used to display the interfaces (IDL) part of the project. +Module implementing the a class used to display the interfaces (IDL) part +of the project. """ import os @@ -21,8 +22,8 @@ ProjectBrowserInterfaceType from .ProjectBaseBrowser import ProjectBaseBrowser -from UI.BrowserModel import BrowserFileItem, BrowserClassItem, BrowserMethodItem, \ - BrowserClassAttributeItem +from UI.BrowserModel import BrowserFileItem, BrowserClassItem, \ + BrowserMethodItem, BrowserClassAttributeItem import UI.PixmapCache import Preferences @@ -34,14 +35,14 @@ A class used to display the interfaces (IDL) part of the project. @signal sourceFile(str, int = 0) emitted to open a file - @signal closeSourceWindow(str) emitted after a file has been removed/deleted - from the project + @signal closeSourceWindow(str) emitted after a file has been + removed/deleted from the project @signal appendStdout(str) emitted after something was received from - a QProcess on stdout + a QProcess on stdout @signal appendStderr(str) emitted after something was received from - a QProcess on stderr - @signal showMenu(str, QMenu) emitted when a menu is about to be shown. The name - of the menu and a reference to the menu are given. + a QProcess on stderr + @signal showMenu(str, QMenu) emitted when a menu is about to be shown. + The name of the menu and a reference to the menu are given. """ appendStdout = pyqtSignal(str) appendStderr = pyqtSignal(str) @@ -56,11 +57,13 @@ """ self.omniidl = Preferences.getCorba("omniidl") if self.omniidl == "": - self.omniidl = Utilities.isWindowsPlatform() and "omniidl.exe" or "omniidl" + self.omniidl = Utilities.isWindowsPlatform() and \ + "omniidl.exe" or "omniidl" if not Utilities.isinpath(self.omniidl): self.omniidl = None - ProjectBaseBrowser.__init__(self, project, ProjectBrowserInterfaceType, parent) + ProjectBaseBrowser.__init__(self, project, + ProjectBrowserInterfaceType, parent) self.selectedItemsFilter = \ [ProjectBrowserFileItem, ProjectBrowserSimpleDirectoryItem] @@ -70,8 +73,8 @@ self.setWhatsThis(self.trUtf8( """<b>Project Interfaces Browser</b>""" """<p>This allows to easily see all interfaces (CORBA IDL files)""" - """ contained in the current project. Several actions can be executed""" - """ via the context menu.</p>""" + """ contained in the current project. Several actions can be""" + """ executed via the context menu.</p>""" )) project.prepareRepopulateItem.connect(self._prepareRepopulateItem) @@ -94,12 +97,14 @@ self.__compileAllInterfaces) self.sourceMenu.addAction(self.trUtf8('Open'), self._openItem) self.sourceMenu.addSeparator() - act = self.sourceMenu.addAction(self.trUtf8('Rename file'), self._renameFile) + act = self.sourceMenu.addAction( + self.trUtf8('Rename file'), self._renameFile) self.menuActions.append(act) act = self.sourceMenu.addAction(self.trUtf8('Remove from project'), self._removeFile) self.menuActions.append(act) - act = self.sourceMenu.addAction(self.trUtf8('Delete'), self.__deleteFile) + act = self.sourceMenu.addAction( + self.trUtf8('Delete'), self.__deleteFile) self.menuActions.append(act) self.sourceMenu.addSeparator() self.sourceMenu.addAction(self.trUtf8('Add interfaces...'), @@ -116,16 +121,19 @@ self._collapseAllDirs) self.sourceMenu.addSeparator() self.sourceMenu.addAction(self.trUtf8('Configure...'), self._configure) - self.sourceMenu.addAction(self.trUtf8('Configure CORBA...'), self.__configureCorba) + self.sourceMenu.addAction( + self.trUtf8('Configure CORBA...'), self.__configureCorba) self.menu = QMenu(self) if self.omniidl is not None: - self.menu.addAction(self.trUtf8('Compile interface'), self.__compileInterface) + self.menu.addAction( + self.trUtf8('Compile interface'), self.__compileInterface) self.menu.addAction(self.trUtf8('Compile all interfaces'), self.__compileAllInterfaces) self.menu.addAction(self.trUtf8('Open'), self._openItem) self.menu.addSeparator() - self.menu.addAction(self.trUtf8('Add interfaces...'), self.__addInterfaceFiles) + self.menu.addAction( + self.trUtf8('Add interfaces...'), self.__addInterfaceFiles) self.menu.addAction(self.trUtf8('Add interfaces directory...'), self.__addInterfacesDirectory) self.menu.addSeparator() @@ -135,7 +143,8 @@ self._collapseAllDirs) self.menu.addSeparator() self.menu.addAction(self.trUtf8('Configure...'), self._configure) - self.menu.addAction(self.trUtf8('Configure CORBA...'), self.__configureCorba) + self.menu.addAction( + self.trUtf8('Configure CORBA...'), self.__configureCorba) self.backMenu = QMenu(self) if self.omniidl is not None: @@ -153,7 +162,8 @@ self._collapseAllDirs) self.backMenu.addSeparator() self.backMenu.addAction(self.trUtf8('Configure...'), self._configure) - self.backMenu.addAction(self.trUtf8('Configure CORBA...'), self.__configureCorba) + self.backMenu.addAction( + self.trUtf8('Configure CORBA...'), self.__configureCorba) self.backMenu.setEnabled(False) # create the menu for multiple selected files @@ -166,7 +176,8 @@ act = self.multiMenu.addAction(self.trUtf8('Remove from project'), self._removeFile) self.multiMenuActions.append(act) - act = self.multiMenu.addAction(self.trUtf8('Delete'), self.__deleteFile) + act = self.multiMenu.addAction( + self.trUtf8('Delete'), self.__deleteFile) self.multiMenuActions.append(act) self.multiMenu.addSeparator() self.multiMenu.addAction(self.trUtf8('Expand all directories'), @@ -175,19 +186,23 @@ self._collapseAllDirs) self.multiMenu.addSeparator() self.multiMenu.addAction(self.trUtf8('Configure...'), self._configure) - self.multiMenu.addAction(self.trUtf8('Configure CORBA...'), self.__configureCorba) + self.multiMenu.addAction( + self.trUtf8('Configure CORBA...'), self.__configureCorba) self.dirMenu = QMenu(self) if self.omniidl is not None: self.dirMenu.addAction(self.trUtf8('Compile all interfaces'), self.__compileAllInterfaces) self.dirMenu.addSeparator() - act = self.dirMenu.addAction(self.trUtf8('Remove from project'), self._removeFile) + act = self.dirMenu.addAction( + self.trUtf8('Remove from project'), self._removeFile) self.dirMenuActions.append(act) - act = self.dirMenu.addAction(self.trUtf8('Delete'), self._deleteDirectory) + act = self.dirMenu.addAction( + self.trUtf8('Delete'), self._deleteDirectory) self.dirMenuActions.append(act) self.dirMenu.addSeparator() - self.dirMenu.addAction(self.trUtf8('Add interfaces...'), self.__addInterfaceFiles) + self.dirMenu.addAction( + self.trUtf8('Add interfaces...'), self.__addInterfaceFiles) self.dirMenu.addAction(self.trUtf8('Add interfaces directory...'), self.__addInterfacesDirectory) self.dirMenu.addSeparator() @@ -200,7 +215,8 @@ self._collapseAllDirs) self.dirMenu.addSeparator() self.dirMenu.addAction(self.trUtf8('Configure...'), self._configure) - self.dirMenu.addAction(self.trUtf8('Configure CORBA...'), self.__configureCorba) + self.dirMenu.addAction( + self.trUtf8('Configure CORBA...'), self.__configureCorba) self.dirMultiMenu = QMenu(self) if self.omniidl is not None: @@ -217,7 +233,8 @@ self.dirMultiMenu.addAction(self.trUtf8('Collapse all directories'), self._collapseAllDirs) self.dirMultiMenu.addSeparator() - self.dirMultiMenu.addAction(self.trUtf8('Configure...'), self._configure) + self.dirMultiMenu.addAction( + self.trUtf8('Configure...'), self._configure) self.dirMultiMenu.addAction(self.trUtf8('Configure CORBA...'), self.__configureCorba) @@ -387,7 +404,8 @@ fn = self.project.getRelativePath(fn2) files.append(fn) - from UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog + from UI.DeleteFilesConfirmationDialog import \ + DeleteFilesConfirmationDialog dlg = DeleteFilesConfirmationDialog(self.parent(), self.trUtf8("Delete interfaces"), self.trUtf8("Do you really want to delete these interfaces from" @@ -399,13 +417,14 @@ self.closeSourceWindow.emit(fn2) self.project.deleteFile(fn) - ############################################################################ + ########################################################################### ## Methods to handle the various compile commands - ############################################################################ + ########################################################################### def __readStdout(self): """ - Private slot to handle the readyReadStandardOutput signal of the omniidl process. + Private slot to handle the readyReadStandardOutput signal of the + omniidl process. """ if self.compileProc is None: return @@ -421,7 +440,8 @@ def __readStderr(self): """ - Private slot to handle the readyReadStandardError signal of the omniidl process. + Private slot to handle the readyReadStandardError signal of the + omniidl process. """ if self.compileProc is None: return @@ -456,20 +476,26 @@ if not self.noDialog and not ui.notificationsEnabled(): E5MessageBox.information(self, self.trUtf8("Interface Compilation"), - self.trUtf8("The compilation of the interface file was successful.")) + self.trUtf8( + "The compilation of the interface file was" + " successful.")) else: ui.showNotification(UI.PixmapCache.getPixmap("corba48.png"), self.trUtf8("Interface Compilation"), - self.trUtf8("The compilation of the interface file was successful.")) + self.trUtf8( + "The compilation of the interface file was" + " successful.")) else: if not self.noDialog: E5MessageBox.information(self, self.trUtf8("Interface Compilation"), - self.trUtf8("The compilation of the interface file failed.")) + self.trUtf8( + "The compilation of the interface file failed.")) else: ui.showNotification(UI.PixmapCache.getPixmap("corba48.png"), self.trUtf8("Interface Compilation"), - self.trUtf8("The compilation of the interface file failed.")) + self.trUtf8( + "The compilation of the interface file failed.")) self.compileProc = None def __compileIDL(self, fn, noDialog=False, progress=None):
--- a/Project/ProjectOthersBrowser.py Tue Oct 08 19:46:25 2013 +0200 +++ b/Project/ProjectOthersBrowser.py Tue Oct 08 19:47:37 2013 +0200 @@ -4,8 +4,8 @@ # """ -Module implementing a class used to display the parts of the project, that don't fit -the other categories. +Module implementing a class used to display the parts of the project, that +don't fit the other categories. """ import mimetypes @@ -21,16 +21,17 @@ class ProjectOthersBrowser(ProjectBaseBrowser): """ - A class used to display the parts of the project, that don't fit the other categories. + A class used to display the parts of the project, that don't fit the + other categories. @signal sourceFile(str) emitted to open a file @signal pixmapFile(str) emitted to open a pixmap file @signal pixmapEditFile(str) emitted to edit a pixmap file @signal svgFile(str) emitted to open a SVG file - @signal closeSourceWindow(str) emitted after a file has been removed/deleted - from the project - @signal showMenu(str, QMenu) emitted when a menu is about to be shown. The name - of the menu and a reference to the menu are given. + @signal closeSourceWindow(str) emitted after a file has been + removed/deleted from the project + @signal showMenu(str, QMenu) emitted when a menu is about to be shown. + The name of the menu and a reference to the menu are given. """ showMenu = pyqtSignal(str, QMenu) @@ -41,9 +42,11 @@ @param project reference to the project object @param parent parent widget of this browser (QWidget) """ - ProjectBaseBrowser.__init__(self, project, ProjectBrowserOthersType, parent) + ProjectBaseBrowser.__init__(self, project, ProjectBrowserOthersType, + parent) - self.selectedItemsFilter = [ProjectBrowserFileItem, ProjectBrowserDirectoryItem] + self.selectedItemsFilter = [ProjectBrowserFileItem, + ProjectBrowserDirectoryItem] self.specialMenuEntries = [1] self.setWindowTitle(self.trUtf8('Others')) @@ -72,13 +75,16 @@ self.renameFileAct = self.menu.addAction(self.trUtf8('Rename file'), self._renameFile) self.menuActions.append(self.renameFileAct) - act = self.menu.addAction(self.trUtf8('Remove from project'), self.__removeItem) + act = self.menu.addAction( + self.trUtf8('Remove from project'), self.__removeItem) self.menuActions.append(act) act = self.menu.addAction(self.trUtf8('Delete'), self.__deleteItem) self.menuActions.append(act) self.menu.addSeparator() - self.menu.addAction(self.trUtf8('Add files...'), self.project.addOthersFiles) - self.menu.addAction(self.trUtf8('Add directory...'), self.project.addOthersDir) + self.menu.addAction( + self.trUtf8('Add files...'), self.project.addOthersFiles) + self.menu.addAction( + self.trUtf8('Add directory...'), self.project.addOthersDir) self.menu.addSeparator() self.menu.addAction(self.trUtf8('Refresh'), self.__refreshItem) self.menu.addSeparator() @@ -110,7 +116,8 @@ act = self.multiMenu.addAction(self.trUtf8('Remove from project'), self.__removeItem) self.multiMenuActions.append(act) - act = self.multiMenu.addAction(self.trUtf8('Delete'), self.__deleteItem) + act = self.multiMenu.addAction( + self.trUtf8('Delete'), self.__deleteItem) self.multiMenuActions.append(act) self.multiMenu.addSeparator() self.multiMenu.addAction(self.trUtf8('Expand all directories'), @@ -236,7 +243,8 @@ def __removeItem(self): """ - Private slot to remove the selected entry from the OTHERS project data area. + Private slot to remove the selected entry from the OTHERS project + data area. """ itmList = self.getSelectedItems() @@ -251,7 +259,8 @@ def __deleteItem(self): """ - Private method to delete the selected entry from the OTHERS project data area. + Private method to delete the selected entry from the OTHERS project + data area. """ itmList = self.getSelectedItems() @@ -281,10 +290,13 @@ del dirFullNames del dirNames - from UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog + from UI.DeleteFilesConfirmationDialog import \ + DeleteFilesConfirmationDialog dlg = DeleteFilesConfirmationDialog(self.parent(), self.trUtf8("Delete files/directories"), - self.trUtf8("Do you really want to delete these entries from the project?"), + self.trUtf8( + "Do you really want to delete these entries from the" + " project?"), names) if dlg.exec_() == QDialog.Accepted:
--- a/Project/ProjectResourcesBrowser.py Tue Oct 08 19:46:25 2013 +0200 +++ b/Project/ProjectResourcesBrowser.py Tue Oct 08 19:47:37 2013 +0200 @@ -31,12 +31,12 @@ A class used to display the resources part of the project. @signal appendStderr(str) emitted after something was received from - a QProcess on stderr + a QProcess on stderr @signal sourceFile(str) emitted to open a resources file in an editor - @signal closeSourceWindow(str) emitted after a file has been removed/deleted - from the project - @signal showMenu(str, QMenu) emitted when a menu is about to be shown. The name - of the menu and a reference to the menu are given. + @signal closeSourceWindow(str) emitted after a file has been + removed/deleted from the project + @signal showMenu(str, QMenu) emitted when a menu is about to be shown. + The name of the menu and a reference to the menu are given. """ appendStderr = pyqtSignal(str) showMenu = pyqtSignal(str, QMenu) @@ -51,7 +51,8 @@ @param project reference to the project object @param parent parent widget of this browser (QWidget) """ - ProjectBaseBrowser.__init__(self, project, ProjectBrowserResourceType, parent) + ProjectBaseBrowser.__init__(self, project, ProjectBrowserResourceType, + parent) self.selectedItemsFilter = \ [ProjectBrowserFileItem, ProjectBrowserSimpleDirectoryItem] @@ -60,8 +61,9 @@ self.setWhatsThis(self.trUtf8( """<b>Project Resources Browser</b>""" - """<p>This allows to easily see all resources contained in the current""" - """ project. Several actions can be executed via the context menu.</p>""" + """<p>This allows to easily see all resources contained in the""" + """ current project. Several actions can be executed via the""" + """ context menu.</p>""" )) self.compileProc = None @@ -76,7 +78,8 @@ self.dirMultiMenuActions = [] self.menu = QMenu(self) - if self.project.getProjectType() in ["Qt4", "PyQt5", "E4Plugin", "PySide"]: + if self.project.getProjectType() in \ + ["Qt4", "PyQt5", "E4Plugin", "PySide"]: self.menu.addAction(self.trUtf8('Compile resource'), self.__compileResource) self.menu.addAction(self.trUtf8('Compile all resources'), @@ -100,19 +103,23 @@ self.menu.addSeparator() act = self.menu.addAction(self.trUtf8('Rename file'), self._renameFile) self.menuActions.append(act) - act = self.menu.addAction(self.trUtf8('Remove from project'), self._removeFile) + act = self.menu.addAction( + self.trUtf8('Remove from project'), self._removeFile) self.menuActions.append(act) act = self.menu.addAction(self.trUtf8('Delete'), self.__deleteFile) self.menuActions.append(act) self.menu.addSeparator() - if self.project.getProjectType() in ["Qt4", "PyQt5", "E4Plugin", "PySide"]: - self.menu.addAction(self.trUtf8('New resource...'), self.__newResource) + if self.project.getProjectType() in \ + ["Qt4", "PyQt5", "E4Plugin", "PySide"]: + self.menu.addAction( + self.trUtf8('New resource...'), self.__newResource) else: if self.hooks["newResource"] is not None: self.menu.addAction( self.hooksMenuEntries.get("newResource", self.trUtf8('New resource...')), self.__newResource) - self.menu.addAction(self.trUtf8('Add resources...'), self.__addResourceFiles) + self.menu.addAction( + self.trUtf8('Add resources...'), self.__addResourceFiles) self.menu.addAction(self.trUtf8('Add resources directory...'), self.__addResourcesDirectory) self.menu.addSeparator() @@ -127,11 +134,13 @@ self.menu.addAction(self.trUtf8('Configure...'), self._configure) self.backMenu = QMenu(self) - if self.project.getProjectType() in ["Qt4", "PyQt5", "E4Plugin", "PySide"]: + if self.project.getProjectType() in \ + ["Qt4", "PyQt5", "E4Plugin", "PySide"]: self.backMenu.addAction(self.trUtf8('Compile all resources'), self.__compileAllResources) self.backMenu.addSeparator() - self.backMenu.addAction(self.trUtf8('New resource...'), self.__newResource) + self.backMenu.addAction( + self.trUtf8('New resource...'), self.__newResource) else: if self.hooks["compileAllResources"] is not None: self.backMenu.addAction( @@ -158,7 +167,8 @@ # create the menu for multiple selected files self.multiMenu = QMenu(self) - if self.project.getProjectType() in ["Qt4", "PyQt5", "E4Plugin", "PySide"]: + if self.project.getProjectType() in \ + ["Qt4", "PyQt5", "E4Plugin", "PySide"]: act = self.multiMenu.addAction(self.trUtf8('Compile resources'), self.__compileSelectedResources) self.multiMenu.addSeparator() @@ -174,7 +184,8 @@ act = self.multiMenu.addAction(self.trUtf8('Remove from project'), self._removeFile) self.multiMenuActions.append(act) - act = self.multiMenu.addAction(self.trUtf8('Delete'), self.__deleteFile) + act = self.multiMenu.addAction( + self.trUtf8('Delete'), self.__deleteFile) self.multiMenuActions.append(act) self.multiMenu.addSeparator() self.multiMenu.addAction(self.trUtf8('Expand all directories'), @@ -185,7 +196,8 @@ self.multiMenu.addAction(self.trUtf8('Configure...'), self._configure) self.dirMenu = QMenu(self) - if self.project.getProjectType() in ["Qt4", "PyQt5", "E4Plugin", "PySide"]: + if self.project.getProjectType() in \ + ["Qt4", "PyQt5", "E4Plugin", "PySide"]: self.dirMenu.addAction(self.trUtf8('Compile all resources'), self.__compileAllResources) self.dirMenu.addSeparator() @@ -196,13 +208,17 @@ self.trUtf8('Compile all resources')), self.__compileAllResources) self.dirMenu.addSeparator() - act = self.dirMenu.addAction(self.trUtf8('Remove from project'), self._removeDir) + act = self.dirMenu.addAction( + self.trUtf8('Remove from project'), self._removeDir) self.dirMenuActions.append(act) - act = self.dirMenu.addAction(self.trUtf8('Delete'), self._deleteDirectory) + act = self.dirMenu.addAction( + self.trUtf8('Delete'), self._deleteDirectory) self.dirMenuActions.append(act) self.dirMenu.addSeparator() - self.dirMenu.addAction(self.trUtf8('New resource...'), self.__newResource) - self.dirMenu.addAction(self.trUtf8('Add resources...'), self.__addResourceFiles) + self.dirMenu.addAction( + self.trUtf8('New resource...'), self.__newResource) + self.dirMenu.addAction( + self.trUtf8('Add resources...'), self.__addResourceFiles) self.dirMenu.addAction(self.trUtf8('Add resources directory...'), self.__addResourcesDirectory) self.dirMenu.addSeparator() @@ -217,7 +233,8 @@ self.dirMenu.addAction(self.trUtf8('Configure...'), self._configure) self.dirMultiMenu = QMenu(self) - if self.project.getProjectType() in ["Qt4", "PyQt5", "E4Plugin", "PySide"]: + if self.project.getProjectType() in \ + ["Qt4", "PyQt5", "E4Plugin", "PySide"]: self.dirMultiMenu.addAction(self.trUtf8('Compile all resources'), self.__compileAllResources) self.dirMultiMenu.addSeparator() @@ -238,7 +255,8 @@ self.dirMultiMenu.addAction(self.trUtf8('Collapse all directories'), self._collapseAllDirs) self.dirMultiMenu.addSeparator() - self.dirMultiMenu.addAction(self.trUtf8('Configure...'), self._configure) + self.dirMultiMenu.addAction( + self.trUtf8('Configure...'), self._configure) self.menu.aboutToShow.connect(self.__showContextMenu) self.multiMenu.aboutToShow.connect(self.__showContextMenuMulti) @@ -265,7 +283,8 @@ if index.isValid(): self._selectSingleItem(index) categories = self.getSelectedItemsCountCategorized( - [ProjectBrowserFileItem, ProjectBrowserSimpleDirectoryItem]) + [ProjectBrowserFileItem, + ProjectBrowserSimpleDirectoryItem]) cnt = categories["sum"] bfcnt = categories[str(ProjectBrowserFileItem)] @@ -454,10 +473,13 @@ fn = self.project.getRelativePath(fn2) files.append(fn) - from UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog + from UI.DeleteFilesConfirmationDialog import \ + DeleteFilesConfirmationDialog dlg = DeleteFilesConfirmationDialog(self.parent(), self.trUtf8("Delete resources"), - self.trUtf8("Do you really want to delete these resources from the project?"), + self.trUtf8( + "Do you really want to delete these resources from the" + " project?"), files) if dlg.exec_() == QDialog.Accepted: @@ -465,9 +487,9 @@ self.closeSourceWindow.emit(fn2) self.project.deleteFile(fn) - ############################################################################ + ########################################################################### ## Methods to handle the various compile commands - ############################################################################ + ########################################################################### def __readStdout(self): """ @@ -539,17 +561,21 @@ if not self.noDialog: E5MessageBox.information(self, self.trUtf8("Resource Compilation"), - self.trUtf8("<p>The compilation of the resource file failed.</p>" - "<p>Reason: {0}</p>").format(str(msg))) + self.trUtf8( + "<p>The compilation of the resource file" + " failed.</p><p>Reason: {0}</p>").format(str(msg))) else: if not self.noDialog: E5MessageBox.information(self, self.trUtf8("Resource Compilation"), - self.trUtf8("The compilation of the resource file failed.")) + self.trUtf8( + "The compilation of the resource file failed.")) else: - ui.showNotification(UI.PixmapCache.getPixmap("resourcesCompiler48.png"), + ui.showNotification( + UI.PixmapCache.getPixmap("resourcesCompiler48.png"), self.trUtf8("Resource Compilation"), - self.trUtf8("The compilation of the resource file failed.")) + self.trUtf8( + "The compilation of the resource file failed.")) self.compileProc = None def __compileQRC(self, fn, noDialog=False, progress=None): @@ -565,13 +591,15 @@ args = [] self.buf = "" - if self.project.pdata["PROGLANGUAGE"][0] in ["Python", "Python2", "Python3"]: + if self.project.pdata["PROGLANGUAGE"][0] in \ + ["Python", "Python2", "Python3"]: if self.project.getProjectType() in ["Qt4", "E4Plugin"]: self.rccCompiler = 'pyrcc4' if Utilities.isWindowsPlatform(): self.rccCompiler += '.exe' if PYQT_VERSION >= 0x040500: - if self.project.pdata["PROGLANGUAGE"][0] in ["Python", "Python2"]: + if self.project.pdata["PROGLANGUAGE"][0] in \ + ["Python", "Python2"]: args.append("-py2") else: args.append("-py3") @@ -580,8 +608,10 @@ if Utilities.isWindowsPlatform(): self.rccCompiler += '.exe' elif self.project.getProjectType() == "PySide": - self.rccCompiler = Utilities.generatePySideToolPath('pyside-rcc') - if self.project.pdata["PROGLANGUAGE"][0] in ["Python", "Python2"]: + self.rccCompiler = Utilities.generatePySideToolPath( + 'pyside-rcc') + if self.project.pdata["PROGLANGUAGE"][0] in \ + ["Python", "Python2"]: args.append("-py2") else: args.append("-py3") @@ -603,12 +633,13 @@ fn = os.path.join(self.project.ppath, fn) dirname, filename = os.path.split(ofn) - if self.project.pdata["PROGLANGUAGE"][0] in ["Python", "Python2", "Python3"]: - self.compiledFile = os.path.join(dirname, - self.RCFilenameFormatPython.format(filename)) + if self.project.pdata["PROGLANGUAGE"][0] in \ + ["Python", "Python2", "Python3"]: + self.compiledFile = os.path.join( + dirname, self.RCFilenameFormatPython.format(filename)) elif self.project.pdata["PROGLANGUAGE"][0] == "Ruby": self.compiledFile = os.path.join( - dirname, self.RCFilenameFormatRuby.format(filename)) + dirname, self.RCFilenameFormatRuby.format(filename)) args.append(fn) self.compileProc.finished.connect(self.__compileQRCDone) @@ -731,7 +762,8 @@ lbuf = "" for line in buf.splitlines(): line = line.strip() - if line.lower().startswith("<file>") or line.lower().startswith("<file "): + if line.lower().startswith("<file>") or \ + line.lower().startswith("<file "): lbuf = line elif lbuf: lbuf = "{0}{1}".format(lbuf, line) @@ -752,9 +784,11 @@ Public method to compile all changed resources to source files. """ if self.hooks["compileChangedResources"] is not None: - self.hooks["compileChangedResources"](self.project.pdata["RESOURCES"]) + self.hooks["compileChangedResources"]( + self.project.pdata["RESOURCES"]) else: - progress = QProgressDialog(self.trUtf8("Determining changed resources..."), + progress = QProgressDialog( + self.trUtf8("Determining changed resources..."), None, 0, 100) progress.setMinimumDuration(0) i = 0 @@ -769,12 +803,12 @@ if self.project.pdata["PROGLANGUAGE"][0] in \ ["Python", "Python2", "Python3"]: dirname, filename = os.path.split(os.path.splitext(ifn)[0]) - ofn = os.path.join(dirname, - self.RCFilenameFormatPython.format(filename)) + ofn = os.path.join( + dirname, self.RCFilenameFormatPython.format(filename)) elif self.project.pdata["PROGLANGUAGE"][0] == "Ruby": dirname, filename = os.path.split(os.path.splitext(ifn)[0]) - ofn = os.path.join(dirname, - self.RCFilenameFormatRuby.format(filename)) + ofn = os.path.join( + dirname, self.RCFilenameFormatRuby.format(filename)) else: return if not os.path.exists(ofn) or \ @@ -787,7 +821,8 @@ QApplication.processEvents() if changedResources: - progress.setLabelText(self.trUtf8("Compiling changed resources...")) + progress.setLabelText( + self.trUtf8("Compiling changed resources...")) progress.setMaximum(len(changedResources)) i = 0 progress.setValue(i) @@ -812,9 +847,9 @@ """ ProjectBaseBrowser.handlePreferencesChanged(self) - ############################################################################ + ########################################################################### ## Support for hooks below - ############################################################################ + ########################################################################### def _initHookMethods(self): """ @@ -825,8 +860,10 @@ <li>compileResource: takes filename as parameter</li> <li>compileAllResources: takes list of filenames as parameter</li> <li>compileChangedResources: takes list of filenames as parameter</li> - <li>compileSelectedResources: takes list of all form filenames as parameter</li> - <li>newResource: takes full directory path of new file as parameter</li> + <li>compileSelectedResources: takes list of all form filenames as + parameter</li> + <li>newResource: takes full directory path of new file as + parameter</li> </ul> <b>Note</b>: Filenames are relative to the project directory, if not
--- a/Project/ProjectSourcesBrowser.py Tue Oct 08 19:46:25 2013 +0200 +++ b/Project/ProjectSourcesBrowser.py Tue Oct 08 19:47:37 2013 +0200 @@ -14,8 +14,8 @@ from E5Gui import E5MessageBox -from UI.BrowserModel import BrowserFileItem, BrowserClassItem, BrowserMethodItem, \ - BrowserClassAttributeItem +from UI.BrowserModel import BrowserFileItem, BrowserClassItem, \ + BrowserMethodItem, BrowserClassAttributeItem from .ProjectBrowserModel import ProjectBrowserFileItem, \ ProjectBrowserSimpleDirectoryItem, ProjectBrowserDirectoryItem, \ @@ -30,14 +30,15 @@ """ A class used to display the Sources part of the project. - @signal closeSourceWindow(str) emitted after a file has been removed/deleted - from the project - @signal showMenu(str, QMenu) emitted when a menu is about to be shown. The name - of the menu and a reference to the menu are given. + @signal closeSourceWindow(str) emitted after a file has been + removed/deleted from the project + @signal showMenu(str, QMenu) emitted when a menu is about to be shown. + The name of the menu and a reference to the menu are given. @signal sourceFile(str) emitted to open the given file. - @signal sourceFile(str, int) emitted to open the given file at the given line. - @signal sourceFile(str, int, str) emitted to open the given file as the given type - at the given line. + @signal sourceFile(str, int) emitted to open the given file at the given + line. + @signal sourceFile(str, int, str) emitted to open the given file as the + given type at the given line. """ showMenu = pyqtSignal(str, QMenu) @@ -48,7 +49,8 @@ @param project reference to the project object @param parent parent widget of this browser (QWidget) """ - ProjectBaseBrowser.__init__(self, project, ProjectBrowserSourceType, parent) + ProjectBaseBrowser.__init__(self, project, ProjectBrowserSourceType, + parent) self.selectedItemsFilter = \ [ProjectBrowserFileItem, ProjectBrowserSimpleDirectoryItem] @@ -57,8 +59,9 @@ self.setWhatsThis(self.trUtf8( """<b>Project Sources Browser</b>""" - """<p>This allows to easily see all sources contained in the current""" - """ project. Several actions can be executed via the context menu.</p>""" + """<p>This allows to easily see all sources contained in the""" + """ current project. Several actions can be executed via the""" + """ context menu.</p>""" )) project.prepareRepopulateItem.connect(self._prepareRepopulateItem) @@ -100,7 +103,8 @@ ProjectBaseBrowser._createPopupMenus(self) self.sourceMenuActions = {} - if self.project.pdata["PROGLANGUAGE"][0] in ["Python", "Python2", "Python3"]: + if self.project.pdata["PROGLANGUAGE"][0] in \ + ["Python", "Python2", "Python3"]: self.__createPythonPopupMenus() elif self.project.pdata["PROGLANGUAGE"][0] == "Ruby": self.__createRubyPopupMenus() @@ -113,7 +117,8 @@ self.checksMenu.aboutToShow.connect(self.__showContextMenuCheck) self.menuShow = QMenu(self.trUtf8('Show')) - self.menuShow.addAction(self.trUtf8('Code metrics...'), self.__showCodeMetrics) + self.menuShow.addAction( + self.trUtf8('Code metrics...'), self.__showCodeMetrics) self.coverageMenuAction = self.menuShow.addAction( self.trUtf8('Code coverage...'), self.__showCodeCoverage) self.profileMenuAction = self.menuShow.addAction( @@ -128,7 +133,8 @@ self.importsDiagramAction = self.graphicsMenu.addAction( self.trUtf8("Imports Diagram..."), self.__showImportsDiagram) self.graphicsMenu.addAction( - self.trUtf8("Application Diagram..."), self.__showApplicationDiagram) + self.trUtf8("Application Diagram..."), + self.__showApplicationDiagram) self.graphicsMenu.addSeparator() self.graphicsMenu.addAction(UI.PixmapCache.getIcon("open.png"), self.trUtf8("Load Diagram..."), self.__loadDiagram) @@ -137,12 +143,14 @@ self.unittestAction = self.sourceMenu.addAction( self.trUtf8('Run unittest...'), self.handleUnittest) self.sourceMenu.addSeparator() - act = self.sourceMenu.addAction(self.trUtf8('Rename file'), self._renameFile) + act = self.sourceMenu.addAction( + self.trUtf8('Rename file'), self._renameFile) self.menuActions.append(act) act = self.sourceMenu.addAction(self.trUtf8('Remove from project'), self._removeFile) self.menuActions.append(act) - act = self.sourceMenu.addAction(self.trUtf8('Delete'), self.__deleteFile) + act = self.sourceMenu.addAction( + self.trUtf8('Delete'), self.__deleteFile) self.menuActions.append(act) self.sourceMenu.addSeparator() self.sourceMenu.addAction(self.trUtf8('New package...'), @@ -204,7 +212,8 @@ self.attributeMenu.addAction(self.trUtf8('Collapse all directories'), self._collapseAllDirs) self.attributeMenu.addSeparator() - self.attributeMenu.addAction(self.trUtf8('Configure...'), self._configure) + self.attributeMenu.addAction( + self.trUtf8('Configure...'), self._configure) self.backMenu = QMenu(self) self.backMenu.addAction(self.trUtf8('New package...'), @@ -226,7 +235,8 @@ act = self.multiMenu.addAction(self.trUtf8('Remove from project'), self._removeFile) self.multiMenuActions.append(act) - act = self.multiMenu.addAction(self.trUtf8('Delete'), self.__deleteFile) + act = self.multiMenu.addAction( + self.trUtf8('Delete'), self.__deleteFile) self.multiMenuActions.append(act) self.multiMenu.addSeparator() self.multiMenu.addAction(self.trUtf8('Expand all directories'), @@ -237,13 +247,17 @@ self.multiMenu.addAction(self.trUtf8('Configure...'), self._configure) self.dirMenu = QMenu(self) - act = self.dirMenu.addAction(self.trUtf8('Remove from project'), self._removeDir) + act = self.dirMenu.addAction( + self.trUtf8('Remove from project'), self._removeDir) self.dirMenuActions.append(act) - act = self.dirMenu.addAction(self.trUtf8('Delete'), self._deleteDirectory) + act = self.dirMenu.addAction( + self.trUtf8('Delete'), self._deleteDirectory) self.dirMenuActions.append(act) self.dirMenu.addSeparator() - self.dirMenu.addAction(self.trUtf8('New package...'), self.__addNewPackage) - self.dirMenu.addAction(self.trUtf8('Add source files...'), self.__addSourceFiles) + self.dirMenu.addAction( + self.trUtf8('New package...'), self.__addNewPackage) + self.dirMenu.addAction( + self.trUtf8('Add source files...'), self.__addSourceFiles) self.dirMenu.addAction(self.trUtf8('Add source directory...'), self.__addSourceDirectory) self.dirMenu.addSeparator() @@ -267,7 +281,8 @@ self.dirMultiMenu.addAction(self.trUtf8('Collapse all directories'), self._collapseAllDirs) self.dirMultiMenu.addSeparator() - self.dirMultiMenu.addAction(self.trUtf8('Configure...'), self._configure) + self.dirMultiMenu.addAction( + self.trUtf8('Configure...'), self._configure) self.sourceMenu.aboutToShow.connect(self.__showContextMenu) self.multiMenu.aboutToShow.connect(self.__showContextMenuMulti) @@ -292,12 +307,14 @@ self.trUtf8("Load Diagram..."), self.__loadDiagram) self.sourceMenu.addSeparator() - act = self.sourceMenu.addAction(self.trUtf8('Rename file'), self._renameFile) + act = self.sourceMenu.addAction( + self.trUtf8('Rename file'), self._renameFile) self.menuActions.append(act) act = self.sourceMenu.addAction(self.trUtf8('Remove from project'), self._removeFile) self.menuActions.append(act) - act = self.sourceMenu.addAction(self.trUtf8('Delete'), self.__deleteFile) + act = self.sourceMenu.addAction( + self.trUtf8('Delete'), self.__deleteFile) self.menuActions.append(act) self.sourceMenu.addSeparator() self.sourceMenu.addAction(self.trUtf8('Add source files...'), @@ -315,7 +332,8 @@ self.sourceMenu.addAction(self.trUtf8('Configure...'), self._configure) self.menu.addSeparator() - self.menu.addAction(self.trUtf8('Add source files...'), self.__addSourceFiles) + self.menu.addAction( + self.trUtf8('Add source files...'), self.__addSourceFiles) self.menu.addAction(self.trUtf8('Add source directory...'), self.__addSourceDirectory) self.menu.addSeparator() @@ -346,7 +364,8 @@ self.attributeMenu.addAction(self.trUtf8('Collapse all directories'), self._collapseAllDirs) self.attributeMenu.addSeparator() - self.attributeMenu.addAction(self.trUtf8('Configure...'), self._configure) + self.attributeMenu.addAction( + self.trUtf8('Configure...'), self._configure) self.backMenu = QMenu(self) self.backMenu.addAction(self.trUtf8('Add source files...'), @@ -366,7 +385,8 @@ act = self.multiMenu.addAction(self.trUtf8('Remove from project'), self._removeFile) self.multiMenuActions.append(act) - act = self.multiMenu.addAction(self.trUtf8('Delete'), self.__deleteFile) + act = self.multiMenu.addAction( + self.trUtf8('Delete'), self.__deleteFile) self.multiMenuActions.append(act) self.multiMenu.addSeparator() self.multiMenu.addAction(self.trUtf8('Expand all directories'), @@ -377,10 +397,12 @@ self.multiMenu.addAction(self.trUtf8('Configure...'), self._configure) self.dirMenu = QMenu(self) - act = self.dirMenu.addAction(self.trUtf8('Remove from project'), self._removeDir) + act = self.dirMenu.addAction( + self.trUtf8('Remove from project'), self._removeDir) self.dirMenuActions.append(act) self.dirMenu.addSeparator() - self.dirMenu.addAction(self.trUtf8('Add source files...'), self.__addSourceFiles) + self.dirMenu.addAction( + self.trUtf8('Add source files...'), self.__addSourceFiles) self.dirMenu.addAction(self.trUtf8('Add source directory...'), self.__addSourceDirectory) self.dirMenu.addSeparator() @@ -399,7 +421,8 @@ self.dirMultiMenu.addAction(self.trUtf8('Collapse all directories'), self._collapseAllDirs) self.dirMultiMenu.addSeparator() - self.dirMultiMenu.addAction(self.trUtf8('Configure...'), self._configure) + self.dirMultiMenu.addAction( + self.trUtf8('Configure...'), self._configure) self.sourceMenu.aboutToShow.connect(self.__showContextMenu) self.multiMenu.aboutToShow.connect(self.__showContextMenuMulti) @@ -452,26 +475,31 @@ if self.project.pdata["PROGLANGUAGE"][0] in \ ["Python", "Python2", "Python3"]: if fn.endswith('.ptl'): - for act in list(self.sourceMenuActions.values()): + for act in self.sourceMenuActions.values(): act.setEnabled(False) self.classDiagramAction.setEnabled(True) self.importsDiagramAction.setEnabled(True) self.unittestAction.setEnabled(False) - self.checksMenu.menuAction().setEnabled(False) - elif fn.endswith('.rb'): # entry for mixed mode programs - for act in list(self.sourceMenuActions.values()): + self.checksMenu.menuAction().setEnabled( + False) + elif fn.endswith('.rb'): # entry for mixed + # mode programs + for act in self.sourceMenuActions.values(): act.setEnabled(False) self.classDiagramAction.setEnabled(True) self.importsDiagramAction.setEnabled(False) self.unittestAction.setEnabled(False) - self.checksMenu.menuAction().setEnabled(False) - else: # assume the source file is a Python file - for act in list(self.sourceMenuActions.values()): + self.checksMenu.menuAction().setEnabled( + False) + else: # assume the source file is a + # Python file + for act in self.sourceMenuActions.values(): act.setEnabled(True) self.classDiagramAction.setEnabled(True) self.importsDiagramAction.setEnabled(True) self.unittestAction.setEnabled(True) - self.checksMenu.menuAction().setEnabled(True) + self.checksMenu.menuAction().setEnabled( + True) self.sourceMenu.popup(self.mapToGlobal(coord)) elif isinstance(itm, BrowserClassItem) or \ isinstance(itm, BrowserMethodItem): @@ -583,13 +611,16 @@ elif itm.isPython3File(): self.sourceFile[str].emit(itm.fileName()) elif itm.isRubyFile(): - self.sourceFile[str, int, str].emit(itm.fileName(), -1, "Ruby") + self.sourceFile[str, int, str].emit( + itm.fileName(), -1, "Ruby") elif itm.isDFile(): - self.sourceFile[str, int, str].emit(itm.fileName(), -1, "D") + self.sourceFile[str, int, str].emit( + itm.fileName(), -1, "D") else: self.sourceFile[str].emit(itm.fileName()) elif isinstance(itm, BrowserClassItem): - self.sourceFile[str, int].emit(itm.fileName(), itm.classObject().lineno) + self.sourceFile[str, int].emit( + itm.fileName(), itm.classObject().lineno) elif isinstance(itm, BrowserMethodItem): self.sourceFile[str, int].emit( itm.fileName(), itm.functionObject().lineno) @@ -630,9 +661,10 @@ except OSError as err: E5MessageBox.critical(self, self.trUtf8("Add new Python package"), - self.trUtf8("""<p>The package directory <b>{0}</b> could""" - """ not be created. Aborting...</p>""" - """<p>Reason: {1}</p>""")\ + self.trUtf8( + """<p>The package directory <b>{0}</b> could""" + """ not be created. Aborting...</p>""" + """<p>Reason: {1}</p>""")\ .format(packagePath, str(err))) return packageFile = os.path.join(packagePath, "__init__.py") @@ -643,9 +675,10 @@ except IOError as err: E5MessageBox.critical(self, self.trUtf8("Add new Python package"), - self.trUtf8("""<p>The package file <b>{0}</b> could""" - """ not be created. Aborting...</p>""" - """<p>Reason: {1}</p>""")\ + self.trUtf8( + """<p>The package file <b>{0}</b> could""" + """ not be created. Aborting...</p>""" + """<p>Reason: {1}</p>""")\ .format(packageFile, str(err))) return self.project.appendFile(packageFile) @@ -698,10 +731,12 @@ fn = self.project.getRelativePath(fn2) files.append(fn) - from UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog + from UI.DeleteFilesConfirmationDialog import \ + DeleteFilesConfirmationDialog dlg = DeleteFilesConfirmationDialog(self.parent(), self.trUtf8("Delete files"), - self.trUtf8("Do you really want to delete these files from the project?"), + self.trUtf8( + "Do you really want to delete these files from the project?"), files) if dlg.exec_() == QDialog.Accepted: @@ -709,9 +744,9 @@ self.closeSourceWindow.emit(fn2) self.project.deleteFile(fn) - ############################################################################ + ########################################################################### ## Methods for the Checks submenu - ############################################################################ + ########################################################################### def __showContextMenuCheck(self): """ @@ -719,9 +754,9 @@ """ self.showMenu.emit("Checks", self.checksMenu) - ############################################################################ + ########################################################################### ## Methods for the Show submenu - ############################################################################ + ########################################################################### def __showCodeMetrics(self): """ @@ -843,9 +878,9 @@ self.profiledata.show() self.profiledata.start(pfn, fn) - ############################################################################ + ########################################################################### ## Methods for the Graphics submenu - ############################################################################ + ########################################################################### def __showContextMenuGraphics(self): """ @@ -885,8 +920,9 @@ self.trUtf8("Imports Diagram"), self.trUtf8("""Include imports from external modules?""")) from Graphics.UMLDialog import UMLDialog - self.importsDiagram = UMLDialog(UMLDialog.ImportsDiagram, self.project, package, - self, showExternalImports=res) + self.importsDiagram = UMLDialog( + UMLDialog.ImportsDiagram, self.project, package, + self, showExternalImports=res) self.importsDiagram.show() def __showPackageDiagram(self): @@ -904,8 +940,9 @@ self.trUtf8("""Include class attributes?"""), yesDefault=True) from Graphics.UMLDialog import UMLDialog - self.packageDiagram = UMLDialog(UMLDialog.PackageDiagram, self.project, package, - self, noAttrs=not res) + self.packageDiagram = UMLDialog( + UMLDialog.PackageDiagram, self.project, package, + self, noAttrs=not res) self.packageDiagram.show() def __showApplicationDiagram(self): @@ -917,8 +954,9 @@ self.trUtf8("""Include module names?"""), yesDefault=True) from Graphics.UMLDialog import UMLDialog - self.applicationDiagram = UMLDialog(UMLDialog.ApplicationDiagram, self.project, - self, noModules=not res) + self.applicationDiagram = UMLDialog( + UMLDialog.ApplicationDiagram, self.project, + self, noModules=not res) self.applicationDiagram.show() def __loadDiagram(self): @@ -927,7 +965,8 @@ """ from Graphics.UMLDialog import UMLDialog self.loadedDiagram = None - loadedDiagram = UMLDialog(UMLDialog.NoDiagram, self.project, parent=self) + loadedDiagram = UMLDialog( + UMLDialog.NoDiagram, self.project, parent=self) if loadedDiagram.load(): self.loadedDiagram = loadedDiagram self.loadedDiagram.show(fromFile=True)
--- a/Project/ProjectTranslationsBrowser.py Tue Oct 08 19:46:25 2013 +0200 +++ b/Project/ProjectTranslationsBrowser.py Tue Oct 08 19:47:37 2013 +0200 @@ -4,7 +4,8 @@ # """ -Module implementing a class used to display the translations part of the project. +Module implementing a class used to display the translations part of the +project. """ import os @@ -33,18 +34,18 @@ A class used to display the translations part of the project. @signal linguistFile(str) emitted to open a translation file with - Qt-Linguist + Qt-Linguist @signal appendStdout(str) emitted after something was received from - a QProcess on stdout + a QProcess on stdout @signal appendStderr(str) emitted after something was received from - a QProcess on stderr + a QProcess on stderr @signal sourceFile(str) emitted to open a translation file in an editor - @signal closeSourceWindow(str) emitted after a file has been removed/deleted - from the project - @signal trpreview(list of str, bool = False) emitted to preview translations in the - translations previewer - @signal showMenu(str, QMenu) emitted when a menu is about to be shown. The name - of the menu and a reference to the menu are given. + @signal closeSourceWindow(str) emitted after a file has been + removed/deleted from the project + @signal trpreview(list of str, bool = False) emitted to preview + translations in the translations previewer + @signal showMenu(str, QMenu) emitted when a menu is about to be shown. + The name of the menu and a reference to the menu are given. """ appendStdout = pyqtSignal(str) appendStderr = pyqtSignal(str) @@ -57,7 +58,8 @@ @param project reference to the project object @param parent parent widget of this browser (QWidget) """ - ProjectBaseBrowser.__init__(self, project, ProjectBrowserTranslationType, parent) + ProjectBaseBrowser.__init__(self, project, + ProjectBrowserTranslationType, parent) self.isTranslationsBrowser = True self.selectedItemsFilter = \ @@ -67,8 +69,9 @@ self.setWhatsThis(self.trUtf8( """<b>Project Translations Browser</b>""" - """<p>This allows to easily see all translations contained in the current""" - """ project. Several actions can be executed via the context menu.</p>""" + """<p>This allows to easily see all translations contained in""" + """ the current project. Several actions can be executed via""" + """ the context menu.</p>""" )) self.__lreleaseProcesses = [] @@ -104,7 +107,8 @@ self.menu = QMenu(self) if self.project.getProjectType() in \ - ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", "PySide", "PySideC"]: + ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", + "PySide", "PySideC"]: act = self.menu.addAction(self.trUtf8('Generate translation'), self.__generateSelected) self.tsMenuActions.append(act) @@ -174,7 +178,8 @@ if self.hooks["generateAllWithObsolete"] is not None: act = self.menu.addAction( self.hooksMenuEntries.get("generateAllWithObsolete", - self.trUtf8('Generate all translations (with obsolete)')), + self.trUtf8( + 'Generate all translations (with obsolete)')), self.__generateObsoleteAll) self.tsprocMenuActions.append(act) self.menu.addSeparator() @@ -205,7 +210,8 @@ act = self.menu.addAction(self.trUtf8('Remove from project'), self.__removeLanguageFile) self.menuActions.append(act) - act = self.menu.addAction(self.trUtf8('Delete'), self.__deleteLanguageFile) + act = self.menu.addAction( + self.trUtf8('Delete'), self.__deleteLanguageFile) self.menuActions.append(act) self.menu.addSeparator() self.__addTranslationAct = self.menu.addAction( @@ -220,19 +226,23 @@ self.backMenu = QMenu(self) if self.project.getProjectType() in \ - ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", "PySide", "PySideC"]: - act = self.backMenu.addAction(self.trUtf8('Generate all translations'), + ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", + "PySide", "PySideC"]: + act = self.backMenu.addAction( + self.trUtf8('Generate all translations'), self.__generateAll) self.tsprocBackMenuActions.append(act) act = self.backMenu.addAction( self.trUtf8('Generate all translations (with obsolete)'), self.__generateObsoleteAll) self.tsprocBackMenuActions.append(act) - act = self.backMenu.addAction(self.trUtf8('Release all translations'), + act = self.backMenu.addAction( + self.trUtf8('Release all translations'), self.__releaseAll) self.qmprocBackMenuActions.append(act) self.backMenu.addSeparator() - act = self.backMenu.addAction(self.trUtf8('Preview all translations'), + act = self.backMenu.addAction( + self.trUtf8('Preview all translations'), self.__TRPreview) else: if self.hooks["extractMessages"] is not None: @@ -250,7 +260,8 @@ if self.hooks["generateAllWithObsolete"] is not None: act = self.backMenu.addAction( self.hooksMenuEntries.get("generateAllWithObsolete", - self.trUtf8('Generate all translations (with obsolete)')), + self.trUtf8( + 'Generate all translations (with obsolete)')), self.__generateObsoleteAll) self.tsprocBackMenuActions.append(act) if self.hooks["releaseAll"] is not None: @@ -271,8 +282,10 @@ # create the menu for multiple selected files self.multiMenu = QMenu(self) if self.project.getProjectType() in \ - ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", "PySide", "PySideC"]: - act = self.multiMenu.addAction(self.trUtf8('Generate translations'), + ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", + "PySide", "PySideC"]: + act = self.multiMenu.addAction( + self.trUtf8('Generate translations'), self.__generateSelected) self.tsMultiMenuActions.append(act) self.tsprocMultiMenuActions.append(act) @@ -341,26 +354,31 @@ act = self.multiMenu.addAction(self.trUtf8('Remove from project'), self.__removeLanguageFile) self.multiMenuActions.append(act) - act = self.multiMenu.addAction(self.trUtf8('Delete'), self.__deleteLanguageFile) + act = self.multiMenu.addAction( + self.trUtf8('Delete'), self.__deleteLanguageFile) self.multiMenuActions.append(act) self.multiMenu.addSeparator() self.multiMenu.addAction(self.trUtf8('Configure...'), self._configure) self.dirMenu = QMenu(self) if self.project.getProjectType() in \ - ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", "PySide", "PySideC"]: - act = self.dirMenu.addAction(self.trUtf8('Generate all translations'), + ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", + "PySide", "PySideC"]: + act = self.dirMenu.addAction( + self.trUtf8('Generate all translations'), self.__generateAll) self.tsprocDirMenuActions.append(act) act = self.dirMenu.addAction( self.trUtf8('Generate all translations (with obsolete)'), self.__generateObsoleteAll) self.tsprocDirMenuActions.append(act) - act = self.dirMenu.addAction(self.trUtf8('Release all translations'), + act = self.dirMenu.addAction( + self.trUtf8('Release all translations'), self.__releaseAll) self.qmprocDirMenuActions.append(act) self.dirMenu.addSeparator() - act = self.dirMenu.addAction(self.trUtf8('Preview all translations'), + act = self.dirMenu.addAction( + self.trUtf8('Preview all translations'), self.__TRPreview) else: if self.hooks["extractMessages"] is not None: @@ -379,7 +397,8 @@ if self.hooks["generateAllWithObsolete"] is not None: act = self.dirMenu.addAction( self.hooksMenuEntries.get("generateAllWithObsolete", - self.trUtf8('Generate all translations (with obsolete)')), + self.trUtf8( + 'Generate all translations (with obsolete)')), self.__generateObsoleteAll) self.tsprocDirMenuActions.append(act) if self.hooks["releaseAll"] is not None: @@ -389,7 +408,8 @@ self.__releaseAll) self.qmprocDirMenuActions.append(act) self.dirMenu.addSeparator() - act = self.dirMenu.addAction(self.trUtf8('Delete'), self._deleteDirectory) + act = self.dirMenu.addAction( + self.trUtf8('Delete'), self._deleteDirectory) self.dirMenuActions.append(act) self.dirMenu.addSeparator() self.__addTranslationDirAct = self.dirMenu.addAction( @@ -428,7 +448,8 @@ if index.isValid(): self._selectSingleItem(index) categories = self.getSelectedItemsCountCategorized( - [ProjectBrowserFileItem, ProjectBrowserSimpleDirectoryItem]) + [ProjectBrowserFileItem, + ProjectBrowserSimpleDirectoryItem]) cnt = categories["sum"] bfcnt = categories[str(ProjectBrowserFileItem)] @@ -454,7 +475,8 @@ Private slot called by the menu aboutToShow signal. """ if self.project.getProjectType() in \ - ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", "PySide", "PySideC"]: + ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", + "PySide", "PySideC"]: tsFiles = 0 qmFiles = 0 itmList = self.getSelectedItems() @@ -483,7 +505,8 @@ if self.lreleaseProcRunning: for act in self.qmprocMenuActions: act.setEnabled(True) - self.__addTranslationAct.setEnabled(self.project.getTranslationPattern() != "") + self.__addTranslationAct.setEnabled( + self.project.getTranslationPattern() != "") ProjectBaseBrowser._showContextMenu(self, self.menu) @@ -494,7 +517,8 @@ Private slot called by the multiMenu aboutToShow signal. """ if self.project.getProjectType() in \ - ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", "PySide", "PySideC"]: + ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", + "PySide", "PySideC"]: tsFiles = 0 qmFiles = 0 itmList = self.getSelectedItems() @@ -533,14 +557,16 @@ Private slot called by the dirMenu aboutToShow signal. """ if self.project.getProjectType() in \ - ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", "PySide", "PySideC"]: + ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", + "PySide", "PySideC"]: if self.pylupdateProcRunning: for act in self.tsprocDirMenuActions: act.setEnabled(False) if self.lreleaseProcRunning: for act in self.qmprocDirMenuActions: act.setEnabled(True) - self.__addTranslationDirAct.setEnabled(self.project.getTranslationPattern() != "") + self.__addTranslationDirAct.setEnabled( + self.project.getTranslationPattern() != "") ProjectBaseBrowser._showContextMenuDir(self, self.dirMenu) @@ -551,7 +577,8 @@ Private slot called by the backMenu aboutToShow signal. """ if self.project.getProjectType() in \ - ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", "PySide", "PySideC"]: + ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", + "PySide", "PySideC"]: if self.pylupdateProcRunning: for act in self.tsprocBackMenuActions: act.setEnabled(False) @@ -622,7 +649,8 @@ translationFiles = [itm.fileName() for itm in itmList] - from UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog + from UI.DeleteFilesConfirmationDialog import \ + DeleteFilesConfirmationDialog dlg = DeleteFilesConfirmationDialog(self.parent(), self.trUtf8("Delete translation files"), self.trUtf8("Do you really want to delete these translation files" @@ -651,7 +679,8 @@ for trfile in trfiles: if trfile.startswith(dname): if trfile not in fileNames: - fileNames.append(os.path.join(self.project.ppath, trfile)) + fileNames.append( + os.path.join(self.project.ppath, trfile)) else: fn = itm.fileName() if fn not in fileNames: @@ -669,17 +698,17 @@ """ self.__TRPreview(True) - ############################################################################ + ########################################################################### ## Methods to support the generation and release commands - ############################################################################ + ########################################################################### def __writeTempProjectFile(self, langs, filter): """ - Private method to write a temporary project file suitable for pylupdate and - lrelease. + Private method to write a temporary project file suitable for + pylupdate and lrelease. - @param langs list of languages to include in the process. An empty list (default) - means that all translations should be included. + @param langs list of languages to include in the process. An empty + list (default) means that all translations should be included. (list of ProjectBrowserFileItem) @param filter list of source file extension that should be considered (list of strings) @@ -771,7 +800,8 @@ except IOError: E5MessageBox.critical(self, self.trUtf8("Write temporary project file"), - self.trUtf8("<p>The temporary project file <b>{0}</b> could not" + self.trUtf8( + "<p>The temporary project file <b>{0}</b> could not" " be written.</p>").format(outFile)) if len(self.__tmpProjects) == 0: @@ -855,9 +885,9 @@ s += error self.appendStderr.emit(s) - ############################################################################ + ########################################################################### ## Methods for the generation commands - ############################################################################ + ########################################################################### def __extractMessages(self): """ @@ -888,13 +918,16 @@ else: E5MessageBox.critical(self, self.trUtf8("Translation file generation"), - self.trUtf8("The generation of the translation files (*.ts) has failed.")) + self.trUtf8( + "The generation of the translation files (*.ts) has" + " failed.")) proc = self.sender() for index in range(len(self.__pylupdateProcesses)): if proc == self.__pylupdateProcesses[index][0]: try: - self.__tmpProjects.remove(self.__pylupdateProcesses[index][1]) + self.__tmpProjects.remove( + self.__pylupdateProcesses[index][1]) os.remove(self.__pylupdateProcesses[index][1]) except EnvironmentError: pass @@ -906,7 +939,8 @@ def __generateTSFile(self, noobsolete=False, generateAll=True): """ - Private method used to run pylupdate/pylupdate4 to generate the .ts files. + Private method used to run pylupdate/pylupdate4 to generate the .ts + files. @param noobsolete flag indicating whether obsolete entries should be kept (boolean) @@ -922,7 +956,8 @@ if generateAll: if noobsolete: if self.hooks["generateAll"] is not None: - self.hooks["generateAll"](self.project.pdata["TRANSLATIONS"]) + self.hooks["generateAll"]( + self.project.pdata["TRANSLATIONS"]) return else: if self.hooks["generateAllWithObsolete"] is not None: @@ -945,7 +980,8 @@ # generate a minimal temporary projectfile suitable for pylupdate self.__tmpProjects = [] - if self.project.pdata["PROGLANGUAGE"][0] in ["Python", "Python2", "Python3"]: + if self.project.pdata["PROGLANGUAGE"][0] in \ + ["Python", "Python2", "Python3"]: ok = self.__writeTempProjectFile(langs, [".py"]) else: ok = False @@ -1019,7 +1055,8 @@ def __generateSelected(self): """ - Private method to generate selected translation files (.ts) for Qt Linguist. + Private method to generate selected translation files (.ts) for + Qt Linguist. All obsolete strings are removed from the .ts file. """ @@ -1027,15 +1064,16 @@ def __generateObsoleteSelected(self): """ - Private method to generate selected translation files (.ts) for Qt Linguist. + Private method to generate selected translation files (.ts) for + Qt Linguist. Obsolete strings are kept. """ self.__generateTSFile(noobsolete=False, generateAll=False) - ############################################################################ + ########################################################################### ## Methods for the release commands - ############################################################################ + ########################################################################### def __releaseTSFileDone(self, exitCode, exitStatus): """ @@ -1058,8 +1096,9 @@ self.trUtf8("The release of the translation files (*.qm)" " was successful.")) if self.project.pdata["TRANSLATIONSBINPATH"]: - target = os.path.join(self.project.ppath, - self.project.pdata["TRANSLATIONSBINPATH"][0]) + target = os.path.join( + self.project.ppath, + self.project.pdata["TRANSLATIONSBINPATH"][0]) for langFile in self.project.pdata["TRANSLATIONS"][:]: if langFile.endswith('.ts'): qmFile = os.path.join(self.project.ppath, @@ -1069,13 +1108,15 @@ else: E5MessageBox.critical(self, self.trUtf8("Translation file release"), - self.trUtf8("The release of the translation files (*.qm) has failed.")) + self.trUtf8( + "The release of the translation files (*.qm) has failed.")) proc = self.sender() for index in range(len(self.__lreleaseProcesses)): if proc == self.__lreleaseProcesses[index][0]: try: - self.__tmpProjects.remove(self.__lreleaseProcesses[index][1]) + self.__tmpProjects.remove( + self.__lreleaseProcesses[index][1]) os.remove(self.__lreleaseProcesses[index][1]) except EnvironmentError: pass @@ -1112,7 +1153,8 @@ # generate a minimal temporary projectfile suitable for lrelease self.__tmpProjects = [] - if self.project.pdata["PROGLANGUAGE"][0] in ["Python", "Python2", "Python3"]: + if self.project.pdata["PROGLANGUAGE"][0] in \ + ["Python", "Python2", "Python3"]: ok = self.__writeTempProjectFile(langs, [".py"]) else: ok = False @@ -1120,7 +1162,8 @@ return if self.project.getProjectType() in \ - ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", "PySide", "PySideC"]: + ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", + "PySide", "PySideC"]: lrelease = os.path.join( Utilities.getQtBinariesPath(), Utilities.generateQtToolName("lrelease")) @@ -1174,9 +1217,9 @@ """ self.__releaseTSFile(generateAll=True) - ############################################################################ + ########################################################################### ## Support for hooks below - ############################################################################ + ########################################################################### def _initHookMethods(self): """ @@ -1188,7 +1231,8 @@ <li>generateAll: takes list of filenames as parameter</li> <li>generateAllWithObsolete: takes list of filenames as parameter</li> <li>generateSelected: takes list of filenames as parameter</li> - <li>generateSelectedWithObsolete: takes list of filenames as parameter</li> + <li>generateSelectedWithObsolete: takes list of filenames as + parameter</li> <li>releaseAll: takes list of filenames as parameter</li> <li>releaseSelected: takes list of filenames as parameter</li> <li>open: takes a filename as parameter</li>
--- a/Project/PropertiesDialog.py Tue Oct 08 19:46:25 2013 +0200 +++ b/Project/PropertiesDialog.py Tue Oct 08 19:47:37 2013 +0200 @@ -53,14 +53,17 @@ projectTypes = project.getProjectTypes() self.projectTypeComboBox.clear() for projectType in sorted(projectTypes.keys()): - self.projectTypeComboBox.addItem(projectTypes[projectType], projectType) + self.projectTypeComboBox.addItem( + projectTypes[projectType], projectType) if not new: name = os.path.splitext(self.project.pfile)[0] self.nameEdit.setText(os.path.basename(name)) self.languageComboBox.setCurrentIndex( - self.languageComboBox.findText(self.project.pdata["PROGLANGUAGE"][0])) - self.mixedLanguageCheckBox.setChecked(self.project.pdata["MIXEDLANGUAGE"][0]) + self.languageComboBox.findText( + self.project.pdata["PROGLANGUAGE"][0])) + self.mixedLanguageCheckBox.setChecked( + self.project.pdata["MIXEDLANGUAGE"][0]) curIndex = self.projectTypeComboBox.findData( self.project.pdata["PROJECTTYPE"][0]) if curIndex == -1: @@ -72,7 +75,8 @@ except IndexError: pass try: - self.mainscriptEdit.setText(self.project.pdata["MAINSCRIPT"][0]) + self.mainscriptEdit.setText( + self.project.pdata["MAINSCRIPT"][0]) except IndexError: pass try: @@ -84,7 +88,8 @@ except IndexError: pass try: - self.descriptionEdit.setPlainText(self.project.pdata["DESCRIPTION"][0]) + self.descriptionEdit.setPlainText( + self.project.pdata["DESCRIPTION"][0]) except LookupError: pass try: @@ -96,11 +101,13 @@ vcsSystemsDict = e5App().getObject("PluginManager")\ .getPluginDisplayStrings("version_control") try: - vcsSystemDisplay = vcsSystemsDict[self.project.pdata["VCS"][0]] + vcsSystemDisplay = \ + vcsSystemsDict[self.project.pdata["VCS"][0]] except KeyError: vcsSystemDisplay = "None" self.vcsLabel.setText( - self.trUtf8("The project is version controlled by <b>{0}</b>.") + self.trUtf8( + "The project is version controlled by <b>{0}</b>.") .format(vcsSystemDisplay)) self.vcsInfoButton.show() else: @@ -113,7 +120,8 @@ self.languageComboBox.findText("Python3")) self.projectTypeComboBox.setCurrentIndex( self.projectTypeComboBox.findData("Qt4")) - hp = Preferences.getMultiProject("Workspace") or Utilities.getHomeDir() + hp = Preferences.getMultiProject("Workspace") or \ + Utilities.getHomeDir() self.dirEdit.setText(hp) self.versionEdit.setText('0.1') self.vcsLabel.hide() @@ -133,7 +141,8 @@ self.projectTypeComboBox.clear() projectTypes = self.project.getProjectTypes(language) for projectType in sorted(projectTypes.keys()): - self.projectTypeComboBox.addItem(projectTypes[projectType], projectType) + self.projectTypeComboBox.addItem( + projectTypes[projectType], projectType) self.projectTypeComboBox.setCurrentIndex( self.projectTypeComboBox.findData(curProjectType)) @@ -171,9 +180,11 @@ Private slot to display the translations properties dialog. """ if self.transPropertiesDlg is None: - from .TranslationPropertiesDialog import TranslationPropertiesDialog + from .TranslationPropertiesDialog import \ + TranslationPropertiesDialog self.transPropertiesDlg = \ - TranslationPropertiesDialog(self.project, self.newProject, self) + TranslationPropertiesDialog(self.project, self.newProject, + self) else: self.transPropertiesDlg.initFilters() res = self.transPropertiesDlg.exec_() @@ -226,7 +237,8 @@ @return selected UI type (string) """ - return self.projectTypeComboBox.itemData(self.projectTypeComboBox.currentIndex()) + return self.projectTypeComboBox.itemData( + self.projectTypeComboBox.currentIndex()) def getPPath(self): """ @@ -259,10 +271,12 @@ self.project.translationsRoot = "" self.project.pdata["AUTHOR"] = [self.authorEdit.text()] self.project.pdata["EMAIL"] = [self.emailEdit.text()] - self.project.pdata["DESCRIPTION"] = [self.descriptionEdit.toPlainText()] + self.project.pdata["DESCRIPTION"] = \ + [self.descriptionEdit.toPlainText()] self.project.pdata["PROGLANGUAGE"] = \ [self.languageComboBox.currentText()] - self.project.pdata["MIXEDLANGUAGE"] = [self.mixedLanguageCheckBox.isChecked()] + self.project.pdata["MIXEDLANGUAGE"] = \ + [self.mixedLanguageCheckBox.isChecked()] projectType = self.getProjectType() if projectType is not None: self.project.pdata["PROJECTTYPE"] = [projectType]
--- a/Project/SpellingPropertiesDialog.py Tue Oct 08 19:46:25 2013 +0200 +++ b/Project/SpellingPropertiesDialog.py Tue Oct 08 19:47:37 2013 +0200 @@ -44,7 +44,8 @@ from QScintilla.SpellChecker import SpellChecker self.spellingComboBox.addItem(self.trUtf8("<default>")) - self.spellingComboBox.addItems(sorted(SpellChecker.getAvailableLanguages())) + self.spellingComboBox.addItems( + sorted(SpellChecker.getAvailableLanguages())) if not new: self.initDialog() @@ -53,16 +54,17 @@ """ Public method to initialize the dialogs data. """ - index = self.spellingComboBox.findText(self.project.pdata["SPELLLANGUAGE"][0]) + index = self.spellingComboBox.findText( + self.project.pdata["SPELLLANGUAGE"][0]) if index == -1: index = 0 self.spellingComboBox.setCurrentIndex(index) if self.project.pdata["SPELLWORDS"][0]: - self.pwlEdit.setText( - Utilities.toNativeSeparators(self.project.pdata["SPELLWORDS"][0])) + self.pwlEdit.setText(Utilities.toNativeSeparators( + self.project.pdata["SPELLWORDS"][0])) if self.project.pdata["SPELLEXCLUDES"][0]: - self.pelEdit.setText( - Utilities.toNativeSeparators(self.project.pdata["SPELLEXCLUDES"][0])) + self.pelEdit.setText(Utilities.toNativeSeparators( + self.project.pdata["SPELLEXCLUDES"][0])) @pyqtSlot() def on_pwlButton_clicked(self): @@ -73,7 +75,8 @@ if not pwl: pwl = self.project.ppath elif not os.path.isabs(pwl): - pwl = Utilities.fromNativeSeparators(os.path.join(self.project.ppath, pwl)) + pwl = Utilities.fromNativeSeparators( + os.path.join(self.project.ppath, pwl)) file = E5FileDialog.getOpenFileName( self, self.trUtf8("Select project word list"), @@ -93,7 +96,8 @@ if not pel: pel = self.project.ppath elif not os.path.isabs(pel): - pel = Utilities.fromNativeSeparators(os.path.join(self.project.ppath, pel)) + pel = Utilities.fromNativeSeparators( + os.path.join(self.project.ppath, pel)) file = E5FileDialog.getOpenFileName( self, self.trUtf8("Select project exclude list"),
--- a/Project/TranslationPropertiesDialog.py Tue Oct 08 19:46:25 2013 +0200 +++ b/Project/TranslationPropertiesDialog.py Tue Oct 08 19:47:37 2013 +0200 @@ -92,7 +92,8 @@ if "%language%" in tp: tp = tp.split("%language%")[0] if not os.path.isabs(tp): - tp = Utilities.fromNativeSeparators(os.path.join(self.project.ppath, tp)) + tp = Utilities.fromNativeSeparators( + os.path.join(self.project.ppath, tp)) tsfile = E5FileDialog.getOpenFileName( self, self.trUtf8("Select translation file"), @@ -120,7 +121,8 @@ """ tbp = Utilities.fromNativeSeparators(self.transBinPathEdit.text()) if not os.path.isabs(tbp): - tbp = Utilities.fromNativeSeparators(os.path.join(self.project.ppath, tbp)) + tbp = Utilities.fromNativeSeparators( + os.path.join(self.project.ppath, tbp)) directory = E5FileDialog.getExistingDirectory( self, self.trUtf8("Select directory for binary translations"), @@ -187,7 +189,8 @@ def on_exceptionsList_currentRowChanged(self, row): """ - Private slot to handle the currentRowChanged signal of the exceptions list. + Private slot to handle the currentRowChanged signal of the exceptions + list. @param row the current row (integer) """
--- a/Project/UserPropertiesDialog.py Tue Oct 08 19:46:25 2013 +0200 +++ b/Project/UserPropertiesDialog.py Tue Oct 08 19:47:37 2013 +0200 @@ -45,8 +45,9 @@ enableVcsGroup = False if self.project.pdata["VCS"]: found = False - for indicator, vcsData in list(e5App().getObject("PluginManager")\ - .getVcsSystemIndicators().items()): + for indicator, vcsData in \ + e5App().getObject("PluginManager")\ + .getVcsSystemIndicators().items(): for vcsSystem, vcsSystemDisplay in vcsData: if vcsSystem == self.project.pdata["VCS"][0]: found = True @@ -54,7 +55,8 @@ if found: for vcsSystem, vcsSystemDisplay in vcsData: - self.vcsInterfaceCombo.addItem(vcsSystemDisplay, vcsSystem) + self.vcsInterfaceCombo.addItem( + vcsSystemDisplay, vcsSystem) enableVcsGroup = len(vcsData) > 1 break self.vcsGroup.setEnabled(enableVcsGroup) @@ -74,8 +76,10 @@ Public method to store the entered/modified data. """ vcsStatusMonitorInterval = self.vcsStatusMonitorIntervalSpinBox.value() - if vcsStatusMonitorInterval != Preferences.getVCS("StatusMonitorInterval"): - self.project.pudata["VCSSTATUSMONITORINTERVAL"] = [vcsStatusMonitorInterval] + if vcsStatusMonitorInterval != \ + Preferences.getVCS("StatusMonitorInterval"): + self.project.pudata["VCSSTATUSMONITORINTERVAL"] = \ + [vcsStatusMonitorInterval] else: self.project.pudata["VCSSTATUSMONITORINTERVAL"] = []