From 356719e00de8446ece29f41ca15da2a26c098ecf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sat, 16 Jan 2016 08:10:28 +0100 Subject: [PATCH] Fix PEP8 errors --- qweechat/about.py | 1 + qweechat/buffer.py | 5 +++-- qweechat/chat.py | 5 +++-- qweechat/connection.py | 1 + qweechat/debug.py | 3 ++- qweechat/input.py | 1 + qweechat/network.py | 3 ++- qweechat/qweechat.py | 37 +++++++++++++++++++------------------ 8 files changed, 32 insertions(+), 24 deletions(-) diff --git a/qweechat/about.py b/qweechat/about.py index 077eee9..bf3c75f 100644 --- a/qweechat/about.py +++ b/qweechat/about.py @@ -21,6 +21,7 @@ # import qt_compat + QtCore = qt_compat.import_module('QtCore') QtGui = qt_compat.import_module('QtGui') diff --git a/qweechat/buffer.py b/qweechat/buffer.py index 0f4efcb..eefb5e1 100644 --- a/qweechat/buffer.py +++ b/qweechat/buffer.py @@ -22,12 +22,13 @@ from pkg_resources import resource_filename import qt_compat -QtCore = qt_compat.import_module('QtCore') -QtGui = qt_compat.import_module('QtGui') from chat import ChatTextEdit from input import InputLineEdit import weechat.color as color +QtCore = qt_compat.import_module('QtCore') +QtGui = qt_compat.import_module('QtGui') + class GenericListWidget(QtGui.QListWidget): """Generic QListWidget with dynamic size.""" diff --git a/qweechat/chat.py b/qweechat/chat.py index 001a742..053a635 100644 --- a/qweechat/chat.py +++ b/qweechat/chat.py @@ -22,11 +22,12 @@ import datetime import qt_compat -QtCore = qt_compat.import_module('QtCore') -QtGui = qt_compat.import_module('QtGui') import config import weechat.color as color +QtCore = qt_compat.import_module('QtCore') +QtGui = qt_compat.import_module('QtGui') + class ChatTextEdit(QtGui.QTextEdit): """Chat area.""" diff --git a/qweechat/connection.py b/qweechat/connection.py index 84f4803..a38ebf9 100644 --- a/qweechat/connection.py +++ b/qweechat/connection.py @@ -21,6 +21,7 @@ # import qt_compat + QtGui = qt_compat.import_module('QtGui') diff --git a/qweechat/debug.py b/qweechat/debug.py index 824779d..67f7f3b 100644 --- a/qweechat/debug.py +++ b/qweechat/debug.py @@ -21,10 +21,11 @@ # import qt_compat -QtGui = qt_compat.import_module('QtGui') from chat import ChatTextEdit from input import InputLineEdit +QtGui = qt_compat.import_module('QtGui') + class DebugDialog(QtGui.QDialog): """Debug dialog.""" diff --git a/qweechat/input.py b/qweechat/input.py index 9a80a10..6fd451b 100644 --- a/qweechat/input.py +++ b/qweechat/input.py @@ -21,6 +21,7 @@ # import qt_compat + QtCore = qt_compat.import_module('QtCore') QtGui = qt_compat.import_module('QtGui') diff --git a/qweechat/network.py b/qweechat/network.py index 20d22ef..46458a4 100644 --- a/qweechat/network.py +++ b/qweechat/network.py @@ -22,9 +22,10 @@ import struct import qt_compat +import config + QtCore = qt_compat.import_module('QtCore') QtNetwork = qt_compat.import_module('QtNetwork') -import config _PROTO_INIT_CMD = ['init password=%(password)s'] diff --git a/qweechat/qweechat.py b/qweechat/qweechat.py index d06ad41..c12b3da 100644 --- a/qweechat/qweechat.py +++ b/qweechat/qweechat.py @@ -37,8 +37,6 @@ import sys import traceback from pkg_resources import resource_filename import qt_compat -QTCORE = qt_compat.import_module('QtCore') -QTGUI = qt_compat.import_module('QtGui') import config import weechat.protocol as protocol from network import Network @@ -48,6 +46,9 @@ from debug import DebugDialog from about import AboutDialog from version import qweechat_version +QtCore = qt_compat.import_module('QtCore') +QtGui = qt_compat.import_module('QtGui') + NAME = 'QWeeChat' AUTHOR = 'Sébastien Helleu' AUTHOR_MAIL = 'flashcode@flashtux.org' @@ -57,11 +58,11 @@ WEECHAT_SITE = 'https://weechat.org/' DEBUG_NUM_LINES = 50 -class MainWindow(QTGUI.QMainWindow): +class MainWindow(QtGui.QMainWindow): """Main window.""" def __init__(self, *args): - QTGUI.QMainWindow.__init__(*(self,) + args) + QtGui.QMainWindow.__init__(*(self,) + args) self.config = config.read() @@ -86,11 +87,11 @@ class MainWindow(QTGUI.QMainWindow): # default buffer self.buffers = [Buffer()] - self.stacked_buffers = QTGUI.QStackedWidget() + self.stacked_buffers = QtGui.QStackedWidget() self.stacked_buffers.addWidget(self.buffers[0].widget) # splitter with buffers + chat/input - splitter = QTGUI.QSplitter() + splitter = QtGui.QSplitter() splitter.addWidget(self.list_buffers) splitter.addWidget(self.stacked_buffers) @@ -125,8 +126,8 @@ class MainWindow(QTGUI.QMainWindow): } self.actions = {} for name, action in list(actions_def.items()): - self.actions[name] = QTGUI.QAction( - QTGUI.QIcon( + self.actions[name] = QtGui.QAction( + QtGui.QIcon( resource_filename(__name__, 'data/icons/%s' % action[0])), name.capitalize(), self) self.actions[name].setStatusTip(action[1]) @@ -145,19 +146,19 @@ class MainWindow(QTGUI.QMainWindow): menu_window.addAction(self.actions['debug']) menu_help = self.menu.addMenu('&Help') menu_help.addAction(self.actions['about']) - self.network_status = QTGUI.QLabel() + self.network_status = QtGui.QLabel() self.network_status.setFixedHeight(20) self.network_status.setFixedWidth(200) self.network_status.setContentsMargins(0, 0, 10, 0) - self.network_status.setAlignment(QTCORE.Qt.AlignRight) + self.network_status.setAlignment(QtCore.Qt.AlignRight) if hasattr(self.menu, 'setCornerWidget'): self.menu.setCornerWidget(self.network_status, - QTCORE.Qt.TopRightCorner) + QtCore.Qt.TopRightCorner) self.network_status_set(self.network.status_disconnected) # toolbar toolbar = self.addToolBar('toolBar') - toolbar.setToolButtonStyle(QTCORE.Qt.ToolButtonTextUnderIcon) + toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon) toolbar.addActions([self.actions['connect'], self.actions['disconnect'], self.actions['debug'], @@ -287,10 +288,10 @@ class MainWindow(QTGUI.QMainWindow): pal = self.network_status.palette() if status == self.network.status_connected: pal.setColor(self.network_status.foregroundRole(), - QTGUI.QColor('green')) + QtGui.QColor('green')) else: pal.setColor(self.network_status.foregroundRole(), - QTGUI.QColor('#aa0000')) + QtGui.QColor('#aa0000')) ssl = ' (SSL)' if status != self.network.status_disconnected \ and self.network.is_ssl() else '' self.network_status.setPalette(pal) @@ -543,12 +544,12 @@ class MainWindow(QTGUI.QMainWindow): if self.debug_dialog: self.debug_dialog.close() config.write(self.config) - QTGUI.QMainWindow.closeEvent(self, event) + QtGui.QMainWindow.closeEvent(self, event) -app = QTGUI.QApplication(sys.argv) -app.setStyle(QTGUI.QStyleFactory.create('Cleanlooks')) -app.setWindowIcon(QTGUI.QIcon( +app = QtGui.QApplication(sys.argv) +app.setStyle(QtGui.QStyleFactory.create('Cleanlooks')) +app.setWindowIcon(QtGui.QIcon( resource_filename(__name__, 'data/icons/weechat_icon_32.png'))) main = MainWindow() sys.exit(app.exec_())