From d4f5b2c63220e4c659abe08143ed4f2c505157d8 Mon Sep 17 00:00:00 2001 From: necoro <> Date: Fri, 27 Jul 2007 01:09:55 +0000 Subject: changed design / added link --- portato.desktop | 7 ++ portato/gui/qt/windows.py | 49 +++++++--- portato/gui/templates/ui/MainWindow.ui | 171 +++++++++++++++++++++++---------- portato_gtk.desktop | 7 -- 4 files changed, 161 insertions(+), 73 deletions(-) create mode 100644 portato.desktop delete mode 100644 portato_gtk.desktop diff --git a/portato.desktop b/portato.desktop new file mode 100644 index 0000000..d5f503a --- /dev/null +++ b/portato.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Name=Portato (Gtk) +Icon=portato-icon +Exec=gksu -D "Portato (GTK)" -u root portato gtk +StartupNotify=true +Type=Application +Categories=Application;System;PackageManager diff --git a/portato/gui/qt/windows.py b/portato/gui/qt/windows.py index ba4dcc5..539a0f7 100644 --- a/portato/gui/qt/windows.py +++ b/portato/gui/qt/windows.py @@ -33,6 +33,7 @@ from dialogs import * from helper import qCheck, qIsChecked import types, logging +from subprocess import Popen UI_DIR = DATA_DIR+"ui/" @@ -339,7 +340,7 @@ class PreferenceWindow (Window): self.fontBtn.setText(self.consoleFontFam+" "+self.consoleFontSize) Qt.QObject.connect(self, Qt.SIGNAL("accepted()"), self.finish) - + def _save (self): """Sets all options in the Config-instance.""" @@ -385,7 +386,7 @@ class PackageDetails: self.window.installedCheck.blockSignals(True) # combo - Qt.QObject.connect(self.window.versCombo, Qt.SIGNAL("currentIndexChanged(int)"), self.cb_combo_changed) + Qt.QObject.connect(self.window.versList, Qt.SIGNAL("currentRowChanged(int)"), self.cb_combo_changed) # buttons Qt.QObject.connect(self.window.pkgEmergeBtn, Qt.SIGNAL("clicked()"), self.cb_emerge_clicked) @@ -427,11 +428,14 @@ class PackageDetails: self.instantChange = instantChange # packages and installed packages - self.packages = system.sort_package_list(system.find_packages(cp, masked = True)) - self.instPackages = system.sort_package_list(system.find_installed_packages(cp, masked = True)) + if not self.doEmerge: + self.instPackages = self.packages = system.find_packages("=%s-%s" % (cp, version), masked = True) + else: + self.packages = system.sort_package_list(system.find_packages(cp, masked = True)) + self.instPackages = system.sort_package_list(system.find_installed_packages(cp, masked = True)) # comboBox - self.set_combo() + self.set_vers_list() # disable buttons when emerging is not allowed if not self.queue or not self.doEmerge: @@ -459,12 +463,31 @@ class PackageDetails: self.window.descLabel.setText(desc) self.window.nameLabel.setText(name) + self.window.pkgLink.setText('%(link)s' % { "link" : self.actual_package().get_package_settings("HOMEPAGE")}) - def set_combo (self): + def set_vers_list (self): """Fills the version combo box with the right items and selects the correct one.""" - self.window.versCombo.clear() - self.window.versCombo.addItems([x.get_version() for x in self.packages]) + use_icons = self.window.cfg.get_boolean("pkgIcons", section = "QT") + + # installed icon + if use_icons: + yes = Qt.QApplication.style().standardIcon(Qt.QStyle.SP_DialogYesButton) + no = Qt.QApplication.style().standardIcon(Qt.QStyle.SP_DialogNoButton) + + self.window.versList.clear() + + for vers, inst in [(x.get_version(), x.is_installed()) for x in self.packages]: + if use_icons: + if inst: + icon = yes + else: + icon = no + Qt.QListWidgetItem(icon, vers, self.window.versList) + else: # use checkboxes + item = Qt.QListWidgetItem(vers, self.window.versList) + item.setCheckState(qCheck(inst)) + item.setFlags(Qt.Qt.ItemIsSelectable | Qt.Qt.ItemIsEnabled) try: best_version = "" @@ -475,9 +498,9 @@ class PackageDetails: for i in range(len(self.packages)): if self.packages[i].get_version() == best_version: - self.window.versCombo.setCurrentIndex(i) + self.window.versList.setCurrentRow(i) except AttributeError: - self.window.versCombo.setCurrentIndex(0) + self.window.versList.setCurrentRow(0) def build_use_list (self): """Builds the list of use flags.""" @@ -527,7 +550,7 @@ class PackageDetails: @returns: the actual selected package @rtype: backend.Package""" - return self.packages[self.window.versCombo.currentIndex()] + return self.packages[self.window.versList.currentIndex().row()] def cb_ebuild_clicked (self): hook = plugin.hook("open_ebuild", package = self.actual_package(), parent = self.window) @@ -790,7 +813,7 @@ class MainWindow (Window): # set emerge queue self.queue = EmergeQueue(console = self.console, tree = self.queueTree, db = self.db, title_update = self.title_update) - self.show() + self.showMaximized() def title_update (self, title): self.emit(Qt.SIGNAL("doTitleUpdate"), title) @@ -884,7 +907,7 @@ class MainWindow (Window): @Qt.pyqtSignature("") def on_prefAction_triggered (self): - PreferenceWindow(self, self.cfg).exec_() + PreferenceWindow(self, self.cfg).show() # set font as it might has changed self.console.setCurrentFont(Qt.QFont(self.cfg.get("consolefontfamily", "QT"), int(self.cfg.get("consolefontsize", "QT")))) diff --git a/portato/gui/templates/ui/MainWindow.ui b/portato/gui/templates/ui/MainWindow.ui index 0011ead..40315cd 100644 --- a/portato/gui/templates/ui/MainWindow.ui +++ b/portato/gui/templates/ui/MainWindow.ui @@ -5,7 +5,7 @@ 0 0 - 466 + 532 695 @@ -135,6 +135,25 @@ + + + + TextLabel + + + Qt::RichText + + + Qt::AlignCenter + + + true + + + Qt::TextBrowserInteraction + + + @@ -143,18 +162,6 @@ 6 - - - - - 3 - 0 - 0 - 0 - - - - @@ -167,12 +174,28 @@ <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600; color:#ff0000;">MISSING KEYWORD</span></p></body></html> + p, li { white-space: pre-wrap; } + </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> + <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600; color:#ff0000;">MISSING KEYWORD</span></p></body></html> + + + Qt::AlignCenter + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -186,6 +209,9 @@ p, li { white-space: pre-wrap; } <b>Installed, but not in portage anymore</b> + + Qt::AlignCenter + @@ -239,44 +265,83 @@ p, li { white-space: pre-wrap; } - - - Qt::ScrollBarAsNeeded - - - QAbstractItemView::NoEditTriggers - - - Qt::ElideNone - - - true - - - false - - - false + + + 0 - - 3 + + 6 - - - 1 - - - - - 1 - - - - - 2 - - - + + + + + 0 + 7 + 0 + 0 + + + + + 150 + 16777215 + + + + Qt::ScrollBarAlwaysOff + + + + + + + + 3 + 7 + 0 + 0 + + + + Qt::ScrollBarAlwaysOn + + + QAbstractItemView::NoEditTriggers + + + Qt::ElideNone + + + true + + + false + + + false + + + 3 + + + + 1 + + + + + 1 + + + + + 2 + + + + + @@ -415,7 +480,7 @@ p, li { white-space: pre-wrap; } 0 0 - 466 + 532 31 diff --git a/portato_gtk.desktop b/portato_gtk.desktop deleted file mode 100644 index d5f503a..0000000 --- a/portato_gtk.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Name=Portato (Gtk) -Icon=portato-icon -Exec=gksu -D "Portato (GTK)" -u root portato gtk -StartupNotify=true -Type=Application -Categories=Application;System;PackageManager -- cgit v1.2.3