diff options
Diffstat (limited to 'module/gui')
-rw-r--r-- | module/gui/CaptchaDock.py | 6 | ||||
-rw-r--r-- | module/gui/ConnectionManager.py | 26 | ||||
-rw-r--r-- | module/gui/MainWindow.py | 63 | ||||
-rw-r--r-- | module/gui/PWInputWindow.py | 6 | ||||
-rw-r--r-- | module/gui/PackageDock.py | 8 | ||||
-rw-r--r-- | module/gui/Queue.py | 18 | ||||
-rw-r--r-- | module/gui/connector.py | 2 |
7 files changed, 67 insertions, 62 deletions
diff --git a/module/gui/CaptchaDock.py b/module/gui/CaptchaDock.py index 8a7e8010e..4f3c9efd0 100644 --- a/module/gui/CaptchaDock.py +++ b/module/gui/CaptchaDock.py @@ -22,7 +22,7 @@ from PyQt4.QtGui import * class CaptchaDock(QDockWidget): def __init__(self): - QDockWidget.__init__(self, "Captcha") + QDockWidget.__init__(self, _("Captcha")) self.setObjectName("Captcha Dock") self.widget = CaptchaDockWidget(self) self.setWidget(self.widget) @@ -53,8 +53,8 @@ class CaptchaDockWidget(QWidget): imgLabel = QLabel() captchaInput = QLineEdit() - okayButton = QPushButton("OK") - cancelButton = QPushButton("Cancel") + okayButton = QPushButton(_("OK")) + cancelButton = QPushButton(_("Cancel")) layout.addStretch() layout.addWidget(imgLabel) diff --git a/module/gui/ConnectionManager.py b/module/gui/ConnectionManager.py index 57aed3a18..29e95f637 100644 --- a/module/gui/ConnectionManager.py +++ b/module/gui/ConnectionManager.py @@ -30,10 +30,10 @@ class ConnectionManager(QWidget): connList = QListWidget() - new = QPushButton("New") - edit = QPushButton("Edit") - remove = QPushButton("Remove") - connect = QPushButton("Connect") + new = QPushButton(_("New")) + edit = QPushButton(_("Edit")) + remove = QPushButton(_("Remove")) + connect = QPushButton(_("Connect")) mainLayout.addWidget(connList) mainLayout.addLayout(buttonLayout) @@ -73,7 +73,7 @@ class ConnectionManager(QWidget): item.setData(Qt.UserRole, QVariant(conn)) self.connList.addItem(item) if conn["default"]: - item.setData(Qt.DisplayRole, QVariant("%s (Default)" % conn["name"])) + item.setData(Qt.DisplayRole, QVariant(_("%s (Default)") % conn["name"])) self.connList.setCurrentItem(item) def slotNew(self): @@ -135,12 +135,12 @@ class ConnectionManager(QWidget): grid = QGridLayout() - nameLabel = QLabel("Name:") - hostLabel = QLabel("Host:") - sslLabel = QLabel("SSL:") - localLabel = QLabel("Local:") - userLabel = QLabel("User:") - portLabel = QLabel("Port:") + nameLabel = QLabel(_("Name:")) + hostLabel = QLabel(_("Host:")) + sslLabel = QLabel(_("SSL:")) + localLabel = QLabel(_("Local:")) + userLabel = QLabel(_("User:")) + portLabel = QLabel(_("Port:")) name = QLineEdit() host = QLineEdit() @@ -150,8 +150,8 @@ class ConnectionManager(QWidget): port = QSpinBox() port.setRange(1,10000) - save = QPushButton("Save") - cancel = QPushButton("Cancel") + save = QPushButton(_("Save")) + cancel = QPushButton(_("Cancel")) grid.addWidget(nameLabel, 0, 0) grid.addWidget(name, 0, 1) diff --git a/module/gui/MainWindow.py b/module/gui/MainWindow.py index 250b701e4..16a409f64 100644 --- a/module/gui/MainWindow.py +++ b/module/gui/MainWindow.py @@ -30,7 +30,7 @@ class MainWindow(QMainWindow): """ QMainWindow.__init__(self) #window stuff - self.setWindowTitle("pyLoad Client") + self.setWindowTitle(_("pyLoad Client")) self.setWindowIcon(QIcon("icons/logo.png")) self.resize(850,500) @@ -57,18 +57,18 @@ class MainWindow(QMainWindow): self.menubar = self.menuBar() self.statusbar = self.statusBar() self.connect(self.statusbar, SIGNAL("showMsg"), self.statusbar.showMessage) - self.serverStatus = QLabel("Status: Not Connected") + self.serverStatus = QLabel(_("Status: Not Connected")) 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")) + self.menus["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"]) + self.mactions["manager"] = QAction(_("Connection manager"), self.menus["connections"]) #add menu actions self.menus["file"].addAction(self.mactions["exit"]) @@ -85,10 +85,10 @@ class MainWindow(QMainWindow): self.tabs["collector"] = {"w":QWidget()} self.tabs["settings"] = {"w":QWidget()} self.tabs["log"] = {"w":QWidget()} - self.tabw.addTab(self.tabs["queue"]["w"], "Queue") - self.tabw.addTab(self.tabs["collector"]["w"], "Collector") - self.tabw.addTab(self.tabs["settings"]["w"], "Settings") - self.tabw.addTab(self.tabs["log"]["w"], "Log") + self.tabw.addTab(self.tabs["queue"]["w"], _("Queue")) + self.tabw.addTab(self.tabs["collector"]["w"], _("Collector")) + self.tabw.addTab(self.tabs["settings"]["w"], _("Settings")) + self.tabw.addTab(self.tabs["log"]["w"], _("Log")) self.tabw.setTabEnabled(2, False) #init tabs @@ -114,29 +114,29 @@ class MainWindow(QMainWindow): """ create toolbar """ - self.toolbar = self.addToolBar("Main Toolbar") + self.toolbar = self.addToolBar(_("Main Toolbar")) self.toolbar.setObjectName("Main Toolbar") self.toolbar.setIconSize(QSize(40,40)) - self.actions["toggle_status"] = self.toolbar.addAction("Toggle Pause/Resume") + self.actions["toggle_status"] = self.toolbar.addAction(_("Toggle Pause/Resume")) pricon = QIcon() pricon.addFile("icons/gui/toolbar_start.png", QSize(), QIcon.Normal, QIcon.Off) pricon.addFile("icons/gui/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("icons/gui/toolbar_stop.png"), "Stop") + self.actions["status_stop"] = self.toolbar.addAction(QIcon("icons/gui/toolbar_stop.png"), _("Stop")) self.toolbar.addSeparator() - self.actions["add"] = self.toolbar.addAction(QIcon("icons/gui/toolbar_add.png"), "Add") + self.actions["add"] = self.toolbar.addAction(QIcon("icons/gui/toolbar_add.png"), _("Add")) self.toolbar.addSeparator() - self.actions["clipboard"] = self.toolbar.addAction(QIcon("icons/gui/clipboard.png"), "Check Clipboard") + self.actions["clipboard"] = self.toolbar.addAction(QIcon("icons/gui/clipboard.png"), _("Check Clipboard")) self.actions["clipboard"].setCheckable(True) self.connect(self.actions["toggle_status"], SIGNAL("toggled(bool)"), self.slotToggleStatus) self.connect(self.actions["clipboard"], SIGNAL("toggled(bool)"), self.slotToggleClipboard) self.connect(self.actions["status_stop"], SIGNAL("triggered()"), self.slotStatusStop) self.addMenu = QMenu() - packageAction = self.addMenu.addAction("Package") - linkAction = self.addMenu.addAction("Links") - containerAction = self.addMenu.addAction("Container") + packageAction = self.addMenu.addAction(_("Package")) + linkAction = self.addMenu.addAction(_("Links")) + containerAction = self.addMenu.addAction(_("Container")) self.connect(self.actions["add"], SIGNAL("triggered()"), self.slotAdd) self.connect(packageAction, SIGNAL("triggered()"), self.slotShowAddPackage) self.connect(linkAction, SIGNAL("triggered()"), self.slotShowAddLinks) @@ -153,9 +153,9 @@ class MainWindow(QMainWindow): self.tabs["queue"]["l"].addWidget(self.tabs["queue"]["view"]) #collector - groupPackage = QGroupBox("Packages") + groupPackage = QGroupBox(_("Packages")) groupPackage.setLayout(QVBoxLayout()) - toQueue = QPushButton("Push selected packages to queue") + toQueue = QPushButton(_("Push selected packages to queue")) self.tabs["collector"]["l"] = QGridLayout() self.tabs["collector"]["w"].setLayout(self.tabs["collector"]["l"]) self.tabs["collector"]["package_view"] = QTreeWidget() @@ -188,9 +188,9 @@ class MainWindow(QMainWindow): self.queueContext = QMenu() self.queueContext.buttons = {} self.queueContext.item = (None, None) - self.queueContext.buttons["remove"] = QAction(QIcon("icons/gui/remove_small.png"), "Remove", self.queueContext) - self.queueContext.buttons["restart"] = QAction(QIcon("icons/gui/refresh_small.png"), "Restart", self.queueContext) - self.queueContext.buttons["pull"] = QAction(QIcon("icons/gui/pull_small.png"), "Pull out", self.queueContext) + self.queueContext.buttons["remove"] = QAction(QIcon("icons/gui/remove_small.png"), _("Remove"), self.queueContext) + self.queueContext.buttons["restart"] = QAction(QIcon("icons/gui/refresh_small.png"), _("Restart"), self.queueContext) + self.queueContext.buttons["pull"] = QAction(QIcon("icons/gui/pull_small.png"), _("Pull out"), self.queueContext) self.queueContext.addAction(self.queueContext.buttons["pull"]) self.queueContext.addAction(self.queueContext.buttons["remove"]) self.queueContext.addAction(self.queueContext.buttons["restart"]) @@ -202,9 +202,9 @@ class MainWindow(QMainWindow): self.collectorContext = QMenu() self.collectorContext.buttons = {} self.collectorContext.item = (None, None) - self.collectorContext.buttons["remove"] = QAction(QIcon("icons/gui/remove_small.png"), "Remove", self.collectorContext) - self.collectorContext.buttons["push"] = QAction(QIcon("icons/gui/push_small.png"), "Push to queue", self.collectorContext) - self.collectorContext.buttons["edit"] = QAction(QIcon("icons/gui/edit_small.png"), "Edit Name", self.collectorContext) + self.collectorContext.buttons["remove"] = QAction(QIcon("icons/gui/remove_small.png"), _("Remove"), self.collectorContext) + self.collectorContext.buttons["push"] = QAction(QIcon("icons/gui/push_small.png"), _("Push to queue"), self.collectorContext) + self.collectorContext.buttons["edit"] = QAction(QIcon("icons/gui/edit_small.png"), _("Edit Name"), self.collectorContext) self.collectorContext.addAction(self.collectorContext.buttons["push"]) self.collectorContext.addAction(self.collectorContext.buttons["edit"]) self.collectorContext.addAction(self.collectorContext.buttons["remove"]) @@ -273,7 +273,14 @@ class MainWindow(QMainWindow): action from add-menu show file selector, emit upload """ - fileNames = QFileDialog.getOpenFileNames(self, "Container Öffnen", "", "All Container Types (*.dlc *.ccf *.rsdf *.txt);;DLC (*.dlc);;CCF (*.ccf);;RSDF (*.rsdf);;Text Files (*.txt)") + typeStr = ";;".join([ + _("All Container Types (%s)") % "*.dlc *.ccf *.rsdf *.txt", + _("DLC (%s)") % "*.dlc", + _("CCF (%s)") % "*.ccf", + _("RSDF (%s)") % "*.rsdf", + _("Text Files (%s)") % "*.txt" + ]) + fileNames = QFileDialog.getOpenFileNames(self, _("Open container"), "", typeStr) for name in fileNames: self.emit(SIGNAL("addContainer"), str(name)) @@ -296,7 +303,7 @@ class MainWindow(QMainWindow): ids = [] for child in pack.getChildren(): ids.append(child.getFileData()["id"]) - self.emit(SIGNAL("addPackage"), "Single Links", ids) + self.emit(SIGNAL("addPackage"), _("Single Links"), ids) id = self.lastAddedID self.emit(SIGNAL("pushPackageToQueue"), id) diff --git a/module/gui/PWInputWindow.py b/module/gui/PWInputWindow.py index 4fc834c4f..e2b82e384 100644 --- a/module/gui/PWInputWindow.py +++ b/module/gui/PWInputWindow.py @@ -24,9 +24,9 @@ class PWInputWindow(QWidget): QWidget.__init__(self) self.input = QLineEdit() self.input.setEchoMode(QLineEdit.Password) - label = QLabel("Password:") - ok = QPushButton("OK") - cancel = QPushButton("Cancel") + label = QLabel(_("Password:")) + ok = QPushButton(_("OK")) + cancel = QPushButton(_("Cancel")) grid = QGridLayout() grid.addWidget(label, 0, 0, 1, 2) grid.addWidget(self.input, 1, 0, 1, 2) diff --git a/module/gui/PackageDock.py b/module/gui/PackageDock.py index c81798935..fec5466c2 100644 --- a/module/gui/PackageDock.py +++ b/module/gui/PackageDock.py @@ -21,7 +21,7 @@ from PyQt4.QtGui import * class NewPackageDock(QDockWidget): def __init__(self): - QDockWidget.__init__(self, "New Package") + QDockWidget.__init__(self, _("New Package")) self.setObjectName("New Package Dock") self.widget = NewPackageWindow(self) self.setWidget(self.widget) @@ -47,10 +47,10 @@ class NewPackageWindow(QWidget): self.setLayout(QGridLayout()) layout = self.layout() - nameLabel = QLabel("Name") + nameLabel = QLabel(_("Name")) nameInput = QLineEdit() - linksLabel = QLabel("Links in this Package") + linksLabel = QLabel(_("Links in this Package")) linkView = QTreeWidget() linkView.setSelectionBehavior(QAbstractItemView.SelectRows) linkView.setSelectionMode(QAbstractItemView.ExtendedSelection) @@ -65,7 +65,7 @@ class NewPackageWindow(QWidget): self.view = linkView self.nameInput = nameInput - save = QPushButton("Create") + save = QPushButton(_("Create")) layout.addWidget(nameLabel, 0, 0) layout.addWidget(nameInput, 0, 1) diff --git a/module/gui/Queue.py b/module/gui/Queue.py index bd45e27dc..2aeb603b0 100644 --- a/module/gui/Queue.py +++ b/module/gui/Queue.py @@ -68,7 +68,6 @@ class Queue(QObject): def update(self): locker = QMutexLocker(self.mutex) - packs = self.connector.getPackageQueue() downloading_raw = self.connector.getDownloadQueue() downloading = {} for d in downloading_raw: @@ -93,16 +92,15 @@ class Queue(QObject): packs = self.connector.getPackageQueue() for data in packs: pack = self.QueuePack(self) - pack.setPackData(data) - files = self.connector.getPackageFiles(data["id"]) - for fid in files: - info = self.connector.getLinkInfo(fid) + pack.setPackData(data["data"]) + files = data["children"] + for fdata in files: child = self.QueueFile(self, pack) - if not info["status_type"]: - info["status_type"] = "queued" - child.setFileData(info) - pack.addPackChild(fid, child) - self.addPack(data["id"], pack) + if not fdata["status_type"]: + fdata["status_type"] = "queued" + child.setFileData(fdata) + pack.addPackChild(fdata["id"], child) + self.addPack(data["data"]["id"], pack) def addEvent(self, event): locker = QMutexLocker(self.mutex) diff --git a/module/gui/connector.py b/module/gui/connector.py index b6c383956..7b872a0a9 100644 --- a/module/gui/connector.py +++ b/module/gui/connector.py @@ -154,7 +154,7 @@ class connector(QThread): """ self.mutex.lock() try: - return self.proxy.get_queue() + return self.proxy.get_full_queue() except Exception, e: self.emit(SIGNAL("proxy_error"), "getPackageQueue", e) finally: |