Mon, 07 Oct 2013 19:10:11 +0200
Continued to shorten the code lines to max. 79 characters.
--- a/E5XML/DebuggerPropertiesReader.py Sun Oct 06 19:52:33 2013 +0200 +++ b/E5XML/DebuggerPropertiesReader.py Mon Oct 07 19:10:11 2013 +0200 @@ -4,7 +4,8 @@ # """ -Module implementing a class for reading an XML project debugger properties file. +Module implementing a class for reading an XML project debugger properties +file. """ from .Config import debuggerPropertiesFileFormatVersion @@ -42,14 +43,16 @@ self.readNext() if self.isStartElement(): if self.name() == "DebuggerProperties": - self.version = \ - self.attribute("version", debuggerPropertiesFileFormatVersion) + self.version = self.attribute( + "version", debuggerPropertiesFileFormatVersion) if self.version not in self.supportedVersions: self.raiseUnsupportedFormatVersion(self.version) elif self.name() == "Interpreter": - self.project.debugProperties["INTERPRETER"] = self.readElementText() + self.project.debugProperties["INTERPRETER"] = \ + self.readElementText() elif self.name() == "DebugClient": - self.project.debugProperties["DEBUGCLIENT"] = self.readElementText() + self.project.debugProperties["DEBUGCLIENT"] = \ + self.readElementText() elif self.name() == "Environment": self.project.debugProperties["ENVIRONMENTOVERRIDE"] = \ int(self.attribute("override", "0")) @@ -80,7 +83,8 @@ """ Private method to read the remote debugger info. """ - self.project.debugProperties["REMOTEDEBUGGER"] = int(self.attribute("on", "0")) + self.project.debugProperties["REMOTEDEBUGGER"] = int(self.attribute( + "on", "0")) while not self.atEnd(): self.readNext() @@ -89,9 +93,11 @@ if self.isStartElement(): if self.name() == "RemoteHost": - self.project.debugProperties["REMOTEHOST"] = self.readElementText() + self.project.debugProperties["REMOTEHOST"] = \ + self.readElementText() elif self.name() == "RemoteCommand": - self.project.debugProperties["REMOTECOMMAND"] = self.readElementText() + self.project.debugProperties["REMOTECOMMAND"] = \ + self.readElementText() else: self.raiseUnexpectedStartTag(self.name()) @@ -99,7 +105,8 @@ """ Private method to read the path translation info. """ - self.project.debugProperties["PATHTRANSLATION"] = int(self.attribute("on", "0")) + self.project.debugProperties["PATHTRANSLATION"] = int(self.attribute( + "on", "0")) while not self.atEnd(): self.readNext() @@ -108,8 +115,10 @@ if self.isStartElement(): if self.name() == "RemotePath": - self.project.debugProperties["REMOTEPATH"] = self.readElementText() + self.project.debugProperties["REMOTEPATH"] = \ + self.readElementText() elif self.name() == "LocalPath": - self.project.debugProperties["LOCALPATH"] = self.readElementText() + self.project.debugProperties["LOCALPATH"] = \ + self.readElementText() else: self.raiseUnexpectedStartTag(self.name())
--- a/E5XML/DebuggerPropertiesWriter.py Sun Oct 06 19:52:33 2013 +0200 +++ b/E5XML/DebuggerPropertiesWriter.py Mon Oct 07 19:10:11 2013 +0200 @@ -4,7 +4,8 @@ # """ -Module implementing the writer class for writing an XML project debugger properties file. +Module implementing the writer class for writing an XML project debugger +properties file. """ import time @@ -19,8 +20,8 @@ class DebuggerPropertiesWriter(XMLStreamWriterBase): """ - Class implementing the writer class for writing an XML project debugger properties - file. + Class implementing the writer class for writing an XML project debugger + properties file. """ def __init__(self, device, projectName): """ @@ -40,23 +41,30 @@ """ XMLStreamWriterBase.writeXML(self) - self.writeDTD('<!DOCTYPE DebuggerProperties SYSTEM "DebuggerProperties-{0}.dtd">'\ - .format(debuggerPropertiesFileFormatVersion)) + self.writeDTD( + '<!DOCTYPE DebuggerProperties SYSTEM' + ' "DebuggerProperties-{0}.dtd">'.format( + debuggerPropertiesFileFormatVersion)) # add some generation comments - self.writeComment(" eric5 debugger properties file for project {0} "\ - .format(self.name)) - self.writeComment(" This file was generated automatically, do not edit. ") + self.writeComment( + " eric5 debugger properties file for project {0} ".format( + self.name)) + self.writeComment( + " This file was generated automatically, do not edit. ") if Preferences.getProject("XMLTimestamp"): - self.writeComment(" Saved: {0} ".format(time.strftime('%Y-%m-%d, %H:%M:%S'))) + self.writeComment( + " Saved: {0} ".format(time.strftime('%Y-%m-%d, %H:%M:%S'))) # add the main tag self.writeStartElement("DebuggerProperties") self.writeAttribute("version", debuggerPropertiesFileFormatVersion) - self.writeTextElement("Interpreter", self.project.debugProperties["INTERPRETER"]) + self.writeTextElement( + "Interpreter", self.project.debugProperties["INTERPRETER"]) - self.writeTextElement("DebugClient", self.project.debugProperties["DEBUGCLIENT"]) + self.writeTextElement( + "DebugClient", self.project.debugProperties["DEBUGCLIENT"]) self.writeStartElement("Environment") self.writeAttribute("override",
--- a/E5XML/HighlightingStylesWriter.py Sun Oct 06 19:52:33 2013 +0200 +++ b/E5XML/HighlightingStylesWriter.py Mon Oct 07 19:10:11 2013 +0200 @@ -4,7 +4,8 @@ # """ -Module implementing the writer class for writing a highlighting styles XML file. +Module implementing the writer class for writing a highlighting styles XML +file. """ import time @@ -17,7 +18,8 @@ class HighlightingStylesWriter(XMLStreamWriterBase): """ - Class implementing the writer class for writing a highlighting styles XML file. + Class implementing the writer class for writing a highlighting styles XML + file. """ def __init__(self, device, lexers): """ @@ -37,12 +39,15 @@ """ XMLStreamWriterBase.writeXML(self) - self.writeDTD('<!DOCTYPE HighlightingStyles SYSTEM "HighlightingStyles-{0}.dtd">'\ - .format(highlightingStylesFileFormatVersion)) + self.writeDTD( + '<!DOCTYPE HighlightingStyles SYSTEM' + ' "HighlightingStyles-{0}.dtd">'.format( + highlightingStylesFileFormatVersion)) # add some generation comments self.writeComment(" Eric5 highlighting styles ") - self.writeComment(" Saved: {0}".format(time.strftime('%Y-%m-%d, %H:%M:%S'))) + self.writeComment( + " Saved: {0}".format(time.strftime('%Y-%m-%d, %H:%M:%S'))) self.writeComment(" Author: {0} ".format(self.email)) # add the main tag
--- a/E5XML/MultiProjectReader.py Sun Oct 06 19:52:33 2013 +0200 +++ b/E5XML/MultiProjectReader.py Mon Oct 07 19:10:11 2013 +0200 @@ -87,7 +87,8 @@ if self.name() == "ProjectName": project["name"] = self.readElementText() elif self.name() == "ProjectFile": - project["file"] = Utilities.toNativeSeparators(self.readElementText()) + project["file"] = Utilities.toNativeSeparators( + self.readElementText()) elif self.name() == "ProjectDescription": project["description"] = self.readElementText() else:
--- a/E5XML/MultiProjectWriter.py Sun Oct 06 19:52:33 2013 +0200 +++ b/E5XML/MultiProjectWriter.py Mon Oct 07 19:10:11 2013 +0200 @@ -46,8 +46,10 @@ self.writeComment(" eric5 multi project file for multi project {0} "\ .format(self.name)) if Preferences.getMultiProject("XMLTimestamp"): - self.writeComment(" Saved: {0} ".format(time.strftime('%Y-%m-%d, %H:%M:%S'))) - self.writeComment(" Copyright (C) {0} ".format(time.strftime('%Y'))) + self.writeComment( + " Saved: {0} ".format(time.strftime('%Y-%m-%d, %H:%M:%S'))) + self.writeComment( + " Copyright (C) {0} ".format(time.strftime('%Y'))) # add the main tag self.writeStartElement("MultiProject")
--- a/E5XML/ProjectReader.py Sun Oct 06 19:52:33 2013 +0200 +++ b/E5XML/ProjectReader.py Mon Oct 07 19:10:11 2013 +0200 @@ -46,7 +46,8 @@ if self.version not in self.supportedVersions: self.raiseUnsupportedFormatVersion(self.version) elif self.name() == "Language": - self.project.pdata["SPELLLANGUAGE"] = [self.readElementText()] + self.project.pdata["SPELLLANGUAGE"] = [ + self.readElementText()] elif self.name() == "ProjectWordList": self.project.pdata["SPELLWORDS"] = \ [Utilities.toNativeSeparators(self.readElementText())] @@ -58,14 +59,17 @@ elif self.name() == "ProgLanguage": self.project.pdata["MIXEDLANGUAGE"] = \ [int(self.attribute("mixed", "0"))] - self.project.pdata["PROGLANGUAGE"] = [self.readElementText()] + self.project.pdata["PROGLANGUAGE"] = [ + self.readElementText()] if self.project.pdata["PROGLANGUAGE"][0] == "Python": # convert Python to the more specific Python2 self.project.pdata["PROGLANGUAGE"][0] = "Python2" elif self.name() == "ProjectType": - self.project.pdata["PROJECTTYPE"] = [self.readElementText()] + self.project.pdata["PROJECTTYPE"] = [ + self.readElementText()] elif self.name() == "Description": - self.project.pdata["DESCRIPTION"] = [self.readElementText()] + self.project.pdata["DESCRIPTION"] = [ + self.readElementText()] elif self.name() == "Version": self.project.pdata["VERSION"] = [self.readElementText()] elif self.name() == "Author": @@ -79,16 +83,19 @@ self.project.pdata["TRANSLATIONSBINPATH"] = \ [Utilities.toNativeSeparators(self.readElementText())] elif self.name() == "Eol": - self.project.pdata["EOL"] = [int(self.attribute("index", "0"))] + self.project.pdata["EOL"] = [ + int(self.attribute("index", "0"))] elif self.name() == "Sources": self.__readFiles("Sources", "Source", "SOURCES") elif self.name() == "Forms": self.__readFiles("Forms", "Form", "FORMS") elif self.name() == "Translations": - self.__readFiles("Translations", "Translation", "TRANSLATIONS") + self.__readFiles( + "Translations", "Translation", "TRANSLATIONS") elif self.name() == "TranslationExceptions": - self.__readFiles("TranslationExceptions", "TranslationException", - "TRANSLATIONEXCEPTIONS") + self.__readFiles( + "TranslationExceptions", "TranslationException", + "TRANSLATIONEXCEPTIONS") elif self.name() == "Resources": self.__readFiles("Resources", "Resource", "RESOURCES") elif self.name() == "Interfaces":
--- a/E5XML/ProjectWriter.py Sun Oct 06 19:52:33 2013 +0200 +++ b/E5XML/ProjectWriter.py Mon Oct 07 19:10:11 2013 +0200 @@ -44,9 +44,11 @@ projectFileFormatVersion)) # add some generation comments - self.writeComment(" eric5 project file for project {0} ".format(self.name)) + self.writeComment( + " eric5 project file for project {0} ".format(self.name)) if Preferences.getProject("XMLTimestamp"): - self.writeComment(" Saved: {0} ".format(time.strftime('%Y-%m-%d, %H:%M:%S'))) + self.writeComment( + " Saved: {0} ".format(time.strftime('%Y-%m-%d, %H:%M:%S'))) self.writeComment(" Copyright (C) {0} {1}, {2} ".format( time.strftime('%Y'), self.pdata["AUTHOR"][0], @@ -88,13 +90,17 @@ # do the translation pattern if self.pdata["TRANSLATIONPATTERN"]: - self.writeTextElement("TranslationPattern", - Utilities.fromNativeSeparators(self.pdata["TRANSLATIONPATTERN"][0])) + self.writeTextElement( + "TranslationPattern", + Utilities.fromNativeSeparators( + self.pdata["TRANSLATIONPATTERN"][0])) # do the binary translations path if self.pdata["TRANSLATIONSBINPATH"]: - self.writeTextElement("TranslationsBinPath", - Utilities.fromNativeSeparators(self.pdata["TRANSLATIONSBINPATH"][0])) + self.writeTextElement( + "TranslationsBinPath", + Utilities.fromNativeSeparators( + self.pdata["TRANSLATIONSBINPATH"][0])) # do the eol setting if self.pdata["EOL"] and self.pdata["EOL"][0]: @@ -104,7 +110,8 @@ # do the sources self.writeStartElement("Sources") for name in self.pdata["SOURCES"]: - self.writeTextElement("Source", Utilities.fromNativeSeparators(name)) + self.writeTextElement( + "Source", Utilities.fromNativeSeparators(name)) self.writeEndElement() # do the forms @@ -116,7 +123,8 @@ # do the translations self.writeStartElement("Translations") for name in self.pdata["TRANSLATIONS"]: - self.writeTextElement("Translation", Utilities.fromNativeSeparators(name)) + self.writeTextElement( + "Translation", Utilities.fromNativeSeparators(name)) self.writeEndElement() # do the translation exceptions @@ -130,19 +138,22 @@ # do the resources self.writeStartElement("Resources") for name in self.pdata["RESOURCES"]: - self.writeTextElement("Resource", Utilities.fromNativeSeparators(name)) + self.writeTextElement( + "Resource", Utilities.fromNativeSeparators(name)) self.writeEndElement() # do the interfaces (IDL) self.writeStartElement("Interfaces") for name in self.pdata["INTERFACES"]: - self.writeTextElement("Interface", Utilities.fromNativeSeparators(name)) + self.writeTextElement( + "Interface", Utilities.fromNativeSeparators(name)) self.writeEndElement() # do the others self.writeStartElement("Others") for name in self.pdata["OTHERS"]: - self.writeTextElement("Other", Utilities.fromNativeSeparators(name)) + self.writeTextElement( + "Other", Utilities.fromNativeSeparators(name)) self.writeEndElement() # do the main script
--- a/E5XML/SessionReader.py Sun Oct 06 19:52:33 2013 +0200 +++ b/E5XML/SessionReader.py Mon Oct 07 19:10:11 2013 +0200 @@ -59,11 +59,13 @@ self.readNext() if self.isStartElement(): if self.name() == "Session": - self.version = self.attribute("version", sessionFileFormatVersion) + self.version = self.attribute( + "version", sessionFileFormatVersion) if self.version not in self.supportedVersions: self.raiseUnsupportedFormatVersion(self.version) elif self.name() == "MultiProject": - self.multiProject.openMultiProject(self.readElementText(), False) + self.multiProject.openMultiProject( + self.readElementText(), False) elif self.name() == "Project": self.project.openProject(self.readElementText(), False) elif self.name() == "Filenames":
--- a/E5XML/SessionWriter.py Sun Oct 06 19:52:33 2013 +0200 +++ b/E5XML/SessionWriter.py Mon Oct 07 19:10:11 2013 +0200 @@ -51,10 +51,13 @@ # add some generation comments if not isGlobal: - self.writeComment(" eric5 session file for project {0} ".format(self.name)) - self.writeComment(" This file was generated automatically, do not edit. ") + self.writeComment( + " eric5 session file for project {0} ".format(self.name)) + self.writeComment( + " This file was generated automatically, do not edit. ") if Preferences.getProject("XMLTimestamp") or isGlobal: - self.writeComment(" Saved: {0} ".format(time.strftime('%Y-%m-%d, %H:%M:%S'))) + self.writeComment( + " Saved: {0} ".format(time.strftime('%Y-%m-%d, %H:%M:%S'))) # add the main tag self.writeStartElement("Session") @@ -134,7 +137,8 @@ wpModel = self.dbs.getWatchPointModel() for row in range(wpModel.rowCount()): index = wpModel.index(row, 0) - cond, temp, enabled, count, special = wpModel.getWatchPointByIndex(index)[:5] + cond, temp, enabled, count, special = \ + wpModel.getWatchPointByIndex(index)[:5] self.writeStartElement("Watchexpression") self.writeTextElement("Condition", str(cond)) self.writeEmptyElement("Temporary") @@ -181,7 +185,7 @@ self.writeAttribute("value", str(self.dbg.tracePython)) self.writeEmptyElement("AutoContinue") self.writeAttribute("value", str(self.dbg.autoContinue)) - self.writeEmptyElement("CovexcPattern") # kept for compatibility + self.writeEmptyElement("CovexcPattern") # kept for compatibility else: self.writeTextElement("CommandLine", self.project.dbgCmdline) self.writeTextElement("WorkingDirectory", self.project.dbgWd) @@ -202,7 +206,7 @@ self.writeAttribute("value", str(self.project.dbgTracePython)) self.writeEmptyElement("AutoContinue") self.writeAttribute("value", str(self.project.dbgAutoContinue)) - self.writeEmptyElement("CovexcPattern") # kept for compatibility + self.writeEmptyElement("CovexcPattern") # kept for compatibility self.writeEndElement() # step 4: save bookmarks of all open (project) files
--- a/E5XML/ShortcutsReader.py Sun Oct 06 19:52:33 2013 +0200 +++ b/E5XML/ShortcutsReader.py Mon Oct 07 19:10:11 2013 +0200 @@ -36,7 +36,8 @@ self.readNext() if self.isStartElement(): if self.name() == "Shortcuts": - self.version = self.attribute("version", shortcutsFileFormatVersion) + self.version = self.attribute( + "version", shortcutsFileFormatVersion) if self.version not in self.supportedVersions: self.raiseUnsupportedFormatVersion(self.version) elif self.name() == "Shortcut":
--- a/E5XML/ShortcutsWriter.py Sun Oct 06 19:52:33 2013 +0200 +++ b/E5XML/ShortcutsWriter.py Mon Oct 07 19:10:11 2013 +0200 @@ -42,7 +42,8 @@ # add some generation comments self.writeComment(" Eric5 keyboard shortcuts ") - self.writeComment(" Saved: {0}".format(time.strftime('%Y-%m-%d, %H:%M:%S'))) + self.writeComment( + " Saved: {0}".format(time.strftime('%Y-%m-%d, %H:%M:%S'))) self.writeComment(" Author: {0} ".format(self.email)) # add the main tag @@ -99,5 +100,6 @@ self.writeAttribute("category", category) self.writeTextElement("Name", act.objectName()) self.writeTextElement("Accel", act.shortcut().toString()) - self.writeTextElement("AltAccel", act.alternateShortcut().toString()) + self.writeTextElement( + "AltAccel", act.alternateShortcut().toString()) self.writeEndElement()
--- a/E5XML/TasksReader.py Sun Oct 06 19:52:33 2013 +0200 +++ b/E5XML/TasksReader.py Mon Oct 07 19:10:11 2013 +0200 @@ -53,7 +53,8 @@ self.readNext() if self.isStartElement(): if self.name() == "Tasks": - self.version = self.attribute("version", tasksFileFormatVersion) + self.version = self.attribute( + "version", tasksFileFormatVersion) if self.version not in self.supportedVersions: self.raiseUnsupportedFormatVersion(self.version) elif self.name() == "Task": @@ -105,8 +106,8 @@ elif self.name() == "Description": task["description"] = self.readElementText() elif self.name() == "Created": - task["created"] = time.mktime( - time.strptime(self.readElementText(), "%Y-%m-%d, %H:%M:%S")) + task["created"] = time.mktime(time.strptime( + self.readElementText(), "%Y-%m-%d, %H:%M:%S")) elif self.name() == "Resource": continue # handle but ignore this tag elif self.name() == "Filename":
--- a/E5XML/TasksWriter.py Sun Oct 06 19:52:33 2013 +0200 +++ b/E5XML/TasksWriter.py Mon Oct 07 19:10:11 2013 +0200 @@ -46,13 +46,15 @@ # add some generation comments if self.forProject: - self.writeComment(" eric5 tasks file for project {0} ".format(self.name)) + self.writeComment( + " eric5 tasks file for project {0} ".format(self.name)) if Preferences.getProject("XMLTimestamp"): self.writeComment(" Saved: {0} ".format( time.strftime('%Y-%m-%d, %H:%M:%S'))) else: self.writeComment(" eric5 tasks file ") - self.writeComment(" Saved: {0} ".format(time.strftime('%Y-%m-%d, %H:%M:%S'))) + self.writeComment( + " Saved: {0} ".format(time.strftime('%Y-%m-%d, %H:%M:%S'))) # add the main tag self.writeStartElement("Tasks") @@ -75,8 +77,8 @@ self.writeAttribute("type", str(task.taskType)) self.writeTextElement("Summary", task.summary.strip()) self.writeTextElement("Description", task.description.strip()) - self.writeTextElement("Created", - time.strftime("%Y-%m-%d, %H:%M:%S", time.localtime(task.created))) + self.writeTextElement("Created", time.strftime( + "%Y-%m-%d, %H:%M:%S", time.localtime(task.created))) if task.filename: self.writeStartElement("Resource") self.writeTextElement("Filename",
--- a/E5XML/TemplatesReader.py Sun Oct 06 19:52:33 2013 +0200 +++ b/E5XML/TemplatesReader.py Mon Oct 07 19:10:11 2013 +0200 @@ -44,7 +44,8 @@ self.readNext() if self.isStartElement(): if self.name() == "Templates": - self.version = self.attribute("version", templatesFileFormatVersion) + self.version = self.attribute( + "version", templatesFileFormatVersion) if self.version not in self.supportedVersions: self.raiseUnsupportedFormatVersion(self.version) elif self.name() == "TemplateGroup": @@ -83,7 +84,9 @@ while not self.atEnd(): self.readNext() - if self.isEndElement() and self.name() == "Template" and templateName: + if self.isEndElement() and \ + self.name() == "Template" and \ + templateName: self.viewer.addEntry(self.groupName, templateName, templateDescription, templateText, quiet=True)
--- a/E5XML/TemplatesWriter.py Sun Oct 06 19:52:33 2013 +0200 +++ b/E5XML/TemplatesWriter.py Mon Oct 07 19:10:11 2013 +0200 @@ -22,7 +22,8 @@ Constructor @param device reference to the I/O device to write to (QIODevice) - @param templatesViewer reference to the templates viewer object (TemplateViewer) + @param templatesViewer reference to the templates viewer object + (TemplateViewer) """ XMLStreamWriterBase.__init__(self, device) @@ -39,7 +40,8 @@ # add some generation comments self.writeComment(" eric5 templates file ") - self.writeComment(" Saved: {0} ".format(time.strftime('%Y-%m-%d, %H:%M:%S'))) + self.writeComment( + " Saved: {0} ".format(time.strftime('%Y-%m-%d, %H:%M:%S'))) # add the main tag self.writeStartElement("Templates") @@ -56,8 +58,10 @@ for template in templates: self.writeStartElement("Template") self.writeAttribute("name", template.getName()) - self.writeTextElement("TemplateDescription", template.getDescription()) - self.writeTextElement("TemplateText", template.getTemplateText()) + self.writeTextElement( + "TemplateDescription", template.getDescription()) + self.writeTextElement( + "TemplateText", template.getTemplateText()) self.writeEndElement() self.writeEndElement()
--- a/E5XML/UserProjectReader.py Sun Oct 06 19:52:33 2013 +0200 +++ b/E5XML/UserProjectReader.py Mon Oct 07 19:10:11 2013 +0200 @@ -41,15 +41,18 @@ self.readNext() if self.isStartElement(): if self.name() == "UserProject": - self.version = self.attribute("version", userProjectFileFormatVersion) + self.version = self.attribute( + "version", userProjectFileFormatVersion) if self.version not in self.supportedVersions: self.raiseUnsupportedFormatVersion(self.version) elif self.name() == "VcsType": - self.project.pudata["VCSOVERRIDE"] = [self.readElementText()] + self.project.pudata["VCSOVERRIDE"] = [ + self.readElementText()] elif self.name() == "VcsStatusMonitorInterval": interval = int(self.attribute("value", Preferences.getVCS("StatusMonitorInterval"))) - self.project.pudata["VCSSTATUSMONITORINTERVAL"] = [interval] + self.project.pudata["VCSSTATUSMONITORINTERVAL"] = [ + interval] else: self.raiseUnexpectedStartTag(self.name())
--- a/E5XML/UserProjectWriter.py Sun Oct 06 19:52:33 2013 +0200 +++ b/E5XML/UserProjectWriter.py Mon Oct 07 19:10:11 2013 +0200 @@ -4,7 +4,8 @@ # """ -Module implementing the writer class for writing an XML user project properties file. +Module implementing the writer class for writing an XML user project +properties file. """ import time @@ -19,7 +20,8 @@ class UserProjectWriter(XMLStreamWriterBase): """ - Class implementing the writer class for writing an XML user project properties file. + Class implementing the writer class for writing an XML user project + properties file. """ def __init__(self, device, projectName): """ @@ -40,15 +42,19 @@ """ XMLStreamWriterBase.writeXML(self) - self.writeDTD('<!DOCTYPE UserProject SYSTEM "UserProject-{0}.dtd">'.format( + self.writeDTD( + '<!DOCTYPE UserProject SYSTEM "UserProject-{0}.dtd">'.format( userProjectFileFormatVersion)) # add some generation comments - self.writeComment(" eric5 user project file for project {0} ".format(self.name)) + self.writeComment( + " eric5 user project file for project {0} ".format(self.name)) if Preferences.getProject("XMLTimestamp"): - self.writeComment(" Saved: {0} ".format(time.strftime('%Y-%m-%d, %H:%M:%S'))) + self.writeComment( + " Saved: {0} ".format(time.strftime('%Y-%m-%d, %H:%M:%S'))) self.writeComment(" Copyright (C) {0} {1}, {2} ".format( - time.strftime('%Y'), self.pdata["AUTHOR"][0], self.pdata["EMAIL"][0])) + time.strftime('%Y'), self.pdata["AUTHOR"][0], + self.pdata["EMAIL"][0])) # add the main tag self.writeStartElement("UserProject") @@ -59,7 +65,8 @@ self.writeTextElement("VcsType", self.pudata["VCSOVERRIDE"][0]) if self.pudata["VCSSTATUSMONITORINTERVAL"]: self.writeEmptyElement("VcsStatusMonitorInterval") - self.writeAttribute("value", str(self.pudata["VCSSTATUSMONITORINTERVAL"][0])) + self.writeAttribute( + "value", str(self.pudata["VCSSTATUSMONITORINTERVAL"][0])) self.writeEndElement() self.writeEndDocument()
--- a/E5XML/XMLStreamReaderBase.py Sun Oct 06 19:52:33 2013 +0200 +++ b/E5XML/XMLStreamReaderBase.py Mon Oct 07 19:10:11 2013 +0200 @@ -49,11 +49,14 @@ """ if self.hasError(): msg = QCoreApplication.translate("XMLStreamReaderBase", - "<p>XML parse error in file <b>{0}</b>, line {1}, column {2}</p>" - "<p>Error: {3}</p>").format(self.device().fileName(), - self.lineNumber(), self.columnNumber(), self.errorString()) + "<p>XML parse error in file <b>{0}</b>, line {1}," + " column {2}</p><p>Error: {3}</p>").format( + self.device().fileName(), + self.lineNumber(), self.columnNumber(), + self.errorString()) E5MessageBox.warning(None, - QCoreApplication.translate("XMLStreamReaderBase", "XML parse error"), + QCoreApplication.translate( + "XMLStreamReaderBase", "XML parse error"), msg) def raiseUnexpectedStartTag(self, tag): @@ -131,7 +134,8 @@ val = None elif self.name() == "int": val = int(self.readElementText()) - elif self.name() == "long": # backward compatibility to 4.6 + elif self.name() == "long": + # backward compatibility to 4.6 val = int(self.readElementText()) elif self.name() == "bool": b = self.readElementText() @@ -146,15 +150,16 @@ val = float(real) + float(imag) * 1j elif self.name() == "string": val = self.readElementText() - elif self.name() == "unicode": # backward compatibility to 4.6 + elif self.name() == "unicode": + # backward compatibility to 4.6 val = self.readElementText() elif self.name() == "bytes": - by = bytes( - [int(b) for b in self.readElementText().split(",")]) + by = bytes([int(b) for b in + self.readElementText().split(",")]) val = by elif self.name() == "bytearray": - by = bytearray( - [int(b) for b in self.readElementText().split(",")]) + by = bytearray([int(b) for b in + self.readElementText().split(",")]) val = by elif self.name() == "tuple": val = self.__readTuple() @@ -176,8 +181,8 @@ if encoding != "base64": self.raiseError(QCoreApplication.translate( "XMLStreamReaderBase", - "Pickle data encoding '{0}' is not supported.")\ - .format(encoding)) + "Pickle data encoding '{0}' is not" + " supported.").format(encoding)) continue b64 = self.readElementText() pic = base64.b64decode(b64.encode("ASCII")) @@ -189,7 +194,8 @@ continue if self.isEndElement(): - if self.name() in ["tuple", "list", "dict", "set", "frozenset"]: + if self.name() in [ + "tuple", "list", "dict", "set", "frozenset"]: return None else: return val @@ -265,7 +271,9 @@ l = [] while not self.atEnd(): val = self._readBasics() - if self.isEndElement() and self.name() == "frozenset" and val is None: + if self.isEndElement() and \ + self.name() == "frozenset" and \ + val is None: return frozenset(l) else: l.append(val)
--- a/E5XML/XMLStreamWriterBase.py Sun Oct 06 19:52:33 2013 +0200 +++ b/E5XML/XMLStreamWriterBase.py Mon Oct 07 19:10:11 2013 +0200 @@ -68,12 +68,13 @@ @param pyobject object to be dumped """ - writeMethod = self.basics.get(type(pyobject)) or self._write_unimplemented + writeMethod = self.basics.get(type(pyobject)) or \ + self._write_unimplemented writeMethod(pyobject) - ############################################################################ + ########################################################################### ## The various writer methods for basic types - ############################################################################ + ########################################################################### def _write_none(self, value): """ @@ -130,7 +131,8 @@ @param value value to be dumped (bytes) """ - self.writeTextElement("bytes", ",".join(["{0:d}".format(b) for b in value])) + self.writeTextElement( + "bytes", ",".join(["{0:d}".format(b) for b in value])) def _write_bytearray(self, value): """ @@ -138,7 +140,8 @@ @param value value to be dumped (bytearray) """ - self.writeTextElement("bytearray", ",".join(["{0:d}".format(b) for b in value])) + self.writeTextElement( + "bytearray", ",".join(["{0:d}".format(b) for b in value])) def _write_tuple(self, value): """ @@ -214,5 +217,6 @@ self.writeStartElement("pickle") self.writeAttribute("method", "pickle") self.writeAttribute("encoding", "base64") - self.writeCharacters(str(base64.b64encode(pickle.dumps(value)), "ASCII")) + self.writeCharacters( + str(base64.b64encode(pickle.dumps(value)), "ASCII")) self.writeEndElement()
--- a/Globals/__init__.py Sun Oct 06 19:52:33 2013 +0200 +++ b/Globals/__init__.py Mon Oct 07 19:10:11 2013 +0200 @@ -78,8 +78,9 @@ # check for blacklisted versions for vers in BlackLists["sip"] + PlatformBlackLists["sip"]: if vers == sipVersion: - print('Sorry, sip version {0} is not compatible with eric5.'\ - .format(vers)) + print( + 'Sorry, sip version {0} is not compatible with eric5.' + .format(vers)) print('Please install another version.') return False except ImportError: @@ -104,10 +105,12 @@ # always assume, that snapshots are new enough if "snapshot" not in scintillaVersion: # check for blacklisted versions - for vers in BlackLists["QScintilla2"] + PlatformBlackLists["QScintilla2"]: + for vers in BlackLists["QScintilla2"] + \ + PlatformBlackLists["QScintilla2"]: if vers == scintillaVersion: - print('Sorry, QScintilla2 version {0} is not compatible with eric5.'\ - .format(vers)) + print( + 'Sorry, QScintilla2 version {0} is not compatible' + ' with eric5.'.format(vers)) print('Please install another version.') return False @@ -199,7 +202,8 @@ @return list of interpreters found (list of strings) """ - winPathList = ["C:\\Python25", "C:\\Python26", "C:\\Python27", "C:\\Python28"] + winPathList = ["C:\\Python25", "C:\\Python26", + "C:\\Python27", "C:\\Python28"] posixPathList = ["/usr/bin", "/usr/local/bin"] posixVersionsList = ["2.5", "2.6", "2.7", "2.8"]
--- a/Graphics/ApplicationDiagramBuilder.py Sun Oct 06 19:52:33 2013 +0200 +++ b/Graphics/ApplicationDiagramBuilder.py Mon Oct 07 19:10:11 2013 +0200 @@ -39,12 +39,14 @@ self.noModules = noModules - self.umlView.setDiagramName(self.trUtf8("Application Diagram {0}").format( - self.project.getProjectName())) + self.umlView.setDiagramName( + self.trUtf8("Application Diagram {0}").format( + self.project.getProjectName())) def __buildModulesDict(self): """ - Private method to build a dictionary of modules contained in the application. + Private method to build a dictionary of modules contained in the + application. @return dictionary of modules contained in the application. """ @@ -55,7 +57,8 @@ mods = self.project.pdata["SOURCES"] modules = [] for module in mods: - modules.append(Utilities.normabsjoinpath(self.project.ppath, module)) + modules.append(Utilities.normabsjoinpath( + self.project.ppath, module)) tot = len(modules) try: prog = 0 @@ -71,8 +74,8 @@ if module.endswith("__init__.py"): continue try: - mod = Utilities.ModuleParser.readModule(module, extensions=extensions, - caching=False) + mod = Utilities.ModuleParser.readModule( + module, extensions=extensions, caching=False) except ImportError: continue else: @@ -143,13 +146,15 @@ ppath = packagePath while hasInit: ppath = os.path.dirname(ppath) - hasInit = \ - len(glob.glob(os.path.join(ppath, '__init__.*'))) > 0 - shortPackage = \ - packagePath.replace(ppath, '').replace(os.sep, '.')[1:] + hasInit = len(glob.glob(os.path.join( + ppath, '__init__.*'))) > 0 + shortPackage = packagePath.replace(ppath, '')\ + .replace(os.sep, '.')[1:] packageList = shortPackage.split('.')[1:] packageListLen = len(packageList) - i = '.'.join(packageList[:packageListLen - dots + 1] + [i[dots:]]) + i = '.'.join( + packageList[:packageListLen - dots + 1] + + [i[dots:]]) if i in modules: impLst.append(i) @@ -185,7 +190,8 @@ relPackage = self.trUtf8("<<Application>>") else: relPackage = self.trUtf8("<<Others>>") - shape = self.__addPackage(relPackage, packages[package][0], 0.0, 0.0) + shape = self.__addPackage( + relPackage, packages[package][0], 0.0, 0.0) shapeRect = shape.sceneBoundingRect() shapes[package] = (shape, packages[package][1]) pn = p + shapeRect.width() + 10 @@ -270,8 +276,9 @@ if projectFile != self.project.getProjectFile(): res = E5MessageBox.yesNo(None, self.trUtf8("Load Diagram"), - self.trUtf8("""<p>The diagram belongs to the project <b>{0}</b>.""" - """ Shall this project be opened?</p>""").format( + self.trUtf8( + """<p>The diagram belongs to the project <b>{0}</b>.""" + """ Shall this project be opened?</p>""").format( projectFile)) if res: self.project.openProject(projectFile)
--- a/Graphics/AssociationItem.py Sun Oct 06 19:52:33 2013 +0200 +++ b/Graphics/AssociationItem.py Mon Oct 07 19:10:11 2013 +0200 @@ -73,7 +73,8 @@ self.setFlag(QGraphicsItem.ItemIsSelectable, False) if topToBottom: - self.calculateEndingPoints = self.__calculateEndingPoints_topToBottom + self.calculateEndingPoints = \ + self.__calculateEndingPoints_topToBottom else: ## self.calculateEndingPoints = self.__calculateEndingPoints_center self.calculateEndingPoints = self.__calculateEndingPoints_rectangle @@ -93,7 +94,8 @@ def __mapRectFromItem(self, item): """ - Private method to map item's rectangle to this item's coordinate system. + Private method to map item's rectangle to this item's coordinate + system. @param item reference to the item to be mapped (QGraphicsRectItem) @return item's rectangle in local coordinates (QRectF) @@ -237,8 +239,8 @@ def __findPointRegion(self, rect, posX, posY): """ - Private method to find out, which region of rectangle rect contains the point - (PosX, PosY) and returns the region number. + Private method to find out, which region of rectangle rect contains + the point (PosX, PosY) and returns the region number. @param rect rectangle to calculate the region for (QRectF) @param posX x position of point (float) @@ -350,7 +352,8 @@ def __findRectIntersectionPoint(self, item, p1, p2): """ - Private method to find the intersetion point of a line with a rectangle. + Private method to find the intersetion point of a line with a + rectangle. @param item item to check against @param p1 first point of the line (QPointF) @@ -479,19 +482,23 @@ pt.setX(slope1 * pt.y() + b1) # the intersection point must be inside the segment (x1, y1) (x2, y2) if x2 >= x1 and y2 >= y1: - if not ((x1 <= pt.y() and pt.y() <= x2) and (y1 <= pt.x() and pt.x() <= y2)): + if not ((x1 <= pt.y() and pt.y() <= x2) and + (y1 <= pt.x() and pt.x() <= y2)): pt.setX(-1.0) pt.setY(-1.0) elif x2 < x1 and y2 >= y1: - if not ((x2 <= pt.y() and pt.y() <= x1) and (y1 <= pt.x() and pt.x() <= y2)): + if not ((x2 <= pt.y() and pt.y() <= x1) and + (y1 <= pt.x() and pt.x() <= y2)): pt.setX(-1.0) pt.setY(-1.0) elif x2 >= x1 and y2 < y1: - if not ((x1 <= pt.y() and pt.y() <= x2) and (y2 <= pt.x() and pt.x() <= y1)): + if not ((x1 <= pt.y() and pt.y() <= x2) and + (y2 <= pt.x() and pt.x() <= y1)): pt.setX(-1.0) pt.setY(-1.0) else: - if not ((x2 <= pt.y() and pt.y() <= x1) and (y2 <= pt.x() and pt.x() <= y1)): + if not ((x2 <= pt.y() and pt.y() <= x1) and + (y2 <= pt.x() and pt.x() <= y1)): pt.setX(-1.0) pt.setY(-1.0)
--- a/Graphics/ClassItem.py Sun Oct 06 19:52:33 2013 +0200 +++ b/Graphics/ClassItem.py Mon Oct 07 19:10:11 2013 +0200 @@ -78,11 +78,13 @@ Constructor @param model class model containing the class data (ClassModel) - @param external flag indicating a class defined outside our scope (boolean) + @param external flag indicating a class defined outside our scope + (boolean) @param x x-coordinate (integer) @param y y-coordinate (integer) @keyparam rounded flag indicating a rounded corner (boolean) - @keyparam noAttrs flag indicating, that no attributes should be shown (boolean) + @keyparam noAttrs flag indicating, that no attributes should be shown + (boolean) @keyparam parent reference to the parent object (QGraphicsItem) @keyparam scene reference to the scene object (QGraphicsScene) """ @@ -182,7 +184,8 @@ @param widget optional reference to the widget painted on (QWidget) """ pen = self.pen() - if (option.state & QStyle.State_Selected) == QStyle.State(QStyle.State_Selected): + if (option.state & QStyle.State_Selected) == \ + QStyle.State(QStyle.State_Selected): pen.setWidth(2) else: pen.setWidth(1) @@ -201,7 +204,8 @@ painter.drawLine(offsetX, offsetY + y, offsetX + w - 1, offsetY + y) if self.attrs: y += self.margin + self.attrs.boundingRect().height() - painter.drawLine(offsetX, offsetY + y, offsetX + w - 1, offsetY + y) + painter.drawLine(offsetX, offsetY + y, + offsetX + w - 1, offsetY + y) self.adjustAssociations() @@ -218,8 +222,8 @@ Public method to build a string to persist the specific item data. This string must start with ", " and should be built like - "attribute=value" with pairs separated by ", ". value must not contain ", " - or newlines. + "attribute=value" with pairs separated by ", ". value must not + contain ", " or newlines. @return persistence data (string) """
--- a/Graphics/ImportsDiagramBuilder.py Sun Oct 06 19:52:33 2013 +0200 +++ b/Graphics/ImportsDiagramBuilder.py Mon Oct 07 19:10:11 2013 +0200 @@ -25,7 +25,8 @@ Note: Only package internal imports are shown in order to maintain some readability. """ - def __init__(self, dialog, view, project, package, showExternalImports=False): + def __init__(self, dialog, view, project, package, + showExternalImports=False): """ Constructor @@ -34,8 +35,8 @@ @param project reference to the project object (Project) @param package name of a python package to show the import relationships (string) - @keyparam showExternalImports flag indicating to show exports from outside - the package (boolean) + @keyparam showExternalImports flag indicating to show exports from + outside the package (boolean) """ super().__init__(dialog, view, project) self.setObjectName("ImportsDiagram") @@ -47,25 +48,29 @@ """ Public method to initialize the object. """ - self.package = os.path.splitdrive(self.packagePath)[1].replace(os.sep, '.')[1:] + self.package = os.path.splitdrive(self.packagePath)[1].replace( + os.sep, '.')[1:] hasInit = True ppath = self.packagePath while hasInit: ppath = os.path.dirname(ppath) hasInit = len(glob.glob(os.path.join(ppath, '__init__.*'))) > 0 - self.shortPackage = self.packagePath.replace(ppath, '').replace(os.sep, '.')[1:] + self.shortPackage = self.packagePath.replace(ppath, '').replace( + os.sep, '.')[1:] pname = self.project.getProjectName() if pname: name = self.trUtf8("Imports Diagramm {0}: {1}").format( pname, self.project.getRelativePath(self.packagePath)) else: - name = self.trUtf8("Imports Diagramm: {0}").format(self.packagePath) + name = self.trUtf8("Imports Diagramm: {0}").format( + self.packagePath) self.umlView.setDiagramName(name) def __buildModulesDict(self): """ - Private method to build a dictionary of modules contained in the package. + Private method to build a dictionary of modules contained in the + package. @return dictionary of modules contained in the package. """ @@ -76,8 +81,8 @@ modules = [] for ext in Preferences.getPython("PythonExtensions") + \ Preferences.getPython("Python3Extensions"): - modules.extend( - glob.glob(Utilities.normjoinpath(self.packagePath, '*{0}'.format(ext)))) + modules.extend(glob.glob(Utilities.normjoinpath( + self.packagePath, '*{0}'.format(ext)))) tot = len(modules) try: @@ -91,8 +96,8 @@ QApplication.processEvents() prog = prog + 1 try: - mod = Utilities.ModuleParser.readModule(module, extensions=extensions, - caching=False) + mod = Utilities.ModuleParser.readModule( + module, extensions=extensions, caching=False) except ImportError: continue else: @@ -113,7 +118,8 @@ if len(initlist) == 0: ct = QGraphicsTextItem(None) ct.setHtml( - self.trUtf8("The directory <b>'{0}'</b> is not a Python package.")\ + self.trUtf8( + "The directory <b>'{0}'</b> is not a Python package.") .format(self.package)) self.scene.addItem(ct) return @@ -151,7 +157,8 @@ else: if self.showExternalImports: n = '.'.join( - packageList[:packageListLen - dots + 1] + [i[dots:]]) + packageList[:packageListLen - dots + 1] + + [i[dots:]]) else: n = i elif i.startswith(self.package): @@ -267,7 +274,8 @@ return False self.packagePath = parts[0].split("=", 1)[1].strip() - self.showExternalImports = Utilities.toBool(parts[1].split("=", 1)[1].strip()) + self.showExternalImports = Utilities.toBool( + parts[1].split("=", 1)[1].strip()) self.initialize()
--- a/Graphics/ModuleItem.py Sun Oct 06 19:52:33 2013 +0200 +++ b/Graphics/ModuleItem.py Mon Oct 07 19:10:11 2013 +0200 @@ -136,7 +136,8 @@ @param widget optional reference to the widget painted on (QWidget) """ pen = self.pen() - if (option.state & QStyle.State_Selected) == QStyle.State(QStyle.State_Selected): + if (option.state & QStyle.State_Selected) == \ + QStyle.State(QStyle.State_Selected): pen.setWidth(2) else: pen.setWidth(1) @@ -161,8 +162,8 @@ Public method to build a string to persist the specific item data. This string must start with ", " and should be built like - "attribute=value" with pairs separated by ", ". value must not contain ", " - or newlines. + "attribute=value" with pairs separated by ", ". value must not + contain ", " or newlines. @return persistence data (string) """
--- a/Graphics/PackageDiagramBuilder.py Sun Oct 06 19:52:33 2013 +0200 +++ b/Graphics/PackageDiagramBuilder.py Mon Oct 07 19:10:11 2013 +0200 @@ -31,7 +31,8 @@ @param view reference to the view object (UMLGraphicsView) @param project reference to the project object (Project) @param package name of a python package to be shown (string) - @keyparam noAttrs flag indicating, that no attributes should be shown (boolean) + @keyparam noAttrs flag indicating, that no attributes should be shown + (boolean) """ super().__init__(dialog, view, project) self.setObjectName("PackageDiagram") @@ -62,15 +63,18 @@ def __buildModulesDict(self): """ - Private method to build a dictionary of modules contained in the package. + Private method to build a dictionary of modules contained in the + package. @return dictionary of modules contained in the package. """ import Utilities.ModuleParser supportedExt = \ - ['*{0}'.format(ext) for ext in Preferences.getPython("PythonExtensions")] + \ - ['*{0}'.format(ext) for ext in Preferences.getPython("Python3Extensions")] + \ + ['*{0}'.format(ext) for ext in + Preferences.getPython("PythonExtensions")] + \ + ['*{0}'.format(ext) for ext in + Preferences.getPython("Python3Extensions")] + \ ['*.rb'] extensions = Preferences.getPython("PythonExtensions") + \ Preferences.getPython("Python3Extensions") + ['.rb'] @@ -92,8 +96,8 @@ QApplication.processEvents() prog += 1 try: - mod = Utilities.ModuleParser.readModule(module, extensions=extensions, - caching=False) + mod = Utilities.ModuleParser.readModule( + module, extensions=extensions, caching=False) except ImportError: continue else: @@ -108,15 +112,18 @@ def __buildSubpackagesDict(self): """ - Private method to build a dictionary of sub-packages contained in this package. + Private method to build a dictionary of sub-packages contained in this + package. @return dictionary of sub-packages contained in this package """ import Utilities.ModuleParser supportedExt = \ - ['*{0}'.format(ext) for ext in Preferences.getPython("PythonExtensions")] + \ - ['*{0}'.format(ext) for ext in Preferences.getPython("Python3Extensions")] + \ + ['*{0}'.format(ext) for ext in + Preferences.getPython("PythonExtensions")] + \ + ['*{0}'.format(ext) for ext in + Preferences.getPython("Python3Extensions")] + \ ['*.rb'] extensions = Preferences.getPython("PythonExtensions") + \ Preferences.getPython("Python3Extensions") + ['.rb'] @@ -147,7 +154,8 @@ subpackagesDict[packageName] = [] modules = [] for ext in supportedExt: - modules.extend(glob.glob(Utilities.normjoinpath(subpackage, ext))) + modules.extend(glob.glob( + Utilities.normjoinpath(subpackage, ext))) for module in modules: progress.setValue(prog) QApplication.processEvents() @@ -192,7 +200,8 @@ if not modules: ct = QGraphicsTextItem(None, self.scene) ct.setHtml( - self.trUtf8("The package <b>'{0}'</b> does not contain any modules.") + self.trUtf8( + "The package <b>'{0}'</b> does not contain any modules.") .format(self.package)) return @@ -207,7 +216,8 @@ if not classesFound: ct = QGraphicsTextItem(None, self.scene) ct.setHtml( - self.trUtf8("The package <b>'{0}'</b> does not contain any classes.") + self.trUtf8( + "The package <b>'{0}'</b> does not contain any classes.") .format(self.package)) return @@ -237,12 +247,14 @@ else: if className in module.classes: # this is a local class (defined in this module) - self.__addLocalClass(className, module.classes[className], - 0, 0) + self.__addLocalClass( + className, module.classes[className], + 0, 0) elif className in module.modules: # this is a local module (defined in this module) - self.__addLocalClass(className, module.modules[className], - 0, 0, True) + self.__addLocalClass( + className, module.modules[className], + 0, 0, True) else: self.__addExternalClass(className, 0, 0) nodes.append(className) @@ -285,7 +297,8 @@ for generation in generations: sizes.append([]) for child in generation: - sizes[-1].append(self.__getCurrentShape(child).sceneBoundingRect()) + sizes[-1].append( + self.__getCurrentShape(child).sceneBoundingRect()) # calculate total width and total height width = 0 @@ -334,7 +347,8 @@ itertools.zip_longest(widths, heights, generations): x = 10.0 # whiteSpace is the space between any two elements - whiteSpace = (width - currentWidth - 20) / (len(generation) - 1.0 or 2.0) + whiteSpace = (width - currentWidth - 20) / \ + (len(generation) - 1.0 or 2.0) for className in generation: cw = self.__getCurrentShape(className) cw.setPos(x, y) @@ -418,7 +432,8 @@ @return persisted data string (string) """ - return "package={0}, no_attributes={1}".format(self.package, self.noAttrs) + return "package={0}, no_attributes={1}".format( + self.package, self.noAttrs) def parsePersistenceData(self, version, data): """
--- a/Graphics/PackageItem.py Sun Oct 06 19:52:33 2013 +0200 +++ b/Graphics/PackageItem.py Mon Oct 07 19:10:11 2013 +0200 @@ -121,7 +121,8 @@ height = height + self.modules.boundingRect().height() latchW = width / 3.0 latchH = min(15.0, latchW) - self.setSize(width + 2 * self.margin, height + latchH + 2 * self.margin) + self.setSize(width + 2 * self.margin, + height + latchH + 2 * self.margin) x = self.margin + self.rect().x() y = self.margin + self.rect().y() + latchH @@ -154,7 +155,8 @@ @param widget optional reference to the widget painted on (QWidget) """ pen = self.pen() - if (option.state & QStyle.State_Selected) == QStyle.State(QStyle.State_Selected): + if (option.state & QStyle.State_Selected) == \ + QStyle.State(QStyle.State_Selected): pen.setWidth(2) else: pen.setWidth(1) @@ -182,8 +184,8 @@ Public method to build a string to persist the specific item data. This string must start with ", " and should be built like - "attribute=value" with pairs separated by ", ". value must not contain ", " - or newlines. + "attribute=value" with pairs separated by ", ". value must not + contain ", " or newlines. @return persistence data (string) """
--- a/Graphics/PixmapDiagram.py Sun Oct 06 19:52:33 2013 +0200 +++ b/Graphics/PixmapDiagram.py Mon Oct 07 19:10:11 2013 +0200 @@ -8,8 +8,9 @@ """ from PyQt4.QtCore import Qt, QSize, QEvent -from PyQt4.QtGui import QLabel, QPalette, QSizePolicy, QScrollArea, QAction, QMenu, \ - QToolBar, QImage, QPixmap, QPrinter, QPrintDialog, QPainter, QFont, QColor +from PyQt4.QtGui import QLabel, QPalette, QSizePolicy, QScrollArea, QAction, \ + QMenu, QToolBar, QImage, QPixmap, QPrinter, QPrintDialog, QPainter, \ + QFont, QColor from E5Gui import E5MessageBox from E5Gui.E5MainWindow import E5MainWindow @@ -51,7 +52,8 @@ self.pixmapLabel = QLabel() self.pixmapLabel.setObjectName("pixmapLabel") self.pixmapLabel.setBackgroundRole(QPalette.Base) - self.pixmapLabel.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) + self.pixmapLabel.setSizePolicy( + QSizePolicy.Ignored, QSizePolicy.Ignored) self.pixmapLabel.setScaledContents(True) self.pixmapView = QScrollArea() @@ -61,7 +63,8 @@ self.setCentralWidget(self.pixmapView) - self.__zoomWidget = E5ZoomWidget(UI.PixmapCache.getPixmap("zoomOut.png"), + self.__zoomWidget = E5ZoomWidget( + UI.PixmapCache.getPixmap("zoomOut.png"), UI.PixmapCache.getPixmap("zoomIn.png"), UI.PixmapCache.getPixmap("zoomReset.png"), self) self.statusBar().addPermanentWidget(self.__zoomWidget) @@ -215,9 +218,9 @@ self.__doZoom(int(pinch.scaleFactor() * 100)) evt.accept() - ############################################################################ + ########################################################################### ## Private menu handling methods below. - ############################################################################ + ########################################################################### def __adjustScrollBar(self, scrollBar, factor): """ @@ -252,11 +255,14 @@ """ oldValue = self.__zoom() if value != oldValue: - self.pixmapLabel.resize(value / 100 * self.pixmapLabel.pixmap().size()) + self.pixmapLabel.resize( + value / 100 * self.pixmapLabel.pixmap().size()) factor = value / oldValue - self.__adjustScrollBar(self.pixmapView.horizontalScrollBar(), factor) - self.__adjustScrollBar(self.pixmapView.verticalScrollBar(), factor) + self.__adjustScrollBar( + self.pixmapView.horizontalScrollBar(), factor) + self.__adjustScrollBar( + self.pixmapView.verticalScrollBar(), factor) self.__zoomWidget.setValue(value) @@ -288,7 +294,8 @@ @return current zoom factor in percent (integer) """ - return int(self.pixmapLabel.width() / self.pixmapLabel.pixmap().width() * 100.0) + return int(self.pixmapLabel.width() / + self.pixmapLabel.pixmap().width() * 100.0) def __printDiagram(self): """ @@ -354,18 +361,18 @@ fm = painter.fontMetrics() fontHeight = fm.lineSpacing() marginX = printer.pageRect().x() - printer.paperRect().x() - marginX = \ - Preferences.getPrinter("LeftMargin") * int(printer.resolution() / 2.54) \ - - marginX + marginX = Preferences.getPrinter("LeftMargin") * \ + int(printer.resolution() / 2.54) - marginX marginY = printer.pageRect().y() - printer.paperRect().y() - marginY = \ - Preferences.getPrinter("TopMargin") * int(printer.resolution() / 2.54) \ - - marginY + marginY = Preferences.getPrinter("TopMargin") * \ + int(printer.resolution() / 2.54) - marginY - width = printer.width() - marginX \ - - Preferences.getPrinter("RightMargin") * int(printer.resolution() / 2.54) - height = printer.height() - fontHeight - 4 - marginY \ - - Preferences.getPrinter("BottomMargin") * int(printer.resolution() / 2.54) + width = printer.width() - marginX - \ + Preferences.getPrinter("RightMargin") * \ + int(printer.resolution() / 2.54) + height = printer.height() - fontHeight - 4 - marginY - \ + Preferences.getPrinter("BottomMargin") * \ + int(printer.resolution() / 2.54) # write a foot note s = self.trUtf8("Diagram: {0}").format(self.getDiagramName()) @@ -382,7 +389,8 @@ size = self.pixmapLabel.pixmap().size() size.scale(QSize(width - 10, height - 10), # 5 px inner margin Qt.KeepAspectRatio) - painter.setViewport(marginX + 5, marginY + 5, size.width(), size.height()) + painter.setViewport(marginX + 5, marginY + 5, + size.width(), size.height()) painter.setWindow(self.pixmapLabel.pixmap().rect()) painter.drawPixmap(0, 0, self.pixmapLabel.pixmap()) painter.end()
--- a/Graphics/SvgDiagram.py Sun Oct 06 19:52:33 2013 +0200 +++ b/Graphics/SvgDiagram.py Mon Oct 07 19:10:11 2013 +0200 @@ -8,8 +8,8 @@ """ from PyQt4.QtCore import Qt, QSize, QEvent -from PyQt4.QtGui import QPalette, QSizePolicy, QScrollArea, QAction, QMenu, QToolBar, \ - QPrinter, QPrintDialog, QPainter, QFont, QColor +from PyQt4.QtGui import QPalette, QSizePolicy, QScrollArea, QAction, QMenu, \ + QToolBar, QPrinter, QPrintDialog, QPainter, QFont, QColor from PyQt4.QtSvg import QSvgWidget from E5Gui.E5MainWindow import E5MainWindow @@ -60,7 +60,8 @@ self.setCentralWidget(self.svgView) - self.__zoomWidget = E5ZoomWidget(UI.PixmapCache.getPixmap("zoomOut.png"), + self.__zoomWidget = E5ZoomWidget( + UI.PixmapCache.getPixmap("zoomOut.png"), UI.PixmapCache.getPixmap("zoomIn.png"), UI.PixmapCache.getPixmap("zoomReset.png"), self) self.statusBar().addPermanentWidget(self.__zoomWidget) @@ -189,9 +190,9 @@ self.__doZoom(int(pinch.scaleFactor() * 100)) evt.accept() - ############################################################################ + ########################################################################### ## Private menu handling methods below. - ############################################################################ + ########################################################################### def __adjustScrollBar(self, scrollBar, factor): """ @@ -262,7 +263,8 @@ @return current zoom factor in percent (integer) """ - return int(self.svgWidget.width() / self.svgWidget.sizeHint().width() * 100.0) + return int(self.svgWidget.width() / + self.svgWidget.sizeHint().width() * 100.0) def __printDiagram(self): """ @@ -328,18 +330,18 @@ fm = painter.fontMetrics() fontHeight = fm.lineSpacing() marginX = printer.pageRect().x() - printer.paperRect().x() - marginX = \ - Preferences.getPrinter("LeftMargin") * int(printer.resolution() / 2.54) \ - - marginX + marginX = Preferences.getPrinter("LeftMargin") * \ + int(printer.resolution() / 2.54) - marginX marginY = printer.pageRect().y() - printer.paperRect().y() - marginY = \ - Preferences.getPrinter("TopMargin") * int(printer.resolution() / 2.54) \ - - marginY + marginY = Preferences.getPrinter("TopMargin") * \ + int(printer.resolution() / 2.54) - marginY - width = printer.width() - marginX \ - - Preferences.getPrinter("RightMargin") * int(printer.resolution() / 2.54) - height = printer.height() - fontHeight - 4 - marginY \ - - Preferences.getPrinter("BottomMargin") * int(printer.resolution() / 2.54) + width = printer.width() - marginX - \ + Preferences.getPrinter("RightMargin") * \ + int(printer.resolution() / 2.54) + height = printer.height() - fontHeight - 4 - marginY - \ + Preferences.getPrinter("BottomMargin") * \ + int(printer.resolution() / 2.54) # write a foot note s = self.trUtf8("Diagram: {0}").format(self.getDiagramName())
--- a/Graphics/UMLClassDiagramBuilder.py Sun Oct 06 19:52:33 2013 +0200 +++ b/Graphics/UMLClassDiagramBuilder.py Mon Oct 07 19:10:11 2013 +0200 @@ -29,7 +29,8 @@ @param view reference to the view object (UMLGraphicsView) @param project reference to the project object (Project) @param file file name of a python module to be shown (string) - @keyparam noAttrs flag indicating, that no attributes should be shown (boolean) + @keyparam noAttrs flag indicating, that no attributes should be shown + (boolean) """ super().__init__(dialog, view, project) self.setObjectName("UMLClassDiagramBuilder") @@ -72,8 +73,8 @@ try: extensions = Preferences.getPython("PythonExtensions") + \ Preferences.getPython("Python3Extensions") + ['.rb'] - module = Utilities.ModuleParser.readModule(self.file, extensions=extensions, - caching=False) + module = Utilities.ModuleParser.readModule( + self.file, extensions=extensions, caching=False) except ImportError: ct = QGraphicsTextItem(None) ct.setHtml( @@ -139,8 +140,8 @@ self.umlView.autoAdjustSceneSize(limit=True) else: ct = QGraphicsTextItem(None) - ct.setHtml( - self.trUtf8("The module <b>'{0}'</b> does not contain any classes.")\ + ct.setHtml(self.trUtf8( + "The module <b>'{0}'</b> does not contain any classes.") .format(self.file)) self.scene.addItem(ct) @@ -163,7 +164,8 @@ for generation in generations: sizes.append([]) for child in generation: - sizes[-1].append(self.__getCurrentShape(child).sceneBoundingRect()) + sizes[-1].append( + self.__getCurrentShape(child).sceneBoundingRect()) # calculate total width and total height width = 0 @@ -212,7 +214,8 @@ itertools.zip_longest(widths, heights, generations): x = 10.0 # whiteSpace is the space between any two elements - whiteSpace = (width - currentWidth - 20) / (len(generation) - 1.0 or 2.0) + whiteSpace = (width - currentWidth - 20) / \ + (len(generation) - 1.0 or 2.0) for className in generation: cw = self.__getCurrentShape(className) cw.setPos(x, y)
--- a/Graphics/UMLDialog.py Sun Oct 06 19:52:33 2013 +0200 +++ b/Graphics/UMLDialog.py Mon Oct 07 19:10:11 2013 +0200 @@ -52,7 +52,8 @@ from .UMLGraphicsView import UMLGraphicsView self.scene = QGraphicsScene(0.0, 0.0, 800.0, 600.0) self.umlView = UMLGraphicsView(self.scene, parent=self) - self.builder = self.__diagramBuilder(self.__diagramType, path, **kwargs) + self.builder = self.__diagramBuilder( + self.__diagramType, path, **kwargs) if self.builder and initBuilder: self.builder.initialize() @@ -104,7 +105,8 @@ self.printPreviewAct = \ QAction(UI.PixmapCache.getIcon("printPreview.png"), self.trUtf8("Print Preview"), self) - self.printPreviewAct.triggered[()].connect(self.umlView.printPreviewDiagram) + self.printPreviewAct.triggered[()].connect( + self.umlView.printPreviewDiagram) def __initToolBars(self): """ @@ -154,7 +156,8 @@ Private method to instantiate a diagram builder object. @param diagramType type of the diagram - (one of ApplicationDiagram, ClassDiagram, ImportsDiagram, PackageDiagram) + (one of ApplicationDiagram, ClassDiagram, ImportsDiagram, + PackageDiagram) @param path file or directory path to build the diagram from (string) @keyparam kwargs diagram specific data @return reference to the instantiated diagram builder @@ -162,16 +165,16 @@ """ if diagramType == UMLDialog.ClassDiagram: from .UMLClassDiagramBuilder import UMLClassDiagramBuilder - return UMLClassDiagramBuilder(self, self.umlView, self.__project, path, - **kwargs) + return UMLClassDiagramBuilder( + self, self.umlView, self.__project, path, **kwargs) elif diagramType == UMLDialog.PackageDiagram: from .PackageDiagramBuilder import PackageDiagramBuilder - return PackageDiagramBuilder(self, self.umlView, self.__project, path, - **kwargs) + return PackageDiagramBuilder( + self, self.umlView, self.__project, path, **kwargs) elif diagramType == UMLDialog.ImportsDiagram: from .ImportsDiagramBuilder import ImportsDiagramBuilder - return ImportsDiagramBuilder(self, self.umlView, self.__project, path, - **kwargs) + return ImportsDiagramBuilder( + self, self.umlView, self.__project, path, **kwargs) elif diagramType == UMLDialog.ApplicationDiagram: from .ApplicationDiagramBuilder import ApplicationDiagramBuilder return ApplicationDiagramBuilder(self, self.umlView, self.__project, @@ -179,8 +182,8 @@ elif diagramType == UMLDialog.NoDiagram: return None else: - raise ValueError( - self.trUtf8("Illegal diagram type '{0}' given.").format(diagramType)) + raise ValueError(self.trUtf8( + "Illegal diagram type '{0}' given.").format(diagramType)) def __diagramTypeString(self): """ @@ -240,7 +243,8 @@ "version: 1.0", "diagram_type: {0} ({1})".format(self.__diagramType, self.__diagramTypeString()), - "scene_size: {0};{1}".format(self.scene.width(), self.scene.height()), + "scene_size: {0};{1}".format(self.scene.width(), + self.scene.height()), ] persistenceData = self.builder.getPersistenceData() if persistenceData: @@ -254,8 +258,9 @@ except (IOError, OSError) as err: E5MessageBox.critical(self, self.trUtf8("Save Diagram"), - self.trUtf8("""<p>The file <b>{0}</b> could not be saved.</p>""" - """<p>Reason: {1}</p>""").format(filename, str(err))) + self.trUtf8( + """<p>The file <b>{0}</b> could not be saved.</p>""" + """<p>Reason: {1}</p>""").format(filename, str(err))) return self.__fileName = filename @@ -282,8 +287,9 @@ except (IOError, OSError) as err: E5MessageBox.critical(self, self.trUtf8("Load Diagram"), - self.trUtf8("""<p>The file <b>{0}</b> could not be read.</p>""" - """<p>Reason: {1}</p>""").format(filename, str(err))) + self.trUtf8( + """<p>The file <b>{0}</b> could not be read.</p>""" + """<p>Reason: {1}</p>""").format(filename, str(err))) return False lines = data.splitlines() @@ -295,7 +301,8 @@ # step 1: check version linenum = 0 key, value = lines[linenum].split(": ", 1) - if key.strip() != "version" or value.strip() not in UMLDialog.FileVersions: + if key.strip() != "version" or \ + value.strip() not in UMLDialog.FileVersions: self.__showInvalidDataMessage(filename, linenum) return False else: @@ -339,7 +346,8 @@ linenum += 1 # step 5: extract the graphics items - ok, vlinenum = self.umlView.parsePersistenceData(version, lines[linenum:]) + ok, vlinenum = self.umlView.parsePersistenceData( + version, lines[linenum:]) if not ok: self.__showInvalidDataMessage(filename, linenum + vlinenum) return False
--- a/Graphics/UMLGraphicsView.py Sun Oct 06 19:52:33 2013 +0200 +++ b/Graphics/UMLGraphicsView.py Mon Oct 07 19:10:11 2013 +0200 @@ -7,8 +7,10 @@ Module implementing a subclass of E5GraphicsView for our diagrams. """ -from PyQt4.QtCore import pyqtSignal, Qt, QSignalMapper, QFileInfo, QEvent, QRectF -from PyQt4.QtGui import QGraphicsView, QAction, QToolBar, QDialog, QPrinter, QPrintDialog +from PyQt4.QtCore import pyqtSignal, Qt, QSignalMapper, QFileInfo, QEvent, \ + QRectF +from PyQt4.QtGui import QGraphicsView, QAction, QToolBar, QDialog, QPrinter, \ + QPrintDialog from E5Graphics.E5GraphicsView import E5GraphicsView @@ -49,7 +51,8 @@ self.border = 10 self.deltaSize = 100.0 - self.__zoomWidget = E5ZoomWidget(UI.PixmapCache.getPixmap("zoomOut.png"), + self.__zoomWidget = E5ZoomWidget( + UI.PixmapCache.getPixmap("zoomOut.png"), UI.PixmapCache.getPixmap("zoomIn.png"), UI.PixmapCache.getPixmap("zoomReset.png"), self) parent.statusBar().addPermanentWidget(self.__zoomWidget) @@ -78,25 +81,29 @@ self.incWidthAct = \ QAction(UI.PixmapCache.getIcon("sceneWidthInc.png"), - self.trUtf8("Increase width by {0} points").format(self.deltaSize), + self.trUtf8("Increase width by {0} points").format( + self.deltaSize), self) self.incWidthAct.triggered[()].connect(self.__incWidth) self.incHeightAct = \ QAction(UI.PixmapCache.getIcon("sceneHeightInc.png"), - self.trUtf8("Increase height by {0} points").format(self.deltaSize), + self.trUtf8("Increase height by {0} points").format( + self.deltaSize), self) self.incHeightAct.triggered[()].connect(self.__incHeight) self.decWidthAct = \ QAction(UI.PixmapCache.getIcon("sceneWidthDec.png"), - self.trUtf8("Decrease width by {0} points").format(self.deltaSize), + self.trUtf8("Decrease width by {0} points").format( + self.deltaSize), self) self.decWidthAct.triggered[()].connect(self.__decWidth) self.decHeightAct = \ QAction(UI.PixmapCache.getIcon("sceneHeightDec.png"), - self.trUtf8("Decrease height by {0} points").format(self.deltaSize), + self.trUtf8("Decrease height by {0} points").format( + self.deltaSize), self) self.decHeightAct.triggered[()].connect(self.__decHeight) @@ -342,11 +349,13 @@ if not res: return - success = super().saveImage(fname, QFileInfo(fname).suffix().upper()) + success = super().saveImage( + fname, QFileInfo(fname).suffix().upper()) if not success: E5MessageBox.critical(self, self.trUtf8("Save Diagram"), - self.trUtf8("""<p>The file <b>{0}</b> could not be saved.</p>""") + self.trUtf8( + """<p>The file <b>{0}</b> could not be saved.</p>""") .format(fname)) def __relayout(self): @@ -677,7 +686,8 @@ from .AssociationItem import AssociationItem for item in self.filteredItems(self.scene().items(), AssociationItem): - lines.append("association: {0}".format(item.buildAssociationItemDataString())) + lines.append("association: {0}".format( + item.buildAssociationItemDataString())) return lines @@ -729,7 +739,8 @@ return False, linenum elif key == "association": srcId, dstId, assocType, topToBottom = \ - AssociationItem.parseAssociationItemDataString(value.strip()) + AssociationItem.parseAssociationItemDataString( + value.strip()) assoc = AssociationItem(umlItems[srcId], umlItems[dstId], assocType, topToBottom) self.scene().addItem(assoc)
--- a/Graphics/UMLItem.py Sun Oct 06 19:52:33 2013 +0200 +++ b/Graphics/UMLItem.py Mon Oct 07 19:10:11 2013 +0200 @@ -183,7 +183,8 @@ @param widget optional reference to the widget painted on (QWidget) """ pen = self.pen() - if (option.state & QStyle.State_Selected) == QStyle.State(QStyle.State_Selected): + if (option.state & QStyle.State_Selected) == \ + QStyle.State(QStyle.State_Selected): pen.setWidth(2) else: pen.setWidth(1) @@ -222,8 +223,8 @@ Public method to build a string to persist the specific item data. This string must start with ", " and should be built like - "attribute=value" with pairs separated by ", ". value must not contain ", " - or newlines. + "attribute=value" with pairs separated by ", ". value must not + contain ", " or newlines. @return persistence data (string) """
--- a/IconEditor/IconEditorGrid.py Sun Oct 06 19:52:33 2013 +0200 +++ b/IconEditor/IconEditorGrid.py Mon Oct 07 19:10:11 2013 +0200 @@ -8,8 +8,9 @@ """ from PyQt4.QtCore import pyqtSignal, Qt, QPoint, QRect, QSize -from PyQt4.QtGui import QUndoCommand, QImage, QWidget, QColor, QPixmap, QSizePolicy, \ - QUndoStack, qRgba, QPainter, QApplication, QCursor, QBrush, QDialog, qGray, qAlpha +from PyQt4.QtGui import QUndoCommand, QImage, QWidget, QColor, QPixmap, \ + QSizePolicy, QUndoStack, qRgba, QPainter, QApplication, QCursor, \ + QBrush, QDialog, qGray, qAlpha from E5Gui import E5MessageBox @@ -26,7 +27,8 @@ @param grid reference to the icon editor grid (IconEditorGrid) @param text text for the undo command (string) - @param oldImage copy of the icon before the changes were applied (QImage) + @param oldImage copy of the icon before the changes were applied + (QImage) @param parent reference to the parent command (QUndoCommand) """ super().__init__(text, parent) @@ -63,13 +65,15 @@ @signal canRedoChanged(bool) emitted after the redo status has changed @signal canUndoChanged(bool) emitted after the undo status has changed - @signal clipboardImageAvailable(bool) emitted to signal the availability of an - image to be pasted + @signal clipboardImageAvailable(bool) emitted to signal the availability + of an image to be pasted @signal colorChanged(QColor) emitted after the drawing color was changed @signal imageChanged(bool) emitted after the image was modified - @signal positionChanged(int, int) emitted after the cursor poition was changed + @signal positionChanged(int, int) emitted after the cursor poition was + changed @signal previewChanged(QPixmap) emitted to signal a new preview pixmap - @signal selectionAvailable(bool) emitted to signal a change of the selection + @signal selectionAvailable(bool) emitted to signal a change of the + selection @signal sizeChanged(int, int) emitted after the size has been changed @signal zoomChanged(int) emitted to signal a change of the zoom value """ @@ -192,8 +196,8 @@ def __initUndoTexts(self): """ - Private method to initialize texts to be associated with undo commands for - the various drawing tools. + Private method to initialize texts to be associated with undo commands + for the various drawing tools. """ self.__undoTexts = { self.Pencil: self.trUtf8("Set Pixel"), @@ -221,7 +225,8 @@ Public slot to set the dirty flag. @param dirty flag indicating the new modification status (boolean) - @param setCleanState flag indicating to set the undo stack to clean (boolean) + @param setCleanState flag indicating to set the undo stack to clean + (boolean) """ self.__dirty = dirty self.imageChanged.emit(dirty) @@ -288,8 +293,8 @@ else: self.__selecting = False - if self.__curTool in [self.RectangleSelection, self.CircleSelection, self.Line, - self.Rectangle, self.FilledRectangle, + if self.__curTool in [self.RectangleSelection, self.CircleSelection, + self.Line, self.Rectangle, self.FilledRectangle, self.Circle, self.FilledCircle, self.Ellipse, self.FilledEllipse]: self.setCursor(self.__aimCursor) @@ -408,13 +413,15 @@ painter.setPen(self.palette().windowText().color()) i = 0 while i <= self.__image.width(): - painter.drawLine(self.__zoom * i, 0, - self.__zoom * i, self.__zoom * self.__image.height()) + painter.drawLine( + self.__zoom * i, 0, + self.__zoom * i, self.__zoom * self.__image.height()) i += 1 j = 0 while j <= self.__image.height(): - painter.drawLine(0, self.__zoom * j, - self.__zoom * self.__image.width(), self.__zoom * j) + painter.drawLine( + 0, self.__zoom * j, + self.__zoom * self.__image.width(), self.__zoom * j) j += 1 col = QColor("#aaa") @@ -426,7 +433,8 @@ color = QColor.fromRgba(self.__image.pixel(i, j)) painter.fillRect(rect, QBrush(Qt.white)) painter.fillRect(QRect(rect.topLeft(), rect.center()), col) - painter.fillRect(QRect(rect.center(), rect.bottomRight()), col) + painter.fillRect(QRect(rect.center(), rect.bottomRight()), + col) painter.fillRect(rect, QBrush(color)) if self.__isMarked(i, j): @@ -446,7 +454,8 @@ return QRect(self.__zoom * i + 1, self.__zoom * j + 1, self.__zoom - 1, self.__zoom - 1) else: - return QRect(self.__zoom * i, self.__zoom * j, self.__zoom, self.__zoom) + return QRect(self.__zoom * i, self.__zoom * j, + self.__zoom, self.__zoom) def mousePressEvent(self, evt): """ @@ -535,7 +544,8 @@ if self.__curTool not in [self.Pencil, self.Rubber, self.Fill, self.ColorPicker, - self.RectangleSelection, self.CircleSelection]: + self.RectangleSelection, + self.CircleSelection]: cmd = IconEditCommand(self, self.__undoTexts[self.__curTool], self.__image) if self.__drawTool(evt.pos(), False): @@ -583,8 +593,9 @@ """ self.__markImage.fill(self.NoMarkColor.rgba()) if self.__pasteRect.isValid(): - self.__updateImageRect(self.__pasteRect.topLeft(), - self.__pasteRect.bottomRight() + QPoint(1, 1)) + self.__updateImageRect( + self.__pasteRect.topLeft(), + self.__pasteRect.bottomRight() + QPoint(1, 1)) x, y = self.__imageCoordinates(pos) isize = self.__image.size() @@ -661,7 +672,8 @@ painter.setBrush(QBrush(drawColor)) painter.drawEllipse(start, r, r) if self.__selecting: - self.__selRect = QRect(start.x() - r, start.y() - r, 2 * r + 1, 2 * r + 1) + self.__selRect = QRect(start.x() - r, start.y() - r, + 2 * r + 1, 2 * r + 1) self.__selectionAvailable = True self.selectionAvailable.emit(True) @@ -713,8 +725,10 @@ """ Private slot to update parts of the widget. - @param pos1 top, left position for the update in widget coordinates (QPoint) - @param pos2 bottom, right position for the update in widget coordinates (QPoint) + @param pos1 top, left position for the update in widget coordinates + (QPoint) + @param pos2 bottom, right position for the update in widget + coordinates (QPoint) """ self.__updateImageRect(QPoint(*self.__imageCoordinates(pos1)), QPoint(*self.__imageCoordinates(pos2))) @@ -723,8 +737,10 @@ """ Private slot to update parts of the widget. - @param ipos1 top, left position for the update in image coordinates (QPoint) - @param ipos2 bottom, right position for the update in image coordinates (QPoint) + @param ipos1 top, left position for the update in image coordinates + (QPoint) + @param ipos2 bottom, right position for the update in image + coordinates (QPoint) """ r1 = self.__pixelRect(ipos1.x(), ipos1.y()) r2 = self.__pixelRect(ipos2.x(), ipos2.y()) @@ -780,8 +796,8 @@ def __checkClipboard(self): """ - Private slot to check, if the clipboard contains a valid image, and signal - the result. + Private slot to check, if the clipboard contains a valid image, and + signal the result. """ ok = self.__clipboardImage()[1] self.__clipboardImageAvailable = ok @@ -817,7 +833,8 @@ @return image of the selection (QImage) """ if cut: - cmd = IconEditCommand(self, self.trUtf8("Cut Selection"), self.__image) + cmd = IconEditCommand(self, self.trUtf8("Cut Selection"), + self.__image) img = QImage(self.__selRect.size(), QImage.Format_ARGB32) img.fill(qRgba(0, 0, 0, 0)) @@ -825,9 +842,10 @@ for j in range(0, self.__selRect.height()): if self.__image.rect().contains(self.__selRect.x() + i, self.__selRect.y() + j): - if self.__isMarked(self.__selRect.x() + i, self.__selRect.y() + j): - img.setPixel(i, j, self.__image.pixel(self.__selRect.x() + i, - self.__selRect.y() + j)) + if self.__isMarked( + self.__selRect.x() + i, self.__selRect.y() + j): + img.setPixel(i, j, self.__image.pixel( + self.__selRect.x() + i, self.__selRect.y() + j)) if cut: self.__image.setPixel(self.__selRect.x() + i, self.__selRect.y() + j, @@ -864,15 +882,18 @@ """ Public slot to paste an image from the clipboard. - @param pasting flag indicating part two of the paste operation (boolean) + @param pasting flag indicating part two of the paste operation + (boolean) """ img, ok = self.__clipboardImage() if ok: - if img.width() > self.__image.width() or img.height() > self.__image.height(): + if img.width() > self.__image.width() or \ + img.height() > self.__image.height(): res = E5MessageBox.yesNo(self, self.trUtf8("Paste"), - self.trUtf8("""<p>The clipboard image is larger than the current """ - """image.<br/>Paste as new image?</p>""")) + self.trUtf8( + """<p>The clipboard image is larger than the""" + """ current image.<br/>Paste as new image?</p>""")) if res: self.editPasteAsNew() return @@ -880,19 +901,23 @@ self.__isPasting = True self.__clipboardSize = img.size() else: - cmd = IconEditCommand(self, self.trUtf8("Paste Clipboard"), self.__image) + cmd = IconEditCommand(self, self.trUtf8("Paste Clipboard"), + self.__image) self.__markImage.fill(self.NoMarkColor.rgba()) painter = QPainter(self.__image) painter.setPen(self.penColor()) painter.setCompositionMode(self.__compositingMode) - painter.drawImage(self.__pasteRect.x(), self.__pasteRect.y(), img, 0, 0, - self.__pasteRect.width() + 1, self.__pasteRect.height() + 1) + painter.drawImage( + self.__pasteRect.x(), self.__pasteRect.y(), img, 0, 0, + self.__pasteRect.width() + 1, + self.__pasteRect.height() + 1) self.__undoStack.push(cmd) cmd.setAfterImage(self.__image) - self.__updateImageRect(self.__pasteRect.topLeft(), - self.__pasteRect.bottomRight() + QPoint(1, 1)) + self.__updateImageRect( + self.__pasteRect.topLeft(), + self.__pasteRect.bottomRight() + QPoint(1, 1)) else: E5MessageBox.warning(self, self.trUtf8("Pasting Image"), @@ -904,8 +929,9 @@ """ img, ok = self.__clipboardImage() if ok: - cmd = IconEditCommand(self, self.trUtf8("Paste Clipboard as New Image"), - self.__image) + cmd = IconEditCommand( + self, self.trUtf8("Paste Clipboard as New Image"), + self.__image) self.setIconImage(img) self.setDirty(True) self.__undoStack.push(cmd) @@ -948,10 +974,13 @@ res = dlg.exec_() if res == QDialog.Accepted: newWidth, newHeight = dlg.getData() - if newWidth != self.__image.width() or newHeight != self.__image.height(): - cmd = IconEditCommand(self, self.trUtf8("Resize Image"), self.__image) - img = self.__image.scaled(newWidth, newHeight, Qt.IgnoreAspectRatio, - Qt.SmoothTransformation) + if newWidth != self.__image.width() or \ + newHeight != self.__image.height(): + cmd = IconEditCommand(self, self.trUtf8("Resize Image"), + self.__image) + img = self.__image.scaled( + newWidth, newHeight, Qt.IgnoreAspectRatio, + Qt.SmoothTransformation) self.setIconImage(img) self.setDirty(True) self.__undoStack.push(cmd) @@ -974,13 +1003,15 @@ """ Public slot to convert the image to gray preserving transparency. """ - cmd = IconEditCommand(self, self.trUtf8("Convert to Grayscale"), self.__image) + cmd = IconEditCommand(self, self.trUtf8("Convert to Grayscale"), + self.__image) for x in range(self.__image.width()): for y in range(self.__image.height()): col = self.__image.pixel(x, y) if col != qRgba(0, 0, 0, 0): gray = qGray(col) - self.__image.setPixel(x, y, qRgba(gray, gray, gray, qAlpha(col))) + self.__image.setPixel( + x, y, qRgba(gray, gray, gray, qAlpha(col))) self.update() self.setDirty(True) self.__undoStack.push(cmd)
--- a/IconEditor/IconEditorPalette.py Sun Oct 06 19:52:33 2013 +0200 +++ b/IconEditor/IconEditorPalette.py Mon Oct 07 19:10:11 2013 +0200 @@ -8,9 +8,9 @@ """ from PyQt4.QtCore import pyqtSignal, Qt -from PyQt4.QtGui import QWidget, QColor, QPainter, QBoxLayout, QLabel, QFrame, \ - QPushButton, QSpinBox, QGroupBox, QVBoxLayout, QRadioButton, QSpacerItem, \ - QSizePolicy, QPixmap, QColorDialog +from PyQt4.QtGui import QWidget, QColor, QPainter, QBoxLayout, QLabel, \ + QFrame, QPushButton, QSpinBox, QGroupBox, QVBoxLayout, QRadioButton, \ + QSpacerItem, QSizePolicy, QPixmap, QColorDialog class IconEditorPalette(QWidget): @@ -18,8 +18,8 @@ Class implementing a palette widget for the icon editor. @signal colorSelected(QColor) emitted after a new color has been selected - @signal compositingChanged(QPainter.CompositionMode) emitted to signal a change - of the compositing mode + @signal compositingChanged(QPainter.CompositionMode) emitted to signal a + change of the compositing mode """ colorSelected = pyqtSignal(QColor) compositingChanged = pyqtSignal(QPainter.CompositionMode) @@ -63,14 +63,16 @@ self.__colorTxt.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter) self.__colorTxt.setWhatsThis(self.trUtf8( """<b>Current Color Value</b>""" - """<p>This is the currently selected color value used for drawing.</p>""" + """<p>This is the currently selected color value used for""" + """ drawing.</p>""" )) self.__layout.addWidget(self.__colorTxt) self.__colorButton = QPushButton(self.trUtf8("Select Color"), self) self.__colorButton.setWhatsThis(self.trUtf8( """<b>Select Color</b>""" - """<p>Select the current drawing color via a color selection dialog.</p>""" + """<p>Select the current drawing color via a color selection""" + """ dialog.</p>""" )) self.__colorButton.clicked[()].connect(self.__selectColor) self.__layout.addWidget(self.__colorButton) @@ -79,7 +81,8 @@ self.__colorAlpha.setRange(0, 255) self.__colorAlpha.setWhatsThis(self.trUtf8( """<b>Select alpha channel value</b>""" - """<p>Select the value for the alpha channel of the current color.</p>""" + """<p>Select the value for the alpha channel of the current""" + """ color.</p>""" )) self.__layout.addWidget(self.__colorAlpha) self.__colorAlpha.valueChanged[int].connect(self.__alphaChanged) @@ -102,11 +105,13 @@ """<p>Blend the new color over the existing pixel.</p>""" )) self.__sourceOverButton.setChecked(True) - self.__sourceOverButton.clicked[bool].connect(self.__compositingChanged) + self.__sourceOverButton.clicked[bool].connect( + self.__compositingChanged) self.__compositingGroupLayout.addWidget(self.__sourceOverButton) self.__layout.addWidget(self.__compositingGroup) - spacer = QSpacerItem(10, 10, QSizePolicy.Minimum, QSizePolicy.Expanding) + spacer = QSpacerItem( + 10, 10, QSizePolicy.Minimum, QSizePolicy.Expanding) self.__layout.addItem(spacer) def previewChanged(self, pixmap): @@ -172,10 +177,13 @@ """ Private slot to handle a change of the compositing mode. - @param on flag indicating the checked state of the compositing button (boolean) + @param on flag indicating the checked state of the compositing button + (boolean) """ if on: if self.__sourceButton.isChecked(): - self.compositingChanged.emit(QPainter.CompositionMode_Source) + self.compositingChanged.emit( + QPainter.CompositionMode_Source) elif self.__sourceOverButton.isChecked(): - self.compositingChanged.emit(QPainter.CompositionMode_SourceOver) + self.compositingChanged.emit( + QPainter.CompositionMode_SourceOver)
--- a/IconEditor/IconEditorWindow.py Sun Oct 06 19:52:33 2013 +0200 +++ b/IconEditor/IconEditorWindow.py Mon Oct 07 19:10:11 2013 +0200 @@ -9,10 +9,10 @@ import os -from PyQt4.QtCore import pyqtSignal, Qt, QSize, QSignalMapper, QFileInfo, QFile, \ - QEvent -from PyQt4.QtGui import QScrollArea, QPalette, QImage, QImageReader, QImageWriter, \ - QKeySequence, QLabel, QDockWidget, QWhatsThis +from PyQt4.QtCore import pyqtSignal, Qt, QSize, QSignalMapper, QFileInfo, \ + QFile, QEvent +from PyQt4.QtGui import QScrollArea, QPalette, QImage, QImageReader, \ + QImageWriter, QKeySequence, QLabel, QDockWidget, QWhatsThis from E5Gui.E5Action import E5Action, createActionGroup from E5Gui import E5FileDialog, E5MessageBox @@ -46,8 +46,8 @@ @param parent parent widget of this window (QWidget) @keyparam fromEric flag indicating whether it was called from within eric5 (boolean) - @keyparam initShortcutsOnly flag indicating to just initialize the keyboard - shortcuts (boolean) + @keyparam initShortcutsOnly flag indicating to just initialize the + keyboard shortcuts (boolean) @keyparam project reference to the project object (Project) """ super().__init__(parent) @@ -62,7 +62,8 @@ self.__initActions() else: if not self.fromEric: - self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) + self.setStyle(Preferences.getUI("Style"), + Preferences.getUI("StyleSheet")) self.__editor = IconEditorGrid() self.__scrollArea = QScrollArea() self.__scrollArea.setWidget(self.__editor) @@ -99,7 +100,8 @@ self.__editor.previewChanged.connect(self.__palette.previewChanged) self.__editor.colorChanged.connect(self.__palette.colorChanged) self.__palette.colorSelected.connect(self.__editor.setPenColor) - self.__palette.compositingChanged.connect(self.__editor.setCompositingMode) + self.__palette.compositingChanged.connect( + self.__editor.setCompositingMode) self.__setCurrentFile("") if fileName: @@ -131,7 +133,8 @@ 'ppm': self.trUtf8("Portable Pixmap File (*.ppm)"), 'sgi': self.trUtf8("Silicon Graphics Image File (*.sgi)"), 'svg': self.trUtf8("Scalable Vector Graphics File (*.svg)"), - 'svgz': self.trUtf8("Compressed Scalable Vector Graphics File (*.svgz)"), + 'svgz': self.trUtf8("Compressed Scalable Vector Graphics File" + " (*.svgz)"), 'tga': self.trUtf8("Targa Graphic File (*.tga)"), 'tif': self.trUtf8("TIFF File (*.tif)"), 'tiff': self.trUtf8("TIFF File (*.tiff)"), @@ -197,7 +200,8 @@ UI.PixmapCache.getIcon("newWindow.png"), self.trUtf8('New &Window'), 0, 0, self, 'iconEditor_file_new_window') - self.newWindowAct.setStatusTip(self.trUtf8('Open a new icon editor window')) + self.newWindowAct.setStatusTip(self.trUtf8( + 'Open a new icon editor window')) self.newWindowAct.setWhatsThis(self.trUtf8( """<b>New Window</b>""" """<p>This opens a new icon editor window.</p>""" @@ -251,7 +255,8 @@ self.trUtf8('&Close'), QKeySequence(self.trUtf8("Ctrl+W", "File|Close")), 0, self, 'iconEditor_file_close') - self.closeAct.setStatusTip(self.trUtf8('Close the current icon editor window')) + self.closeAct.setStatusTip(self.trUtf8( + 'Close the current icon editor window')) self.closeAct.setWhatsThis(self.trUtf8( """<b>Close</b>""" """<p>Closes the current icon editor window.</p>""" @@ -262,10 +267,11 @@ self.closeAllAct = E5Action(self.trUtf8('Close All'), self.trUtf8('Close &All'), 0, 0, self, 'iconEditor_file_close_all') - self.closeAllAct.setStatusTip(self.trUtf8('Close all icon editor windows')) + self.closeAllAct.setStatusTip(self.trUtf8( + 'Close all icon editor windows')) self.closeAllAct.setWhatsThis(self.trUtf8( - """<b>Close All</b>""" - """<p>Closes all icon editor windows except the first one.</p>""" + """<b>Close All</b>""" + """<p>Closes all icon editor windows except the first one.</p>""" )) self.closeAllAct.triggered[()].connect(self.__closeAll) self.__actions.append(self.closeAllAct) @@ -378,7 +384,8 @@ self.deleteAct.setStatusTip(self.trUtf8('Clear the icon image')) self.deleteAct.setWhatsThis(self.trUtf8( """<b>Clear</b>""" - """<p>Clear the icon image and set it to be completely transparent.</p>""" + """<p>Clear the icon image and set it to be completely""" + """ transparent.</p>""" )) self.deleteAct.triggered[()].connect(self.__editor.editClear) self.__actions.append(self.deleteAct) @@ -388,7 +395,8 @@ QKeySequence(self.trUtf8("Ctrl+A", "Edit|Select All")), 0, self, 'iconEditor_edit_select_all') - self.selectAllAct.setStatusTip(self.trUtf8('Select the complete icon image')) + self.selectAllAct.setStatusTip(self.trUtf8( + 'Select the complete icon image')) self.selectAllAct.setWhatsThis(self.trUtf8( """<b>Select All</b>""" """<p>Selects the complete icon image.</p>""" @@ -414,7 +422,8 @@ self.trUtf8('&Grayscale'), 0, 0, self, 'iconEditor_edit_grayscale') - self.grayscaleAct.setStatusTip(self.trUtf8('Change the icon to grayscale')) + self.grayscaleAct.setStatusTip(self.trUtf8( + 'Change the icon to grayscale')) self.grayscaleAct.setWhatsThis(self.trUtf8( """<b>Grayscale</b>""" """<p>Changes the icon to grayscale.</p>""" @@ -475,7 +484,8 @@ self.trUtf8('Zoom &reset'), QKeySequence(self.trUtf8("Ctrl+0", "View|Zoom reset")), 0, self, 'iconEditor_view_zoom_reset') - self.zoomResetAct.setStatusTip(self.trUtf8('Reset the zoom of the icon')) + self.zoomResetAct.setStatusTip(self.trUtf8( + 'Reset the zoom of the icon')) self.zoomResetAct.setWhatsThis(self.trUtf8( """<b>Zoom reset</b>""" """<p>Reset the zoom of the icon. """ @@ -489,7 +499,8 @@ self.trUtf8('Show &Grid'), 0, 0, self, 'iconEditor_view_show_grid') - self.showGridAct.setStatusTip(self.trUtf8('Toggle the display of the grid')) + self.showGridAct.setStatusTip(self.trUtf8( + 'Toggle the display of the grid')) self.showGridAct.setWhatsThis(self.trUtf8( """<b>Show Grid</b>""" """<p>Toggle the display of the grid.</p>""" @@ -534,7 +545,8 @@ """the current draw color.</p>""" )) self.drawColorPickerAct.setCheckable(True) - self.esm.setMapping(self.drawColorPickerAct, IconEditorGrid.ColorPicker) + self.esm.setMapping(self.drawColorPickerAct, + IconEditorGrid.ColorPicker) self.drawColorPickerAct.triggered[()].connect(self.esm.map) self.__actions.append(self.drawColorPickerAct) @@ -562,7 +574,8 @@ """<p>Draw a filled rectangle.</p>""" )) self.drawFilledRectangleAct.setCheckable(True) - self.esm.setMapping(self.drawFilledRectangleAct, IconEditorGrid.FilledRectangle) + self.esm.setMapping(self.drawFilledRectangleAct, + IconEditorGrid.FilledRectangle) self.drawFilledRectangleAct.triggered[()].connect(self.esm.map) self.__actions.append(self.drawFilledRectangleAct) @@ -590,7 +603,8 @@ """<p>Draw a filled circle.</p>""" )) self.drawFilledCircleAct.setCheckable(True) - self.esm.setMapping(self.drawFilledCircleAct, IconEditorGrid.FilledCircle) + self.esm.setMapping(self.drawFilledCircleAct, + IconEditorGrid.FilledCircle) self.drawFilledCircleAct.triggered[()].connect(self.esm.map) self.__actions.append(self.drawFilledCircleAct) @@ -618,7 +632,8 @@ """<p>Draw a filled ellipse.</p>""" )) self.drawFilledEllipseAct.setCheckable(True) - self.esm.setMapping(self.drawFilledEllipseAct, IconEditorGrid.FilledEllipse) + self.esm.setMapping(self.drawFilledEllipseAct, + IconEditorGrid.FilledEllipse) self.drawFilledEllipseAct.triggered[()].connect(self.esm.map) self.__actions.append(self.drawFilledEllipseAct) @@ -665,14 +680,16 @@ self.drawEraserAct.triggered[()].connect(self.esm.map) self.__actions.append(self.drawEraserAct) - self.drawRectangleSelectionAct = E5Action(self.trUtf8('Rectangular Selection'), + self.drawRectangleSelectionAct = E5Action( + self.trUtf8('Rectangular Selection'), UI.PixmapCache.getIcon("selectRectangle.png"), self.trUtf8('Rect&angular Selection'), 0, 0, self.drawingActGrp, 'iconEditor_tools_selection_rectangle') self.drawRectangleSelectionAct.setWhatsThis(self.trUtf8( - """<b>Rectangular Selection</b>""" - """<p>Select a rectangular section of the icon using the mouse.</p>""" + """<b>Rectangular Selection</b>""" + """<p>Select a rectangular section of the icon using""" + """ the mouse.</p>""" )) self.drawRectangleSelectionAct.setCheckable(True) self.esm.setMapping(self.drawRectangleSelectionAct, @@ -680,14 +697,16 @@ self.drawRectangleSelectionAct.triggered[()].connect(self.esm.map) self.__actions.append(self.drawRectangleSelectionAct) - self.drawCircleSelectionAct = E5Action(self.trUtf8('Circular Selection'), + self.drawCircleSelectionAct = E5Action( + self.trUtf8('Circular Selection'), UI.PixmapCache.getIcon("selectCircle.png"), self.trUtf8('Rect&angular Selection'), 0, 0, self.drawingActGrp, 'iconEditor_tools_selection_circle') self.drawCircleSelectionAct.setWhatsThis(self.trUtf8( - """<b>Circular Selection</b>""" - """<p>Select a circular section of the icon using the mouse.</p>""" + """<b>Circular Selection</b>""" + """<p>Select a circular section of the icon using""" + """ the mouse.</p>""" )) self.drawCircleSelectionAct.setCheckable(True) self.esm.setMapping(self.drawCircleSelectionAct, @@ -704,7 +723,8 @@ self.aboutAct = E5Action(self.trUtf8('About'), self.trUtf8('&About'), 0, 0, self, 'iconEditor_help_about') - self.aboutAct.setStatusTip(self.trUtf8('Display information about this software')) + self.aboutAct.setStatusTip(self.trUtf8( + 'Display information about this software')) self.aboutAct.setWhatsThis(self.trUtf8( """<b>About</b>""" """<p>Display some information about this software.</p>""")) @@ -730,12 +750,12 @@ 0, self, 'iconEditor_help_whats_this') self.whatsThisAct.setStatusTip(self.trUtf8('Context sensitive help')) self.whatsThisAct.setWhatsThis(self.trUtf8( - """<b>Display context sensitive help</b>""" - """<p>In What's This? mode, the mouse cursor shows an arrow with a""" - """ question mark, and you can click on the interface elements to get""" - """ a short description of what they do and how to use them. In""" - """ dialogs, this feature can be accessed using the context help button""" - """ in the titlebar.</p>""" + """<b>Display context sensitive help</b>""" + """<p>In What's This? mode, the mouse cursor shows an arrow""" + """ with a question mark, and you can click on the interface""" + """ elements to get a short description of what they do and""" + """ how to use them. In dialogs, this feature can be accessed""" + """ using the context help button in the titlebar.</p>""" )) self.whatsThisAct.triggered[()].connect(self.__whatsThis) self.__actions.append(self.whatsThisAct) @@ -886,11 +906,13 @@ self.__sbPos = QLabel(self.__statusBar) self.__statusBar.addPermanentWidget(self.__sbPos) self.__sbPos.setWhatsThis(self.trUtf8( - """<p>This part of the status bar displays the cursor position.</p>""" + """<p>This part of the status bar displays the cursor""" + """ position.</p>""" )) self.__updatePosition(0, 0) - self.__zoomWidget = E5ZoomWidget(UI.PixmapCache.getPixmap("zoomOut.png"), + self.__zoomWidget = E5ZoomWidget( + UI.PixmapCache.getPixmap("zoomOut.png"), UI.PixmapCache.getPixmap("zoomIn.png"), UI.PixmapCache.getPixmap("zoomReset.png"), self) self.__zoomWidget.setMinimum(IconEditorGrid.ZoomMinimum) @@ -938,7 +960,8 @@ try: if self.fromEric or len(self.__class__.windows) > 1: - del self.__class__.windows[self.__class__.windows.index(self)] + del self.__class__.windows[ + self.__class__.windows.index(self)] except ValueError: pass @@ -1057,15 +1080,17 @@ """ file = QFile(fileName) if not file.exists(): - E5MessageBox.warning(self, self.trUtf8("eric5 Icon Editor"), - self.trUtf8("The file '{0}' does not exist.")\ - .format(fileName)) + E5MessageBox.warning( + self, self.trUtf8("eric5 Icon Editor"), + self.trUtf8("The file '{0}' does not exist.") + .format(fileName)) return if not file.open(QFile.ReadOnly): - E5MessageBox.warning(self, self.trUtf8("eric5 Icon Editor"), - self.trUtf8("Cannot read file '{0}:\n{1}.")\ - .format(fileName, file.errorString())) + E5MessageBox.warning( + self, self.trUtf8("eric5 Icon Editor"), + self.trUtf8("Cannot read file '{0}:\n{1}.") + .format(fileName, file.errorString())) return file.close() @@ -1082,9 +1107,10 @@ """ file = QFile(fileName) if not file.open(QFile.WriteOnly): - E5MessageBox.warning(self, self.trUtf8("eric5 Icon Editor"), - self.trUtf8("Cannot write file '{0}:\n{1}.")\ - .format(fileName, file.errorString())) + E5MessageBox.warning( + self, self.trUtf8("eric5 Icon Editor"), + self.trUtf8("Cannot write file '{0}:\n{1}.") + .format(fileName, file.errorString())) self.__checkActions() @@ -1095,9 +1121,10 @@ file.close() if not res: - E5MessageBox.warning(self, self.trUtf8("eric5 Icon Editor"), - self.trUtf8("Cannot write file '{0}:\n{1}.")\ - .format(fileName, file.errorString())) + E5MessageBox.warning( + self, self.trUtf8("eric5 Icon Editor"), + self.trUtf8("Cannot write file '{0}:\n{1}.") + .format(fileName, file.errorString())) self.__checkActions() @@ -1125,7 +1152,7 @@ else: shownName = self.__strippedName(self.__fileName) - self.setWindowTitle(self.trUtf8("{0}[*] - {1}")\ + self.setWindowTitle(self.trUtf8("{0}[*] - {1}") .format(shownName, self.trUtf8("Icon Editor"))) self.setWindowModified(self.__editor.isDirty()) @@ -1212,14 +1239,16 @@ """ Private slot called to handle the zoom in action. """ - self.__editor.setZoomFactor(self.__editor.zoomFactor() + IconEditorGrid.ZoomStep) + self.__editor.setZoomFactor( + self.__editor.zoomFactor() + IconEditorGrid.ZoomStep) self.__updateZoom() def __zoomOut(self): """ Private slot called to handle the zoom out action. """ - self.__editor.setZoomFactor(self.__editor.zoomFactor() - IconEditorGrid.ZoomStep) + self.__editor.setZoomFactor( + self.__editor.zoomFactor() - IconEditorGrid.ZoomStep) self.__updateZoom() def __zoomReset(self): @@ -1233,7 +1262,8 @@ """ Private slot to show a little About message. """ - E5MessageBox.about(self, self.trUtf8("About eric5 Icon Editor"), + E5MessageBox.about( + self, self.trUtf8("About eric5 Icon Editor"), self.trUtf8("The eric5 Icon Editor is a simple editor component" " to perform icon drawing tasks."))
--- a/MultiProject/AddProjectDialog.py Sun Oct 06 19:52:33 2013 +0200 +++ b/MultiProject/AddProjectDialog.py Mon Oct 07 19:10:11 2013 +0200 @@ -66,16 +66,17 @@ self.trUtf8("Project Files (*.e4p)")) if projectFile: - self.filenameEdit.setText(Utilities.toNativeSeparators(projectFile)) + self.filenameEdit.setText( + Utilities.toNativeSeparators(projectFile)) def getData(self): """ Public slot to retrieve the dialogs data. - @return tuple of four values (string, string, boolean, string) giving the - project name, the name of the project file, a flag telling, whether - the project shall be the main project and a short description - for the project + @return tuple of four values (string, string, boolean, string) giving + the project name, the name of the project file, a flag telling, + whether the project shall be the main project and a short + description for the project """ return (self.nameEdit.text(), self.filenameEdit.text(), self.masterCheckBox.isChecked(),
--- a/MultiProject/MultiProject.py Sun Oct 06 19:52:33 2013 +0200 +++ b/MultiProject/MultiProject.py Mon Oct 07 19:10:11 2013 +0200 @@ -60,7 +60,8 @@ @param project reference to the project object (Project.Project) @param parent parent widget (usually the ui object) (QWidget) - @param filename optional filename of a multi project file to open (string) + @param filename optional filename of a multi project file to open + (string) """ super().__init__(parent) @@ -86,10 +87,12 @@ self.description = "" # description of the multi project self.name = "" self.opened = False - self.projects = [] # list of project info; each info entry is a dictionary + self.projects = [] # list of project info; each info entry is + # a dictionary # 'name' : Name of the project # 'file' : project filename - # 'master' : flag indicating the master project + # 'master' : flag indicating the master + # project # 'description' : description of the project def __loadRecent(self): @@ -108,7 +111,8 @@ """ Private method to save the list of recently opened filenames. """ - Preferences.Prefs.rsettings.setValue(recentNameMultiProject, self.recent) + Preferences.Prefs.rsettings.setValue( + recentNameMultiProject, self.recent) Preferences.Prefs.rsettings.sync() def getMostRecent(self): @@ -203,8 +207,9 @@ QApplication.restoreOverrideCursor() E5MessageBox.critical(self.ui, self.trUtf8("Read multiproject file"), - self.trUtf8("<p>The multiproject file <b>{0}</b> could not be read.</p>")\ - .format(fn)) + self.trUtf8( + "<p>The multiproject file <b>{0}</b> could not be" + " read.</p>").format(fn)) return False self.pfile = os.path.abspath(fn) @@ -225,10 +230,10 @@ Private method to save the multi project infos to a multi project file. @param fn optional filename of the multi project file to be written. - If fn is None, the filename stored in the multi project object - is used. This is the 'save' action. If fn is given, this filename - is used instead of the one in the multi project object. This is the - 'save as' action. + If fn is None, the filename stored in the multi project object + is used. This is the 'save' action. If fn is given, this filename + is used instead of the one in the multi project object. This is the + 'save as' action. @return flag indicating success """ if fn is None: @@ -237,7 +242,8 @@ f = QFile(fn) if f.open(QIODevice.WriteOnly): from E5XML.MultiProjectWriter import MultiProjectWriter - MultiProjectWriter(f, self, os.path.splitext(os.path.basename(fn))[0])\ + MultiProjectWriter( + f, self, os.path.splitext(os.path.basename(fn))[0])\ .writeXML() res = True else: @@ -349,7 +355,8 @@ """ Public slot to remove a project from the multi project. - @param fn filename of the project to be removed from the multi project (string) + @param fn filename of the project to be removed from the multi + project (string) """ for project in self.projects: if project['file'] == fn: @@ -396,7 +403,8 @@ """ Public slot to open a multi project. - @param fn optional filename of the multi project file to be read (string) + @param fn optional filename of the multi project file to be + read (string) @param openMaster flag indicating, that the master project should be opened depending on the configuration (boolean) """ @@ -407,7 +415,8 @@ fn = E5FileDialog.getOpenFileName( self.parent(), self.trUtf8("Open multiproject"), - Preferences.getMultiProject("Workspace") or Utilities.getHomeDir(), + Preferences.getMultiProject("Workspace") or \ + Utilities.getHomeDir(), self.trUtf8("Multiproject Files (*.e4m)")) if fn == "": @@ -431,7 +440,8 @@ self.multiProjectOpened.emit() - if openMaster and Preferences.getMultiProject("OpenMasterAutomatically"): + if openMaster and Preferences.getMultiProject( + "OpenMasterAutomatically"): self.__openMasterProject(False) else: QApplication.restoreOverrideCursor() @@ -583,7 +593,8 @@ self.closeAct = E5Action(self.trUtf8('Close multiproject'), UI.PixmapCache.getIcon("multiProjectClose.png"), self.trUtf8('&Close'), 0, 0, self, 'multi_project_close') - self.closeAct.setStatusTip(self.trUtf8('Close the current multiproject')) + self.closeAct.setStatusTip(self.trUtf8( + 'Close the current multiproject')) self.closeAct.setWhatsThis(self.trUtf8( """<b>Close</b>""" """<p>This closes the current multiproject.</p>""" @@ -604,7 +615,8 @@ self.saveasAct = E5Action(self.trUtf8('Save multiproject as'), UI.PixmapCache.getIcon("multiProjectSaveAs.png"), - self.trUtf8('Save &as...'), 0, 0, self, 'multi_project_save_as') + self.trUtf8('Save &as...'), 0, 0, self, + 'multi_project_save_as') self.saveasAct.setStatusTip(self.trUtf8( 'Save the current multiproject to a new file')) self.saveasAct.setWhatsThis(self.trUtf8( @@ -614,10 +626,11 @@ self.saveasAct.triggered[()].connect(self.saveMultiProjectAs) self.actions.append(self.saveasAct) - self.addProjectAct = E5Action(self.trUtf8('Add project to multiproject'), - UI.PixmapCache.getIcon("fileProject.png"), - self.trUtf8('Add &project...'), 0, 0, - self, 'multi_project_add_project') + self.addProjectAct = E5Action( + self.trUtf8('Add project to multiproject'), + UI.PixmapCache.getIcon("fileProject.png"), + self.trUtf8('Add &project...'), 0, 0, + self, 'multi_project_add_project') self.addProjectAct.setStatusTip(self.trUtf8( 'Add a project to the current multiproject')) self.addProjectAct.setWhatsThis(self.trUtf8( @@ -630,11 +643,14 @@ self.propsAct = E5Action(self.trUtf8('Multiproject properties'), UI.PixmapCache.getIcon("multiProjectProps.png"), - self.trUtf8('&Properties...'), 0, 0, self, 'multi_project_properties') - self.propsAct.setStatusTip(self.trUtf8('Show the multiproject properties')) + self.trUtf8('&Properties...'), 0, 0, self, + 'multi_project_properties') + self.propsAct.setStatusTip(self.trUtf8( + 'Show the multiproject properties')) self.propsAct.setWhatsThis(self.trUtf8( """<b>Properties...</b>""" - """<p>This shows a dialog to edit the multiproject properties.</p>""" + """<p>This shows a dialog to edit the multiproject""" + """ properties.</p>""" )) self.propsAct.triggered[()].connect(self.__showProperties) self.actions.append(self.propsAct) @@ -652,7 +668,8 @@ @return the menu generated (QMenu) """ menu = QMenu(self.trUtf8('&Multiproject'), self.parent()) - self.recentMenu = QMenu(self.trUtf8('Open &Recent Multiprojects'), menu) + self.recentMenu = QMenu(self.trUtf8('Open &Recent Multiprojects'), + menu) self.__menus = { "Main": menu, @@ -685,7 +702,8 @@ """ Public slot to initialize the multi 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("Multiproject"), self.ui) @@ -715,8 +733,8 @@ def __syncRecent(self): """ - Private method to synchronize the list of recently opened multi projects - with the central store. + Private method to synchronize the list of recently opened multi + projects with the central store. """ for recent in self.recent[:]: if Utilities.samepath(self.pfile, recent):
--- a/MultiProject/MultiProjectBrowser.py Sun Oct 06 19:52:33 2013 +0200 +++ b/MultiProject/MultiProjectBrowser.py Mon Oct 07 19:10:11 2013 +0200 @@ -34,22 +34,29 @@ self.__openingProject = False - self.multiProject.newMultiProject.connect(self.__newMultiProject) - self.multiProject.multiProjectOpened.connect(self.__multiProjectOpened) - self.multiProject.multiProjectClosed.connect(self.__multiProjectClosed) - self.multiProject.projectDataChanged.connect(self.__projectDataChanged) - self.multiProject.projectAdded.connect(self.__projectAdded) - self.multiProject.projectRemoved.connect(self.__projectRemoved) - self.multiProject.projectOpened.connect(self.__projectOpened) + self.multiProject.newMultiProject.connect( + self.__newMultiProject) + self.multiProject.multiProjectOpened.connect( + self.__multiProjectOpened) + self.multiProject.multiProjectClosed.connect( + self.__multiProjectClosed) + self.multiProject.projectDataChanged.connect( + self.__projectDataChanged) + self.multiProject.projectAdded.connect( + self.__projectAdded) + self.multiProject.projectRemoved.connect( + self.__projectRemoved) + self.multiProject.projectOpened.connect( + self.__projectOpened) self.__createPopupMenu() self.setContextMenuPolicy(Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.__contextMenuRequested) self.itemActivated.connect(self.__openItem) - ############################################################################ + ########################################################################### ## Slot handling methods below - ############################################################################ + ########################################################################### def __newMultiProject(self): """ @@ -150,9 +157,9 @@ self.multiProject.openProject(filename) self.__openingProject = False - ############################################################################ + ########################################################################### ## Private methods below - ############################################################################ + ########################################################################### def __addProject(self, project): """ @@ -240,16 +247,20 @@ self.__menu = QMenu(self) self.__menu.addAction(self.trUtf8("Open"), self.__openItem) self.__menu.addAction(self.trUtf8("Remove"), self.__removeProject) - self.__menu.addAction(self.trUtf8("Properties"), self.__showProjectProperties) + self.__menu.addAction(self.trUtf8("Properties"), + self.__showProjectProperties) self.__menu.addSeparator() - self.__menu.addAction(self.trUtf8("Add Project..."), self.__addNewProject) + self.__menu.addAction(self.trUtf8("Add Project..."), + self.__addNewProject) self.__menu.addSeparator() self.__menu.addAction(self.trUtf8("Configure..."), self.__configure) self.__backMenu = QMenu(self) - self.__backMenu.addAction(self.trUtf8("Add Project..."), self.__addNewProject) + self.__backMenu.addAction(self.trUtf8("Add Project..."), + self.__addNewProject) self.__backMenu.addSeparator() - self.__backMenu.addAction(self.trUtf8("Configure..."), self.__configure) + self.__backMenu.addAction(self.trUtf8("Configure..."), + self.__configure) def __configure(self): """
--- a/Network/IRC/IrcChannelWidget.py Sun Oct 06 19:52:33 2013 +0200 +++ b/Network/IRC/IrcChannelWidget.py Mon Oct 07 19:10:11 2013 +0200 @@ -9,9 +9,10 @@ import re -from PyQt4.QtCore import pyqtSlot, pyqtSignal, QDateTime, QPoint, QFileInfo, QTimer, QUrl -from PyQt4.QtGui import QWidget, QListWidgetItem, QIcon, QPainter, QMenu, QApplication, \ - QInputDialog, QLineEdit, QTextCursor, QDesktopServices +from PyQt4.QtCore import pyqtSlot, pyqtSignal, QDateTime, QPoint, QFileInfo, \ + QTimer, QUrl +from PyQt4.QtGui import QWidget, QListWidgetItem, QIcon, QPainter, QMenu, \ + QApplication, QInputDialog, QLineEdit, QTextCursor, QDesktopServices from E5Gui import E5MessageBox, E5FileDialog from E5Gui.E5Application import e5App @@ -52,7 +53,8 @@ Constructor @param name string with user name and privilege prefix (string) - @param parent reference to the parent widget (QListWidget or QListWidgetItem) + @param parent reference to the parent widget (QListWidget or + QListWidgetItem) """ super().__init__(name, parent) @@ -180,7 +182,8 @@ @signal sendData(str) emitted to send a message to the channel @signal sendCtcpReply(str, str) emitted to send a CTCP reply @signal channelClosed(str) emitted after the user has left the channel - @signal openPrivateChat(str) emitted to open a "channel" for private messages + @signal openPrivateChat(str) emitted to open a "channel" for private + messages """ sendData = pyqtSignal(str) sendCtcpReply = pyqtSignal(str, str) @@ -206,7 +209,8 @@ self.__ui = e5App().getObject("UserInterface") self.__ircWidget = parent - self.editTopicButton.setIcon(UI.PixmapCache.getIcon("ircEditTopic.png")) + self.editTopicButton.setIcon( + UI.PixmapCache.getIcon("ircEditTopic.png")) self.editTopicButton.hide() height = self.usersList.height() + self.messages.height() @@ -229,9 +233,11 @@ self.__patterns = [ # :foo_!n=foo@foohost.bar.net PRIVMSG #eric-ide :some long message # :foo_!n=foo@foohost.bar.net PRIVMSG bar_ :some long message - (re.compile(r":([^!]+)!([^ ]+)\sPRIVMSG\s([^ ]+)\s:(.*)"), self.__message), + (re.compile(r":([^!]+)!([^ ]+)\sPRIVMSG\s([^ ]+)\s:(.*)"), + self.__message), # :foo_!n=foo@foohost.bar.net JOIN :#eric-ide - (re.compile(r":([^!]+)!([^ ]+)\sJOIN\s:?([^ ]+)"), self.__userJoin), + (re.compile(r":([^!]+)!([^ ]+)\sJOIN\s:?([^ ]+)"), + self.__userJoin), # :foo_!n=foo@foohost.bar.net PART #eric-ide :part message (re.compile(r":([^!]+).*\sPART\s([^ ]+)\s:(.*)"), self.__userPart), # :foo_!n=foo@foohost.bar.net PART #eric-ide @@ -246,66 +252,84 @@ (re.compile(r":([^!]+).*\sMODE\s([^ ]+)\s([+-][ovO]+)\s([^ ]+).*"), self.__setUserPrivilege), # :cameron.freenode.net MODE #eric-ide +ns - (re.compile(r":([^ ]+)\sMODE\s([^ ]+)\s(.+)"), self.__updateChannelModes), - # :foo_!n=foo@foohost.bar.net TOPIC #eric-ide :eric - The Python IDE + (re.compile(r":([^ ]+)\sMODE\s([^ ]+)\s(.+)"), + self.__updateChannelModes), + # :foo_!n=foo@foohost.bar.net TOPIC #eric-ide :eric - Python IDE (re.compile(r":.*\sTOPIC\s([^ ]+)\s:(.*)"), self.__setTopic), # :sturgeon.freenode.net 301 foo_ bar :Gone away for now - (re.compile(r":.*\s301\s([^ ]+)\s([^ ]+)\s:(.+)"), self.__userAway), + (re.compile(r":.*\s301\s([^ ]+)\s([^ ]+)\s:(.+)"), + self.__userAway), # :sturgeon.freenode.net 315 foo_ #eric-ide :End of /WHO list. (re.compile(r":.*\s315\s[^ ]+\s([^ ]+)\s:(.*)"), self.__whoEnd), # :zelazny.freenode.net 324 foo_ #eric-ide +cnt (re.compile(r":.*\s324\s.*\s([^ ]+)\s(.+)"), self.__channelModes), - # :zelazny.freenode.net 328 foo_ #eric-ide :http://www.buggeroff.com/ + # :zelazny.freenode.net 328 foo_ #eric-ide :http://www.bugger.com/ (re.compile(r":.*\s328\s.*\s([^ ]+)\s:(.+)"), self.__channelUrl), # :zelazny.freenode.net 329 foo_ #eric-ide 1353001005 - (re.compile(r":.*\s329\s.*\s([^ ]+)\s(.+)"), self.__channelCreated), + (re.compile(r":.*\s329\s.*\s([^ ]+)\s(.+)"), + self.__channelCreated), # :zelazny.freenode.net 332 foo_ #eric-ide :eric support channel (re.compile(r":.*\s332\s.*\s([^ ]+)\s:(.*)"), self.__setTopic), # :zelazny.freenode.net foo_ 333 #eric-ide foo 1353089020 - (re.compile(r":.*\s333\s.*\s([^ ]+)\s([^ ]+)\s(\d+)"), self.__topicCreated), - # :cameron.freenode.net 352 detlev_ #eric-ide ~foo foohost.bar.net cameron.freenode.net foo_ H :0 Foo Bar - (re.compile(r":.*\s352\s[^ ]+\s([^ ]+)\s([^ ]+)\s([^ ]+)\s[^ ]+\s([^ ]+)" - r"\s([^ ]+)\s:\d+\s(.*)"), self.__whoEntry), + (re.compile(r":.*\s333\s.*\s([^ ]+)\s([^ ]+)\s(\d+)"), + self.__topicCreated), + # :cameron.freenode.net 352 detlev_ #eric-ide ~foo foohost.bar.net + # cameron.freenode.net foo_ H :0 Foo Bar + (re.compile( + r":.*\s352\s[^ ]+\s([^ ]+)\s([^ ]+)\s([^ ]+)\s[^ ]+\s([^ ]+)" + r"\s([^ ]+)\s:\d+\s(.*)"), self.__whoEntry), # :zelazny.freenode.net 353 foo_ @ #eric-ide :@user1 +user2 user3 (re.compile(r":.*\s353\s.*\s.\s([^ ]+)\s:(.*)"), self.__userList), # :sturgeon.freenode.net 354 foo_ 42 ChanServ H@ - (re.compile(r":.*\s354\s[^ ]+\s42\s([^ ]+)\s(.*)"), self.__autoWhoEntry), + (re.compile(r":.*\s354\s[^ ]+\s42\s([^ ]+)\s(.*)"), + self.__autoWhoEntry), # :zelazny.freenode.net 366 foo_ #eric-ide :End of /NAMES list. (re.compile(r":.*\s366\s.*\s([^ ]+)\s:(.*)"), self.__ignore), - # :sturgeon.freenode.net 704 foo_ index :Help topics available to users: + # :sturgeon.freenode.net 704 foo_ index :Help topics available: (re.compile(r":.*\s70[456]\s[^ ]+\s([^ ]+)\s:(.*)"), self.__help), # WHOIS replies - # :sturgeon.freenode.net 311 foo_ bar ~bar barhost.foo.net * :Bar User - (re.compile(r":.*\s311\s[^ ]+\s([^ ]+)\s([^ ]+)\s([^ ]+)\s\*\s:(.*)"), - self.__whoIsUser), + # :sturgeon.freenode.net 311 foo_ bar ~bar barhost.foo.net * :Bar + (re.compile( + r":.*\s311\s[^ ]+\s([^ ]+)\s([^ ]+)\s([^ ]+)\s\*\s:(.*)"), + self.__whoIsUser), # :sturgeon.freenode.net 319 foo_ bar :@#eric-ide - (re.compile(r":.*\s319\s[^ ]+\s([^ ]+)\s:(.*)"), self.__whoIsChannels), - # :sturgeon.freenode.net 312 foo_ bar sturgeon.freenode.net :London, UK - (re.compile(r":.*\s312\s[^ ]+\s([^ ]+)\s([^ ]+)\s:(.*)"), self.__whoIsServer), + (re.compile(r":.*\s319\s[^ ]+\s([^ ]+)\s:(.*)"), + self.__whoIsChannels), + # :sturgeon.freenode.net 312 foo_ bar sturgeon.freenode.net :London + (re.compile(r":.*\s312\s[^ ]+\s([^ ]+)\s([^ ]+)\s:(.*)"), + self.__whoIsServer), # :sturgeon.freenode.net 671 foo_ bar :is using a secure connection (re.compile(r":.*\s671\s[^ ]+\s([^ ]+)\s:.*"), self.__whoIsSecure), - # :sturgeon.freenode.net 317 foo_ bar 3758 1355046912 :seconds idle, signon time + # :sturgeon.freenode.net 317 foo_ bar 3758 1355046912 :seconds + # idle, signon time (re.compile(r":.*\s317\s[^ ]+\s([^ ]+)\s(\d+)\s(\d+)\s:.*"), self.__whoIsIdle), # :sturgeon.freenode.net 330 foo_ bar bar :is logged in as - (re.compile(r":.*\s330\s[^ ]+\s([^ ]+)\s([^ ]+)\s:.*"), self.__whoIsAccount), + (re.compile(r":.*\s330\s[^ ]+\s([^ ]+)\s([^ ]+)\s:.*"), + self.__whoIsAccount), # :sturgeon.freenode.net 318 foo_ bar :End of /WHOIS list. (re.compile(r":.*\s318\s[^ ]+\s([^ ]+)\s:(.*)"), self.__whoIsEnd), # :sturgeon.freenode.net 307 foo_ bar :is an identified user - (re.compile(r":.*\s307\s[^ ]+\s([^ ]+)\s:(.*)"), self.__whoIsIdentify), + (re.compile(r":.*\s307\s[^ ]+\s([^ ]+)\s:(.*)"), + self.__whoIsIdentify), # :sturgeon.freenode.net 320 foo_ bar :is an identified user - (re.compile(r":.*\s320\s[^ ]+\s([^ ]+)\s:(.*)"), self.__whoIsIdentify), + (re.compile(r":.*\s320\s[^ ]+\s([^ ]+)\s:(.*)"), + self.__whoIsIdentify), # :sturgeon.freenode.net 310 foo_ bar :is available for help - (re.compile(r":.*\s310\s[^ ]+\s([^ ]+)\s:(.*)"), self.__whoIsHelper), - # :sturgeon.freenode.net 338 foo_ bar real.ident@real.host 12.34.56.78 :Actual user@host, Actual IP + (re.compile(r":.*\s310\s[^ ]+\s([^ ]+)\s:(.*)"), + self.__whoIsHelper), + # :sturgeon.freenode.net 338 foo_ bar real.ident@real.host + # 12.34.56.78 :Actual user@host, Actual IP (re.compile(r":.*\s338\s[^ ]+\s([^ ]+)\s([^ ]+)\s([^ ]+)\s:.*"), - self.__whoIsActually), + self.__whoIsActually), # :sturgeon.freenode.net 313 foo_ bar :is an IRC Operator - (re.compile(r":.*\s313\s[^ ]+\s([^ ]+)\s:(.*)"), self.__whoIsOperator), - # :sturgeon.freenode.net 378 foo_ bar :is connecting from *@mnch-4d044d5a.pool.mediaWays.net 77.4.77.90 + (re.compile(r":.*\s313\s[^ ]+\s([^ ]+)\s:(.*)"), + self.__whoIsOperator), + # :sturgeon.freenode.net 378 foo_ bar :is connecting from + # *@mnch-4d044d5a.pool.mediaWays.net 77.4.77.90 (re.compile(r":.*\s378\s[^ ]+\s([^ ]+)\s:.*\s([^ ]+)\s([^ ]+)"), - self.__whoIsConnection), + self.__whoIsConnection), ] self.__autoWhoTemplate = "WHO {0} %tnf,42" @@ -331,8 +355,9 @@ if self.__private: E5MessageBox.information(self, self.trUtf8("Send Message"), - self.trUtf8("""Messages starting with a '/' are not allowed""" - """ in private chats.""")) + self.trUtf8( + """Messages starting with a '/' are not allowed""" + """ in private chats.""")) else: msgList = msg.split(None, 1) cmd = msgList[0][1:].upper() @@ -342,9 +367,11 @@ self.sendData.emit(" ".join(msgList)) else: if self.__private: - self.sendData.emit("PRIVMSG " + self.__privatePartner + " :" + msg) + self.sendData.emit( + "PRIVMSG " + self.__privatePartner + " :" + msg) else: - self.sendData.emit("PRIVMSG " + self.__name + " :" + msg) + self.sendData.emit( + "PRIVMSG " + self.__name + " :" + msg) self.messageEdit.clear() self.unsetMarkerLine() @@ -354,11 +381,13 @@ """ ok = E5MessageBox.yesNo(self, self.trUtf8("Leave IRC channel"), - self.trUtf8("""Do you really want to leave the IRC channel <b>{0}</b>?""")\ + self.trUtf8( + """Do you really want to leave the IRC channel <b>{0}</b>?""") .format(self.__name)) if ok: if not self.__private: - self.sendData.emit("PART " + self.__name + " :" + self.__partMessage) + self.sendData.emit( + "PART " + self.__name + " :" + self.__partMessage) self.channelClosed.emit(self.__name) def name(self): @@ -469,7 +498,8 @@ self.addMessage(match.group(1), match.group(4)) if self.__private and not self.topicLabel.text(): - self.setPrivateInfo("{0} - {1}".format(match.group(1), match.group(2))) + self.setPrivateInfo( + "{0} - {1}".format(match.group(1), match.group(2))) return True return False @@ -489,11 +519,13 @@ ircTimestamp(), sender, ircFilter(msg))) if Preferences.getIrc("ShowNotifications"): if Preferences.getIrc("NotifyMessage"): - self.__ui.showNotification(UI.PixmapCache.getPixmap("irc48.png"), + self.__ui.showNotification( + UI.PixmapCache.getPixmap("irc48.png"), self.trUtf8("Channel Message"), msg) elif Preferences.getIrc("NotifyNick") and \ self.__userName.lower() in msg.lower(): - self.__ui.showNotification(UI.PixmapCache.getPixmap("irc48.png"), + self.__ui.showNotification( + UI.PixmapCache.getPixmap("irc48.png"), self.trUtf8("Nick mentioned"), msg) def addUsers(self, users): @@ -517,16 +549,21 @@ if match.group(3).lower() == self.__name.lower(): if self.__userName != match.group(1): IrcUserItem(match.group(1), self.usersList) - msg = self.trUtf8("{0} has joined the channel {1} ({2}).").format( - match.group(1), self.__name, match.group(2)) - self.__addManagementMessage(IrcChannelWidget.JoinIndicator, msg) + msg = self.trUtf8( + "{0} has joined the channel {1} ({2}).").format( + match.group(1), self.__name, match.group(2)) + self.__addManagementMessage( + IrcChannelWidget.JoinIndicator, msg) else: - msg = self.trUtf8("You have joined the channel {0} ({1}).").format( - self.__name, match.group(2)) - self.__addManagementMessage(IrcChannelWidget.JoinIndicator, msg) + msg = self.trUtf8( + "You have joined the channel {0} ({1}).").format( + self.__name, match.group(2)) + self.__addManagementMessage( + IrcChannelWidget.JoinIndicator, msg) if Preferences.getIrc("ShowNotifications") and \ Preferences.getIrc("NotifyJoinPart"): - self.__ui.showNotification(UI.PixmapCache.getPixmap("irc48.png"), + self.__ui.showNotification( + UI.PixmapCache.getPixmap("irc48.png"), self.trUtf8("Join Channel"), msg) return True @@ -547,16 +584,19 @@ msg = self.trUtf8("{0} has left {1}.").format( match.group(1), self.__name) nmsg = msg - self.__addManagementMessage(IrcChannelWidget.LeaveIndicator, msg) + self.__addManagementMessage( + IrcChannelWidget.LeaveIndicator, msg) else: msg = self.trUtf8("{0} has left {1}: {2}.").format( match.group(1), self.__name, ircFilter(match.group(3))) nmsg = self.trUtf8("{0} has left {1}: {2}.").format( match.group(1), self.__name, match.group(3)) - self.__addManagementMessage(IrcChannelWidget.LeaveIndicator, msg) + self.__addManagementMessage( + IrcChannelWidget.LeaveIndicator, msg) if Preferences.getIrc("ShowNotifications") and \ Preferences.getIrc("NotifyJoinPart"): - self.__ui.showNotification(UI.PixmapCache.getPixmap("irc48.png"), + self.__ui.showNotification( + UI.PixmapCache.getPixmap("irc48.png"), self.trUtf8("Leave Channel"), nmsg) return True @@ -576,14 +616,17 @@ if match.lastindex == 1: msg = self.trUtf8("{0} has quit {1}.").format( match.group(1), self.__name) - self.__addManagementMessage(IrcChannelWidget.MessageIndicator, msg) + self.__addManagementMessage( + IrcChannelWidget.MessageIndicator, msg) else: msg = self.trUtf8("{0} has quit {1}: {2}.").format( match.group(1), self.__name, ircFilter(match.group(2))) - self.__addManagementMessage(IrcChannelWidget.MessageIndicator, msg) + self.__addManagementMessage( + IrcChannelWidget.MessageIndicator, msg) if Preferences.getIrc("ShowNotifications") and \ Preferences.getIrc("NotifyJoinPart"): - self.__ui.showNotification(UI.PixmapCache.getPixmap("irc48.png"), + self.__ui.showNotification( + UI.PixmapCache.getPixmap("irc48.png"), self.trUtf8("Quit"), msg) # always return False for other channels and server to process @@ -643,7 +686,8 @@ """ if match.group(1).lower() == self.__name.lower(): self.__addManagementMessage(self.trUtf8("Away"), - self.trUtf8("{0} is away: {1}").format(match.group(2), match.group(3))) + self.trUtf8("{0} is away: {1}").format( + match.group(2), match.group(3))) return True return False @@ -689,7 +733,8 @@ """ if match.group(1).lower() == self.__name.lower(): self.__addManagementMessage(IrcChannelWidget.MessageIndicator, - ircFilter(self.trUtf8("Channel URL: {0}").format(match.group(2)))) + ircFilter(self.trUtf8("Channel URL: {0}").format( + match.group(2)))) return True return False @@ -711,12 +756,12 @@ continue elif modeChar == "k": parameter = modesParameters.pop(0) - modes.append( - self.trUtf8("password protected ({0})").format(parameter)) + modes.append(self.trUtf8( + "password protected ({0})").format(parameter)) elif modeChar == "l": parameter = modesParameters.pop(0) - modes.append( - self.trUtf8("limited to %n user(s)", "", int(parameter))) + modes.append(self.trUtf8( + "limited to %n user(s)", "", int(parameter))) elif modeChar in modesDict: modes.append(modesDict[modeChar]) else: @@ -771,11 +816,12 @@ elif mode == "a": if isPlus: message = self.trUtf8( - "{0} sets the channel mode to 'anonymous'.").format(nick) + "{0} sets the channel mode to 'anonymous'.")\ + .format(nick) else: message = self.trUtf8( - "{0} removes the 'anonymous' mode from the channel.").format( - nick) + "{0} removes the 'anonymous' mode from the" + " channel.").format(nick) elif mode == "b": if isPlus: message = self.trUtf8( @@ -788,12 +834,12 @@ elif mode == "c": if isPlus: message = self.trUtf8( - "{0} sets the channel mode to 'no colors allowed'.").format( - nick) + "{0} sets the channel mode to 'no colors" + " allowed'.").format(nick) else: message = self.trUtf8( - "{0} sets the channel mode to 'allow color codes'.").format( - nick) + "{0} sets the channel mode to 'allow color" + " codes'.").format(nick) elif mode == "e": if isPlus: message = self.trUtf8( @@ -806,11 +852,12 @@ elif mode == "i": if isPlus: message = self.trUtf8( - "{0} sets the channel mode to 'invite only'.").format(nick) + "{0} sets the channel mode to 'invite only'.")\ + .format(nick) else: message = self.trUtf8( - "{0} removes the 'invite only' mode from the channel." - ).format(nick) + "{0} removes the 'invite only' mode from the" + " channel.").format(nick) elif mode == "k": if isPlus: message = self.trUtf8( @@ -830,50 +877,58 @@ elif mode == "m": if isPlus: message = self.trUtf8( - "{0} sets the channel mode to 'moderated'.").format(nick) + "{0} sets the channel mode to 'moderated'.")\ + .format(nick) else: message = self.trUtf8( - "{0} sets the channel mode to 'unmoderated'.").format(nick) + "{0} sets the channel mode to 'unmoderated'.")\ + .format(nick) elif mode == "n": if isPlus: message = self.trUtf8( - "{0} sets the channel mode to 'no messages from outside'." - ).format(nick) + "{0} sets the channel mode to 'no messages from" + " outside'.").format(nick) else: message = self.trUtf8( - "{0} sets the channel mode to 'allow messages from outside'." - ).format(nick) + "{0} sets the channel mode to 'allow messages" + " from outside'.").format(nick) elif mode == "p": if isPlus: message = self.trUtf8( - "{0} sets the channel mode to 'private'.").format(nick) + "{0} sets the channel mode to 'private'.")\ + .format(nick) else: message = self.trUtf8( - "{0} sets the channel mode to 'public'.").format(nick) + "{0} sets the channel mode to 'public'.")\ + .format(nick) elif mode == "q": if isPlus: message = self.trUtf8( - "{0} sets the channel mode to 'quiet'.").format(nick) + "{0} sets the channel mode to 'quiet'.")\ + .format(nick) else: message = self.trUtf8( - "{0} removes the 'quiet' mode from the channel.").format( - nick) + "{0} removes the 'quiet' mode from the channel.")\ + .format(nick) elif mode == "r": continue elif mode == "s": if isPlus: message = self.trUtf8( - "{0} sets the channel mode to 'secret'.").format(nick) + "{0} sets the channel mode to 'secret'.")\ + .format(nick) else: message = self.trUtf8( - "{0} sets the channel mode to 'visible'.").format(nick) + "{0} sets the channel mode to 'visible'.")\ + .format(nick) elif mode == "t": if isPlus: message = self.trUtf8( "{0} switches on 'topic protection'.").format(nick) else: message = self.trUtf8( - "{0} switches off 'topic protection'.").format(nick) + "{0} switches off 'topic protection'.")\ + .format(nick) elif mode == "I": if isPlus: message = self.trUtf8( @@ -960,7 +1015,8 @@ self.__addManagementMessage(self.trUtf8("CTCP"), self.trUtf8("Received CTCP-PING request from {0}," " sending answer.").format(match.group(1))) - self.sendCtcpReply.emit(match.group(1), "PING {0}".format(ctcpArg)) + self.sendCtcpReply.emit( + match.group(1), "PING {0}".format(ctcpArg)) elif ctcpRequest == "clientinfo": self.__addManagementMessage(self.trUtf8("CTCP"), self.trUtf8("Received CTCP-CLIENTINFO request from {0}," @@ -969,8 +1025,8 @@ "CLIENTINFO CLIENTINFO PING VERSION") else: self.__addManagementMessage(self.trUtf8("CTCP"), - self.trUtf8("Received unknown CTCP-{0} request from {1}.").format( - ctcpRequest, match.group(1))) + self.trUtf8("Received unknown CTCP-{0} request from {1}.") + .format(ctcpRequest, match.group(1))) return True return False @@ -1052,10 +1108,10 @@ """ self.unsetMarkerLine() self.__markerLine = \ - '<span style=" color:{0}; background-color:{1};">{2}</span>'.format( - Preferences.getIrc("MarkerLineForegroundColour"), - Preferences.getIrc("MarkerLineBackgroundColour"), - self.trUtf8('--- New From Here ---')) + '<span style=" color:{0}; background-color:{1};">{2}</span>'\ + .format(Preferences.getIrc("MarkerLineForegroundColour"), + Preferences.getIrc("MarkerLineBackgroundColour"), + self.trUtf8('--- New From Here ---')) self.messages.append(self.__markerLine) def unsetMarkerLine(self): @@ -1082,13 +1138,15 @@ def __copyMessages(self): """ - Private slot to copy the selection of the messages display to the clipboard. + Private slot to copy the selection of the messages display to the + clipboard. """ self.messages.copy() def __copyAllMessages(self): """ - Private slot to copy the contents of the messages display to the clipboard. + Private slot to copy the contents of the messages display to the + clipboard. """ txt = self.messages.toPlainText() if txt: @@ -1097,7 +1155,8 @@ def __cutAllMessages(self): """ - Private slot to cut the contents of the messages display to the clipboard. + Private slot to cut the contents of the messages display to the + clipboard. """ txt = self.messages.toPlainText() if txt: @@ -1120,8 +1179,8 @@ self.trUtf8("Save Messages"), "", self.trUtf8( - "HTML Files (*.{0});;Text Files (*.txt);;All Files (*)").format( - htmlExtension), + "HTML Files (*.{0});;Text Files (*.txt);;All Files (*)") + .format(htmlExtension), None, E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) if fname: @@ -1152,8 +1211,9 @@ except IOError as err: E5MessageBox.critical(self, self.trUtf8("Error saving Messages"), - self.trUtf8("""<p>The messages contents could not be written""" - """ to <b>{0}</b></p><p>Reason: {1}</p>""")\ + self.trUtf8( + """<p>The messages contents could not be written""" + """ to <b>{0}</b></p><p>Reason: {1}</p>""") .format(fname, str(err))) def __initMessagesMenu(self): @@ -1189,7 +1249,8 @@ self.__messagesMenu.addAction(self.trUtf8("Mark Current Position"), self.setMarkerLine) self.__unsetMarkerMessagesAct = \ - self.__messagesMenu.addAction(self.trUtf8("Remove Position Marker"), + self.__messagesMenu.addAction( + self.trUtf8("Remove Position Marker"), self.unsetMarkerLine) self.on_messages_copyAvailable(False) @@ -1197,7 +1258,8 @@ @pyqtSlot(bool) def on_messages_copyAvailable(self, yes): """ - Private slot to react to text selection/deselection of the messages edit. + Private slot to react to text selection/deselection of the messages + edit. @param yes flag signaling the availability of selected text (boolean) """ @@ -1304,8 +1366,8 @@ def __autoWhoEntry(self, match): """ - Private method to handle a WHO entry returned by the server as requested - automatically. + Private method to handle a WHO entry returned by the server as + requested automatically. @param match match object that matched the pattern @return flag indicating whether the message was handled (boolean) @@ -1333,15 +1395,16 @@ self.initAutoWho() else: self.__addManagementMessage(self.trUtf8("Who"), - self.trUtf8("End of WHO list for {0}.").format(match.group(1))) + self.trUtf8("End of WHO list for {0}.").format( + match.group(1))) return True return False def __whoEntry(self, match): """ - Private method to handle a WHO entry returned by the server as requested - manually. + Private method to handle a WHO entry returned by the server as + requested manually. @param match match object that matched the pattern @return flag indicating whether the message was handled (boolean) @@ -1353,10 +1416,12 @@ # group(5) user flags # group(6) real name if match.group(1).lower() == self.__name.lower(): - away = self.trUtf8(" (Away)") if match.group(5).startswith("G") else "" + away = self.trUtf8(" (Away)") if match.group(5).startswith("G") \ + else "" self.__addManagementMessage(self.trUtf8("Who"), self.trUtf8("{0} is {1}@{2} ({3}){4}").format( - match.group(4), match.group(2), match.group(3), match.group(6), away)) + match.group(4), match.group(2), match.group(3), + match.group(6), away)) return True return False @@ -1458,8 +1523,8 @@ # group(3) server info if match.group(1) == self.__whoIsNick: self.__addManagementMessage(self.trUtf8("Whois"), - self.trUtf8("{0} is online via {1} ({2}).").format(match.group(1), - match.group(2), match.group(3))) + self.trUtf8("{0} is online via {1} ({2}).").format( + match.group(1), match.group(2), match.group(3))) return True return False @@ -1476,7 +1541,8 @@ if match.group(1) == self.__whoIsNick: if match.group(2).lower().startswith("is an irc operator"): self.__addManagementMessage(self.trUtf8("Whois"), - self.trUtf8("{0} is an IRC Operator.").format(match.group(1))) + self.trUtf8("{0} is an IRC Operator.").format( + match.group(1))) else: self.__addManagementMessage(self.trUtf8("Whois"), "{0} {1}".format(match.group(1), match.group(2))) @@ -1510,11 +1576,13 @@ minutesString = self.trUtf8("%n minute(s)", "", minutes) secondsString = self.trUtf8("%n second(s)", "", seconds) self.__addManagementMessage(self.trUtf8("Whois"), - self.trUtf8("{0} has been idle for {1}, {2}, {3}, and {4}.", - "{0} = name of person, {1} = (x days), {2} = (x hours)," - " {3} = (x minutes), {4} = (x seconds)").format( - match.group(1), daysString, hoursString, minutesString, - secondsString)) + self.trUtf8( + "{0} has been idle for {1}, {2}, {3}, and {4}.", + "{0} = name of person, {1} = (x days)," + " {2} = (x hours), {3} = (x minutes)," + " {4} = (x seconds)").format( + match.group(1), daysString, hoursString, minutesString, + secondsString)) elif hours: hoursString = self.trUtf8("%n hour(s)", "", hours) minutesString = self.trUtf8("%n minute(s)", "", minutes) @@ -1540,7 +1608,8 @@ if not signonTime.isNull(): self.__addManagementMessage(self.trUtf8("Whois"), self.trUtf8("{0} has been online since {1}.").format( - match.group(1), signonTime.toString("yyyy-MM-dd, hh:mm:ss"))) + match.group(1), + signonTime.toString("yyyy-MM-dd, hh:mm:ss"))) return True return False @@ -1557,7 +1626,8 @@ if match.group(1) == self.__whoIsNick: self.__whoIsNick = "" self.__addManagementMessage(self.trUtf8("Whois"), - self.trUtf8("End of WHOIS list for {0}.").format(match.group(1))) + self.trUtf8("End of WHOIS list for {0}.").format( + match.group(1))) return True return False @@ -1573,7 +1643,8 @@ # group(2) identified message if match.group(1) == self.__whoIsNick: self.__addManagementMessage(self.trUtf8("Whois"), - self.trUtf8("{0} is an identified user.").format(match.group(1))) + self.trUtf8("{0} is an identified user.").format( + match.group(1))) return True return False @@ -1589,7 +1660,8 @@ # group(2) helper message if match.group(1) == self.__whoIsNick: self.__addManagementMessage(self.trUtf8("Whois"), - self.trUtf8("{0} is available for help.").format(match.group(1))) + self.trUtf8("{0} is available for help.").format( + match.group(1))) return True return False @@ -1623,8 +1695,9 @@ # group(3) actual IP if match.group(1) == self.__whoIsNick: self.__addManagementMessage(self.trUtf8("Whois"), - self.trUtf8("{0} is actually using the host {1} (IP: {2}).").format( - match.group(1), match.group(2), match.group(3))) + self.trUtf8( + "{0} is actually using the host {1} (IP: {2}).").format( + match.group(1), match.group(2), match.group(3))) return True return False @@ -1639,7 +1712,8 @@ # group(1) nick if match.group(1) == self.__whoIsNick: self.__addManagementMessage(self.trUtf8("Whois"), - self.trUtf8("{0} is using a secure connection.").format(match.group(1))) + self.trUtf8("{0} is using a secure connection.").format( + match.group(1))) return True return False
--- a/Network/IRC/IrcIdentitiesEditDialog.py Sun Oct 06 19:52:33 2013 +0200 +++ b/Network/IRC/IrcIdentitiesEditDialog.py Mon Oct 07 19:10:11 2013 +0200 @@ -30,7 +30,8 @@ """ Constructor - @param manager reference to the IRC network manager object (IrcNetworkManager) + @param manager reference to the IRC network manager object + (IrcNetworkManager) @param identityName name of the identity to be selected (string) @param parent reference to the parent widget (QWidget) """ @@ -44,7 +45,8 @@ self.nicknameAddButton.setIcon(UI.PixmapCache.getIcon("plus.png")) self.nicknameDeleteButton.setIcon(UI.PixmapCache.getIcon("minus.png")) self.nicknameUpButton.setIcon(UI.PixmapCache.getIcon("1uparrow.png")) - self.nicknameDownButton.setIcon(UI.PixmapCache.getIcon("1downarrow.png")) + self.nicknameDownButton.setIcon( + UI.PixmapCache.getIcon("1downarrow.png")) self.__manager = manager @@ -86,7 +88,8 @@ """ Private slot to update the status of the identity related buttons. """ - enable = self.identitiesCombo.currentText() != IrcIdentity.DefaultIdentityDisplay + enable = (self.identitiesCombo.currentText() != + IrcIdentity.DefaultIdentityDisplay) self.renameButton.setEnabled(enable) self.deleteButton.setEnabled(enable) @@ -140,8 +143,9 @@ # General Tab self.__currentIdentity.setRealName(self.realnameEdit.text()) - self.__currentIdentity.setNickNames([self.nicknamesList.item(row).text() - for row in range(self.nicknamesList.count())]) + self.__currentIdentity.setNickNames( + [self.nicknamesList.item(row).text() + for row in range(self.nicknamesList.count())]) self.__currentIdentity.setServiceName(self.serviceEdit.text()) self.__currentIdentity.setPassword(self.passwordEdit.text()) @@ -164,12 +168,14 @@ if self.nicknamesList.count() == 0: E5MessageBox.critical(self, self.trUtf8("Edit Identity"), - self.trUtf8("""The identity must contain at least one nick name.""")) + self.trUtf8( + """The identity must contain at least one nick name.""")) block = self.identitiesCombo.blockSignals(True) identity = self.__currentIdentity.getName() if identity == IrcIdentity.DefaultIdentityName: identity = IrcIdentity.DefaultIdentityDisplay - self.identitiesCombo.setCurrentIndex(self.identitiesCombo.findText(identity)) + self.identitiesCombo.setCurrentIndex( + self.identitiesCombo.findText(identity)) self.identitiesCombo.blockSignals(block) self.identityTabWidget.setCurrentIndex(0) self.nicknameEdit.setFocus() @@ -183,7 +189,8 @@ identity = self.__currentIdentity.getName() if identity == IrcIdentity.DefaultIdentityName: identity = IrcIdentity.DefaultIdentityDisplay - self.identitiesCombo.setCurrentIndex(self.identitiesCombo.findText(identity)) + self.identitiesCombo.setCurrentIndex( + self.identitiesCombo.findText(identity)) self.identitiesCombo.blockSignals(block) self.identityTabWidget.setCurrentIndex(0) self.realnameEdit.setFocus() @@ -207,8 +214,9 @@ if name in self.__identities: E5MessageBox.critical(self, self.trUtf8("Add Identity"), - self.trUtf8("""An identity named <b>{0}</b> already exists.""" - """ You must provide a different name.""").format( + self.trUtf8( + """An identity named <b>{0}</b> already exists.""" + """ You must provide a different name.""").format( name)) self.on_addButton_clicked() else: @@ -217,7 +225,8 @@ identity.setRealName(Utilities.getRealName()) self.__identities[name] = identity self.identitiesCombo.addItem(name) - self.identitiesCombo.setCurrentIndex(self.identitiesCombo.count() - 1) + self.identitiesCombo.setCurrentIndex( + self.identitiesCombo.count() - 1) else: E5MessageBox.critical(self, self.trUtf8("Add Identity"), @@ -242,8 +251,9 @@ if name in self.__identities: E5MessageBox.critical(self, self.trUtf8("Copy Identity"), - self.trUtf8("""An identity named <b>{0}</b> already exists.""" - """ You must provide a different name.""").format( + self.trUtf8( + """An identity named <b>{0}</b> already exists.""" + """ You must provide a different name.""").format( name)) self.on_copyButton_clicked() else: @@ -251,7 +261,8 @@ identity.setName(name) self.__identities[name] = identity self.identitiesCombo.addItem(name) - self.identitiesCombo.setCurrentIndex(self.identitiesCombo.count() - 1) + self.identitiesCombo.setCurrentIndex( + self.identitiesCombo.count() - 1) else: E5MessageBox.critical(self, self.trUtf8("Copy Identity"), @@ -276,8 +287,9 @@ if name in self.__identities: E5MessageBox.critical(self, self.trUtf8("Rename Identity"), - self.trUtf8("""An identity named <b>{0}</b> already exists.""" - """ You must provide a different name.""").format( + self.trUtf8( + """An identity named <b>{0}</b> already exists.""" + """ You must provide a different name.""").format( name)) self.on_renameButton_clicked() else: @@ -310,12 +322,14 @@ break if inUse: - msg = self.trUtf8("""This identity is in use. If you remove it, the network""" - """ settings using it will fall back to the default""" - """ identity. Should it be deleted anyway?""") + msg = self.trUtf8( + """This identity is in use. If you remove it, the network""" + """ settings using it will fall back to the default""" + """ identity. Should it be deleted anyway?""") else: - msg = self.trUtf8("""Do you really want to delete all information for""" - """ this identity?""") + msg = self.trUtf8( + """Do you really want to delete all information for""" + """ this identity?""") res = E5MessageBox.yesNo(self, self.trUtf8("Delete Identity"), msg, @@ -327,7 +341,8 @@ def __updateNicknameUpDownButtons(self): """ - Private method to set the enabled state of the nick name up and down buttons. + Private method to set the enabled state of the nick name up and + down buttons. """ if len(self.nicknamesList.selectedItems()) == 0: self.nicknameUpButton.setEnabled(False) @@ -336,7 +351,8 @@ if self.nicknamesList.currentRow() == 0: self.nicknameUpButton.setEnabled(False) self.nicknameDownButton.setEnabled(True) - elif self.nicknamesList.currentRow() == self.nicknamesList.count() - 1: + elif self.nicknamesList.currentRow() == \ + self.nicknamesList.count() - 1: self.nicknameUpButton.setEnabled(True) self.nicknameDownButton.setEnabled(False) else:
--- a/Network/IRC/IrcMessageEdit.py Sun Oct 06 19:52:33 2013 +0200 +++ b/Network/IRC/IrcMessageEdit.py Mon Oct 07 19:10:11 2013 +0200 @@ -18,14 +18,15 @@ """ MaxHistory = 100 - def __init__(self, parent=None, inactiveText="", side=E5LineEdit.RightSide): + def __init__(self, parent=None, inactiveText="", + side=E5LineEdit.RightSide): """ Constructor @param parent reference to the parent widget (QWidget) @keyparam inactiveText text to be shown on inactivity (string) - @keyparam side side the clear button should be shown at (E5LineEdit.RightSide, - E5LineEdit.LeftSide) + @keyparam side side the clear button should be shown at + (E5LineEdit.RightSide, E5LineEdit.LeftSide) """ super().__init__(parent, inactiveText, side) @@ -36,7 +37,8 @@ """ Public method to set the text. - Note: This reimplementation ensures, that the cursor is at the end of the text. + Note: This reimplementation ensures, that the cursor is at the end of + the text. @param text text to be set (string) """ @@ -107,19 +109,21 @@ if up: self.__historyLine += 1 - # If the position was moved past the end of the history, go to the last entry + # If the position was moved past the end of the history, + # go to the last entry if self.__historyLine == len(self.__historyList): self.__historyLine -= 1 return else: - # If the position is at the top of the history, arrow-down shall add the text - # to the history and clear the line edit for new input + # If the position is at the top of the history, arrow-down shall + # add the text to the history and clear the line edit for new input if self.__historyLine == 0: if self.text(): self.__addHistory(self.text()) self.setText("") else: - # If the position is not at the top of the history, decrement it + # If the position is not at the top of the history, + # decrement it self.__historyLine -= 1 # replace the text of the line edit with the selected history entry
--- a/Network/IRC/IrcNetworkEditDialog.py Sun Oct 06 19:52:33 2013 +0200 +++ b/Network/IRC/IrcNetworkEditDialog.py Mon Oct 07 19:10:11 2013 +0200 @@ -27,7 +27,8 @@ """ Constructor - @param manager reference to the IRC network manager object (IrcNetworkManager) + @param manager reference to the IRC network manager object + (IrcNetworkManager) @param networkName name of the network to work on (string) @param parent reference to the parent widget (QWidget) """ @@ -36,16 +37,20 @@ self.__manager = manager - self.editIdentitiesButton.setIcon(UI.PixmapCache.getIcon("ircConfigure.png")) - self.editServerButton.setIcon(UI.PixmapCache.getIcon("ircConfigure.png")) - self.editChannelButton.setIcon(UI.PixmapCache.getIcon("ircConfigure.png")) + self.editIdentitiesButton.setIcon( + UI.PixmapCache.getIcon("ircConfigure.png")) + self.editServerButton.setIcon( + UI.PixmapCache.getIcon("ircConfigure.png")) + self.editChannelButton.setIcon( + UI.PixmapCache.getIcon("ircConfigure.png")) self.addChannelButton.setIcon(UI.PixmapCache.getIcon("plus.png")) self.deleteChannelButton.setIcon(UI.PixmapCache.getIcon("minus.png")) self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok) if networkName: - self.__network = copy.deepcopy(self.__manager.getNetwork(networkName)) + self.__network = copy.deepcopy( + self.__manager.getNetwork(networkName)) else: from .IrcNetworkManager import IrcNetwork self.__network = IrcNetwork("") @@ -178,7 +183,8 @@ if itm: res = E5MessageBox.yesNo(self, self.trUtf8("Delete Channel"), - self.trUtf8("""Do you really want to delete channel <b>{0}</b>?""")\ + self.trUtf8( + """Do you really want to delete channel <b>{0}</b>?""") .format(itm.text(0))) if res: self.__network.deleteChannel(itm.text(0))
--- a/Network/IRC/IrcNetworkManager.py Sun Oct 06 19:52:33 2013 +0200 +++ b/Network/IRC/IrcNetworkManager.py Mon Oct 07 19:10:11 2013 +0200 @@ -22,11 +22,15 @@ Class implementing the IRC identity object. """ DefaultIdentityName = "0default" - DefaultIdentityDisplay = QCoreApplication.translate("IrcIdentity", "Default Identity") + DefaultIdentityDisplay = QCoreApplication.translate( + "IrcIdentity", "Default Identity") - DefaultAwayMessage = QCoreApplication.translate("IrcIdentity", "Gone away for now.") - DefaultQuitMessage = QCoreApplication.translate("IrcIdentity", "IRC for eric5 IDE") - DefaultPartMessage = QCoreApplication.translate("IrcIdentity", "IRC for eric5 IDE") + DefaultAwayMessage = QCoreApplication.translate( + "IrcIdentity", "Gone away for now.") + DefaultQuitMessage = QCoreApplication.translate( + "IrcIdentity", "IRC for eric5 IDE") + DefaultPartMessage = QCoreApplication.translate( + "IrcIdentity", "IRC for eric5 IDE") def __init__(self, name): """ @@ -152,7 +156,8 @@ def setServiceName(self, name): """ - Public method to set the service name of the identity used for identification. + Public method to set the service name of the identity used for + identification. @param name service name (string) """ @@ -160,7 +165,8 @@ def getServiceName(self): """ - Public method to get the service name of the identity used for identification. + Public method to get the service name of the identity used for + identification. @return service name (string) """ @@ -230,7 +236,8 @@ def rememberAwayPosition(self): """ - Public method to get a flag indicating to remember the chat position upon AWAY. + Public method to get a flag indicating to remember the chat position + upon AWAY. @return flag indicating to remember the chat position (boolean) """ @@ -504,7 +511,8 @@ @param settings reference to the settings object (QSettings) """ self.__identity = settings.value("Identity", "") - self.__autoConnect = Preferences.toBool(settings.value("AutoConnect", False)) + self.__autoConnect = Preferences.toBool( + settings.value("AutoConnect", False)) settings.beginGroup("Server") self.__server = IrcServer("") @@ -655,7 +663,8 @@ def autoConnect(self): """ - Public method to check, if the network should be connected to at start-up. + Public method to check, if the network should be connected to at + start-up. @return flag indicating an auto connect (boolean) """ @@ -666,7 +675,8 @@ """ Class method to create the default network. - @param ssl flag indicating to create a SSL network configuration (boolean) + @param ssl flag indicating to create a SSL network configuration + (boolean) @return default network object (IrcNetwork) """ # network @@ -905,7 +915,8 @@ @param name name of the identity to delete (string) """ - if name in self.__identities and name != IrcIdentity.DefaultIdentityName: + if name in self.__identities and \ + name != IrcIdentity.DefaultIdentityName: del self.__identities[name] self.identityChanged()
--- a/Network/IRC/IrcUtilities.py Sun Oct 06 19:52:33 2013 +0200 +++ b/Network/IRC/IrcUtilities.py Mon Oct 07 19:10:11 2013 +0200 @@ -110,13 +110,16 @@ else: if colors[0]: # foreground and background - tag = '<span style="background-color:{0};color={1}">'.format( - Preferences.getIrc("IrcColor{0}".format(int(colors[0]))), - Preferences.getIrc("IrcColor{0}".format(int(colors[1])))) + tag = '<span style="background-color:{0};color={1}">'\ + .format(Preferences.getIrc( + "IrcColor{0}".format(int(colors[0]))), + Preferences.getIrc( + "IrcColor{0}".format(int(colors[1])))) else: # background only tag = '<span style="background-color:{0}">'.format( - Preferences.getIrc("IrcColor{0}".format(int(colors[1])))) + Preferences.getIrc( + "IrcColor{0}".format(int(colors[1])))) msgParts.append(tag) openTags.append("span") else: @@ -156,7 +159,8 @@ "k": QCoreApplication.translate("IrcUtilities", "password protected"), "l": QCoreApplication.translate("IrcUtilities", "user limit"), "m": QCoreApplication.translate("IrcUtilities", "moderated"), - "n": QCoreApplication.translate("IrcUtilities", "no messages from outside"), + "n": QCoreApplication.translate("IrcUtilities", + "no messages from outside"), "p": QCoreApplication.translate("IrcUtilities", "private"), "q": QCoreApplication.translate("IrcUtilities", "quiet"), "r": QCoreApplication.translate("IrcUtilities", "reop channel"),
--- a/Network/IRC/IrcWidget.py Sun Oct 06 19:52:33 2013 +0200 +++ b/Network/IRC/IrcWidget.py Mon Oct 07 19:10:11 2013 +0200 @@ -57,11 +57,14 @@ self.__ircNetworkManager = IrcNetworkManager(self) self.__leaveButton = QToolButton(self) - self.__leaveButton.setIcon(UI.PixmapCache.getIcon("ircCloseChannel.png")) - self.__leaveButton.setToolTip(self.trUtf8("Press to leave the current channel")) + self.__leaveButton.setIcon( + UI.PixmapCache.getIcon("ircCloseChannel.png")) + self.__leaveButton.setToolTip( + self.trUtf8("Press to leave the current channel")) self.__leaveButton.clicked[()].connect(self.__leaveChannel) self.__leaveButton.setEnabled(False) - self.channelsWidget.setCornerWidget(self.__leaveButton, Qt.BottomRightCorner) + self.channelsWidget.setCornerWidget( + self.__leaveButton, Qt.BottomRightCorner) self.channelsWidget.setTabsClosable(False) if not isMacPlatform(): self.channelsWidget.setTabPosition(QTabWidget.South) @@ -93,11 +96,14 @@ self.__patterns = [ # :foo_!n=foo@foohost.bar.net PRIVMSG bar_ :some long message - (re.compile(r":([^!]+)!([^ ]+)\sPRIVMSG\s([^ ]+)\s:(.*)"), self.__query), + (re.compile(r":([^!]+)!([^ ]+)\sPRIVMSG\s([^ ]+)\s:(.*)"), + self.__query), # :foo.bar.net COMMAND some message - (re.compile(r""":([^ ]+)\s+([A-Z]+)\s+(.+)"""), self.__handleNamedMessage), + (re.compile(r""":([^ ]+)\s+([A-Z]+)\s+(.+)"""), + self.__handleNamedMessage), # :foo.bar.net 123 * :info - (re.compile(r""":([^ ]+)\s+(\d{3})\s+(.+)"""), self.__handleNumericMessage), + (re.compile(r""":([^ ]+)\s+(\d{3})\s+(.+)"""), + self.__handleNumericMessage), # PING :ping message (re.compile(r"""PING\s+:(.*)"""), self.__ping), ] @@ -131,9 +137,10 @@ if Preferences.getIrc("AskOnShutdown"): ok = E5MessageBox.yesNo(self, self.trUtf8("Disconnect from Server"), - self.trUtf8("""<p>Do you really want to disconnect from""" - """ <b>{0}</b>?</p><p>All channels will be closed.""" - """</p>""").format(self.__server.getName())) + self.trUtf8( + """<p>Do you really want to disconnect from""" + """ <b>{0}</b>?</p><p>All channels will be closed.""" + """</p>""").format(self.__server.getName())) else: ok = True if ok: @@ -170,7 +177,8 @@ if network: self.__server = network.getServer() self.__identityName = network.getIdentityName() - identity = self.__ircNetworkManager.getIdentity(self.__identityName) + identity = self.__ircNetworkManager.getIdentity( + self.__identityName) self.__userName = identity.getIdent() self.__quitMessage = identity.getQuitMessage() if self.__server: @@ -178,9 +186,11 @@ if useSSL and not SSL_AVAILABLE: E5MessageBox.critical(self, self.trUtf8("SSL Connection"), - self.trUtf8("""An encrypted connection to the IRC network""" - """ was requested but SSL is not available.""" - """ Please change the server configuration.""")) + self.trUtf8( + """An encrypted connection to the IRC""" + """ network was requested but SSL is not""" + """ available. Please change the server""" + """ configuration.""")) return if useSSL: @@ -199,16 +209,21 @@ self.__connectionState = IrcWidget.ServerConnecting if useSSL: - self.networkWidget.addServerMessage(self.trUtf8("Info"), - self.trUtf8("Looking for server {0} (port {1}) using" - " an SSL encrypted connection...").format( - self.__server.getName(), self.__server.getPort())) - self.__socket.connectToHostEncrypted(self.__server.getName(), - self.__server.getPort()) + self.networkWidget.addServerMessage( + self.trUtf8("Info"), + self.trUtf8("Looking for server {0} (port {1})" + " using an SSL encrypted connection" + "...").format(self.__server.getName(), + self.__server.getPort())) + self.__socket.connectToHostEncrypted( + self.__server.getName(), self.__server.getPort()) else: - self.networkWidget.addServerMessage(self.trUtf8("Info"), - self.trUtf8("Looking for server {0} (port {1})...").format( - self.__server.getName(), self.__server.getPort())) + self.networkWidget.addServerMessage( + self.trUtf8("Info"), + self.trUtf8( + "Looking for server {0} (port {1})...").format( + self.__server.getName(), + self.__server.getPort())) self.__socket.connectToHost(self.__server.getName(), self.__server.getPort()) else: @@ -313,7 +328,8 @@ # the above call sets the new channel as the current widget channel = self.channelsWidget.currentWidget() channel.addMessage(match.group(1), match.group(4)) - channel.setPrivateInfo("{0} - {1}".format(match.group(1), match.group(2))) + channel.setPrivateInfo( + "{0} - {1}".format(match.group(1), match.group(2))) return True @@ -373,7 +389,8 @@ """ for channel in self.__channelList: if channel.name() == name: - self.channelsWidget.removeTab(self.channelsWidget.indexOf(channel)) + self.channelsWidget.removeTab( + self.channelsWidget.indexOf(channel)) self.__channelList.remove(channel) channel.deleteLater() @@ -401,7 +418,8 @@ @param data data to be sent (string) """ if self.__socket: - self.__socket.write(QByteArray("{0}\r\n".format(data).encode("utf-8"))) + self.__socket.write( + QByteArray("{0}\r\n".format(data).encode("utf-8"))) def __sendCtcpReply(self, receiver, text): """ @@ -421,7 +439,8 @@ def __hostConnected(self): """ - Private slot to log in to the server after the connection was established. + Private slot to log in to the server after the connection was + established. """ self.networkWidget.addServerMessage(self.trUtf8("Info"), self.trUtf8("Connected,logging in...")) @@ -435,15 +454,16 @@ if not nick: self.__nickIndex = 0 try: - nick = self.__ircNetworkManager.getIdentity(self.__identityName)\ - .getNickNames()[self.__nickIndex] + nick = self.__ircNetworkManager.getIdentity( + self.__identityName).getNickNames()[self.__nickIndex] except IndexError: nick = "" if not nick: nick = self.__userName self.__nickName = nick self.networkWidget.setNickName(nick) - realName = self.__ircNetworkManager.getIdentity(self.__identityName).getRealName() + realName = self.__ircNetworkManager.getIdentity( + self.__identityName).getRealName() if not realName: realName = "eric IDE chat" self.__send("NICK " + nick) @@ -500,8 +520,9 @@ # Oops, the message wasn't handled self.networkWidget.addErrorMessage( self.trUtf8("Message Error"), - self.trUtf8("Unknown message received from server:" - "<br/>{0}").format(line)) + self.trUtf8( + "Unknown message received from server:" + "<br/>{0}").format(line)) self.__updateUsersCount() self.__buffer = "" @@ -534,12 +555,12 @@ if name == self.__nickName: if sourceNick == self.__nickName: msg = self.trUtf8( - "You have set your personal modes to <b>[{0}]</b>.")\ - .format(modes) + "You have set your personal modes to" + " <b>[{0}]</b>.").format(modes) else: msg = self.trUtf8( - "{0} has changed your personal modes to <b>[{1}]</b>.")\ - .format(sourceNick, modes) + "{0} has changed your personal modes to" + " <b>[{1}]</b>.").format(sourceNick, modes) self.networkWidget.addServerMessage( self.trUtf8("Mode"), msg, filterMsg=False) return True @@ -583,9 +604,11 @@ """ code = int(match.group(2)) if code < 400: - return self.__handleServerReply(code, match.group(1), match.group(3)) + return self.__handleServerReply( + code, match.group(1), match.group(3)) else: - return self.__handleServerError(code, match.group(1), match.group(3)) + return self.__handleServerError( + code, match.group(1), match.group(3)) def __handleServerError(self, code, server, message): """ @@ -637,15 +660,18 @@ elif code == 4: parts = message.strip().split() message = self.trUtf8("Server {0} (Version {1}), User-Modes: {2}," - " Channel-Modes: {3}").format(parts[1], parts[2], parts[3], parts[4]) + " Channel-Modes: {3}").format( + parts[1], parts[2], parts[3], parts[4]) elif code == 265: parts = message.strip().split() - message = self.trUtf8("Current users on {0}: {1}, max. {2}").format( - server, parts[1], parts[2]) + message = self.trUtf8( + "Current users on {0}: {1}, max. {2}").format( + server, parts[1], parts[2]) elif code == 266: parts = message.strip().split() - message = self.trUtf8("Current users on the network: {0}, max. {1}").format( - parts[1], parts[2]) + message = self.trUtf8( + "Current users on the network: {0}, max. {1}").format( + parts[1], parts[2]) elif code == 305: message = self.trUtf8("You are no longer marked as being away.") elif code == 306: @@ -691,7 +717,8 @@ def __autoJoinChannels(self): """ - Private slot to join channels automatically once a server got connected. + Private slot to join channels automatically once a server got + connected. """ for channel in self.networkWidget.getNetworkChannels(): if channel.autoJoin(): @@ -710,26 +737,30 @@ # ignore this one, it's a disconnect if self.__sslErrorLock: self.networkWidget.addErrorMessage(self.trUtf8("SSL Error"), - self.trUtf8("""Connection to server {0} (port {1}) lost while""" - """ waiting for user response to an SSL error.""").format( - self.__server.getName(), self.__server.getPort())) + self.trUtf8( + """Connection to server {0} (port {1}) lost while""" + """ waiting for user response to an SSL error.""") + .format(self.__server.getName(), self.__server.getPort())) self.__connectionState = IrcWidget.ServerDisconnected elif error == QAbstractSocket.HostNotFoundError: self.networkWidget.addErrorMessage(self.trUtf8("Socket Error"), - self.trUtf8("The host was not found. Please check the host name" - " and port settings.")) + self.trUtf8( + "The host was not found. Please check the host name" + " and port settings.")) elif error == QAbstractSocket.ConnectionRefusedError: self.networkWidget.addErrorMessage(self.trUtf8("Socket Error"), - self.trUtf8("The connection was refused by the peer. Please check the" - " host name and port settings.")) + self.trUtf8( + "The connection was refused by the peer. Please check the" + " host name and port settings.")) elif error == QAbstractSocket.SslHandshakeFailedError: self.networkWidget.addErrorMessage(self.trUtf8("Socket Error"), self.trUtf8("The SSL handshake failed.")) else: if self.__socket: self.networkWidget.addErrorMessage(self.trUtf8("Socket Error"), - self.trUtf8("The following network error occurred:<br/>{0}").format( - self.__socket.errorString())) + self.trUtf8( + "The following network error occurred:<br/>{0}") + .format(self.__socket.errorString())) else: self.networkWidget.addErrorMessage(self.trUtf8("Socket Error"), self.trUtf8("A network error occurred.")) @@ -744,10 +775,11 @@ errors, self.__server.getName(), self.__server.getPort()) if ignored == E5SslErrorHandler.NotIgnored: self.networkWidget.addErrorMessage(self.trUtf8("SSL Error"), - self.trUtf8("""Could not connect to {0} (port {1}) using an SSL""" - """ encrypted connection. Either the server does not""" - """ support SSL (did you use the correct port?) or""" - """ you rejected the certificate.""").format( + self.trUtf8( + """Could not connect to {0} (port {1}) using an SSL""" + """ encrypted connection. Either the server does not""" + """ support SSL (did you use the correct port?) or""" + """ you rejected the certificate.""").format( self.__server.getName(), self.__server.getPort())) self.__socket.close() else: @@ -756,9 +788,10 @@ QSslConfiguration.defaultConfiguration()) if ignored == E5SslErrorHandler.UserIgnored: self.networkWidget.addErrorMessage(self.trUtf8("SSL Error"), - self.trUtf8("""The SSL certificate for the server {0} (port {1})""" - """ failed the authenticity check. SSL errors""" - """ were accepted by you.""").format( + self.trUtf8( + """The SSL certificate for the server {0} (port {1})""" + """ failed the authenticity check. SSL errors""" + """ were accepted by you.""").format( self.__server.getName(), self.__server.getPort())) if self.__connectionState == IrcWidget.ServerConnecting: self.__socket.ignoreSslErrors() @@ -819,7 +852,8 @@ self.networkWidget.addServerMessage(self.trUtf8("CTCP"), self.trUtf8("Received CTCP-PING request from {0}," " sending answer.").format(match.group(1))) - self.__sendCtcpReply(match.group(1), "PING {0}".format(ctcpArg)) + self.__sendCtcpReply( + match.group(1), "PING {0}".format(ctcpArg)) elif ctcpRequest == "clientinfo": self.networkWidget.addServerMessage(self.trUtf8("CTCP"), self.trUtf8("Received CTCP-CLIENTINFO request from {0}," @@ -828,7 +862,8 @@ "CLIENTINFO CLIENTINFO PING VERSION") else: self.networkWidget.addServerMessage(self.trUtf8("CTCP"), - self.trUtf8("Received unknown CTCP-{0} request from {1}.").format( + self.trUtf8( + "Received unknown CTCP-{0} request from {1}.").format( ctcpRequest, match.group(1))) return True @@ -854,10 +889,13 @@ .getNickNames()[self.__nickIndex] self.__nickName = nick except IndexError: - self.networkWidget.addServerMessage(self.trUtf8("Critical"), - self.trUtf8("No nickname acceptable to the server configured" - " for <b>{0}</b>. Disconnecting...").format(self.__userName), - filterMsg=False) + self.networkWidget.addServerMessage( + self.trUtf8("Critical"), + self.trUtf8( + "No nickname acceptable to the server configured" + " for <b>{0}</b>. Disconnecting...").format( + self.__userName), + filterMsg=False) self.__connectNetwork("", False, silent=True) self.__nickName = "" self.__nickIndex = -1 @@ -912,7 +950,8 @@ @param isAway flag indicating the current away state (boolean) """ if isAway and self.__identityName: - identity = self.__ircNetworkManager.getIdentity(self.__identityName) + identity = self.__ircNetworkManager.getIdentity( + self.__identityName) if identity.rememberAwayPosition(): for channel in self.__channelList: channel.setMarkerLine()
--- a/PluginManager/PluginExceptions.py Sun Oct 06 19:52:33 2013 +0200 +++ b/PluginManager/PluginExceptions.py Mon Oct 07 19:10:11 2013 +0200 @@ -71,7 +71,8 @@ class PluginLoadError(PluginError): """ - Class defining an error raised, when there was an error during plugin loading. + Class defining an error raised, when there was an error during plugin + loading. """ def __init__(self, name): """ @@ -80,13 +81,16 @@ @param name name of the plugin module (string) """ self._errorMessage = \ - QApplication.translate("PluginError", "Error loading plugin module: {0}")\ - .format(name) + QApplication.translate( + "PluginError", + "Error loading plugin module: {0}")\ + .format(name) class PluginActivationError(PluginError): """ - Class defining an error raised, when there was an error during plugin activation. + Class defining an error raised, when there was an error during plugin + activation. """ def __init__(self, name): """ @@ -95,8 +99,10 @@ @param name name of the plugin module (string) """ self._errorMessage = \ - QApplication.translate("PluginError", "Error activating plugin module: {0}")\ - .format(name) + QApplication.translate( + "PluginError", + "Error activating plugin module: {0}")\ + .format(name) class PluginModuleFormatError(PluginError): @@ -111,9 +117,10 @@ @param missing description of the missing element (string) """ self._errorMessage = \ - QApplication.translate("PluginError", - "The plugin module {0} is missing {1}.")\ - .format(name, missing) + QApplication.translate( + "PluginError", + "The plugin module {0} is missing {1}.")\ + .format(name, missing) class PluginClassFormatError(PluginError): @@ -125,10 +132,12 @@ Constructor @param name name of the plugin module (string) - @param class_ name of the class not satisfying the requirements (string) + @param class_ name of the class not satisfying the requirements + (string) @param missing description of the missing element (string) """ self._errorMessage = \ - QApplication.translate("PluginError", - "The plugin class {0} of module {1} is missing {2}.")\ - .format(class_, name, missing) + QApplication.translate( + "PluginError", + "The plugin class {0} of module {1} is missing {2}.")\ + .format(class_, name, missing)
--- a/PluginManager/PluginInfoDialog.py Sun Oct 06 19:52:33 2013 +0200 +++ b/PluginManager/PluginInfoDialog.py Mon Oct 07 19:10:11 2013 +0200 @@ -41,12 +41,13 @@ self.__menu = QMenu(self) self.__menu.addAction(self.trUtf8('Show details'), self.__showDetails) - self.__activateAct = \ - self.__menu.addAction(self.trUtf8('Activate'), self.__activatePlugin) - self.__deactivateAct = \ - self.__menu.addAction(self.trUtf8('Deactivate'), self.__deactivatePlugin) + self.__activateAct = self.__menu.addAction( + self.trUtf8('Activate'), self.__activatePlugin) + self.__deactivateAct = self.__menu.addAction( + self.trUtf8('Deactivate'), self.__deactivatePlugin) self.pluginList.setContextMenuPolicy(Qt.CustomContextMenu) - self.pluginList.customContextMenuRequested.connect(self.__showContextMenu) + self.pluginList.customContextMenuRequested.connect( + self.__showContextMenu) def __populateList(self): """ @@ -55,8 +56,9 @@ self.pluginList.clear() for info in self.pm.getPluginInfos(): self.__createEntry(info) - self.pluginList.sortItems(self.pluginList.sortColumn(), - self.pluginList.header().sortIndicatorOrder()) + self.pluginList.sortItems( + self.pluginList.sortColumn(), + self.pluginList.header().sortIndicatorOrder()) def __createEntry(self, info): """ @@ -91,7 +93,8 @@ """ itm = self.pluginList.itemAt(coord) if itm is not None: - autoactivate = itm.text(self.__autoActivateColumn) == self.trUtf8("Yes") + autoactivate = (itm.text(self.__autoActivateColumn) == + self.trUtf8("Yes")) if itm.text(self.__activeColumn) == self.trUtf8("Yes"): self.__activateAct.setEnabled(False) self.__deactivateAct.setEnabled(autoactivate)
--- a/PluginManager/PluginInstallDialog.py Sun Oct 06 19:52:33 2013 +0200 +++ b/PluginManager/PluginInstallDialog.py Mon Oct 07 19:10:11 2013 +0200 @@ -16,8 +16,8 @@ import glob from PyQt4.QtCore import pyqtSlot, Qt, QDir, QFileInfo -from PyQt4.QtGui import QWidget, QDialogButtonBox, QAbstractButton, QApplication, \ - QDialog, QVBoxLayout +from PyQt4.QtGui import QWidget, QDialogButtonBox, QAbstractButton, \ + QApplication, QDialog, QVBoxLayout from E5Gui import E5FileDialog from E5Gui.E5MainWindow import E5MainWindow @@ -55,24 +55,26 @@ self.__pluginManager = pluginManager self.__external = False - self.__backButton = \ - self.buttonBox.addButton(self.trUtf8("< Back"), QDialogButtonBox.ActionRole) - self.__nextButton = \ - self.buttonBox.addButton(self.trUtf8("Next >"), QDialogButtonBox.ActionRole) - self.__finishButton = \ - self.buttonBox.addButton(self.trUtf8("Install"), QDialogButtonBox.ActionRole) + self.__backButton = self.buttonBox.addButton( + self.trUtf8("< Back"), QDialogButtonBox.ActionRole) + self.__nextButton = self.buttonBox.addButton( + self.trUtf8("Next >"), QDialogButtonBox.ActionRole) + self.__finishButton = self.buttonBox.addButton( + self.trUtf8("Install"), QDialogButtonBox.ActionRole) self.__closeButton = self.buttonBox.button(QDialogButtonBox.Close) self.__cancelButton = self.buttonBox.button(QDialogButtonBox.Cancel) userDir = self.__pluginManager.getPluginDir("user") if userDir is not None: - self.destinationCombo.addItem(self.trUtf8("User plugins directory"), + self.destinationCombo.addItem( + self.trUtf8("User plugins directory"), userDir) globalDir = self.__pluginManager.getPluginDir("global") if globalDir is not None and os.access(globalDir, os.W_OK): - self.destinationCombo.addItem(self.trUtf8("Global plugins directory"), + self.destinationCombo.addItem( + self.trUtf8("Global plugins directory"), globalDir) self.__installedDirs = [] @@ -84,7 +86,8 @@ for pluginFileName in pluginFileNames: fi = QFileInfo(pluginFileName) if fi.isRelative(): - pluginFileName = QFileInfo(downloadDir, fi.fileName()).absoluteFilePath() + pluginFileName = QFileInfo( + downloadDir, fi.fileName()).absoluteFilePath() self.archivesList.addItem(pluginFileName) self.archivesList.sortItems() @@ -134,7 +137,8 @@ self.__closeButton.hide() self.__cancelButton.show() - msg = self.trUtf8("Plugin ZIP-Archives:\n{0}\n\nDestination:\n{1} ({2})")\ + msg = self.trUtf8( + "Plugin ZIP-Archives:\n{0}\n\nDestination:\n{1} ({2})")\ .format("\n".join(self.__createArchivesList()), self.destinationCombo.currentText(), self.destinationCombo.itemData( @@ -171,7 +175,8 @@ """ Private slot called, when the selection of the archives list changes. """ - self.removeArchivesButton.setEnabled(len(self.archivesList.selectedItems()) > 0) + self.removeArchivesButton.setEnabled( + len(self.archivesList.selectedItems()) > 0) @pyqtSlot() def on_removeArchivesButton_clicked(self): @@ -179,7 +184,8 @@ Private slot to remove archives from the list. """ for archiveItem in self.archivesList.selectedItems(): - itm = self.archivesList.takeItem(self.archivesList.row(archiveItem)) + itm = self.archivesList.takeItem( + self.archivesList.row(archiveItem)) del itm self.__nextButton.setEnabled(self.archivesList.count() > 0) @@ -212,7 +218,8 @@ res = True self.summaryEdit.clear() for archive in self.__createArchivesList(): - self.summaryEdit.append(self.trUtf8("Installing {0} ...").format(archive)) + self.summaryEdit.append( + self.trUtf8("Installing {0} ...").format(archive)) ok, msg, restart = self.__installPlugin(archive) res = res and ok if ok: @@ -244,8 +251,8 @@ installedPluginName = "" archive = archiveFilename - destination = \ - self.destinationCombo.itemData(self.destinationCombo.currentIndex()) + destination = self.destinationCombo.itemData( + self.destinationCombo.currentIndex()) # check if archive is a local url url = urllib.parse.urlparse(archive) @@ -255,22 +262,25 @@ # check, if the archive exists if not os.path.exists(archive): return False, \ - self.trUtf8("""<p>The archive file <b>{0}</b> does not exist. """ - """Aborting...</p>""").format(archive), \ + self.trUtf8( + """<p>The archive file <b>{0}</b> does not exist. """ + """Aborting...</p>""").format(archive), \ False # check, if the archive is a valid zip file if not zipfile.is_zipfile(archive): return False, \ - self.trUtf8("""<p>The file <b>{0}</b> is not a valid plugin """ - """ZIP-archive. Aborting...</p>""").format(archive), \ + self.trUtf8( + """<p>The file <b>{0}</b> is not a valid plugin """ + """ZIP-archive. Aborting...</p>""").format(archive), \ False # check, if the destination is writeable if not os.access(destination, os.W_OK): return False, \ - self.trUtf8("""<p>The destination directory <b>{0}</b> is not """ - """writeable. Aborting...</p>""").format(destination), \ + self.trUtf8( + """<p>The destination directory <b>{0}</b> is not """ + """writeable. Aborting...</p>""").format(destination), \ False zip = zipfile.ZipFile(archive, "r") @@ -287,8 +297,9 @@ if not pluginFound: return False, \ - self.trUtf8("""<p>The file <b>{0}</b> is not a valid plugin """ - """ZIP-archive. Aborting...</p>""").format(archive), \ + self.trUtf8( + """<p>The file <b>{0}</b> is not a valid plugin """ + """ZIP-archive. Aborting...</p>""").format(archive), \ False # parse the plugin module's plugin header @@ -310,7 +321,8 @@ packageName = "None" elif line.startswith("internalPackages"): tokens = line.split("=") - token = tokens[1].strip()[1:-1] # it is a comma separated string + token = tokens[1].strip()[1:-1] + # it is a comma separated string internalPackages = [p.strip() for p in token.split(",")] elif line.startswith("needsRestart"): tokens = line.split("=") @@ -330,15 +342,17 @@ if not packageName: return False, \ - self.trUtf8("""<p>The plugin module <b>{0}</b> does not contain """ - """a 'packageName' attribute. Aborting...</p>""")\ + self.trUtf8( + """<p>The plugin module <b>{0}</b> does not contain """ + """a 'packageName' attribute. Aborting...</p>""")\ .format(pluginFileName), \ False if pyqtApi < 2: return False, \ - self.trUtf8("""<p>The plugin module <b>{0}</b> does not conform""" - """ with the PyQt v2 API. Aborting...</p>""")\ + self.trUtf8( + """<p>The plugin module <b>{0}</b> does not conform""" + """ with the PyQt v2 API. Aborting...</p>""")\ .format(pluginFileName), \ False @@ -364,7 +378,8 @@ activatePlugin = False if not self.__external: activatePlugin = \ - not self.__pluginManager.isPluginLoaded(installedPluginName) or \ + not self.__pluginManager.isPluginLoaded( + installedPluginName) or \ (self.__pluginManager.isPluginLoaded(installedPluginName) and \ self.__pluginManager.isPluginActive(installedPluginName)) # try to unload a plugin with the same name @@ -422,17 +437,20 @@ except os.error as why: self.__rollback() return False, \ - self.trUtf8("Error installing plugin. Reason: {0}").format(str(why)), \ + self.trUtf8( + "Error installing plugin. Reason: {0}").format(str(why)), \ False except IOError as why: self.__rollback() return False, \ - self.trUtf8("Error installing plugin. Reason: {0}").format(str(why)), \ + self.trUtf8( + "Error installing plugin. Reason: {0}").format(str(why)), \ False except OSError as why: self.__rollback() return False, \ - self.trUtf8("Error installing plugin. Reason: {0}").format(str(why)), \ + self.trUtf8( + "Error installing plugin. Reason: {0}").format(str(why)), \ False except: print("Unspecific exception installing plugin.", file=sys.stderr) @@ -443,12 +461,15 @@ # now compile the plugins if doCompile: - compileall.compile_dir(os.path.join(destination, packageName), quiet=True) - compileall.compile_file(os.path.join(destination, pluginFileName), quiet=True) + compileall.compile_dir( + os.path.join(destination, packageName), quiet=True) + compileall.compile_file( + os.path.join(destination, pluginFileName), quiet=True) if not self.__external: # now load and activate the plugin - self.__pluginManager.loadPlugin(installedPluginName, destination, reload_) + self.__pluginManager.loadPlugin(installedPluginName, destination, + reload_) if activatePlugin: self.__pluginManager.activatePlugin(installedPluginName) @@ -480,7 +501,8 @@ head, tail = os.path.split(head) if head and tail and not os.path.exists(head): self.__makedirs(head, mode) - if tail == os.curdir: # xxx/newdir/. exists if xxx/newdir exists + if tail == os.curdir: + # xxx/newdir/. exists if xxx/newdir exists return os.mkdir(name, mode) self.__installedDirs.append(name) @@ -512,14 +534,18 @@ if os.path.exists(fnamec): os.remove(fnamec) - pluginDirCache = os.path.join(os.path.dirname(pluginFile), "__pycache__") + pluginDirCache = os.path.join( + os.path.dirname(pluginFile), "__pycache__") if os.path.exists(pluginDirCache): - pluginFileName = os.path.splitext(os.path.basename(pluginFile))[0] + pluginFileName = os.path.splitext( + os.path.basename(pluginFile))[0] for fnameo in glob.glob( - os.path.join(pluginDirCache, "{0}*.pyo".format(pluginFileName))): + os.path.join(pluginDirCache, + "{0}*.pyo".format(pluginFileName))): os.remove(fnameo) for fnamec in glob.glob( - os.path.join(pluginDirCache, "{0}*.pyc".format(pluginFileName))): + os.path.join(pluginDirCache, + "{0}*.pyc".format(pluginFileName))): os.remove(fnamec) os.remove(pluginFile) @@ -583,7 +609,8 @@ self.setCentralWidget(self.cw) self.resize(size) - self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) + self.setStyle(Preferences.getUI("Style"), + Preferences.getUI("StyleSheet")) self.cw.buttonBox.accepted[()].connect(self.close) self.cw.buttonBox.rejected[()].connect(self.close)
--- a/PluginManager/PluginManager.py Sun Oct 06 19:52:33 2013 +0200 +++ b/PluginManager/PluginManager.py Mon Oct 07 19:10:11 2013 +0200 @@ -16,8 +16,9 @@ from E5Gui import E5MessageBox -from .PluginExceptions import PluginPathError, PluginModulesError, PluginLoadError, \ - PluginActivationError, PluginModuleFormatError, PluginClassFormatError +from .PluginExceptions import PluginPathError, PluginModulesError, \ + PluginLoadError, PluginActivationError, PluginModuleFormatError, \ + PluginClassFormatError import UI.PixmapCache @@ -32,16 +33,16 @@ Class implementing the Plugin Manager. @signal shutdown() emitted at shutdown of the IDE - @signal pluginAboutToBeActivated(modulName, pluginObject) emitted just before a - plugin is activated - @signal pluginActivated(modulName, pluginObject) emitted just after a plugin - was activated + @signal pluginAboutToBeActivated(modulName, pluginObject) emitted just + before a plugin is activated + @signal pluginActivated(modulName, pluginObject) emitted just after + a plugin was activated @signal allPlugginsActivated() emitted at startup after all plugins have been activated - @signal pluginAboutToBeDeactivated(modulName, pluginObject) emitted just before a - plugin is deactivated - @signal pluginDeactivated(modulName, pluginObject) emitted just after a plugin - was deactivated + @signal pluginAboutToBeDeactivated(modulName, pluginObject) emitted just + before a plugin is deactivated + @signal pluginDeactivated(modulName, pluginObject) emitted just after + a plugin was deactivated """ shutdown = pyqtSignal() pluginAboutToBeActivated = pyqtSignal(str, object) @@ -84,7 +85,8 @@ } self.__priorityOrder = ["eric5", "global", "user"] - self.__defaultDownloadDir = os.path.join(Utilities.getConfigDir(), "Downloads") + self.__defaultDownloadDir = os.path.join( + Utilities.getConfigDir(), "Downloads") self.__activePlugins = {} self.__inactivePlugins = {} @@ -192,8 +194,9 @@ if not os.path.exists(self.pluginDirs["eric5"]): return (False, - self.trUtf8("The internal plugin directory <b>{0}</b> does not exits.")\ - .format(self.pluginDirs["eric5"])) + self.trUtf8( + "The internal plugin directory <b>{0}</b>" + " does not exits.").format(self.pluginDirs["eric5"])) return (True, "") @@ -203,10 +206,12 @@ @return flag indicating the availability of plugins (boolean) """ - if self.__develPluginFile and not os.path.exists(self.__develPluginFile): + if self.__develPluginFile and \ + not os.path.exists(self.__develPluginFile): return False - self.__foundCoreModules = self.getPluginModules(self.pluginDirs["eric5"]) + self.__foundCoreModules = self.getPluginModules( + self.pluginDirs["eric5"]) if "global" in self.pluginDirs: self.__foundGlobalModules = \ self.getPluginModules(self.pluginDirs["global"]) @@ -306,8 +311,8 @@ fname = "{0}.py".format(os.path.join(directory, name)) module = imp.load_source(name, fname) if not hasattr(module, "autoactivate"): - module.error = \ - self.trUtf8("Module is missing the 'autoactivate' attribute.") + module.error = self.trUtf8( + "Module is missing the 'autoactivate' attribute.") self.__failedModules[name] = module raise PluginLoadError(name) if getattr(module, "autoactivate"): @@ -331,8 +336,8 @@ print("Error loading plugin module:", name) except Exception as err: module = imp.new_module(name) - module.error = \ - self.trUtf8("Module failed to load. Error: {0}").format(str(err)) + module.error = self.trUtf8( + "Module failed to load. Error: {0}").format(str(err)) self.__failedModules[name] = module print("Error loading plugin module:", name) print(str(err)) @@ -369,21 +374,25 @@ self.__modulesCount -= 1 return True - def removePluginFromSysModules(self, pluginName, package, internalPackages): + def removePluginFromSysModules(self, pluginName, package, + internalPackages): """ - Public method to remove a plugin and all related modules from sys.modules. + Public method to remove a plugin and all related modules from + sys.modules. @param pluginName name of the plugin module (string) @param package name of the plugin package (string) @param internalPackages list of intenal packages (list of string) - @return flag indicating the plugin module was found in sys.modules (boolean) + @return flag indicating the plugin module was found in sys.modules + (boolean) """ packages = [package] + internalPackages found = False if not package: package = "__None__" for moduleName in list(sys.modules.keys())[:]: - if moduleName == pluginName or moduleName.split(".")[0] in packages: + if moduleName == pluginName or \ + moduleName.split(".")[0] in packages: found = True del sys.modules[moduleName] return found @@ -431,10 +440,11 @@ def activatePlugins(self): """ - Public method to activate all plugins having the "autoactivate" attribute - set to True. + Public method to activate all plugins having the "autoactivate" + attribute set to True. """ - savedInactiveList = Preferences.Prefs.settings.value(self.__inactivePluginsKey) + savedInactiveList = Preferences.Prefs.settings.value( + self.__inactivePluginsKey) if self.__develPluginName is not None and \ savedInactiveList is not None and \ self.__develPluginName in savedInactiveList: @@ -481,7 +491,8 @@ try: obj, ok = pluginObject.activate() except TypeError: - module.error = self.trUtf8("Incompatible plugin activation method.") + module.error = self.trUtf8( + "Incompatible plugin activation method.") obj = None ok = True except Exception as err: @@ -530,12 +541,15 @@ """ try: if not hasattr(module, "version"): - raise PluginModuleFormatError(module.eric5PluginModuleName, "version") + raise PluginModuleFormatError( + module.eric5PluginModuleName, "version") if not hasattr(module, "className"): - raise PluginModuleFormatError(module.eric5PluginModuleName, "className") + raise PluginModuleFormatError( + module.eric5PluginModuleName, "className") className = getattr(module, "className") if not hasattr(module, className): - raise PluginModuleFormatError(module.eric5PluginModuleName, className) + raise PluginModuleFormatError( + module.eric5PluginModuleName, className) pluginClass = getattr(module, className) if not hasattr(pluginClass, "__init__"): raise PluginClassFormatError(module.eric5PluginModuleName, @@ -607,7 +621,8 @@ def getPluginObject(self, type_, typename, maybeActive=False): """ - Public method to activate an ondemand plugin given by type and typename. + Public method to activate an ondemand plugin given by type and + typename. @param type_ type of the plugin to be activated (string) @param typename name of the plugin within the type category (string) @@ -633,9 +648,9 @@ """ Public method to get infos about all loaded plugins. - @return list of tuples giving module name (string), plugin name (string), - version (string), autoactivate (boolean), active (boolean), - short description (string), error flag (boolean) + @return list of tuples giving module name (string), plugin name + (string), version (string), autoactivate (boolean), active + (boolean), short description (string), error flag (boolean) """ infos = [] @@ -646,19 +661,23 @@ for name in list(self.__inactiveModules.keys()): pname, shortDesc, error, version = \ self.__getShortInfo(self.__inactiveModules[name]) - infos.append((name, pname, version, True, False, shortDesc, error)) + infos.append( + (name, pname, version, True, False, shortDesc, error)) for name in list(self.__onDemandActiveModules.keys()): pname, shortDesc, error, version = \ self.__getShortInfo(self.__onDemandActiveModules[name]) - infos.append((name, pname, version, False, True, shortDesc, error)) + infos.append( + (name, pname, version, False, True, shortDesc, error)) for name in list(self.__onDemandInactiveModules.keys()): pname, shortDesc, error, version = \ self.__getShortInfo(self.__onDemandInactiveModules[name]) - infos.append((name, pname, version, False, False, shortDesc, error)) + infos.append( + (name, pname, version, False, False, shortDesc, error)) for name in list(self.__failedModules.keys()): pname, shortDesc, error, version = \ self.__getShortInfo(self.__failedModules[name]) - infos.append((name, pname, version, False, False, shortDesc, error)) + infos.append( + (name, pname, version, False, False, shortDesc, error)) return infos def __getShortInfo(self, module): @@ -709,7 +728,8 @@ return None details["moduleName"] = name - details["moduleFileName"] = getattr(module, "eric5PluginModuleFilename", "") + details["moduleFileName"] = getattr( + module, "eric5PluginModuleFilename", "") details["pluginName"] = getattr(module, "name", "") details["version"] = getattr(module, "version", "") details["author"] = getattr(module, "author", "") @@ -733,7 +753,8 @@ def getPluginDisplayStrings(self, type_): """ - Public method to get the display strings of all plugins of a specific type. + Public method to get the display strings of all plugins of a specific + type. @param type_ type of the plugins (string) @return dictionary with name as key and display string as value @@ -801,26 +822,29 @@ external tool. @return list of dictionaries containing the data. Each dictionary must - either contain data for the determination or the data to be displayed.<br /> + either contain data for the determination or the data to be + displayed.<br /> A dictionary of the first form must have the following entries: <ul> - <li>programEntry - indicator for this dictionary form (boolean), - always True</li> + <li>programEntry - indicator for this dictionary form + (boolean), always True</li> <li>header - string to be diplayed as a header (string)</li> <li>exe - the executable (string)</li> - <li>versionCommand - commandline parameter for the exe (string)</li> - <li>versionStartsWith - indicator for the output line containing - the version (string)</li> + <li>versionCommand - commandline parameter for the exe + (string)</li> + <li>versionStartsWith - indicator for the output line + containing the version (string)</li> <li>versionPosition - number of element containing the version (integer)</li> <li>version - version to be used as default (string)</li> - <li>versionCleanup - tuple of two integers giving string positions - start and stop for the version string (tuple of integers)</li> + <li>versionCleanup - tuple of two integers giving string + positions start and stop for the version string + (tuple of integers)</li> </ul> A dictionary of the second form must have the following entries: <ul> - <li>programEntry - indicator for this dictionary form (boolean), - always False</li> + <li>programEntry - indicator for this dictionary form + (boolean), always False</li> <li>header - string to be diplayed as a header (string)</li> <li>text - entry text to be shown (string)</li> <li>version - version text to be shown (string)</li> @@ -845,8 +869,8 @@ def getPluginConfigData(self): """ - Public method to get the config data of all active, non on-demand plugins - used by the configuration dialog. + Public method to get the config data of all active, non on-demand + plugins used by the configuration dialog. Plugins supporting this functionality must provide the plugin module function 'getConfigData' returning a dictionary with unique keys @@ -856,18 +880,21 @@ <dd>string shown in the selection area of the configuration page. This should be a localized string</dd> <dt>pixmap name</dt> - <dd>filename of the pixmap to be shown next to the display string</dd> + <dd>filename of the pixmap to be shown next to the display + string</dd> <dt>page creation function</dt> <dd>plugin module function to be called to create the configuration page. The page must be subclasses from Preferences.ConfigurationPages.ConfigurationPageBase and must implement a method called 'save' to save the settings. A parent - entry will be created in the selection list, if this value is None.</dd> + entry will be created in the selection list, if this value is + None.</dd> <dt>parent key</dt> <dd>dictionary key of the parent entry or None, if this defines a toplevel entry.</dd> <dt>reference to configuration page</dt> - <dd>This will be used by the configuration dialog and must always be None</dd> + <dd>This will be used by the configuration dialog and must always + be None</dd> </dl> @return plug-in configuration data @@ -902,13 +929,13 @@ return pluginName in self.__activeModules or \ pluginName in self.__onDemandActiveModules - ############################################################################ + ########################################################################### ## Specialized plugin module handling methods below - ############################################################################ + ########################################################################### - ############################################################################ + ########################################################################### ## VCS related methods below - ############################################################################ + ########################################################################### def getVcsSystemIndicators(self): """ @@ -918,8 +945,9 @@ getVcsSystemIndicator returning a dictionary with indicator as key and a tuple with the vcs name (string) and vcs display string (string). - @return dictionary with indicator as key and a list of tuples as values. - Each tuple contains the vcs name (string) and vcs display string (string). + @return dictionary with indicator as key and a list of tuples as + values. Each tuple contains the vcs name (string) and vcs display + string (string). """ vcsDict = {} @@ -947,7 +975,8 @@ def __checkPluginsDownloadDirectory(self): """ - Private slot to check for the existence of the plugins download directory. + Private slot to check for the existence of the plugins download + directory. """ downloadDir = Preferences.getPluginManager("DownloadPath") if not downloadDir: @@ -965,10 +994,11 @@ except (OSError, IOError) as err: E5MessageBox.critical(self.__ui, self.trUtf8("Plugin Manager Error"), - self.trUtf8("""<p>The plugin download directory <b>{0}</b> """ - """could not be created. Please configure it """ - """via the configuration dialog.</p>""" - """<p>Reason: {1}</p>""")\ + self.trUtf8( + """<p>The plugin download directory""" + """ <b>{0}</b> could not be created. Please""" + """ configure it via the configuration""" + """ dialog.</p><p>Reason: {1}</p>""") .format(downloadDir, str(err))) downloadDir = ""
--- a/PluginManager/PluginRepositoryDialog.py Sun Oct 06 19:52:33 2013 +0200 +++ b/PluginManager/PluginRepositoryDialog.py Mon Oct 07 19:10:11 2013 +0200 @@ -12,10 +12,12 @@ import os import zipfile -from PyQt4.QtCore import pyqtSignal, pyqtSlot, Qt, QFile, QIODevice, QUrl, QProcess -from PyQt4.QtGui import QWidget, QDialogButtonBox, QAbstractButton, QTreeWidgetItem, \ - QDialog, QVBoxLayout -from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply +from PyQt4.QtCore import pyqtSignal, pyqtSlot, Qt, QFile, QIODevice, QUrl, \ + QProcess +from PyQt4.QtGui import QWidget, QDialogButtonBox, QAbstractButton, \ + QTreeWidgetItem, QDialog, QVBoxLayout +from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest, \ + QNetworkReply from .Ui_PluginRepositoryDialog import Ui_PluginRepositoryDialog @@ -47,7 +49,8 @@ """ Class implementing a dialog showing the available plugins. - @signal closeAndInstall() emitted when the Close & Install button is pressed + @signal closeAndInstall() emitted when the Close & Install button is + pressed """ closeAndInstall = pyqtSignal() @@ -62,26 +65,28 @@ super().__init__(parent) self.setupUi(self) - self.__updateButton = \ - self.buttonBox.addButton(self.trUtf8("Update"), QDialogButtonBox.ActionRole) - self.__downloadButton = \ - self.buttonBox.addButton(self.trUtf8("Download"), QDialogButtonBox.ActionRole) + self.__updateButton = self.buttonBox.addButton( + self.trUtf8("Update"), QDialogButtonBox.ActionRole) + self.__downloadButton = self.buttonBox.addButton( + self.trUtf8("Download"), QDialogButtonBox.ActionRole) self.__downloadButton.setEnabled(False) self.__downloadInstallButton = \ self.buttonBox.addButton(self.trUtf8("Download && Install"), QDialogButtonBox.ActionRole) self.__downloadInstallButton.setEnabled(False) - self.__downloadCancelButton = \ - self.buttonBox.addButton(self.trUtf8("Cancel"), QDialogButtonBox.ActionRole) + self.__downloadCancelButton = self.buttonBox.addButton( + self.trUtf8("Cancel"), QDialogButtonBox.ActionRole) self.__installButton = \ self.buttonBox.addButton(self.trUtf8("Close && Install"), QDialogButtonBox.ActionRole) self.__downloadCancelButton.setEnabled(False) self.__installButton.setEnabled(False) - self.repositoryUrlEdit.setText(Preferences.getUI("PluginRepositoryUrl5")) + self.repositoryUrlEdit.setText( + Preferences.getUI("PluginRepositoryUrl5")) - self.repositoryList.headerItem().setText(self.repositoryList.columnCount(), "") + self.repositoryList.headerItem().setText( + self.repositoryList.columnCount(), "") self.repositoryList.header().setSortIndicator(0, Qt.AscendingOrder) self.pluginRepositoryFile = \ @@ -243,7 +248,8 @@ self.__downloadInstallButton.setEnabled(False) self.__installButton.setEnabled(False) for itm in self.repositoryList.selectedItems(): - if itm not in [self.__stableItem, self.__unstableItem, self.__unknownItem]: + if itm not in [self.__stableItem, self.__unstableItem, + self.__unknownItem]: url = itm.data(0, urlRole) filename = os.path.join( Preferences.getPluginManager("DownloadPath"), @@ -284,8 +290,9 @@ """ Private method to resort the tree. """ - self.repositoryList.sortItems(self.repositoryList.sortColumn(), - self.repositoryList.header().sortIndicatorOrder()) + self.repositoryList.sortItems( + self.repositoryList.sortColumn(), + self.repositoryList.header().sortIndicatorOrder()) def __populateList(self): """ @@ -315,9 +322,10 @@ self.repositoryUrlEdit.setText(url) E5MessageBox.warning(self, self.trUtf8("Plugins Repository URL Changed"), - self.trUtf8("""The URL of the Plugins Repository has""" - """ changed. Select the "Update" button to get""" - """ the new repository file.""")) + self.trUtf8( + """The URL of the Plugins Repository has""" + """ changed. Select the "Update" button to get""" + """ the new repository file.""")) else: E5MessageBox.critical(self, self.trUtf8("Read plugins repository file"), @@ -327,8 +335,8 @@ else: self.__repositoryMissing = True QTreeWidgetItem(self.repositoryList, - ["", - self.trUtf8("No plugin repository file available.\nSelect Update.") + ["", self.trUtf8( + "No plugin repository file available.\nSelect Update.") ]) self.repositoryList.resizeColumnToContents(1) @@ -380,8 +388,8 @@ E5MessageBox.warning(self, self.trUtf8("Error downloading file"), self.trUtf8( - """<p>Could not download the requested file from {0}.</p>""" - """<p>Error: {1}</p>""" + """<p>Could not download the requested file""" + """ from {0}.</p><p>Error: {1}</p>""" ).format(self.__downloadURL, reply.errorString()) ) self.downloadProgress.setValue(0) @@ -393,8 +401,10 @@ self.repositoryList.setCurrentItem( self.repositoryList.topLevelItem(0)) else: - self.__downloadButton.setEnabled(len(self.__selectedItems())) - self.__downloadInstallButton.setEnabled(len(self.__selectedItems())) + self.__downloadButton.setEnabled( + len(self.__selectedItems())) + self.__downloadInstallButton.setEnabled( + len(self.__selectedItems())) return self.__downloadIODevice.open(QIODevice.WriteOnly) @@ -430,7 +440,8 @@ self.downloadProgress.setMaximum(total) self.downloadProgress.setValue(done) - def addEntry(self, name, short, description, url, author, version, filename, status): + def addEntry(self, name, short, description, url, author, version, + filename, status): """ Public method to add an entry to the list. @@ -446,19 +457,22 @@ if status == "stable": if self.__stableItem is None: self.__stableItem = \ - QTreeWidgetItem(self.repositoryList, [self.trUtf8("Stable")]) + QTreeWidgetItem(self.repositoryList, + [self.trUtf8("Stable")]) self.__stableItem.setExpanded(True) parent = self.__stableItem elif status == "unstable": if self.__unstableItem is None: self.__unstableItem = \ - QTreeWidgetItem(self.repositoryList, [self.trUtf8("Unstable")]) + QTreeWidgetItem(self.repositoryList, + [self.trUtf8("Unstable")]) self.__unstableItem.setExpanded(True) parent = self.__unstableItem else: if self.__unknownItem is None: self.__unknownItem = \ - QTreeWidgetItem(self.repositoryList, [self.trUtf8("Unknown")]) + QTreeWidgetItem(self.repositoryList, + [self.trUtf8("Unknown")]) self.__unknownItem.setExpanded(True) parent = self.__unknownItem itm = QTreeWidgetItem(parent, [name, version, short]) @@ -523,7 +537,8 @@ @pyqtSlot(bool) def on_repositoryUrlEditButton_toggled(self, checked): """ - Private slot to set the read only status of the repository URL line edit. + Private slot to set the read only status of the repository URL line + edit. @param checked state of the push button (boolean) """ @@ -587,7 +602,8 @@ self.setCentralWidget(self.cw) self.resize(size) - self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) + self.setStyle(Preferences.getUI("Style"), + Preferences.getUI("StyleSheet")) self.cw.buttonBox.accepted[()].connect(self.close) self.cw.buttonBox.rejected[()].connect(self.close) @@ -604,7 +620,8 @@ args.append(applPath) args += self.cw.getDownloadedPlugins() - if not os.path.isfile(applPath) or not proc.startDetached(sys.executable, args): + if not os.path.isfile(applPath) or \ + not proc.startDetached(sys.executable, args): E5MessageBox.critical(self, self.trUtf8('Process Generation Error'), self.trUtf8(
--- a/PluginManager/PluginUninstallDialog.py Sun Oct 06 19:52:33 2013 +0200 +++ b/PluginManager/PluginUninstallDialog.py Mon Oct 07 19:10:11 2013 +0200 @@ -51,12 +51,14 @@ self.__pluginManager = pluginManager self.__external = False - self.pluginDirectoryCombo.addItem(self.trUtf8("User plugins directory"), + self.pluginDirectoryCombo.addItem( + self.trUtf8("User plugins directory"), self.__pluginManager.getPluginDir("user")) globalDir = self.__pluginManager.getPluginDir("global") if globalDir is not None and os.access(globalDir, os.W_OK): - self.pluginDirectoryCombo.addItem(self.trUtf8("Global plugins directory"), + self.pluginDirectoryCombo.addItem( + self.trUtf8("Global plugins directory"), globalDir) @pyqtSlot(int) @@ -69,7 +71,8 @@ """ pluginDirectory = self.pluginDirectoryCombo\ .itemData(index) - pluginNames = sorted(self.__pluginManager.getPluginModules(pluginDirectory)) + pluginNames = sorted(self.__pluginManager.getPluginModules( + pluginDirectory)) self.pluginNameCombo.clear() for pluginName in pluginNames: fname = "{0}.py".format(os.path.join(pluginDirectory, pluginName)) @@ -100,8 +103,9 @@ if not self.__pluginManager.unloadPlugin(pluginName): E5MessageBox.critical(self, self.trUtf8("Plugin Uninstallation"), - self.trUtf8("""<p>The plugin <b>{0}</b> could not be unloaded.""" - """ Aborting...</p>""").format(pluginName)) + self.trUtf8( + """<p>The plugin <b>{0}</b> could not be unloaded.""" + """ Aborting...</p>""").format(pluginName)) return False if not pluginDirectory in sys.path: @@ -110,8 +114,9 @@ if not hasattr(module, "packageName"): E5MessageBox.critical(self, self.trUtf8("Plugin Uninstallation"), - self.trUtf8("""<p>The plugin <b>{0}</b> has no 'packageName' attribute.""" - """ Aborting...</p>""").format(pluginName)) + self.trUtf8( + """<p>The plugin <b>{0}</b> has no 'packageName'""" + """ attribute. Aborting...</p>""").format(pluginName)) return False package = getattr(module, "packageName") @@ -125,7 +130,8 @@ internalPackages = [] if hasattr(module, "internalPackages"): # it is a comma separated string - internalPackages = [p.strip() for p in module.internalPackages.split(",")] + internalPackages = [p.strip() for p in + module.internalPackages.split(",")] del module # clean sys.modules @@ -144,23 +150,26 @@ if os.path.exists(fnamec): os.remove(fnamec) - pluginDirCache = os.path.join(os.path.dirname(pluginFile), "__pycache__") + pluginDirCache = os.path.join( + os.path.dirname(pluginFile), "__pycache__") if os.path.exists(pluginDirCache): - pluginFileName = os.path.splitext(os.path.basename(pluginFile))[0] - for fnameo in glob.glob( - os.path.join(pluginDirCache, "{0}*.pyo".format(pluginFileName))): + pluginFileName = os.path.splitext( + os.path.basename(pluginFile))[0] + for fnameo in glob.glob(os.path.join( + pluginDirCache, "{0}*.pyo".format(pluginFileName))): os.remove(fnameo) - for fnamec in glob.glob( - os.path.join(pluginDirCache, "{0}*.pyc".format(pluginFileName))): + for fnamec in glob.glob(os.path.join( + pluginDirCache, "{0}*.pyc".format(pluginFileName))): os.remove(fnamec) os.remove(pluginFile) except OSError as err: E5MessageBox.critical(self, self.trUtf8("Plugin Uninstallation"), - self.trUtf8("""<p>The plugin package <b>{0}</b> could not be""" - """ removed. Aborting...</p>""" - """<p>Reason: {1}</p>""").format(packageDir, str(err))) + self.trUtf8( + """<p>The plugin package <b>{0}</b> could not be""" + """ removed. Aborting...</p>""" + """<p>Reason: {1}</p>""").format(packageDir, str(err))) return False if not self.__external: @@ -168,15 +177,17 @@ if ui.notificationsEnabled(): ui.showNotification(UI.PixmapCache.getPixmap("plugin48.png"), self.trUtf8("Plugin Uninstallation"), - self.trUtf8("""<p>The plugin <b>{0}</b> was uninstalled successfully""" - """ from {1}.</p>""")\ + self.trUtf8( + """<p>The plugin <b>{0}</b> was uninstalled successfully""" + """ from {1}.</p>""")\ .format(pluginName, pluginDirectory)) return True E5MessageBox.information(self, self.trUtf8("Plugin Uninstallation"), - self.trUtf8("""<p>The plugin <b>{0}</b> was uninstalled successfully""" - """ from {1}.</p>""")\ + self.trUtf8( + """<p>The plugin <b>{0}</b> was uninstalled successfully""" + """ from {1}.</p>""")\ .format(pluginName, pluginDirectory)) return True @@ -224,7 +235,8 @@ self.setCentralWidget(self.cw) self.resize(size) - self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) + self.setStyle(Preferences.getUI("Style"), + Preferences.getUI("StyleSheet")) self.cw.buttonBox.accepted[()].connect(self.close) self.cw.buttonBox.rejected[()].connect(self.close)
--- a/PyUnit/UnittestDialog.py Sun Oct 06 19:52:33 2013 +0200 +++ b/PyUnit/UnittestDialog.py Mon Oct 07 19:10:11 2013 +0200 @@ -14,8 +14,8 @@ import os from PyQt4.QtCore import pyqtSignal, QEvent, Qt, pyqtSlot -from PyQt4.QtGui import QWidget, QColor, QDialog, QApplication, QDialogButtonBox, \ - QListWidgetItem +from PyQt4.QtGui import QWidget, QColor, QDialog, QApplication, \ + QDialogButtonBox, QListWidgetItem from E5Gui.E5Application import e5App from E5Gui.E5Completers import E5FileCompleter @@ -34,14 +34,15 @@ """ Class implementing the UI to the pyunit package. - @signal unittestFile(str, int, int) emitted to show the source of a unittest file + @signal unittestFile(str, int, int) emitted to show the source of a + unittest file @signal unittestStopped() emitted after a unit test was run """ unittestFile = pyqtSignal(str, int, int) unittestStopped = pyqtSignal() - def __init__(self, prog=None, dbs=None, ui=None, fromEric=False, parent=None, - name=None): + def __init__(self, prog=None, dbs=None, ui=None, fromEric=False, + parent=None, name=None): """ Constructor @@ -61,7 +62,8 @@ self.startButton = self.buttonBox.addButton( self.trUtf8("Start"), QDialogButtonBox.ActionRole) - self.startButton.setToolTip(self.trUtf8("Start the selected testsuite")) + self.startButton.setToolTip(self.trUtf8( + "Start the selected testsuite")) self.startButton.setWhatsThis(self.trUtf8( """<b>Start Test</b>""" """<p>This button starts the selected testsuite.</p>""")) @@ -71,7 +73,8 @@ self.trUtf8("Reruns failed tests of the selected testsuite")) self.startFailedButton.setWhatsThis(self.trUtf8( """<b>Rerun Failed</b>""" - """<p>This button reruns all failed tests of the selected testsuite.</p>""")) + """<p>This button reruns all failed tests of the selected""" + """ testsuite.</p>""")) self.stopButton = self.buttonBox.addButton( self.trUtf8("Stop"), QDialogButtonBox.ActionRole) self.stopButton.setToolTip(self.trUtf8("Stop the running unittest")) @@ -86,7 +89,8 @@ self.__fromEric = fromEric self.setWindowFlags( - self.windowFlags() | Qt.WindowFlags(Qt.WindowContextHelpButtonHint)) + self.windowFlags() | Qt.WindowFlags( + Qt.WindowContextHelpButtonHint)) self.setWindowIcon(UI.PixmapCache.getIcon("eric.png")) self.setWindowTitle(self.trUtf8("Unittest")) if dbs: @@ -124,7 +128,8 @@ self.dbs.utTestErrored.connect(self.testErrored) self.dbs.utTestSkipped.connect(self.testSkipped) self.dbs.utTestFailedExpected.connect(self.testFailedExpected) - self.dbs.utTestSucceededUnexpected.connect(self.testSucceededUnexpected) + self.dbs.utTestSucceededUnexpected.connect( + self.testSucceededUnexpected) def keyPressEvent(self, evt): """ @@ -145,7 +150,8 @@ def insertProg(self, prog): """ - Public slot to insert the filename prog into the testsuiteComboBox object. + Public slot to insert the filename prog into the testsuiteComboBox + object. @param prog filename to be inserted (string) """ @@ -294,9 +300,11 @@ self.coverageEraseCheckBox.isChecked(), clientType=clientType) else: # we are running as an application or in local mode - sys.path = [os.path.dirname(os.path.abspath(prog))] + self.savedSysPath + sys.path = [os.path.dirname(os.path.abspath(prog))] + \ + self.savedSysPath - # clean up list of imported modules to force a reimport upon running the test + # clean up list of imported modules to force a reimport upon + # running the test if self.savedModulelist: for modname in list(sys.modules.keys()): if modname not in self.savedModulelist: @@ -316,13 +324,17 @@ test = unittest.defaultTestLoader.loadTestsFromName( testFunctionName, module) except AttributeError: - test = unittest.defaultTestLoader.loadTestsFromModule(module) + test = unittest.defaultTestLoader.loadTestsFromModule( + module) except: exc_type, exc_value, exc_tb = sys.exc_info() E5MessageBox.critical(self, self.trUtf8("Unittest"), - self.trUtf8("<p>Unable to run test <b>{0}</b>.<br>{1}<br>{2}</p>") - .format(self.testName, str(exc_type), str(exc_value))) + self.trUtf8( + "<p>Unable to run test <b>{0}</b>.<br>" + "{1}<br>{2}</p>") + .format(self.testName, str(exc_type), + str(exc_value))) return # now set up the coverage stuff @@ -341,7 +353,8 @@ from DebugClients.Python3.coverage import coverage cover = coverage( - data_file="{0}.coverage".format(os.path.splitext(mainScript)[0])) + data_file="{0}.coverage".format( + os.path.splitext(mainScript)[0])) cover.use_cache(True) if self.coverageEraseCheckBox.isChecked(): cover.erase() @@ -375,7 +388,8 @@ if nrTests == 0: E5MessageBox.critical(self, self.trUtf8("Unittest"), - self.trUtf8("<p>Unable to run test <b>{0}</b>.<br>{1}<br>{2}</p>") + self.trUtf8( + "<p>Unable to run test <b>{0}</b>.<br>{1}<br>{2}</p>") .format(self.testName, exc_type, exc_value)) return @@ -402,7 +416,8 @@ if text: for pattern in self.rxPatterns: text = re.sub(pattern, "", text) - itm = self.testsListWidget.findItems(text, Qt.MatchFlags(Qt.MatchExactly))[0] + itm = self.testsListWidget.findItems( + text, Qt.MatchFlags(Qt.MatchExactly))[0] self.testsListWidget.setCurrentItem(itm) self.testsListWidget.scrollToItem(itm) @@ -427,7 +442,8 @@ self.progressCounterFailureCount.setText(str(self.failCount)) self.progressCounterErrorCount.setText(str(self.errorCount)) self.progressCounterSkippedCount.setText(str(self.skippedCount)) - self.progressCounterExpectedFailureCount.setText(str(self.expectedFailureCount)) + self.progressCounterExpectedFailureCount.setText( + str(self.expectedFailureCount)) self.progressCounterUnexpectedSuccessCount.setText( str(self.unexpectedSuccessCount)) self.errorsListWidget.clear() @@ -524,7 +540,8 @@ @param id id of the test (string) """ self.expectedFailureCount += 1 - self.progressCounterExpectedFailureCount.setText(str(self.expectedFailureCount)) + self.progressCounterExpectedFailureCount.setText( + str(self.expectedFailureCount)) itm = QListWidgetItem(self.trUtf8(" Expected Failure")) itm.setForeground(Qt.blue) self.testsListWidget.insertItem(1, itm) @@ -629,7 +646,8 @@ tracebackLines = self.dlg.traceback.toPlainText().splitlines() # find the last entry matching the pattern for index in range(len(tracebackLines) - 1, -1, -1): - fmatch = re.search(r'File "(.*?)", line (\d*?),.*', tracebackLines[index]) + fmatch = re.search(r'File "(.*?)", line (\d*?),.*', + tracebackLines[index]) if fmatch: break if fmatch: @@ -749,7 +767,8 @@ self.setCentralWidget(self.cw) self.resize(size) - self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) + self.setStyle(Preferences.getUI("Style"), + Preferences.getUI("StyleSheet")) def eventFilter(self, obj, event): """
--- a/eric5.py Sun Oct 06 19:52:33 2013 +0200 +++ b/eric5.py Mon Oct 07 19:10:11 2013 +0200 @@ -28,7 +28,8 @@ # generate list of arguments to be remembered for a restart restartArgsList = ["--nosplash", "--plugin", "--debug", "--config"] -restartArgs = [arg for arg in sys.argv[1:] if arg.split("=", 1)[0] in restartArgsList] +restartArgs = [arg for arg in sys.argv[1:] + if arg.split("=", 1)[0] in restartArgsList] if "--debug" in sys.argv: del sys.argv[sys.argv.index("--debug")] @@ -43,8 +44,10 @@ break # make Third-Party package available as a packages repository -sys.path.insert(2, os.path.join(os.path.dirname(__file__), "ThirdParty", "Pygments")) -sys.path.insert(2, os.path.join(os.path.dirname(__file__), "ThirdParty", "Jasy")) +sys.path.insert(2, os.path.join(os.path.dirname(__file__), + "ThirdParty", "Pygments")) +sys.path.insert(2, os.path.join(os.path.dirname(__file__), + "ThirdParty", "Jasy")) from E5Gui.E5Application import E5Application @@ -99,7 +102,8 @@ BugAddress, logFile) timeString = time.strftime("%Y-%m-%d, %H:%M:%S") - versionInfo = "\n{0}\n{1}".format(separator, Utilities.generateVersionInfo()) + versionInfo = "\n{0}\n{1}".format( + separator, Utilities.generateVersionInfo()) pluginVersionInfo = Utilities.generatePluginsVersionInfo() if pluginVersionInfo: versionInfo += "{0}\n{1}".format(separator, pluginVersionInfo) @@ -160,14 +164,18 @@ "use the given directory as the one containing the config files"), ("--debug", "activate debugging output to the console"), ("--nosplash", "don't show the splash screen"), - ("--noopen", "don't open anything at startup except that given in command"), - ("--plugin=plugin-file", "load the given plugin file (plugin development)"), + ("--noopen", + "don't open anything at startup except that given in command"), + ("--plugin=plugin-file", + "load the given plugin file (plugin development)"), ("--start-file", "load the most recently opened file"), ("--start-multi", "load the most recently opened multi-project"), ("--start-project", "load the most recently opened project"), ("--start-session", "load the global session file"), - ("--", "indicate that there are options for the program to be debugged"), - ("", "(everything after that is considered arguments for this program)") + ("--", + "indicate that there are options for the program to be debugged"), + ("", + "(everything after that is considered arguments for this program)") ] appinfo = AppInfo.makeAppInfo(sys.argv, "Eric5", @@ -211,7 +219,8 @@ if Globals.isWindowsPlatform(): pyqtDataDir = Globals.getPyQt4ModulesDirectory() if os.path.exists(os.path.join(pyqtDataDir, "bin")): - path = os.path.join(pyqtDataDir, "bin") + os.pathsep + os.environ["PATH"] + path = os.path.join(pyqtDataDir, "bin") + \ + os.pathsep + os.environ["PATH"] else: path = pyqtDataDir + os.pathsep + os.environ["PATH"] os.environ["PATH"] = path @@ -248,9 +257,11 @@ # make Qt calls that need the E5Application to exist. from UI.UserInterface import UserInterface - splash.showMessage(QApplication.translate("eric5", "Generating Main Window...")) + splash.showMessage( + QApplication.translate("eric5", "Generating Main Window...")) try: - mainWindow = UserInterface(app, loc, splash, pluginFile, noopen, restartArgs) + mainWindow = UserInterface(app, loc, splash, pluginFile, noopen, + restartArgs) app.lastWindowClosed.connect(app.quit) mainWindow.show()
--- a/eric5_api.py Sun Oct 06 19:52:33 2013 +0200 +++ b/eric5_api.py Mon Oct 07 19:10:11 2013 +0200 @@ -33,7 +33,8 @@ """ print("eric5_api") print() - print("Copyright (c) 2004 - 2013 Detlev Offenbach <detlev@die-offenbachs.de>.") + print("Copyright (c) 2004 - 2013 Detlev Offenbach" + " <detlev@die-offenbachs.de>.") print() print("Usage:") print() @@ -57,13 +58,16 @@ print(" -l language or --language=language") print(" Generate an API file for the given programming language.") print(" Supported programming languages are:") - for lang in sorted(DocumentationTools.supportedExtensionsDictForApis.keys()): + for lang in sorted( + DocumentationTools.supportedExtensionsDictForApis.keys()): print(" * {0}".format(lang)) print(" The default is 'Python3'.") print(" This option may be repeated multiple times.") print(" -o filename or --output=filename") - print(" Write the API information to the named file. A '%L' placeholder") - print(" is replaced by the language of the API file (see --language).") + print(" Write the API information to the named file." + " A '%L' placeholder") + print(" is replaced by the language of the API file" + " (see --language).") print(" -p or --private") print(" Include private methods and functions.") print(" -R, -r or --recursive") @@ -111,7 +115,8 @@ usage() excludeDirs = ["CVS", ".svn", "_svn", ".ropeproject", "_ropeproject", - ".eric5project", "_eric5project", "dist", "build", "doc", "docs"] + ".eric5project", "_eric5project", "dist", "build", "doc", + "docs"] excludePatterns = [] outputFileName = "" recursive = False @@ -145,8 +150,9 @@ elif k in ["-l", "--language"]: if v not in progLanguages: if v not in \ - list(DocumentationTools.supportedExtensionsDictForApis.keys()): - sys.stderr.write("Wrong language given: {0}. Aborting\n".format(v)) + DocumentationTools.supportedExtensionsDictForApis: + sys.stderr.write( + "Wrong language given: {0}. Aborting\n".format(v)) sys.exit(1) else: progLanguages.append(v) @@ -183,17 +189,19 @@ outputFile = outputFileName else: root, ext = os.path.splitext(outputFileName) - outputFile = "{0}-{1}{2}".format(root, progLanguage.lower(), ext) + outputFile = "{0}-{1}{2}".format(root, progLanguage.lower(), + ext) basesFile = os.path.splitext(outputFile)[0] + '.bas' for arg in args: if os.path.isdir(arg): if os.path.exists(os.path.join(arg, - Utilities.joinext("__init__", ".py"))): + Utilities.joinext("__init__", ".py"))): basename = os.path.dirname(arg) if arg == '.': sys.stderr.write("The directory '.' is a package.\n") - sys.stderr.write("Please repeat the call giving its real name.\n") + sys.stderr.write( + "Please repeat the call giving its real name.\n") sys.stderr.write("Ignoring the directory.\n") continue else: @@ -214,10 +222,10 @@ if os.path.isdir(filename): files = [] for ext in supportedExtensions: - files.extend(glob.glob(os.path.join(filename, - Utilities.joinext("*", ext)))) - initFile = os.path.join(filename, - Utilities.joinext("__init__", ext)) + files.extend(glob.glob(os.path.join( + filename, Utilities.joinext("*", ext)))) + initFile = os.path.join( + filename, Utilities.joinext("__init__", ext)) if initFile in files: inpackage = True files.remove(initFile) @@ -226,7 +234,8 @@ # assume package inpackage = True else: - if Utilities.isWindowsPlatform() and glob.has_magic(filename): + if Utilities.isWindowsPlatform() and \ + glob.has_magic(filename): files = glob.glob(filename) else: files = [filename] @@ -244,7 +253,8 @@ module = Utilities.ModuleParser.readModule(file, basename=basename, inpackage=inpackage) apiGenerator = APIGenerator(module) - api = apiGenerator.genAPI(True, basePackage, includePrivate) + api = apiGenerator.genAPI(True, basePackage, + includePrivate) bases = apiGenerator.genBases(includePrivate) except IOError as v: sys.stderr.write("{0} error: {1}\n".format(file, v[1])) @@ -259,7 +269,8 @@ for basesEntry in bases: if bases[basesEntry]: basesDict[basesEntry] = bases[basesEntry][:] - sys.stdout.write("-- {0} -- {1} ok\n".format(progLanguage, file)) + sys.stdout.write("-- {0} -- {1} ok\n".format( + progLanguage, file)) outdir = os.path.dirname(outputFile) if outdir and not os.path.exists(outdir):
--- a/eric5_configure.py Sun Oct 06 19:52:33 2013 +0200 +++ b/eric5_configure.py Mon Oct 07 19:10:11 2013 +0200 @@ -22,7 +22,8 @@ break # make ThirdParty package available as a packages repository -sys.path.insert(2, os.path.join(os.path.dirname(__file__), "ThirdParty", "Pygments")) +sys.path.insert(2, os.path.join(os.path.dirname(__file__), + "ThirdParty", "Pygments")) from Globals import AppInfo
--- a/eric5_doc.py Sun Oct 06 19:52:33 2013 +0200 +++ b/eric5_doc.py Mon Oct 07 19:10:11 2013 +0200 @@ -38,7 +38,8 @@ """ print("eric5_doc") print() - print("Copyright (c) 2003 - 2013 Detlev Offenbach <detlev@die-offenbachs.de>.") + print("Copyright (c) 2003 - 2013 Detlev Offenbach" + " <detlev@die-offenbachs.de>.") print() print("Usage:") print() @@ -91,7 +92,8 @@ print(" --cfheader-color=color") print(" Specify the text color of class and function headers.") print(" --cfheader-background-color=color") - print(" Specify the text background color of class and function headers.") + print(" Specify the text background color of class and" + " function headers.") print(" --link-color=color") print(" Specify the text color of hyperlinks.") print() @@ -155,7 +157,8 @@ usage() excludeDirs = ["CVS", ".svn", "_svn", ".ropeproject", "_ropeproject", - ".eric5project", "_eric5project", "dist", "build", "doc", "docs"] + ".eric5project", "_eric5project", "dist", "build", "doc", + "docs"] excludePatterns = [] outputDir = "doc" recursive = False @@ -277,7 +280,8 @@ sf.close() except IOError: sys.stderr.write( - "The CSS stylesheet '{0}' does not exist\n".format(stylesheetFile)) + "The CSS stylesheet '{0}' does not exist\n".format( + stylesheetFile)) sys.stderr.write("Disabling CSS usage.\n") stylesheet = None else: @@ -300,17 +304,20 @@ qtHelpOutputDir = os.path.abspath(qtHelpOutputDir) qtHelpGenerator = QtHelpGenerator(outputDir, - qtHelpOutputDir, qtHelpNamespace, qtHelpFolder, - qtHelpFilterName, qtHelpFilterAttribs, - qtHelpTitle, qtHelpCreateCollection) + qtHelpOutputDir, qtHelpNamespace, + qtHelpFolder, qtHelpFilterName, + qtHelpFilterAttribs, qtHelpTitle, + qtHelpCreateCollection) for arg in args: if os.path.isdir(arg): - if os.path.exists(os.path.join(arg, Utilities.joinext("__init__", ".py"))): + if os.path.exists(os.path.join( + arg, Utilities.joinext("__init__", ".py"))): basename = os.path.dirname(arg) if arg == '.': sys.stderr.write("The directory '.' is a package.\n") - sys.stderr.write("Please repeat the call giving its real name.\n") + sys.stderr.write( + "Please repeat the call giving its real name.\n") sys.stderr.write("Ignoring the directory.\n") continue else: @@ -331,9 +338,10 @@ if os.path.isdir(filename): files = [] for ext in supportedExtensions: - files.extend(glob.glob(os.path.join(filename, - Utilities.joinext("*", ext)))) - initFile = os.path.join(filename, Utilities.joinext("__init__", ext)) + files.extend(glob.glob(os.path.join( + filename, Utilities.joinext("*", ext)))) + initFile = os.path.join( + filename, Utilities.joinext("__init__", ext)) if initFile in files: inpackage = True files.remove(initFile) @@ -354,8 +362,9 @@ continue try: - module = Utilities.ModuleParser.readModule(file, basename=basename, - inpackage=inpackage, extensions=supportedExtensions) + module = Utilities.ModuleParser.readModule( + file, basename=basename, + inpackage=inpackage, extensions=supportedExtensions) moduleDocument = ModuleDocument(module, colors, stylesheet) doc = moduleDocument.genDocument() except IOError as v: @@ -367,8 +376,8 @@ input = input + 1 - f = Utilities.joinext(os.path.join(outputDir, moduleDocument.name()), - ".html") + f = Utilities.joinext(os.path.join( + outputDir, moduleDocument.name()), ".html") # remember for index file generation indexGenerator.remember(file, moduleDocument, basename)
--- a/eric5_editor.py Sun Oct 06 19:52:33 2013 +0200 +++ b/eric5_editor.py Mon Oct 07 19:10:11 2013 +0200 @@ -24,7 +24,8 @@ break # make ThirdParty package available as a packages repository -sys.path.insert(2, os.path.join(os.path.dirname(__file__), "ThirdParty", "Pygments")) +sys.path.insert(2, os.path.join(os.path.dirname(__file__), + "ThirdParty", "Pygments")) from Globals import AppInfo
--- a/eric5_plugininstall.py Sun Oct 06 19:52:33 2013 +0200 +++ b/eric5_plugininstall.py Mon Oct 07 19:10:11 2013 +0200 @@ -7,7 +7,8 @@ """ Eric5 Plugin Installer. -This is the main Python script to install eric5 plugins from outside of the IDE. +This is the main Python script to install eric5 plugins from outside of the +IDE. """ import sys
--- a/eric5_pluginrepository.py Sun Oct 06 19:52:33 2013 +0200 +++ b/eric5_pluginrepository.py Mon Oct 07 19:10:11 2013 +0200 @@ -7,7 +7,8 @@ """ Eric5 Plugin Installer. -This is the main Python script to install eric5 plugins from outside of the IDE. +This is the main Python script to install eric5 plugins from outside of the +IDE. """ import sys
--- a/eric5_pluginuninstall.py Sun Oct 06 19:52:33 2013 +0200 +++ b/eric5_pluginuninstall.py Mon Oct 07 19:10:11 2013 +0200 @@ -7,7 +7,8 @@ """ Eric5 Plugin Uninstaller. -This is the main Python script to uninstall eric5 plugins from outside of the IDE. +This is the main Python script to uninstall eric5 plugins from outside of the +IDE. """ import sys
--- a/eric5_qregularexpression.py Sun Oct 06 19:52:33 2013 +0200 +++ b/eric5_qregularexpression.py Mon Oct 07 19:10:11 2013 +0200 @@ -8,8 +8,8 @@ Eric5 QRegularExpression. This is the main Python script that performs the necessary initialization -of the QRegularExpression wizard module and starts the Qt event loop. This is a standalone -version of the integrated QRegularExpression wizard. +of the QRegularExpression wizard module and starts the Qt event loop. This is +a standalone version of the integrated QRegularExpression wizard. """ import sys @@ -34,8 +34,8 @@ @param argv list of commandline parameters (list of strings) @return reference to the main widget (QWidget) """ - from Plugins.WizardPlugins.QRegularExpressionWizard.QRegularExpressionWizardDialog \ - import QRegularExpressionWizardWindow + from Plugins.WizardPlugins.QRegularExpressionWizard\ + .QRegularExpressionWizardDialog import QRegularExpressionWizardWindow return QRegularExpressionWizardWindow() @@ -47,11 +47,12 @@ ("--config=configDir", "use the given directory as the one containing the config files"), ] - appinfo = AppInfo.makeAppInfo(sys.argv, - "Eric5 QRegularExpression", - "", - "Regexp editor for Qt's QRegularExpression class", - options) + appinfo = AppInfo.makeAppInfo( + sys.argv, + "Eric5 QRegularExpression", + "", + "Regexp editor for Qt's QRegularExpression class", + options) res = Startup.simpleAppStartup(sys.argv, appinfo, createMainWidget)
--- a/eric5_re.py Sun Oct 06 19:52:33 2013 +0200 +++ b/eric5_re.py Mon Oct 07 19:10:11 2013 +0200 @@ -8,8 +8,8 @@ Eric5 Re. This is the main Python script that performs the necessary initialization -of the PyRegExp wizard module and starts the Qt event loop. This is a standalone -version of the integrated PyRegExp wizard. +of the PyRegExp wizard module and starts the Qt event loop. This is a +standalone version of the integrated PyRegExp wizard. """ import sys
--- a/eric5_snap.py Sun Oct 06 19:52:33 2013 +0200 +++ b/eric5_snap.py Mon Oct 07 19:10:11 2013 +0200 @@ -45,11 +45,12 @@ ("--config=configDir", "use the given directory as the one containing the config files"), ] - appinfo = AppInfo.makeAppInfo(sys.argv, - "Eric5 Snap", - "", - "Simple utility to do snapshots of the screen.", - options) + appinfo = AppInfo.makeAppInfo( + sys.argv, + "Eric5 Snap", + "", + "Simple utility to do snapshots of the screen.", + options) res = Startup.simpleAppStartup(sys.argv, appinfo, createMainWidget)
--- a/eric5_webbrowser.py Sun Oct 06 19:52:33 2013 +0200 +++ b/eric5_webbrowser.py Mon Oct 07 19:10:11 2013 +0200 @@ -24,7 +24,8 @@ break # make ThirdParty package available as a packages repository -sys.path.insert(2, os.path.join(os.path.dirname(__file__), "ThirdParty", "Pygments")) +sys.path.insert(2, os.path.join(os.path.dirname(__file__), + "ThirdParty", "Pygments")) import Globals from Globals import AppInfo
--- a/install-i18n.py Sun Oct 06 19:52:33 2013 +0200 +++ b/install-i18n.py Mon Oct 07 19:10:11 2013 +0200 @@ -62,7 +62,8 @@ print(" {0} [-hp]".format(progName)) print("where:") print(" -h display this help message") - print(" -p install into the private area ({0})".format(configDir)) + print(" -p install into the private area ({0})".format( + configDir)) sys.exit(rcode) @@ -123,7 +124,8 @@ except SystemExit: raise except: - print("""An internal error occured. Please report all the output of the program, + print( +"""An internal error occured. Please report all the output of the program, including the following traceback, to eric5-bugs@eric-ide.python-projects.org. """) raise
--- a/install.py Sun Oct 06 19:52:33 2013 +0200 +++ b/install.py Mon Oct 07 19:10:11 2013 +0200 @@ -35,7 +35,8 @@ configName = 'eric5config.py' defaultMacAppBundleName = "eric5.app" macAppBundleName = "eric5.app" -macPythonExe = "{0}/Resources/Python.app/Contents/MacOS/Python".format(sys.exec_prefix) +macPythonExe = "{0}/Resources/Python.app/Contents/MacOS/Python".format( + sys.exec_prefix) # Define blacklisted versions of the prerequisites BlackLists = { @@ -93,8 +94,8 @@ print() print("Usage:") if sys.platform == "darwin": - print(" {0} [-chxz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir] [-m name] [-p python]"\ - .format(progName)) + print(" {0} [-chxz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]" + " [-m name] [-p python]".format(progName)) elif sys.platform.startswith("win"): print(" {0} [-chxz] [-a dir] [-b dir] [-d dir] [-f file]"\ .format(progName)) @@ -112,7 +113,8 @@ print(" (default: {0})".format(platBinDir)) print(" -d dir where eric5 python files will be installed") print(" (default: {0})".format(modDir)) - print(" -f file configuration file naming the various installation paths") + print(" -f file configuration file naming the various installation" + " paths") if not sys.platform.startswith("win"): print(" -i dir temporary install prefix") print(" (default: {0})".format(distDir)) @@ -121,17 +123,21 @@ print(" (default: {0})".format(macAppBundleName)) print(" -p python name of the python executable") print(" (default: {0})".format(macPythonExe)) - print(" -x don't perform dependency checks (use on your own risk)") + print(" -x don't perform dependency checks (use on your own" + " risk)") print(" -c don't cleanup old installation first") print(" -z don't compile the installed python files") print() - print("The file given to the -f option must be valid Python code defining a") - print("dictionary called 'cfg' with the keys 'ericDir', 'ericPixDir', 'ericIconDir',") - print("'ericDTDDir', 'ericCSSDir', 'ericStylesDir', 'ericDocDir', 'ericExamplesDir',") + print("The file given to the -f option must be valid Python code" + " defining a") + print("dictionary called 'cfg' with the keys 'ericDir', 'ericPixDir'," + " 'ericIconDir',") + print("'ericDTDDir', 'ericCSSDir', 'ericStylesDir', 'ericDocDir'," + " 'ericExamplesDir',") print("'ericTranslationsDir', 'ericTemplatesDir', 'ericCodeTemplatesDir',") print("'ericOthersDir','bindir', 'mdir' and 'apidir.") - print("These define the directories for the installation of the various parts of"\ - " eric5.") + print("These define the directories for the installation of the various" + " parts of eric5.") exit(rcode) @@ -216,7 +222,8 @@ '''@echo off\n''' \ '''start "" "{2}\\pythonw.exe"''' \ ''' "{0}\\{1}.pyw"''' \ - ''' %1 %2 %3 %4 %5 %6 %7 %8 %9\n'''.format(pydir, wfile, sys.exec_prefix) + ''' %1 %2 %3 %4 %5 %6 %7 %8 %9\n'''.format( + pydir, wfile, sys.exec_prefix) else: wrapper = \ '''@"{0}\\python" "{1}\\{2}.py"''' \ @@ -259,12 +266,14 @@ @param dst name of the destination directory @param filters list of filter pattern determining the files to be copied @param excludeDirs list of (sub)directories to exclude from copying - @keyparam excludePatterns list of filter pattern determining the files to be skipped + @keyparam excludePatterns list of filter pattern determining the files to + be skipped """ try: names = os.listdir(src) except OSError: - return # ignore missing directories (most probably the i18n directory) + # ignore missing directories (most probably the i18n directory) + return for name in names: skipIt = False @@ -284,7 +293,8 @@ break else: if os.path.isdir(srcname) and not srcname in excludeDirs: - copyTree(srcname, dstname, filters, excludePatterns=excludePatterns) + copyTree(srcname, dstname, filters, + excludePatterns=excludePatterns) def createGlobalPluginsDir(): @@ -379,7 +389,8 @@ # Cleanup the install directories for name in ['ericExamplesDir', 'ericDocDir', 'ericDTDDir', 'ericCSSDir', 'ericIconDir', 'ericPixDir', 'ericTemplatesDir', - 'ericCodeTemplatesDir', 'ericOthersDir', 'ericStylesDir', 'ericDir']: + 'ericCodeTemplatesDir', 'ericOthersDir', 'ericStylesDir', + 'ericDir']: if os.path.exists(getConfig(name)): shutil.rmtree(getConfig(name), True) @@ -411,7 +422,8 @@ shutil.rmtree("/Applications/" + macAppBundleName) except (IOError, OSError) as msg: - sys.stderr.write('Error: {0}\nTry install with admin rights.\n'.format(msg)) + sys.stderr.write( + 'Error: {0}\nTry install with admin rights.\n'.format(msg)) exit(7) @@ -492,15 +504,18 @@ copyTree('{1}{0}Plugins'.format(os.sep, sourceDir), '{0}{1}Plugins'.format(cfg['ericDir'], os.sep), ['*.png', '*.style']) - copyTree('{1}{0}Documentation'.format(os.sep, sourceDir), cfg['ericDocDir'], + copyTree( + '{1}{0}Documentation'.format(os.sep, sourceDir), cfg['ericDocDir'], ['*.html', '*.qch']) copyTree('{1}{0}DTDs'.format(os.sep, sourceDir), cfg['ericDTDDir'], ['*.dtd']) copyTree('{1}{0}CSSs'.format(os.sep, sourceDir), cfg['ericCSSDir'], ['*.css']) - copyTree('{1}{0}Styles'.format(os.sep, sourceDir), cfg['ericStylesDir'], + copyTree( + '{1}{0}Styles'.format(os.sep, sourceDir), cfg['ericStylesDir'], ['*.qss']) - copyTree('{1}{0}i18n'.format(os.sep, sourceDir), cfg['ericTranslationsDir'], + copyTree( + '{1}{0}i18n'.format(os.sep, sourceDir), cfg['ericTranslationsDir'], ['*.qm']) copyTree('{1}{0}icons'.format(os.sep, sourceDir), cfg['ericIconDir'], ['*.png', 'LICENSE*.*', 'readme.txt']) @@ -512,7 +527,8 @@ copyTree('{1}{0}CodeTemplates'.format(os.sep, sourceDir), cfg['ericCodeTemplatesDir'], ['*.tmpl']) - copyTree('{1}{0}Examples'.format(os.sep, sourceDir), cfg['ericExamplesDir'], + copyTree( + '{1}{0}Examples'.format(os.sep, sourceDir), cfg['ericExamplesDir'], ['*.py', '*.pyc', '*.pyo']) # copy the wrappers @@ -521,21 +537,25 @@ os.remove(wname) # copy the license file - shutilCopy('{1}{0}LICENSE.GPL3'.format(os.sep, sourceDir), cfg['ericDir']) + shutilCopy( + '{1}{0}LICENSE.GPL3'.format(os.sep, sourceDir), cfg['ericDir']) # create the global plugins directory createGlobalPluginsDir() except (IOError, OSError) as msg: - sys.stderr.write('Error: {0}\nTry install with admin rights.\n'.format(msg)) + sys.stderr.write( + 'Error: {0}\nTry install with admin rights.\n'.format(msg)) return(7) # copy some text files to the doc area for name in ["LICENSE.GPL3", "THANKS", "changelog"]: try: - shutilCopy('{2}{0}{1}'.format(os.sep, name, sourceDir), cfg['ericDocDir']) + shutilCopy( + '{2}{0}{1}'.format(os.sep, name, sourceDir), cfg['ericDocDir']) except EnvironmentError: - print("Could not install '{2}{0}{1}'.".format(os.sep, name, sourceDir)) + print("Could not install '{2}{0}{1}'.".format( + os.sep, name, sourceDir)) for name in glob.glob(os.path.join(sourceDir, 'README*.*')): try: shutilCopy(name, cfg['ericDocDir']) @@ -545,33 +565,40 @@ # copy some more stuff for name in ['default.e4k', 'default_Mac.e4k']: try: - shutilCopy('{2}{0}{1}'.format(os.sep, name, sourceDir), cfg['ericOthersDir']) + shutilCopy( + '{2}{0}{1}'.format(os.sep, name, sourceDir), + cfg['ericOthersDir']) except EnvironmentError: - print("Could not install '{2}{0}{1}'.".format(os.sep, name, sourceDir)) + print("Could not install '{2}{0}{1}'.".format( + os.sep, name, sourceDir)) # install the API file for progLanguage in progLanguages: apidir = os.path.join(cfg['apidir'], progLanguage.lower()) if not os.path.exists(apidir): os.makedirs(apidir) - for apiName in glob.glob(os.path.join(sourceDir, "APIs", progLanguage, "*.api")): + for apiName in glob.glob(os.path.join(sourceDir, "APIs", + progLanguage, "*.api")): try: shutilCopy(apiName, apidir) except EnvironmentError: print("Could not install '{0}'.".format(apiName)) - for apiName in glob.glob(os.path.join(sourceDir, "APIs", progLanguage, "*.bas")): + for apiName in glob.glob(os.path.join(sourceDir, "APIs", + progLanguage, "*.bas")): try: shutilCopy(apiName, apidir) except EnvironmentError: print("Could not install '{0}'.".format(apiName)) if progLanguage == "Python": # copy Python3 API files to the same destination - for apiName in glob.glob(os.path.join(sourceDir, "APIs", "Python3", "*.api")): + for apiName in glob.glob(os.path.join(sourceDir, "APIs", + "Python3", "*.api")): try: shutilCopy(apiName, apidir) except EnvironmentError: print("Could not install '{0}'.".format(apiName)) - for apiName in glob.glob(os.path.join(sourceDir, "APIs", "Python3", "*.bas")): + for apiName in glob.glob(os.path.join(sourceDir, "APIs", + "Python3", "*.bas")): try: shutilCopy(apiName, apidir) except EnvironmentError: @@ -585,7 +612,8 @@ os.makedirs(dst) shutilCopy(os.path.join(sourceDir, "icons", "default", "eric.png"), os.path.join(dst, "eric.png")) - dst = os.path.normpath(os.path.join(distDir, "usr/share/applications")) + dst = os.path.normpath( + os.path.join(distDir, "usr/share/applications")) if not os.path.exists(dst): os.makedirs(dst) shutilCopy(os.path.join(sourceDir, "eric5.desktop"), dst) @@ -594,7 +622,8 @@ "/usr/share/pixmaps/eric.png") shutilCopy(os.path.join(sourceDir, "eric5.desktop"), "/usr/share/applications") - shutilCopy(os.path.join(sourceDir, "icons", "default", "ericWeb48.png"), + shutilCopy( + os.path.join(sourceDir, "icons", "default", "ericWeb48.png"), "/usr/share/pixmaps/ericWeb.png") shutilCopy(os.path.join(sourceDir, "eric5_webbrowser.desktop"), "/usr/share/applications") @@ -610,14 +639,15 @@ """ Create a Mac application bundle. - @param pydir the name of the directory where the Python script will eventually - be installed (string) + @param pydir the name of the directory where the Python script will + eventually be installed (string) """ global cfg, sourceDir, macAppBundleName, macPythonExe dirs = {"contents": "/Applications/{0}/Contents/".format(macAppBundleName), "exe": "/Applications/{0}/Contents/MacOS".format(macAppBundleName), - "icns": "/Applications/{0}/Contents/Resources".format(macAppBundleName)} + "icns": "/Applications/{0}/Contents/Resources".format( + macAppBundleName)} os.makedirs(dirs["contents"]) os.mkdir(dirs["exe"]) os.mkdir(dirs["icns"]) @@ -720,11 +750,13 @@ apis = [] for progLanguage in progLanguages: - for apiName in glob.glob(os.path.join(sourceDir, "APIs", progLanguage, "*.api")): + for apiName in glob.glob( + os.path.join(sourceDir, "APIs", progLanguage, "*.api")): apis.append(os.path.basename(apiName)) if progLanguage == "Python": # treat Python3 API files the same as Python API files - for apiName in glob.glob(os.path.join(sourceDir, "APIs", "Python3", "*.api")): + for apiName in glob.glob( + os.path.join(sourceDir, "APIs", "Python3", "*.api")): apis.append(os.path.basename(apiName)) fn = 'eric5config.py' @@ -764,7 +796,8 @@ except KeyError: pass - raise AttributeError('"{{0}}" is not a valid configuration value'.format(name)) + raise AttributeError('"{{0}}" is not a valid configuration value'.format( + name)) """.format(cfg['ericDir'], cfg['ericPixDir'], cfg['ericIconDir'], cfg['ericDTDDir'], cfg['ericCSSDir'], cfg['ericStylesDir'], cfg['ericDocDir'], @@ -856,8 +889,9 @@ # check for blacklisted versions for vers in BlackLists["sip"] + PlatformBlackLists["sip"]: if vers == sipVersion: - print('Sorry, sip version {0} is not compatible with eric5.'\ - .format(vers)) + print( + 'Sorry, sip version {0} is not compatible with eric5.' + .format(vers)) print('Please install another version.') exit(3) except ImportError: @@ -903,10 +937,12 @@ ' a recent snapshot release.') exit(5) # check for blacklisted versions - for vers in BlackLists["QScintilla2"] + PlatformBlackLists["QScintilla2"]: + for vers in BlackLists["QScintilla2"] + \ + PlatformBlackLists["QScintilla2"]: if vers == scintillaVersion: - print('Sorry, QScintilla2 version {0} is not compatible with eric5.'\ - .format(vers)) + print( + 'Sorry, QScintilla2 version {0} is not compatible with' + ' eric5.'.format(vers)) print('Please install another version.') exit(5) print("QScintilla Version: ", QSCINTILLA_VERSION_STR) @@ -930,19 +966,22 @@ Creates Python modules from Qt Designer .ui files in a directory or directory tree. - Note: This function is a modified version of the one found in PyQt4. + Note: This function is a modified version of the one found in + PyQt4. - @param dir Name of the directory to scan for files whose name ends with - '.ui'. By default the generated Python module is created in the same - directory ending with '.py'. - @param recurse flag indicating that any sub-directories should be scanned. - @param map an optional callable that is passed the name of the directory - containing the '.ui' file and the name of the Python module that will be - created. The callable should return a tuple of the name of the directory - in which the Python module will be created and the (possibly modified) - name of the module. - @param compileUi_args any additional keyword arguments that are passed to - the compileUi() function that is called to create each Python module. + @param dir Name of the directory to scan for files whose name ends + with '.ui'. By default the generated Python module is created + in the same directory ending with '.py'. + @param recurse flag indicating that any sub-directories should be + scanned. + @param map an optional callable that is passed the name of the + directory containing the '.ui' file and the name of the Python + module that will be created. The callable should return a + tuple of the name of the directory in which the Python module + will be created and the (possibly modified) name of the module. + @param compileUi_args any additional keyword arguments that are + passed to the compileUi() function that is called to create + each Python module. """ def compile_ui(ui_dir, ui_file): """ @@ -956,8 +995,8 @@ py_dir = ui_dir py_file = ui_file[:-3] + '.py' - # Allow the caller to change the name of the .py file or generate - # it in a different directory. + # Allow the caller to change the name of the .py file or + # generate it in a different directory. if map is not None: py_dir, py_file = list(map(py_dir, py_file)) @@ -990,7 +1029,8 @@ def pyName(py_dir, py_file): """ - Local function to create the Python source file name for the compiled .ui file. + Local function to create the Python source file name for the compiled + .ui file. @param py_dir suggested name of the directory (string) @param py_file suggested name for the compile source file (string) @@ -1121,14 +1161,17 @@ if distDir: compileall.compile_dir(sourceDir, ddir=os.path.join(distDir, modDir, cfg['ericDir']), - rx=re.compile(r"DebugClients[\\/]Python[\\/]|UtilitiesPython2[\\/]"), + rx=re.compile( + r"DebugClients[\\/]Python[\\/]|UtilitiesPython2[\\/]"), quiet=True) - py_compile.compile(configName, - dfile=os.path.join(distDir, modDir, "eric5config.py")) + py_compile.compile( + configName, + dfile=os.path.join(distDir, modDir, "eric5config.py")) else: compileall.compile_dir(sourceDir, ddir=os.path.join(modDir, cfg['ericDir']), - rx=re.compile(r"DebugClients[\\/]Python[\\/]|UtilitiesPython2[\\/]"), + rx=re.compile( + r"DebugClients[\\/]Python[\\/]|UtilitiesPython2[\\/]"), quiet=True) py_compile.compile(configName, dfile=os.path.join(modDir, "eric5config.py"))
--- a/patch_modpython.py Sun Oct 06 19:52:33 2013 +0200 +++ b/patch_modpython.py Mon Oct 07 19:10:11 2013 +0200 @@ -31,10 +31,11 @@ print(" {0} [-h] [-d dir]".format(progName)) print("where:") print(" -h display this help message") - print(" -d dir where Mod_python files are installed [default {0}]".format( - modDir)) + print(" -d dir where Mod_python files are installed" + " [default {0}]".format(modDir)) print() - print("This script patches the file apache.py of the Mod_python distribution") + print("This script patches the file apache.py of the Mod_python" + " distribution") print("so that it will work with the eric5 debugger instead of pdb.") print("Please see mod_python.html for more details.") print() @@ -49,7 +50,8 @@ """ global modDir - modDir = os.path.join(distutils.sysconfig.get_python_lib(True), "mod_python") + modDir = os.path.join(distutils.sysconfig.get_python_lib(True), + "mod_python") def main(argv): @@ -106,7 +108,8 @@ s.write("\n") s.write('def initDebugger(name):\n') s.write(' """\n') - s.write(' Initialize the debugger and set the script name to be reported \n') + s.write(' Initialize the debugger and set the script name to be' + ' reported \n') s.write(' by the debugger. This is a patch for eric5.\n') s.write(' """\n') s.write(' if not pdb.initDebugger("standard"):\n') @@ -154,7 +157,8 @@ except SystemExit: raise except: - print("""An internal error occured. Please report all the output of the program, + print( +"""An internal error occured. Please report all the output of the program, including the following traceback, to eric-bugs@die-offenbachs.de. """) raise
--- a/uninstall.py Sun Oct 06 19:52:33 2013 +0200 +++ b/uninstall.py Mon Oct 07 19:10:11 2013 +0200 @@ -130,14 +130,16 @@ # Cleanup the install directories for name in ['ericExamplesDir', 'ericDocDir', 'ericDTDDir', 'ericCSSDir', - 'ericIconDir', 'ericPixDir', 'ericTemplatesDir', 'ericCodeTemplatesDir', - 'ericOthersDir', 'ericStylesDir', 'ericDir']: + 'ericIconDir', 'ericPixDir', 'ericTemplatesDir', + 'ericCodeTemplatesDir', 'ericOthersDir', 'ericStylesDir', + 'ericDir']: dirpath = getConfig(name) if os.path.exists(dirpath): shutil.rmtree(dirpath, True) # Cleanup translations - for name in glob.glob(os.path.join(getConfig('ericTranslationsDir'), 'eric5_*.qm')): + for name in glob.glob( + os.path.join(getConfig('ericTranslationsDir'), 'eric5_*.qm')): if os.path.exists(name): os.remove(name) @@ -148,7 +150,8 @@ apiname = os.path.join(apidir, progLanguage.lower(), name) if os.path.exists(apiname): os.remove(apiname) - for apiname in glob.glob(os.path.join(apidir, progLanguage.lower(), "*.bas")): + for apiname in glob.glob( + os.path.join(apidir, progLanguage.lower(), "*.bas")): os.remove(apiname) if sys.platform == "darwin": @@ -187,9 +190,11 @@ try: uninstallEric() except IOError as msg: - sys.stderr.write('IOError: {0}\nTry uninstall with admin rights.\n'.format(msg)) + sys.stderr.write( + 'IOError: {0}\nTry uninstall with admin rights.\n'.format(msg)) except OSError as msg: - sys.stderr.write('OSError: {0}\nTry uninstall with admin rights.\n'.format(msg)) + sys.stderr.write( + 'OSError: {0}\nTry uninstall with admin rights.\n'.format(msg)) exit(0) @@ -200,7 +205,8 @@ except SystemExit: raise except: - print("""An internal error occured. Please report all the output of the program, + print( +"""An internal error occured. Please report all the output of the program, including the following traceback, to eric5-bugs@eric-ide.python-projects.org. """) raise