Sun, 06 Oct 2013 17:27:53 +0200
Started to shorten the code lines to max. 79 characters.
--- a/Cooperation/ChatWidget.py Fri Oct 04 17:48:17 2013 +0200 +++ b/Cooperation/ChatWidget.py Sun Oct 06 17:27:53 2013 +0200 @@ -30,8 +30,8 @@ @signal connected(connected) emitted to signal a change of the connected state (bool) - @signal editorCommand(hash, filename, message) emitted when an editor command - has been received (string, string, string) + @signal editorCommand(hash, filename, message) emitted when an editor + command has been received (string, string, string) @signal shareEditor(share) emitted to signal a share is requested (bool) @signal startEdit() emitted to start a shared edit session @signal sendEdit() emitted to send a shared edit session @@ -148,7 +148,8 @@ if text.startswith("/"): self.__showErrorMessage( - self.trUtf8("! Unknown command: {0}\n").format(text.split()[0])) + self.trUtf8("! Unknown command: {0}\n") + .format(text.split()[0])) else: self.__client.sendMessage(text) self.appendMessage(self.__myNickName, text) @@ -167,7 +168,8 @@ color = self.chatEdit.textColor() self.chatEdit.setTextColor(Qt.gray) self.chatEdit.append( - QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + ":") + QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + + ":") self.chatEdit.append(self.trUtf8("* {0} has joined.\n").format(nick)) self.chatEdit.setTextColor(color) @@ -180,9 +182,10 @@ self.__setConnected(True) if not self.isVisible(): - self.__ui.showNotification(UI.PixmapCache.getPixmap("cooperation48.png"), - self.trUtf8("New User"), self.trUtf8("{0} has joined.").format(nick)) - + self.__ui.showNotification( + UI.PixmapCache.getPixmap("cooperation48.png"), + self.trUtf8("New User"), self.trUtf8("{0} has joined.") + .format(nick)) def __participantLeft(self, nick): """ Private slot handling a participant leaving the session. @@ -200,7 +203,8 @@ color = self.chatEdit.textColor() self.chatEdit.setTextColor(Qt.gray) self.chatEdit.append( - QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + ":") + QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + + ":") self.chatEdit.append(self.trUtf8("* {0} has left.\n").format(nick)) self.chatEdit.setTextColor(color) @@ -208,8 +212,10 @@ self.__setConnected(False) if not self.isVisible(): - self.__ui.showNotification(UI.PixmapCache.getPixmap("cooperation48.png"), - self.trUtf8("User Left"), self.trUtf8("{0} has left.").format(nick)) + self.__ui.showNotification( + UI.PixmapCache.getPixmap("cooperation48.png"), + self.trUtf8("User Left"), self.trUtf8("{0} has left.") + .format(nick)) def appendMessage(self, from_, message): """ @@ -229,7 +235,8 @@ bar.setValue(bar.maximum()) if not self.isVisible(): - self.__ui.showNotification(UI.PixmapCache.getPixmap("cooperation48.png"), + self.__ui.showNotification( + UI.PixmapCache.getPixmap("cooperation48.png"), self.trUtf8("Message from <{0}>").format(from_), message) @pyqtSlot(str) @@ -295,11 +302,14 @@ self.__client.close() self.serverButton.setText(self.trUtf8("Start Server")) self.serverPortSpin.setEnabled(True) - if self.serverPortSpin.value() != Preferences.getCooperation("ServerPort"): - self.serverPortSpin.setValue(Preferences.getCooperation("ServerPort")) + if (self.serverPortSpin.value() != + Preferences.getCooperation("ServerPort")): + self.serverPortSpin.setValue( + Preferences.getCooperation("ServerPort")) self.serverLed.setColor(QColor(Qt.red)) else: - res, port = self.__client.startListening(self.serverPortSpin.value()) + res, port = self.__client.startListening( + self.serverPortSpin.value()) if res: self.serverButton.setText(self.trUtf8("Stop Server")) self.serverPortSpin.setValue(port) @@ -348,7 +358,8 @@ color = self.chatEdit.textColor() self.chatEdit.setTextColor(Qt.red) self.chatEdit.append( - QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + ":") + QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + + ":") self.chatEdit.append(message + "\n") self.chatEdit.setTextColor(color) @@ -363,7 +374,8 @@ Public slot to handle a change of preferences. """ if not self.__client.isListening(): - self.serverPortSpin.setValue(Preferences.getCooperation("ServerPort")) + self.serverPortSpin.setValue( + Preferences.getCooperation("ServerPort")) if Preferences.getCooperation("AutoStartServer"): self.on_serverButton_clicked() @@ -469,7 +481,8 @@ self.startEditButton.setChecked(editing) self.shareButton.setEnabled(shareable and not editing) - self.startEditButton.setEnabled(sharing and not editing and not remoteEditing) + self.startEditButton.setEnabled( + sharing and not editing and not remoteEditing) self.sendEditButton.setEnabled(editing) self.cancelEditButton.setEnabled(editing) @@ -568,9 +581,10 @@ except IOError as err: E5MessageBox.critical(self, self.trUtf8("Error saving Chat"), - self.trUtf8("""<p>The chat contents could not be written""" - """ to <b>{0}</b></p><p>Reason: {1}</p>""")\ - .format(fname, str(err))) + self.trUtf8("""<p>The chat contents could not be""" + """ written to <b>{0}</b></p>""" + """<p>Reason: {1}</p>""") .format( + fname, str(err))) def __copyChat(self): """ @@ -638,7 +652,8 @@ color = self.chatEdit.textColor() self.chatEdit.setTextColor(Qt.darkYellow) self.chatEdit.append( - QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + ":") + QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + + ":") self.chatEdit.append(self.trUtf8("* {0} has been kicked.\n").format( itm.text().split("@")[0])) self.chatEdit.setTextColor(color) @@ -653,7 +668,8 @@ color = self.chatEdit.textColor() self.chatEdit.setTextColor(Qt.darkYellow) self.chatEdit.append( - QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + ":") + QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + + ":") self.chatEdit.append(self.trUtf8("* {0} has been banned.\n").format( itm.text().split("@")[0])) self.chatEdit.setTextColor(color) @@ -668,9 +684,11 @@ color = self.chatEdit.textColor() self.chatEdit.setTextColor(Qt.darkYellow) self.chatEdit.append( - QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + ":") - self.chatEdit.append(self.trUtf8("* {0} has been banned and kicked.\n").format( - itm.text().split("@")[0])) + QDateTime.currentDateTime().toString(Qt.SystemLocaleLongDate) + + ":") + self.chatEdit.append( + self.trUtf8("* {0} has been banned and kicked.\n") + .format( itm.text().split("@")[0])) self.chatEdit.setTextColor(color) def shutdown(self):
--- a/Cooperation/Connection.py Fri Oct 04 17:48:17 2013 +0200 +++ b/Cooperation/Connection.py Sun Oct 06 17:27:53 2013 +0200 @@ -28,10 +28,11 @@ @signal readyForUse() emitted when the connection is ready for use @signal newMessage(user, message) emitted after a new message has - arrived (string, string) - @signal getParticipants() emitted after a get participants message has arrived - @signal participants(participants) emitted after the list of participants has - arrived (list of strings of "host:port") + arrived (string, string) + @signal getParticipants() emitted after a get participants message has + arrived + @signal participants(participants) emitted after the list of participants + has arrived (list of strings of "host:port") """ WaitingForGreeting = 0 ReadingGreeting = 1 @@ -163,13 +164,15 @@ if not self.__hasEnoughData(): return - self.__buffer = QByteArray(self.read(self.__numBytesForCurrentDataType)) + self.__buffer = QByteArray( + self.read(self.__numBytesForCurrentDataType)) if self.__buffer.size() != self.__numBytesForCurrentDataType: self.abort() return try: - user, serverPort = str(self.__buffer, encoding="utf-8").split(":") + user, serverPort = \ + str(self.__buffer, encoding="utf-8").split(":") except ValueError: self.abort() return @@ -195,9 +198,9 @@ ) Preferences.syncPreferences() if bannedName in Preferences.getCooperation("BannedUsers"): - self.rejected.emit( - self.trUtf8("* Connection attempted by banned user '{0}'.")\ - .format(bannedName)) + self.rejected.emit(self.trUtf8( + "* Connection attempted by banned user '{0}'.") + .format(bannedName)) self.abort() return @@ -218,7 +221,8 @@ if self.__client is not None: chatWidget = self.__client.chatWidget() if chatWidget is not None and not chatWidget.isVisible(): - e5App().getObject("UserInterface").activateCooperationViewer() + e5App().getObject( + "UserInterface").activateCooperationViewer() if not self.__isGreetingMessageSent: self.__sendGreetingMessage() @@ -246,7 +250,8 @@ self.abort() return - self.write("{0}{1}1{1}p".format(Connection.ProtocolPing, SeparatorToken)) + self.write("{0}{1}1{1}p".format( + Connection.ProtocolPing, SeparatorToken)) def __sendGreetingMessage(self): """ @@ -254,7 +259,8 @@ """ greeting = QByteArray(self.__greetingMessage.encode("utf-8")) data = QByteArray("{0}{1}{2}{1}".format( - Connection.ProtocolGreeting, SeparatorToken, greeting.size())) + greeting + Connection.ProtocolGreeting, SeparatorToken, greeting.size())) + \ + greeting if self.write(data) == data.size(): self.__isGreetingMessageSent = True @@ -331,7 +337,8 @@ return False self.__buffer.clear() - self.__numBytesForCurrentDataType = self.__dataLengthForCurrentDataType() + self.__numBytesForCurrentDataType = \ + self.__dataLengthForCurrentDataType() return True def __hasEnoughData(self): @@ -345,7 +352,8 @@ self.__transferTimerId = 0 if self.__numBytesForCurrentDataType <= 0: - self.__numBytesForCurrentDataType = self.__dataLengthForCurrentDataType() + self.__numBytesForCurrentDataType = \ + self.__dataLengthForCurrentDataType() if self.bytesAvailable() < self.__numBytesForCurrentDataType or \ self.__numBytesForCurrentDataType <= 0: @@ -358,15 +366,18 @@ """ Private method to process the received data. """ - self.__buffer = QByteArray(self.read(self.__numBytesForCurrentDataType)) + self.__buffer = QByteArray( + self.read(self.__numBytesForCurrentDataType)) if self.__buffer.size() != self.__numBytesForCurrentDataType: self.abort() return if self.__currentDataType == Connection.PlainText: - self.newMessage.emit(self.__username, str(self.__buffer, encoding="utf-8")) + self.newMessage.emit( + self.__username, str(self.__buffer, encoding="utf-8")) elif self.__currentDataType == Connection.Ping: - self.write("{0}{1}1{1}p".format(Connection.ProtocolPong, SeparatorToken)) + self.write("{0}{1}1{1}p".format( + Connection.ProtocolPong, SeparatorToken)) elif self.__currentDataType == Connection.Pong: self.__pongTime.restart() elif self.__currentDataType == Connection.GetParticipants: @@ -379,7 +390,8 @@ participantsList = msg.split(SeparatorToken) self.participants.emit(participantsList[:]) elif self.__currentDataType == Connection.Editor: - hash, fn, msg = str(self.__buffer, encoding="utf-8").split(SeparatorToken) + hash, fn, msg = \ + str(self.__buffer, encoding="utf-8").split(SeparatorToken) self.editorCommand.emit(hash, fn, msg) self.__currentDataType = Connection.Undefined @@ -391,14 +403,16 @@ Public method to request a list of participants. """ self.write( - "{0}{1}1{1}l".format(Connection.ProtocolGetParticipants, SeparatorToken) + "{0}{1}1{1}l".format( + Connection.ProtocolGetParticipants, SeparatorToken) ) def sendParticipants(self, participants): """ Public method to send the list of participants. - @param participants list of participants (list of strings of "host:port") + @param participants list of participants (list of strings of + "host:port") """ if participants: message = SeparatorToken.join(participants) @@ -430,5 +444,6 @@ """ self.__pingTimer.stop() if self.__state == Connection.WaitingForGreeting: - self.rejected.emit(self.trUtf8("* Connection to {0}:{1} refused.").format( + self.rejected.emit(self.trUtf8( + "* Connection to {0}:{1} refused.").format( self.peerName(), self.peerPort()))
--- a/Cooperation/CooperationClient.py Fri Oct 04 17:48:17 2013 +0200 +++ b/Cooperation/CooperationClient.py Sun Oct 06 17:27:53 2013 +0200 @@ -10,7 +10,8 @@ import collections from PyQt4.QtCore import QObject, pyqtSignal, QProcess, QRegExp -from PyQt4.QtNetwork import QHostInfo, QHostAddress, QAbstractSocket, QNetworkInterface +from PyQt4.QtNetwork import QHostInfo, QHostAddress, QAbstractSocket, \ + QNetworkInterface from .CooperationServer import CooperationServer from .Connection import Connection @@ -23,13 +24,15 @@ Class implementing the client of the cooperation package. @signal newMessage(user, message) emitted after a new message has - arrived (string, string) - @signal newParticipant(nickname) emitted after a new participant joined (string) + arrived (string, string) + @signal newParticipant(nickname) emitted after a new participant joined + (string) @signal participantLeft(nickname) emitted after a participant left (string) - @signal connectionError(message) emitted when a connection error occurs (string) + @signal connectionError(message) emitted when a connection error occurs + (string) @signal cannotConnect() emitted, if the initial connection fails - @signal editorCommand(hash, filename, message) emitted when an editor command - has been received (string, string, string) + @signal editorCommand(hash, filename, message) emitted when an editor + command has been received (string, string, string) """ newMessage = pyqtSignal(str, str) newParticipant = pyqtSignal(str) @@ -154,7 +157,8 @@ """ Public method to remove a connection. - @param connection reference to the connection to be removed (Connection) + @param connection reference to the connection to be removed + (Connection) """ if connection.peerAddress() in self.__peers and \ connection in self.__peers[connection.peerAddress()]: @@ -202,7 +206,8 @@ """ Private slot to handle a connection error. - @param socketError reference to the error object (QAbstractSocket.SocketError) + @param socketError reference to the error object + (QAbstractSocket.SocketError) """ connection = self.sender() if socketError != QAbstractSocket.RemoteHostClosedError: @@ -256,7 +261,8 @@ """ self.__initialConnection = Connection(self) self.__newConnection(self.__initialConnection) - self.__initialConnection.participants.connect(self.__processParticipants) + self.__initialConnection.participants.connect( + self.__processParticipants) self.__initialConnection.connectToHost(host, port) def __getParticipants(self): @@ -269,21 +275,24 @@ for connection in connectionList: if connection != reqConnection: participants.append("{0}@{1}".format( - connection.peerAddress().toString(), connection.serverPort())) + connection.peerAddress().toString(), + connection.serverPort())) reqConnection.sendParticipants(participants) def __processParticipants(self, participants): """ Private slot to handle the receipt of a list of participants. - @param participants list of participants (list of strings of "host:port") + @param participants list of participants (list of strings of + "host:port") """ for participant in participants: host, port = participant.split("@") port = int(port) if port == 0: - msg = self.trUtf8("Illegal address: {0}@{1}\n").format(host, port) + msg = self.trUtf8("Illegal address: {0}@{1}\n").format( + host, port) self.connectionError.emit(msg) else: if not self.hasConnection(QHostAddress(host), port): @@ -309,7 +318,8 @@ Public method to get a list of connection given a nick name. @param nick nick name in the format of self.nickName() (string) - @return list of references to the connection objects (list of Connection) + @return list of references to the connection objects (list of + Connection) """ if "@" not in nick: # nick given in wrong format @@ -399,8 +409,10 @@ def errorString(self): """ - Public method to get a human readable error message about the last server error. + Public method to get a human readable error message about the last + server error. - @return human readable error message about the last server error (string) + @return human readable error message about the last server error + (string) """ return self.__serversErrorString
--- a/Cooperation/CooperationServer.py Fri Oct 04 17:48:17 2013 +0200 +++ b/Cooperation/CooperationServer.py Sun Oct 06 17:27:53 2013 +0200 @@ -19,8 +19,8 @@ """ Class implementing the cooperation server. - @signal newConnection(connection) emitted after a new connection was received - (Connection) + @signal newConnection(connection) emitted after a new connection was + received (Connection) """ newConnection = pyqtSignal(Connection) @@ -50,8 +50,8 @@ Public method to start listening for new connections. @param port port to listen on (integer) - @param findFreePort flag indicating to search for a free port depending on - the configuration (boolean) + @param findFreePort flag indicating to search for a free port + depending on the configuration (boolean) @return tuple giving a flag indicating success (boolean) and the port the server listens on """
--- a/DataViews/CodeMetrics.py Fri Oct 04 17:48:17 2013 +0200 +++ b/DataViews/CodeMetrics.py Sun Oct 06 17:27:53 2013 +0200 @@ -108,9 +108,12 @@ """ Constructor """ - self.identifiers = [] # list of identifiers in order of appearance - self.active = [('TOTAL ', -1, 0)] # stack of active identifiers and indent levels - self.counters = {} # counters per identifier + self.identifiers = [] + # list of identifiers in order of appearance + self.active = [('TOTAL ', -1, 0)] + # stack of active identifiers and indent levels + self.counters = {} + # counters per identifier self.indent_level = 0 def indent(self, tok): @@ -253,7 +256,8 @@ summarize(total, 'bytes', len(text)) summarize(total, 'comments', stats.getCounter('TOTAL ', 'comments')) summarize(total, 'empty lines', stats.getCounter('TOTAL ', 'empty')) - summarize(total, 'non-commentary lines', stats.getCounter('TOTAL ', 'nloc')) + summarize(total, 'non-commentary lines', + stats.getCounter('TOTAL ', 'nloc')) return stats
--- a/DataViews/CodeMetricsDialog.py Fri Oct 04 17:48:17 2013 +0200 +++ b/DataViews/CodeMetricsDialog.py Sun Oct 06 17:27:53 2013 +0200 @@ -11,8 +11,8 @@ import fnmatch from PyQt4.QtCore import pyqtSlot, Qt, QLocale, qVersion -from PyQt4.QtGui import QDialog, QDialogButtonBox, QMenu, QHeaderView, QTreeWidgetItem, \ - QApplication +from PyQt4.QtGui import QDialog, QDialogButtonBox, QMenu, QHeaderView, \ + QTreeWidgetItem, QApplication from .Ui_CodeMetricsDialog import Ui_CodeMetricsDialog from . import CodeMetrics @@ -36,7 +36,8 @@ self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) - self.summaryList.headerItem().setText(self.summaryList.columnCount(), "") + self.summaryList.headerItem().setText( + self.summaryList.columnCount(), "") self.summaryList.header().resizeSection(0, 200) self.summaryList.header().resizeSection(1, 100) @@ -45,10 +46,12 @@ self.cancelled = False self.__menu = QMenu(self) - self.__menu.addAction(self.trUtf8("Collapse all"), self.__resultCollapse) + self.__menu.addAction(self.trUtf8("Collapse all"), + self.__resultCollapse) self.__menu.addAction(self.trUtf8("Expand all"), self.__resultExpand) self.resultList.setContextMenuPolicy(Qt.CustomContextMenu) - self.resultList.customContextMenuRequested.connect(self.__showContextMenu) + self.resultList.customContextMenuRequested.connect( + self.__showContextMenu) self.__fileList = [] self.__project = None @@ -182,10 +185,14 @@ # now do the summary stuff docstrings = total['lines'] - total['comments'] - \ total['empty lines'] - total['non-commentary lines'] - self.__createSummaryItem(self.trUtf8("files"), loc.toString(total['files'])) - self.__createSummaryItem(self.trUtf8("lines"), loc.toString(total['lines'])) - self.__createSummaryItem(self.trUtf8("bytes"), loc.toString(total['bytes'])) - self.__createSummaryItem(self.trUtf8("comments"), loc.toString(total['comments'])) + self.__createSummaryItem(self.trUtf8("files"), + loc.toString(total['files'])) + self.__createSummaryItem(self.trUtf8("lines"), + loc.toString(total['lines'])) + self.__createSummaryItem(self.trUtf8("bytes"), + loc.toString(total['bytes'])) + self.__createSummaryItem(self.trUtf8("comments"), + loc.toString(total['comments'])) self.__createSummaryItem(self.trUtf8("empty lines"), loc.toString(total['empty lines'])) self.__createSummaryItem(self.trUtf8("non-commentary lines"), @@ -215,7 +222,8 @@ def __finish(self): """ - Private slot called when the action finished or the user pressed the button. + Private slot called when the action finished or the user pressed the + button. """ self.cancelled = True self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) @@ -223,8 +231,10 @@ self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) if qVersion() >= "5.0.0": - self.resultList.header().setSectionResizeMode(QHeaderView.Interactive) - self.summaryList.header().setSectionResizeMode(QHeaderView.Interactive) + self.resultList.header().setSectionResizeMode( + QHeaderView.Interactive) + self.summaryList.header().setSectionResizeMode( + QHeaderView.Interactive) else: self.resultList.header().setResizeMode(QHeaderView.Interactive) self.summaryList.header().setResizeMode(QHeaderView.Interactive) @@ -251,12 +261,13 @@ if "ExcludeFiles" not in self.__data or \ filterString != self.__data["ExcludeFiles"]: self.__data["ExcludeFiles"] = filterString - self.__project.setData("OTHERTOOLSPARMS", "CodeMetrics", self.__data) + self.__project.setData("OTHERTOOLSPARMS", "CodeMetrics", + self.__data) filterList = filterString.split(",") if filterList: for filter in filterList: - fileList = \ - [f for f in fileList if not fnmatch.fnmatch(f, filter.strip())] + fileList = [f for f in fileList + if not fnmatch.fnmatch(f, filter.strip())] self.resultList.clear() self.summaryList.clear()
--- a/DataViews/PyCoverageDialog.py Fri Oct 04 17:48:17 2013 +0200 +++ b/DataViews/PyCoverageDialog.py Sun Oct 06 17:27:53 2013 +0200 @@ -10,8 +10,8 @@ import os from PyQt4.QtCore import pyqtSlot, Qt -from PyQt4.QtGui import QDialog, QDialogButtonBox, QMenu, QHeaderView, QTreeWidgetItem, \ - QApplication, QProgressDialog +from PyQt4.QtGui import QDialog, QDialogButtonBox, QMenu, QHeaderView, \ + QTreeWidgetItem, QApplication, QProgressDialog from E5Gui import E5MessageBox from E5Gui.E5Application import e5App @@ -39,7 +39,8 @@ self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) - self.summaryList.headerItem().setText(self.summaryList.columnCount(), "") + self.summaryList.headerItem().setText( + self.summaryList.columnCount(), "") self.resultList.headerItem().setText(self.resultList.columnCount(), "") self.cancelled = False @@ -61,11 +62,13 @@ self.__menu.addSeparator() self.__menu.addAction(self.trUtf8('Erase Coverage Info'), self.__erase) self.resultList.setContextMenuPolicy(Qt.CustomContextMenu) - self.resultList.customContextMenuRequested.connect(self.__showContextMenu) + self.resultList.customContextMenuRequested.connect( + self.__showContextMenu) def __format_lines(self, lines): """ - Private method to format a list of integers into string by coalescing groups. + Private method to format a list of integers into string by coalescing + groups. @param lines list of integers @return string representing the list @@ -94,7 +97,8 @@ def stringify(pair): """ - Private helper function to generate a string representation of a pair + Private helper function to generate a string representation of a + pair. @param pair pair of integers """ @@ -106,7 +110,8 @@ return ", ".join(map(stringify, pairs)) - def __createResultItem(self, file, statements, executed, coverage, excluded, missing): + def __createResultItem(self, file, statements, executed, coverage, + excluded, missing): """ Private method to create an entry in the result list. @@ -188,8 +193,10 @@ return try: - statements, excluded, missing, readable = cover.analysis2(file)[1:] - readableEx = excluded and self.__format_lines(excluded) or '' + statements, excluded, missing, readable = \ + cover.analysis2(file)[1:] + readableEx = (excluded and self.__format_lines(excluded) + or '') n = len(statements) m = n - len(missing) if n > 0: @@ -232,14 +239,16 @@ if total_exceptions: E5MessageBox.warning(self, self.trUtf8("Parse Error"), - self.trUtf8("""%n file(s) could not be parsed. Coverage info for""" - """ these is not available.""", "", total_exceptions)) + self.trUtf8("""%n file(s) could not be parsed. Coverage""" + """ info for these is not available.""", "", + total_exceptions)) self.__finish() def __finish(self): """ - Private slot called when the action finished or the user pressed the button. + Private slot called when the action finished or the user pressed the + button. """ self.cancelled = True self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True)
--- a/DataViews/PyProfileDialog.py Fri Oct 04 17:48:17 2013 +0200 +++ b/DataViews/PyProfileDialog.py Sun Oct 06 17:27:53 2013 +0200 @@ -11,8 +11,8 @@ import pickle from PyQt4.QtCore import Qt -from PyQt4.QtGui import QDialog, QDialogButtonBox, QMenu, QHeaderView, QTreeWidgetItem, \ - QApplication +from PyQt4.QtGui import QDialog, QDialogButtonBox, QMenu, QHeaderView, \ + QTreeWidgetItem, QApplication from E5Gui import E5MessageBox @@ -22,7 +22,8 @@ class ProfileTreeWidgetItem(QTreeWidgetItem): """ - Class implementing a custom QTreeWidgetItem to allow sorting on numeric values. + Class implementing a custom QTreeWidgetItem to allow sorting on numeric + values. """ def __getNC(self, itm): """ @@ -38,7 +39,8 @@ """ Public method to check, if the item is less than the other one. - @param other reference to item to compare against (ProfileTreeWidgetItem) + @param other reference to item to compare against + (ProfileTreeWidgetItem) @return true, if this item is less than other (boolean) """ column = self.treeWidget().sortColumn() @@ -67,29 +69,36 @@ self.cancelled = False self.exclude = True - self.ericpath = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + self.ericpath = os.path.dirname( + os.path.dirname(os.path.abspath(__file__))) self.pyLibPath = Utilities.getPythonLibPath() - self.summaryList.headerItem().setText(self.summaryList.columnCount(), "") + self.summaryList.headerItem().setText( + self.summaryList.columnCount(), "") self.resultList.headerItem().setText(self.resultList.columnCount(), "") self.resultList.header().setSortIndicator(0, Qt.DescendingOrder) self.__menu = QMenu(self) - self.filterItm = self.__menu.addAction(self.trUtf8('Exclude Python Library'), + self.filterItm = self.__menu.addAction( + self.trUtf8('Exclude Python Library'), self.__filter) self.__menu.addSeparator() self.__menu.addAction(self.trUtf8('Erase Profiling Info'), self.__eraseProfile) - self.__menu.addAction(self.trUtf8('Erase Timing Info'), self.__eraseTiming) + self.__menu.addAction(self.trUtf8('Erase Timing Info'), + self.__eraseTiming) self.__menu.addSeparator() self.__menu.addAction(self.trUtf8('Erase All Infos'), self.__eraseAll) self.resultList.setContextMenuPolicy(Qt.CustomContextMenu) - self.resultList.customContextMenuRequested.connect(self.__showContextMenu) + self.resultList.customContextMenuRequested.connect( + self.__showContextMenu) self.summaryList.setContextMenuPolicy(Qt.CustomContextMenu) - self.summaryList.customContextMenuRequested.connect(self.__showContextMenu) + self.summaryList.customContextMenuRequested.connect( + self.__showContextMenu) - def __createResultItem(self, calls, totalTime, totalTimePerCall, cumulativeTime, - cumulativeTimePerCall, file, line, functionName): + def __createResultItem(self, calls, totalTime, totalTimePerCall, + cumulativeTime, cumulativeTimePerCall, file, line, + functionName): """ Private method to create an entry in the result list. @@ -130,7 +139,8 @@ Private method to resort the tree. """ self.resultList.sortItems(self.resultList.sortColumn(), - self.resultList.header().sortIndicatorOrder()) + self.resultList.header() + .sortIndicatorOrder()) def __populateLists(self, exclude=False): """ @@ -160,7 +170,8 @@ if self.cancelled: return - if not (self.ericpath and func[0].startswith(self.ericpath)) and \ + if not (self.ericpath and + func[0].startswith(self.ericpath)) and \ not func[0].startswith("DebugClients") and \ func[0] != "profile" and \ not (exclude and ( @@ -197,10 +208,13 @@ self.__resortResultList() # now do the summary stuff - self.__createSummaryItem(self.trUtf8("function calls"), str(total_calls)) + self.__createSummaryItem(self.trUtf8("function calls"), + str(total_calls)) if total_calls != prim_calls: - self.__createSummaryItem(self.trUtf8("primitive calls"), str(prim_calls)) - self.__createSummaryItem(self.trUtf8("CPU seconds"), "{0:.3f}".format(total_tt)) + self.__createSummaryItem(self.trUtf8("primitive calls"), + str(prim_calls)) + self.__createSummaryItem(self.trUtf8("CPU seconds"), + "{0:.3f}".format(total_tt)) def start(self, pfn, fn=None): """ @@ -239,7 +253,8 @@ def __finish(self): """ - Private slot called when the action finished or the user pressed the button. + Private slot called when the action finished or the user pressed the + button. """ self.cancelled = True self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) @@ -304,7 +319,8 @@ def __filter(self): """ - Private slot to handle the Exclude/Include Python Library context menu action. + Private slot to handle the Exclude/Include Python Library context menu + action. """ self.__unfinish() if self.exclude: