diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-05-14 15:37:58 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-05-14 15:37:58 +0200 |
commit | 9973f09a616900ab0900974da77d22b566598b5f (patch) | |
tree | 0669cdda0a367e1b53b7286f19b6aaf1b9e4004a /module/gui | |
parent | revert premium account change see #309 (diff) | |
download | pyload-9973f09a616900ab0900974da77d22b566598b5f.tar.xz |
improved some code style issues
Diffstat (limited to 'module/gui')
-rw-r--r-- | module/gui/Collector.py | 2 | ||||
-rw-r--r-- | module/gui/ConnectionManager.py | 19 | ||||
-rw-r--r-- | module/gui/MainWindow.py | 25 | ||||
-rw-r--r-- | module/gui/Overview.py | 4 | ||||
-rw-r--r-- | module/gui/SettingsWidget.py | 6 |
5 files changed, 26 insertions, 30 deletions
diff --git a/module/gui/Collector.py b/module/gui/Collector.py index caeff4460..6b0a54d2f 100644 --- a/module/gui/Collector.py +++ b/module/gui/Collector.py @@ -280,7 +280,7 @@ class CollectorModel(QAbstractItemModel): def hasChildren(self, parent=QModelIndex()): if not parent.isValid(): return True - return (self.rowCount(parent) > 0) + return self.rowCount(parent) > 0 def canFetchMore(self, parent): return False diff --git a/module/gui/ConnectionManager.py b/module/gui/ConnectionManager.py index 51f39f2be..7a7a25f5f 100644 --- a/module/gui/ConnectionManager.py +++ b/module/gui/ConnectionManager.py @@ -213,16 +213,15 @@ class ConnectionManager(QWidget): grid.addWidget(save, 6, 1) self.setLayout(grid) - self.controls = {} - self.controls["name"] = name - self.controls["host"] = host - self.controls["local"] = local - self.controls["user"] = user - self.controls["password"] = password - self.controls["port"] = port - self.controls["save"] = save - self.controls["cancel"] = cancel - + self.controls = {"name": name, + "host": host, + "local": local, + "user": user, + "password": password, + "port": port, + "save": save, + "cancel": cancel} + self.connect(cancel, SIGNAL("clicked()"), self.hide) self.connect(save, SIGNAL("clicked()"), self.slotDone) self.connect(local, SIGNAL("stateChanged(int)"), self.slotLocalChanged) diff --git a/module/gui/MainWindow.py b/module/gui/MainWindow.py index 46f7e54a3..a9ede10c5 100644 --- a/module/gui/MainWindow.py +++ b/module/gui/MainWindow.py @@ -126,15 +126,13 @@ class MainWindow(QMainWindow): #self.statusbar.addPermanentWidget(self.serverStatus) #menu - self.menus = {} - self.menus["file"] = self.menubar.addMenu(_("File")) - self.menus["connections"] = self.menubar.addMenu(_("Connections")) - + self.menus = {"file": self.menubar.addMenu(_("File")), + "connections": self.menubar.addMenu(_("Connections"))} + #menu actions - self.mactions = {} - self.mactions["exit"] = QAction(_("Exit"), self.menus["file"]) - self.mactions["manager"] = QAction(_("Connection manager"), self.menus["connections"]) - + self.mactions = {"exit": QAction(_("Exit"), self.menus["file"]), + "manager": QAction(_("Connection manager"), self.menus["connections"])} + #add menu actions self.menus["file"].addAction(self.mactions["exit"]) self.menus["connections"].addAction(self.mactions["manager"]) @@ -145,12 +143,11 @@ class MainWindow(QMainWindow): #tabs self.tabw = QTabWidget() - self.tabs = {} - self.tabs["overview"] = {"w":QWidget()} - self.tabs["queue"] = {"w":QWidget()} - self.tabs["collector"] = {"w":QWidget()} - self.tabs["accounts"] = {"w":QWidget()} - self.tabs["settings"] = {} + self.tabs = {"overview": {"w": QWidget()}, + "queue": {"w": QWidget()}, + "collector": {"w": QWidget()}, + "accounts": {"w": QWidget()}, + "settings": {}} #self.tabs["settings"]["s"] = QScrollArea() self.tabs["settings"]["w"] = SettingsWidget() #self.tabs["settings"]["s"].setWidgetResizable(True) diff --git a/module/gui/Overview.py b/module/gui/Overview.py index edc2e9ccc..50e9dd618 100644 --- a/module/gui/Overview.py +++ b/module/gui/Overview.py @@ -76,8 +76,8 @@ class OverviewModel(QAbstractListModel): def getProgress(p): for c in p.children: if c.data["status"] == 13: - return (_("Unpacking"), int(c.data["progress"])) - return (_("Downloading"), self.queue.getProgress(p)) + return _("Unpacking"), int(c.data["progress"]) + return _("Downloading"), self.queue.getProgress(p) d = self.queue._data for p in d: diff --git a/module/gui/SettingsWidget.py b/module/gui/SettingsWidget.py index 7218cc570..8123fe139 100644 --- a/module/gui/SettingsWidget.py +++ b/module/gui/SettingsWidget.py @@ -118,7 +118,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) @@ -149,7 +149,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: @@ -190,7 +190,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) |