diff options
| author | 2010-11-19 14:15:17 +0100 | |
|---|---|---|
| committer | 2010-11-19 14:15:17 +0100 | |
| commit | c881b83f107e3c5b28bfcc06508d4db128d37e20 (patch) | |
| tree | fd3a463b0f5bf3ee45fdfa30db4270609c78dbf3 /module/gui | |
| parent | closed #153 (diff) | |
| download | pyload-c881b83f107e3c5b28bfcc06508d4db128d37e20.tar.xz | |
sharecx fix and gui package edit
Diffstat (limited to 'module/gui')
| -rw-r--r-- | module/gui/MainWindow.py | 27 | ||||
| -rw-r--r-- | module/gui/PackageDock.py | 39 | ||||
| -rw-r--r-- | module/gui/connector.py | 2 | 
3 files changed, 54 insertions, 14 deletions
| diff --git a/module/gui/MainWindow.py b/module/gui/MainWindow.py index 03590ac2d..60b6e2033 100644 --- a/module/gui/MainWindow.py +++ b/module/gui/MainWindow.py @@ -259,7 +259,7 @@ class MainWindow(QMainWindow):          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["edit"] = QAction(QIcon(join(pypath, "icons","edit_small.png")), _("Edit"), 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"]) @@ -317,6 +317,7 @@ class MainWindow(QMainWindow):              show new-package dock          """          self.tabw.setCurrentIndex(1) +        self.newPackDock.fillWithPackage(None)          self.newPackDock.show()      def slotShowAddLinks(self): @@ -334,12 +335,12 @@ class MainWindow(QMainWindow):          """          self.emit(SIGNAL("connector")) -    def slotAddPackage(self, name, links): +    def slotAddPackage(self, name, links, password=None, id=None):          """              new package              let main to the stuff          """ -        self.emit(SIGNAL("addPackage"), name, links) +        self.emit(SIGNAL("addPackage"), name, links, password, id)      def slotShowAddContainer(self):          """ @@ -508,11 +509,25 @@ class MainWindow(QMainWindow):          self.emit(SIGNAL("setClipboardStatus"), status)      def slotEditPackage(self): +        # in Queue, only edit name          if self.activeMenu == self.queueContext:              view = self.tabs["queue"]["view"] -        else: -            view = self.tabs["collector"]["package_view"] -        view.edit(self.activeMenu.index) +            view.edit(self.activeMenu.index) +            return + +        # in collector, edit entire package, this requires deleting the old one +        # and creating a new one, all progress will be lost +        pId = self.activeMenu.index.internalPointer().id +         +        packData = self.connector.getPackageInfo(pId) +        packData["id"] = pId +        links = [] +        for fId in packData["links"]: +            links.append( self.connector.getLinkInfo(fId)[fId]["url"] ) +        packData["links"] = links +         +        self.newPackDock.fillWithPackage(packData) +        self.newPackDock.show()      def slotEditCommit(self, editor):          self.emit(SIGNAL("changePackageName"), self.activeMenu.index.internalPointer().id, editor.text()) diff --git a/module/gui/PackageDock.py b/module/gui/PackageDock.py index 8bd965f16..e29c624a2 100644 --- a/module/gui/PackageDock.py +++ b/module/gui/PackageDock.py @@ -27,18 +27,38 @@ class NewPackageDock(QDockWidget):          self.setWidget(self.widget)          self.setAllowedAreas(Qt.RightDockWidgetArea|Qt.LeftDockWidgetArea)          self.hide() +         +        self.currentPackId = None +         +    def fillWithPackage(self, packData=None): +        if not packData: +            self.widget.nameInput.setText("") +            self.widget.passwordInput.setText("") +            self.widget.box.clear() +            self.currentPackId = None +            return +         +        self.widget.box.setPlainText("\n".join(packData["links"])) +        self.widget.nameInput.setText(packData["name"]) +        self.widget.passwordInput.setText(packData["password"]) +        self.currentPackId = packData["id"]      def slotDone(self):          text = str(self.widget.box.toPlainText()) +        pw   = str(self.widget.passwordInput.text()) +        if not pw: +            pw = None          lines = []          for line in text.splitlines():              line = line.strip()              if not line:                  continue              lines.append(line) -        self.emit(SIGNAL("done"), str(self.widget.nameInput.text()), lines) -        self.widget.nameInput.setText("") -        self.widget.box.clear() +        self.emit(SIGNAL("done"), str(self.widget.nameInput.text()), lines, pw, self.currentPackId) +        # self.widget.nameInput.setText("") +        # self.widget.passwordInput.setText("") +        # self.widget.box.clear() +        #self.currentPackId = None          self.hide()  class NewPackageWindow(QWidget): @@ -50,18 +70,23 @@ class NewPackageWindow(QWidget):          nameLabel = QLabel(_("Name"))          nameInput = QLineEdit() +        passwordLabel = QLabel(_("Password")) +        passwordInput = QLineEdit()          linksLabel = QLabel(_("Links in this Package"))          self.box = QTextEdit()          self.nameInput = nameInput +        self.passwordInput = passwordInput -        save = QPushButton(_("Create")) +        save = QPushButton(_("Save"))          layout.addWidget(nameLabel, 0, 0)          layout.addWidget(nameInput, 0, 1) -        layout.addWidget(linksLabel, 1, 0, 1, 2) -        layout.addWidget(self.box, 2, 0, 1, 2) -        layout.addWidget(save, 3, 0, 1, 2) +        layout.addWidget(passwordLabel, 1, 0) +        layout.addWidget(passwordInput, 1, 1) +        layout.addWidget(linksLabel, 2, 0, 1, 2) +        layout.addWidget(self.box, 3, 0, 1, 2) +        layout.addWidget(save, 4, 0, 1, 2)          self.connect(save, SIGNAL("clicked()"), self.dock.slotDone) diff --git a/module/gui/connector.py b/module/gui/connector.py index 485578bbe..8417b888e 100644 --- a/module/gui/connector.py +++ b/module/gui/connector.py @@ -119,7 +119,7 @@ class Connector(QThread):          """              grab file info for the given id and return it          """ -        w = self.proxy.get_file_info +        w = self.proxy.get_file_data          w.error = False          info = w(id)          if not info: return None | 
