summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbionel <ionel.busuioc@gmail.com>2019-10-06 17:43:10 +0300
committerbionel <ionel.busuioc@gmail.com>2019-10-06 17:43:10 +0300
commit85a3e1ba7cbe637bfbd894d0152aa0995c8b11b5 (patch)
tree89477a877b75df428770adafe99e9d11274901b3
parente3f87d670b32727cc91d0b3654e6da72b469010a (diff)
fix GUI when unable to install packages with same name from different categories
-rw-r--r--src/frontend/gui/sisyphus-gui.py25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/frontend/gui/sisyphus-gui.py b/src/frontend/gui/sisyphus-gui.py
index af98396..3c89200 100644
--- a/src/frontend/gui/sisyphus-gui.py
+++ b/src/frontend/gui/sisyphus-gui.py
@@ -228,25 +228,30 @@ class Sisyphus(QtWidgets.QMainWindow):
self.statusBar().showMessage("I am syncing myself, hope to finish soon ...")
self.updateThread.start()
+ def getSelectedPackages(self):
+ def byRow(e):
+ return e['row']
+
+ pkg_categs = [{'row': pkg.row(), 'cat': pkg.data()} for pkg in self.databaseTable.selectionModel().selectedRows(0)]
+ pkg_names = [{'row': pkg.row(), 'name': pkg.data()} for pkg in self.databaseTable.selectionModel().selectedRows(1)]
+ pkg_categs = sorted(pkg_categs, key=byRow)
+ pkg_names = sorted(pkg_names, key=byRow)
+ selected_pkgs = [pkg_categs[i]['cat'] + '/' + pkg_names[i]['name'] for i in range(len(pkg_categs))]
+ return(selected_pkgs)
+
def packageInstall(self):
- indexes = self.databaseTable.selectionModel().selectedRows(1)
- if len(indexes) == 0:
+ if not self.databaseTable.selectionModel().hasSelection():
self.statusBar().showMessage("No package selected, please pick at least one!")
else:
- Sisyphus.pkgList = []
- for index in sorted(indexes):
- Sisyphus.pkgList.append(index.data())
+ Sisyphus.pkgList = self.getSelectedPackages()
self.statusBar().showMessage("I am installing requested package(s), please wait ...")
self.installThread.start()
def packageUninstall(self):
- indexes = self.databaseTable.selectionModel().selectedRows(1)
- if len(indexes) == 0:
+ if not self.databaseTable.selectionModel().hasSelection():
self.statusBar().showMessage("No package selected, please pick at least one!")
else:
- Sisyphus.pkgList = []
- for index in sorted(indexes):
- Sisyphus.pkgList.append(index.data())
+ Sisyphus.pkgList = self.getSelectedPackages()
self.statusBar().showMessage("I am removing requested package(s), please wait ...")
self.uninstallThread.start()