diff options
author | necoro <> | 2007-07-27 01:09:55 +0000 |
---|---|---|
committer | necoro <> | 2007-07-27 01:09:55 +0000 |
commit | d4f5b2c63220e4c659abe08143ed4f2c505157d8 (patch) | |
tree | eb1560d0614347c4080fb5797bec8e72f33ca1ea /portato/gui | |
parent | 3fce3ad6e5f28abcb77b23f72000a3b1e5fb8b55 (diff) | |
download | portato-d4f5b2c63220e4c659abe08143ed4f2c505157d8.tar.gz portato-d4f5b2c63220e4c659abe08143ed4f2c505157d8.tar.bz2 portato-d4f5b2c63220e4c659abe08143ed4f2c505157d8.zip |
changed design / added link
Diffstat (limited to 'portato/gui')
-rw-r--r-- | portato/gui/qt/windows.py | 49 | ||||
-rw-r--r-- | portato/gui/templates/ui/MainWindow.ui | 171 |
2 files changed, 154 insertions, 66 deletions
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('<a href="%(link)s">%(link)s</a>' % { "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 @@ <rect> <x>0</x> <y>0</y> - <width>466</width> + <width>532</width> <height>695</height> </rect> </property> @@ -136,6 +136,25 @@ </widget> </item> <item> + <widget class="QLabel" name="pkgLink" > + <property name="text" > + <string>TextLabel</string> + </property> + <property name="textFormat" > + <enum>Qt::RichText</enum> + </property> + <property name="alignment" > + <set>Qt::AlignCenter</set> + </property> + <property name="openExternalLinks" > + <bool>true</bool> + </property> + <property name="textInteractionFlags" > + <enum>Qt::TextBrowserInteraction</enum> + </property> + </widget> + </item> + <item> <layout class="QHBoxLayout" > <property name="margin" > <number>0</number> @@ -144,18 +163,6 @@ <number>6</number> </property> <item> - <widget class="QComboBox" name="versCombo" > - <property name="sizePolicy" > - <sizepolicy> - <hsizetype>3</hsizetype> - <vsizetype>0</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item> <widget class="QLabel" name="missingLabel" > <property name="sizePolicy" > <sizepolicy> @@ -167,13 +174,29 @@ </property> <property name="text" > <string><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></string> + 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></string> + </property> + <property name="alignment" > + <set>Qt::AlignCenter</set> </property> </widget> </item> <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> <widget class="QLabel" name="notInSysLabel" > <property name="sizePolicy" > <sizepolicy> @@ -186,6 +209,9 @@ p, li { white-space: pre-wrap; } <property name="text" > <string><b>Installed, but not in portage anymore</b></string> </property> + <property name="alignment" > + <set>Qt::AlignCenter</set> + </property> </widget> </item> <item> @@ -239,44 +265,83 @@ p, li { white-space: pre-wrap; } </layout> </item> <item> - <widget class="QTreeWidget" name="useList" > - <property name="horizontalScrollBarPolicy" > - <enum>Qt::ScrollBarAsNeeded</enum> - </property> - <property name="editTriggers" > - <set>QAbstractItemView::NoEditTriggers</set> - </property> - <property name="textElideMode" > - <enum>Qt::ElideNone</enum> - </property> - <property name="rootIsDecorated" > - <bool>true</bool> - </property> - <property name="sortingEnabled" > - <bool>false</bool> - </property> - <property name="allColumnsShowFocus" > - <bool>false</bool> + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> </property> - <property name="columnCount" > - <number>3</number> + <property name="spacing" > + <number>6</number> </property> - <column> - <property name="text" > - <string>1</string> - </property> - </column> - <column> - <property name="text" > - <string>1</string> - </property> - </column> - <column> - <property name="text" > - <string>2</string> - </property> - </column> - </widget> + <item> + <widget class="QListWidget" name="versList" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize" > + <size> + <width>150</width> + <height>16777215</height> + </size> + </property> + <property name="horizontalScrollBarPolicy" > + <enum>Qt::ScrollBarAlwaysOff</enum> + </property> + </widget> + </item> + <item> + <widget class="QTreeWidget" name="useList" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="horizontalScrollBarPolicy" > + <enum>Qt::ScrollBarAlwaysOn</enum> + </property> + <property name="editTriggers" > + <set>QAbstractItemView::NoEditTriggers</set> + </property> + <property name="textElideMode" > + <enum>Qt::ElideNone</enum> + </property> + <property name="rootIsDecorated" > + <bool>true</bool> + </property> + <property name="sortingEnabled" > + <bool>false</bool> + </property> + <property name="allColumnsShowFocus" > + <bool>false</bool> + </property> + <property name="columnCount" > + <number>3</number> + </property> + <column> + <property name="text" > + <string>1</string> + </property> + </column> + <column> + <property name="text" > + <string>1</string> + </property> + </column> + <column> + <property name="text" > + <string>2</string> + </property> + </column> + </widget> + </item> + </layout> </item> <item> <layout class="QHBoxLayout" > @@ -415,7 +480,7 @@ p, li { white-space: pre-wrap; } <rect> <x>0</x> <y>0</y> - <width>466</width> + <width>532</width> <height>31</height> </rect> </property> |