Fix PEP8 errors
This commit is contained in:
parent
bcea4dd1fc
commit
356719e00d
@ -21,6 +21,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import qt_compat
|
import qt_compat
|
||||||
|
|
||||||
QtCore = qt_compat.import_module('QtCore')
|
QtCore = qt_compat.import_module('QtCore')
|
||||||
QtGui = qt_compat.import_module('QtGui')
|
QtGui = qt_compat.import_module('QtGui')
|
||||||
|
|
||||||
|
@ -22,12 +22,13 @@
|
|||||||
|
|
||||||
from pkg_resources import resource_filename
|
from pkg_resources import resource_filename
|
||||||
import qt_compat
|
import qt_compat
|
||||||
QtCore = qt_compat.import_module('QtCore')
|
|
||||||
QtGui = qt_compat.import_module('QtGui')
|
|
||||||
from chat import ChatTextEdit
|
from chat import ChatTextEdit
|
||||||
from input import InputLineEdit
|
from input import InputLineEdit
|
||||||
import weechat.color as color
|
import weechat.color as color
|
||||||
|
|
||||||
|
QtCore = qt_compat.import_module('QtCore')
|
||||||
|
QtGui = qt_compat.import_module('QtGui')
|
||||||
|
|
||||||
|
|
||||||
class GenericListWidget(QtGui.QListWidget):
|
class GenericListWidget(QtGui.QListWidget):
|
||||||
"""Generic QListWidget with dynamic size."""
|
"""Generic QListWidget with dynamic size."""
|
||||||
|
@ -22,11 +22,12 @@
|
|||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import qt_compat
|
import qt_compat
|
||||||
QtCore = qt_compat.import_module('QtCore')
|
|
||||||
QtGui = qt_compat.import_module('QtGui')
|
|
||||||
import config
|
import config
|
||||||
import weechat.color as color
|
import weechat.color as color
|
||||||
|
|
||||||
|
QtCore = qt_compat.import_module('QtCore')
|
||||||
|
QtGui = qt_compat.import_module('QtGui')
|
||||||
|
|
||||||
|
|
||||||
class ChatTextEdit(QtGui.QTextEdit):
|
class ChatTextEdit(QtGui.QTextEdit):
|
||||||
"""Chat area."""
|
"""Chat area."""
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import qt_compat
|
import qt_compat
|
||||||
|
|
||||||
QtGui = qt_compat.import_module('QtGui')
|
QtGui = qt_compat.import_module('QtGui')
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,10 +21,11 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import qt_compat
|
import qt_compat
|
||||||
QtGui = qt_compat.import_module('QtGui')
|
|
||||||
from chat import ChatTextEdit
|
from chat import ChatTextEdit
|
||||||
from input import InputLineEdit
|
from input import InputLineEdit
|
||||||
|
|
||||||
|
QtGui = qt_compat.import_module('QtGui')
|
||||||
|
|
||||||
|
|
||||||
class DebugDialog(QtGui.QDialog):
|
class DebugDialog(QtGui.QDialog):
|
||||||
"""Debug dialog."""
|
"""Debug dialog."""
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import qt_compat
|
import qt_compat
|
||||||
|
|
||||||
QtCore = qt_compat.import_module('QtCore')
|
QtCore = qt_compat.import_module('QtCore')
|
||||||
QtGui = qt_compat.import_module('QtGui')
|
QtGui = qt_compat.import_module('QtGui')
|
||||||
|
|
||||||
|
@ -22,9 +22,10 @@
|
|||||||
|
|
||||||
import struct
|
import struct
|
||||||
import qt_compat
|
import qt_compat
|
||||||
|
import config
|
||||||
|
|
||||||
QtCore = qt_compat.import_module('QtCore')
|
QtCore = qt_compat.import_module('QtCore')
|
||||||
QtNetwork = qt_compat.import_module('QtNetwork')
|
QtNetwork = qt_compat.import_module('QtNetwork')
|
||||||
import config
|
|
||||||
|
|
||||||
_PROTO_INIT_CMD = ['init password=%(password)s']
|
_PROTO_INIT_CMD = ['init password=%(password)s']
|
||||||
|
|
||||||
|
@ -37,8 +37,6 @@ import sys
|
|||||||
import traceback
|
import traceback
|
||||||
from pkg_resources import resource_filename
|
from pkg_resources import resource_filename
|
||||||
import qt_compat
|
import qt_compat
|
||||||
QTCORE = qt_compat.import_module('QtCore')
|
|
||||||
QTGUI = qt_compat.import_module('QtGui')
|
|
||||||
import config
|
import config
|
||||||
import weechat.protocol as protocol
|
import weechat.protocol as protocol
|
||||||
from network import Network
|
from network import Network
|
||||||
@ -48,6 +46,9 @@ from debug import DebugDialog
|
|||||||
from about import AboutDialog
|
from about import AboutDialog
|
||||||
from version import qweechat_version
|
from version import qweechat_version
|
||||||
|
|
||||||
|
QtCore = qt_compat.import_module('QtCore')
|
||||||
|
QtGui = qt_compat.import_module('QtGui')
|
||||||
|
|
||||||
NAME = 'QWeeChat'
|
NAME = 'QWeeChat'
|
||||||
AUTHOR = 'Sébastien Helleu'
|
AUTHOR = 'Sébastien Helleu'
|
||||||
AUTHOR_MAIL = 'flashcode@flashtux.org'
|
AUTHOR_MAIL = 'flashcode@flashtux.org'
|
||||||
@ -57,11 +58,11 @@ WEECHAT_SITE = 'https://weechat.org/'
|
|||||||
DEBUG_NUM_LINES = 50
|
DEBUG_NUM_LINES = 50
|
||||||
|
|
||||||
|
|
||||||
class MainWindow(QTGUI.QMainWindow):
|
class MainWindow(QtGui.QMainWindow):
|
||||||
"""Main window."""
|
"""Main window."""
|
||||||
|
|
||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
QTGUI.QMainWindow.__init__(*(self,) + args)
|
QtGui.QMainWindow.__init__(*(self,) + args)
|
||||||
|
|
||||||
self.config = config.read()
|
self.config = config.read()
|
||||||
|
|
||||||
@ -86,11 +87,11 @@ class MainWindow(QTGUI.QMainWindow):
|
|||||||
|
|
||||||
# default buffer
|
# default buffer
|
||||||
self.buffers = [Buffer()]
|
self.buffers = [Buffer()]
|
||||||
self.stacked_buffers = QTGUI.QStackedWidget()
|
self.stacked_buffers = QtGui.QStackedWidget()
|
||||||
self.stacked_buffers.addWidget(self.buffers[0].widget)
|
self.stacked_buffers.addWidget(self.buffers[0].widget)
|
||||||
|
|
||||||
# splitter with buffers + chat/input
|
# splitter with buffers + chat/input
|
||||||
splitter = QTGUI.QSplitter()
|
splitter = QtGui.QSplitter()
|
||||||
splitter.addWidget(self.list_buffers)
|
splitter.addWidget(self.list_buffers)
|
||||||
splitter.addWidget(self.stacked_buffers)
|
splitter.addWidget(self.stacked_buffers)
|
||||||
|
|
||||||
@ -125,8 +126,8 @@ class MainWindow(QTGUI.QMainWindow):
|
|||||||
}
|
}
|
||||||
self.actions = {}
|
self.actions = {}
|
||||||
for name, action in list(actions_def.items()):
|
for name, action in list(actions_def.items()):
|
||||||
self.actions[name] = QTGUI.QAction(
|
self.actions[name] = QtGui.QAction(
|
||||||
QTGUI.QIcon(
|
QtGui.QIcon(
|
||||||
resource_filename(__name__, 'data/icons/%s' % action[0])),
|
resource_filename(__name__, 'data/icons/%s' % action[0])),
|
||||||
name.capitalize(), self)
|
name.capitalize(), self)
|
||||||
self.actions[name].setStatusTip(action[1])
|
self.actions[name].setStatusTip(action[1])
|
||||||
@ -145,19 +146,19 @@ class MainWindow(QTGUI.QMainWindow):
|
|||||||
menu_window.addAction(self.actions['debug'])
|
menu_window.addAction(self.actions['debug'])
|
||||||
menu_help = self.menu.addMenu('&Help')
|
menu_help = self.menu.addMenu('&Help')
|
||||||
menu_help.addAction(self.actions['about'])
|
menu_help.addAction(self.actions['about'])
|
||||||
self.network_status = QTGUI.QLabel()
|
self.network_status = QtGui.QLabel()
|
||||||
self.network_status.setFixedHeight(20)
|
self.network_status.setFixedHeight(20)
|
||||||
self.network_status.setFixedWidth(200)
|
self.network_status.setFixedWidth(200)
|
||||||
self.network_status.setContentsMargins(0, 0, 10, 0)
|
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'):
|
if hasattr(self.menu, 'setCornerWidget'):
|
||||||
self.menu.setCornerWidget(self.network_status,
|
self.menu.setCornerWidget(self.network_status,
|
||||||
QTCORE.Qt.TopRightCorner)
|
QtCore.Qt.TopRightCorner)
|
||||||
self.network_status_set(self.network.status_disconnected)
|
self.network_status_set(self.network.status_disconnected)
|
||||||
|
|
||||||
# toolbar
|
# toolbar
|
||||||
toolbar = self.addToolBar('toolBar')
|
toolbar = self.addToolBar('toolBar')
|
||||||
toolbar.setToolButtonStyle(QTCORE.Qt.ToolButtonTextUnderIcon)
|
toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)
|
||||||
toolbar.addActions([self.actions['connect'],
|
toolbar.addActions([self.actions['connect'],
|
||||||
self.actions['disconnect'],
|
self.actions['disconnect'],
|
||||||
self.actions['debug'],
|
self.actions['debug'],
|
||||||
@ -287,10 +288,10 @@ class MainWindow(QTGUI.QMainWindow):
|
|||||||
pal = self.network_status.palette()
|
pal = self.network_status.palette()
|
||||||
if status == self.network.status_connected:
|
if status == self.network.status_connected:
|
||||||
pal.setColor(self.network_status.foregroundRole(),
|
pal.setColor(self.network_status.foregroundRole(),
|
||||||
QTGUI.QColor('green'))
|
QtGui.QColor('green'))
|
||||||
else:
|
else:
|
||||||
pal.setColor(self.network_status.foregroundRole(),
|
pal.setColor(self.network_status.foregroundRole(),
|
||||||
QTGUI.QColor('#aa0000'))
|
QtGui.QColor('#aa0000'))
|
||||||
ssl = ' (SSL)' if status != self.network.status_disconnected \
|
ssl = ' (SSL)' if status != self.network.status_disconnected \
|
||||||
and self.network.is_ssl() else ''
|
and self.network.is_ssl() else ''
|
||||||
self.network_status.setPalette(pal)
|
self.network_status.setPalette(pal)
|
||||||
@ -543,12 +544,12 @@ class MainWindow(QTGUI.QMainWindow):
|
|||||||
if self.debug_dialog:
|
if self.debug_dialog:
|
||||||
self.debug_dialog.close()
|
self.debug_dialog.close()
|
||||||
config.write(self.config)
|
config.write(self.config)
|
||||||
QTGUI.QMainWindow.closeEvent(self, event)
|
QtGui.QMainWindow.closeEvent(self, event)
|
||||||
|
|
||||||
|
|
||||||
app = QTGUI.QApplication(sys.argv)
|
app = QtGui.QApplication(sys.argv)
|
||||||
app.setStyle(QTGUI.QStyleFactory.create('Cleanlooks'))
|
app.setStyle(QtGui.QStyleFactory.create('Cleanlooks'))
|
||||||
app.setWindowIcon(QTGUI.QIcon(
|
app.setWindowIcon(QtGui.QIcon(
|
||||||
resource_filename(__name__, 'data/icons/weechat_icon_32.png')))
|
resource_filename(__name__, 'data/icons/weechat_icon_32.png')))
|
||||||
main = MainWindow()
|
main = MainWindow()
|
||||||
sys.exit(app.exec_())
|
sys.exit(app.exec_())
|
||||||
|
Loading…
Reference in New Issue
Block a user