diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-04-10 13:37:02 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-06-28 02:51:58 +0200 |
commit | 2ff2fb0495febe11d5015d2308d67e1d8048e597 (patch) | |
tree | 2ae9d1da4a701fc6b3945ccc32dfbbf102b9c85a /module/gui | |
parent | Localization badge (diff) | |
download | pyload-2ff2fb0495febe11d5015d2308d67e1d8048e597.tar.xz |
Some code cosmetics about commas, spaces and quotes
Merges #577
Diffstat (limited to 'module/gui')
-rw-r--r-- | module/gui/AccountEdit.py | 2 | ||||
-rw-r--r-- | module/gui/CNLServer.py | 4 | ||||
-rw-r--r-- | module/gui/Collector.py | 2 | ||||
-rw-r--r-- | module/gui/ConnectionManager.py | 8 | ||||
-rw-r--r-- | module/gui/CoreConfigParser.py | 20 | ||||
-rw-r--r-- | module/gui/MainWindow.py | 46 | ||||
-rw-r--r-- | module/gui/Overview.py | 2 | ||||
-rw-r--r-- | module/gui/SettingsWidget.py | 8 | ||||
-rw-r--r-- | module/gui/connector.py | 2 |
9 files changed, 47 insertions, 47 deletions
diff --git a/module/gui/AccountEdit.py b/module/gui/AccountEdit.py index 07a4cdad6..83472d4b5 100644 --- a/module/gui/AccountEdit.py +++ b/module/gui/AccountEdit.py @@ -30,7 +30,7 @@ class AccountEdit(QWidget): QMainWindow.__init__(self) self.setWindowTitle(_("Edit account")) - self.setWindowIcon(QIcon(join(pypath, "icons","logo.png"))) + self.setWindowIcon(QIcon(join(pypath, "icons", "logo.png"))) self.setLayout(QGridLayout()) l = self.layout() diff --git a/module/gui/CNLServer.py b/module/gui/CNLServer.py index b55555272..295cfa045 100644 --- a/module/gui/CNLServer.py +++ b/module/gui/CNLServer.py @@ -117,7 +117,7 @@ class CNLHandler(BaseHTTPRequestHandler): resp += "\r\n" self.start_response(resp) self.wfile.write(resp) - except Exception,e : + except Exception, e: self.send_error(500, str(e)) else: self.send_error(404, "Not Found") @@ -163,7 +163,7 @@ class CNLHandler(BaseHTTPRequestHandler): IV = Key obj = AES.new(Key, AES.MODE_CBC, IV) - result = obj.decrypt(crypted).replace("\x00", "").replace("\r","").split("\n") + result = obj.decrypt(crypted).replace("\x00", "").replace("\r", "").split("\n") result = filter(lambda x: x != "", result) diff --git a/module/gui/Collector.py b/module/gui/Collector.py index 50d45cf28..47da2bada 100644 --- a/module/gui/Collector.py +++ b/module/gui/Collector.py @@ -24,7 +24,7 @@ from module.utils import formatSize from module.remote.thriftbackend.ThriftClient import Destination, FileDoesNotExists, ElementType -statusMapReverse = dict((v,k) for k, v in statusMap.iteritems()) +statusMapReverse = dict((v, k) for k, v in statusMap.iteritems()) translatedStatusMap = {} # -> CollectorModel.__init__ diff --git a/module/gui/ConnectionManager.py b/module/gui/ConnectionManager.py index 8dfdf7dd2..eb6e68f02 100644 --- a/module/gui/ConnectionManager.py +++ b/module/gui/ConnectionManager.py @@ -40,7 +40,7 @@ class ConnectionManager(QWidget): buttonLayout = QVBoxLayout() self.setWindowTitle(_("pyLoad ConnectionManager")) - self.setWindowIcon(QIcon(join(pypath, "icons","logo.png"))) + self.setWindowIcon(QIcon(join(pypath, "icons", "logo.png"))) connList = QListWidget() @@ -118,7 +118,7 @@ class ConnectionManager(QWidget): self.connList.setCurrentItem(item) def slotNew(self): - data = {"id":uuid().hex, "type":"remote", "default":False, "name":"", "host":"", "port":"7228", "user":"admin", "password":""} + data = {"id": uuid().hex, "type":"remote", "default": False, "name":"", "host":"", "port":"7228", "user":"admin", "password":""} self.edit.setData(data) self.edit.show() @@ -183,7 +183,7 @@ class ConnectionManager(QWidget): QWidget.__init__(self) self.setWindowTitle(_("pyLoad ConnectionManager")) - self.setWindowIcon(QIcon(join(pypath, "icons","logo.png"))) + self.setWindowIcon(QIcon(join(pypath, "icons", "logo.png"))) grid = QGridLayout() @@ -201,7 +201,7 @@ class ConnectionManager(QWidget): password = QLineEdit() password.setEchoMode(QLineEdit.Password) port = QSpinBox() - port.setRange(1,10000) + port.setRange(1, 10000) save = QPushButton(_("Save")) cancel = QPushButton(_("Cancel")) diff --git a/module/gui/CoreConfigParser.py b/module/gui/CoreConfigParser.py index 84910da1a..cf0c24868 100644 --- a/module/gui/CoreConfigParser.py +++ b/module/gui/CoreConfigParser.py @@ -52,7 +52,7 @@ class ConfigParser: conf = {} - section, option, value, typ, desc = "","","","","" + section, option, value, typ, desc = "", "", "", "", "" listmode = False @@ -75,20 +75,20 @@ class ConfigParser: section, none, desc = line[:-1].partition('-') section = section.strip() desc = desc.replace('"', "").strip() - conf[section] = { "desc" : desc } + conf[section] = {"desc": desc} else: if listmode: if line.endswith("]"): listmode = False - line = line.replace("]","") + line = line.replace("]", "") value += [self.cast(typ, x.strip()) for x in line.split(",") if x] if not listmode: - conf[section][option] = { "desc" : desc, - "type" : typ, - "value" : value} + conf[section][option] = {"desc": desc, + "type": typ, + "value": value} else: content, none, value = line.partition("=") @@ -113,9 +113,9 @@ class ConfigParser: value = self.cast(typ, value) if not listmode: - conf[section][option] = { "desc" : desc, - "type" : typ, - "value" : value} + conf[section][option] = {"desc": desc, + "type": typ, + "value": value} except: pass @@ -132,7 +132,7 @@ class ConfigParser: if typ == "int": return int(value) elif typ == "bool": - return True if value.lower() in ("1","true", "on", "an","yes") else False + return True if value.lower() in ("1", "true", "on", "an", "yes") else False else: return value diff --git a/module/gui/MainWindow.py b/module/gui/MainWindow.py index d2e27a7a6..85a3bb59c 100644 --- a/module/gui/MainWindow.py +++ b/module/gui/MainWindow.py @@ -42,8 +42,8 @@ class MainWindow(QMainWindow): QMainWindow.__init__(self) #window stuff self.setWindowTitle(_("pyLoad Client")) - self.setWindowIcon(QIcon(join(pypath, "icons","logo.png"))) - self.resize(1000,600) + self.setWindowIcon(QIcon(join(pypath, "icons", "logo.png"))) + self.resize(1000, 600) #layout version self.version = 3 @@ -152,7 +152,7 @@ class MainWindow(QMainWindow): self.tabs["settings"]["w"] = SettingsWidget() #self.tabs["settings"]["s"].setWidgetResizable(True) #self.tabs["settings"]["s"].setWidget(self.tabs["settings"]["w"]) - self.tabs["log"] = {"w":QWidget()} + self.tabs["log"] = {"w": QWidget()} self.tabw.addTab(self.tabs["overview"]["w"], _("Overview")) self.tabw.addTab(self.tabs["queue"]["w"], _("Queue")) self.tabw.addTab(self.tabs["collector"]["w"], _("Collector")) @@ -189,19 +189,19 @@ class MainWindow(QMainWindow): """ self.toolbar = self.addToolBar(_("Hide Toolbar")) self.toolbar.setObjectName("Main Toolbar") - self.toolbar.setIconSize(QSize(30,30)) + self.toolbar.setIconSize(QSize(30, 30)) self.toolbar.setMovable(False) self.actions["toggle_status"] = self.toolbar.addAction(_("Toggle Pause/Resume")) pricon = QIcon() - pricon.addFile(join(pypath, "icons","toolbar_start.png"), QSize(), QIcon.Normal, QIcon.Off) - pricon.addFile(join(pypath, "icons","toolbar_pause.png"), QSize(), QIcon.Normal, QIcon.On) + pricon.addFile(join(pypath, "icons", "toolbar_start.png"), QSize(), QIcon.Normal, QIcon.Off) + pricon.addFile(join(pypath, "icons", "toolbar_pause.png"), QSize(), QIcon.Normal, QIcon.On) self.actions["toggle_status"].setIcon(pricon) self.actions["toggle_status"].setCheckable(True) - self.actions["status_stop"] = self.toolbar.addAction(QIcon(join(pypath, "icons","toolbar_stop.png")), _("Stop")) + self.actions["status_stop"] = self.toolbar.addAction(QIcon(join(pypath, "icons", "toolbar_stop.png")), _("Stop")) self.toolbar.addSeparator() - self.actions["add"] = self.toolbar.addAction(QIcon(join(pypath, "icons","toolbar_add.png")), _("Add")) + self.actions["add"] = self.toolbar.addAction(QIcon(join(pypath, "icons", "toolbar_add.png")), _("Add")) self.toolbar.addSeparator() - self.actions["clipboard"] = self.toolbar.addAction(QIcon(join(pypath, "icons","clipboard.png")), _("Check Clipboard")) + self.actions["clipboard"] = self.toolbar.addAction(QIcon(join(pypath, "icons", "clipboard.png")), _("Check Clipboard")) self.actions["clipboard"].setCheckable(True) self.connect(self.actions["toggle_status"], SIGNAL("toggled(bool)"), self.slotToggleStatus) @@ -272,11 +272,11 @@ class MainWindow(QMainWindow): self.queueContext = QMenu() self.queueContext.buttons = {} self.queueContext.item = (None, None) - self.queueContext.buttons["remove"] = QAction(QIcon(join(pypath, "icons","remove_small.png")), _("Remove"), self.queueContext) - self.queueContext.buttons["restart"] = QAction(QIcon(join(pypath, "icons","refresh_small.png")), _("Restart"), self.queueContext) - self.queueContext.buttons["pull"] = QAction(QIcon(join(pypath, "icons","pull_small.png")), _("Pull out"), self.queueContext) - self.queueContext.buttons["abort"] = QAction(QIcon(join(pypath, "icons","abort.png")), _("Abort"), self.queueContext) - self.queueContext.buttons["edit"] = QAction(QIcon(join(pypath, "icons","edit_small.png")), _("Edit Name"), self.queueContext) + self.queueContext.buttons["remove"] = QAction(QIcon(join(pypath, "icons", "remove_small.png")), _("Remove"), self.queueContext) + self.queueContext.buttons["restart"] = QAction(QIcon(join(pypath, "icons", "refresh_small.png")), _("Restart"), self.queueContext) + self.queueContext.buttons["pull"] = QAction(QIcon(join(pypath, "icons", "pull_small.png")), _("Pull out"), self.queueContext) + self.queueContext.buttons["abort"] = QAction(QIcon(join(pypath, "icons", "abort.png")), _("Abort"), self.queueContext) + self.queueContext.buttons["edit"] = QAction(QIcon(join(pypath, "icons", "edit_small.png")), _("Edit Name"), self.queueContext) self.queueContext.addAction(self.queueContext.buttons["pull"]) self.queueContext.addAction(self.queueContext.buttons["edit"]) self.queueContext.addAction(self.queueContext.buttons["remove"]) @@ -292,14 +292,14 @@ class MainWindow(QMainWindow): self.collectorContext = QMenu() self.collectorContext.buttons = {} self.collectorContext.item = (None, None) - self.collectorContext.buttons["remove"] = QAction(QIcon(join(pypath, "icons","remove_small.png")), _("Remove"), self.collectorContext) - self.collectorContext.buttons["push"] = QAction(QIcon(join(pypath, "icons","push_small.png")), _("Push to queue"), self.collectorContext) - self.collectorContext.buttons["edit"] = QAction(QIcon(join(pypath, "icons","edit_small.png")), _("Edit Name"), self.collectorContext) - self.collectorContext.buttons["restart"] = QAction(QIcon(join(pypath, "icons","refresh_small.png")), _("Restart"), self.collectorContext) - self.collectorContext.buttons["refresh"] = QAction(QIcon(join(pypath, "icons","refresh1_small.png")),_("Refresh Status"), self.collectorContext) + self.collectorContext.buttons["remove"] = QAction(QIcon(join(pypath, "icons", "remove_small.png")), _("Remove"), self.collectorContext) + self.collectorContext.buttons["push"] = QAction(QIcon(join(pypath, "icons", "push_small.png")), _("Push to queue"), self.collectorContext) + self.collectorContext.buttons["edit"] = QAction(QIcon(join(pypath, "icons", "edit_small.png")), _("Edit Name"), self.collectorContext) + self.collectorContext.buttons["restart"] = QAction(QIcon(join(pypath, "icons", "refresh_small.png")), _("Restart"), self.collectorContext) + self.collectorContext.buttons["refresh"] = QAction(QIcon(join(pypath, "icons", "refresh1_small.png")), _("Refresh Status"), self.collectorContext) self.collectorContext.addAction(self.collectorContext.buttons["push"]) self.collectorContext.addSeparator() - self.collectorContext.buttons["add"] = self.collectorContext.addMenu(QIcon(join(pypath, "icons","add_small.png")), _("Add")) + self.collectorContext.buttons["add"] = self.collectorContext.addMenu(QIcon(join(pypath, "icons", "add_small.png")), _("Add")) self.collectorContext.addAction(self.collectorContext.buttons["edit"]) self.collectorContext.addAction(self.collectorContext.buttons["remove"]) self.collectorContext.addAction(self.collectorContext.buttons["restart"]) @@ -319,9 +319,9 @@ class MainWindow(QMainWindow): self.accountContext = QMenu() self.accountContext.buttons = {} - self.accountContext.buttons["add"] = QAction(QIcon(join(pypath, "icons","add_small.png")), _("Add"), self.accountContext) - self.accountContext.buttons["remove"] = QAction(QIcon(join(pypath, "icons","remove_small.png")), _("Remove"), self.accountContext) - self.accountContext.buttons["edit"] = QAction(QIcon(join(pypath, "icons","edit_small.png")), _("Edit"), self.accountContext) + self.accountContext.buttons["add"] = QAction(QIcon(join(pypath, "icons", "add_small.png")), _("Add"), self.accountContext) + self.accountContext.buttons["remove"] = QAction(QIcon(join(pypath, "icons", "remove_small.png")), _("Remove"), self.accountContext) + self.accountContext.buttons["edit"] = QAction(QIcon(join(pypath, "icons", "edit_small.png")), _("Edit"), self.accountContext) self.accountContext.addAction(self.accountContext.buttons["add"]) self.accountContext.addAction(self.accountContext.buttons["edit"]) self.accountContext.addAction(self.accountContext.buttons["remove"]) diff --git a/module/gui/Overview.py b/module/gui/Overview.py index a7c82e7d0..6c9957eba 100644 --- a/module/gui/Overview.py +++ b/module/gui/Overview.py @@ -154,7 +154,7 @@ class OverviewDelegate(QItemDelegate): else: speedline = QString(formatEta(eta) + " " + _("Speed: %s") % formatSpeed(speed)) - if progress in (0,100): + if progress in (0, 100): sizeline = QString(_("Size:") + "%s" % formatSize(maxSize)) else: sizeline = QString(_("Size:") + "%s / %s" % (formatSize(currentSize), formatSize(maxSize))) diff --git a/module/gui/SettingsWidget.py b/module/gui/SettingsWidget.py index ebe849d48..4e8440667 100644 --- a/module/gui/SettingsWidget.py +++ b/module/gui/SettingsWidget.py @@ -117,7 +117,7 @@ class SettingsWidget(QWidget): elif not item.type.find(";") == -1: i.setCurrentIndex(i.findText(item.value)) elif item.type == "bool": - if True if item.value.lower() in ("1","true", "on", "an","yes") else False: + if True if item.value.lower() in ("1", "true", "on", "an", "yes") else False: i.setCurrentIndex(0) else: i.setCurrentIndex(1) @@ -141,7 +141,7 @@ class SettingsWidget(QWidget): if item.name in widget.inputs: i = widget.inputs[item.name] - #TODO : unresolved reference: option + #TODO: unresolved reference: option if item.type == "int": if i.value() != int(item.value): @@ -150,7 +150,7 @@ class SettingsWidget(QWidget): if i.currentText() != item.value: self.connector.setConfigValue(k, option, i.currentText(), sec) elif item.type == "bool": - if (True if item.value.lower() in ("1","true", "on", "an","yes") else False) ^ (not i.currentIndex()): + if (True if item.value.lower() in ("1", "true", "on", "an", "yes") else False) ^ (not i.currentIndex()): self.connector.setConfigValue(k, option, not i.currentIndex(), sec) else: if i.text() != item.value: @@ -191,7 +191,7 @@ class Section(QGroupBox): i = QComboBox(self) i.addItem(_("Yes"), QVariant(True)) i.addItem(_("No"), QVariant(False)) - if True if option.value.lower() in ("1","true", "on", "an","yes") else False: + if True if option.value.lower() in ("1", "true", "on", "an", "yes") else False: i.setCurrentIndex(0) else: i.setCurrentIndex(1) diff --git a/module/gui/connector.py b/module/gui/connector.py index 68cc531ce..c96389e91 100644 --- a/module/gui/connector.py +++ b/module/gui/connector.py @@ -91,7 +91,7 @@ class Connector(QObject): self.connectionID = uuid().hex if not server_version == SERVER_VERSION: - self.emit(SIGNAL("errorBox"), _("server is version %(new)s client accepts version %(current)s") % { "new": server_version, "current": SERVER_VERSION}) + self.emit(SIGNAL("errorBox"), _("server is version %(new)s client accepts version %(current)s") % {"new": server_version, "current": SERVER_VERSION}) return False return True |