Fix PEP8 errors

This commit is contained in:
Sébastien Helleu 2016-01-16 08:10:28 +01:00
parent bcea4dd1fc
commit 356719e00d
8 changed files with 32 additions and 24 deletions

View file

@ -21,6 +21,7 @@
#
import qt_compat
QtCore = qt_compat.import_module('QtCore')
QtGui = qt_compat.import_module('QtGui')

View file

@ -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."""

View file

@ -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."""

View file

@ -21,6 +21,7 @@
#
import qt_compat
QtGui = qt_compat.import_module('QtGui')

View file

@ -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."""

View file

@ -21,6 +21,7 @@
#
import qt_compat
QtCore = qt_compat.import_module('QtCore')
QtGui = qt_compat.import_module('QtGui')

View file

@ -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']

View file

@ -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_())