diff options
Diffstat (limited to 'portato/gui')
-rw-r--r-- | portato/gui/qt/windows.py | 47 | ||||
-rw-r--r-- | portato/gui/templates/ui/MainWindow.ui | 8 | ||||
-rw-r--r-- | portato/gui/templates/ui/UpdateDialog.ui | 93 |
3 files changed, 145 insertions, 3 deletions
diff --git a/portato/gui/qt/windows.py b/portato/gui/qt/windows.py index 9f91109..3996563 100644 --- a/portato/gui/qt/windows.py +++ b/portato/gui/qt/windows.py @@ -140,6 +140,45 @@ class SearchDialog (Window): self.done(0) self.jumpTo(s) +class UpdateDialog (Window): + """Dialog showing updateble packages.""" + __metaclass__ = WindowMeta + + def __init__ (self, parent, packages, queue, jump_to): + Window.__init__(self, parent) + + self.queue = queue + self.jump = jump_to + + self.packages = system.sort_package_list(packages) + for p in self.packages: + Qt.QListWidgetItem(p.get_cpv(), self.packageList) + + self.adjustSize() + + @Qt.pyqtSignature("QListWidgetItem*, QListWidgetItem*") + def on_packageList_currentItemChanged (self, index, prev): + cpv = str(index.text()) + pkg = system.new_package(cpv) + self.jump(pkg.get_cp(), pkg.get_version()) + + @Qt.pyqtSignature("") + def on_installAllBtn_clicked (self): + world = [x.get_cp() for x in system.find_all_world_packages()] + for p in self.packages: + not_in_world = p.get_cp() not in world + try: + try: + self.queue.append(p.get_cpv(), unmerge = False, oneshot = not_in_world) + except PackageNotFoundException, e: + if unmask_dialog(self, e[0]) == Qt.QMessageBox.Yes : + self.queue.append(p.get_cpv(), unmerge = False, unmask = True, oneshot = not_in_world) + + except BlockedException, e: + blocked_dialog(self, e[0], e[1]) + + self.accept() + class EbuildDialog (Window): """Window showing an ebuild.""" __metaclass__ = WindowMeta @@ -691,9 +730,9 @@ class MainWindow (Window): self.tabWidget.setTabText(self.CONSOLE_PAGE, title) - def jump_to (self, cp): + def jump_to (self, cp, version = None): """Is called when we want to jump to a specific package.""" - self.pkgDetails.update(cp, self.queue) + self.pkgDetails.update(cp, self.queue, version = version) def fill_pkg_list (self, cat): use_icons = self.cfg.get_boolean("pkgIcons", section = "QT") @@ -787,6 +826,10 @@ class MainWindow (Window): self.queue.sync() @Qt.pyqtSignature("") + def on_updateListAction_triggered (self): + Window.watch_cursor(UpdateDialog)(self, system.get_updated_packages(), self.queue, self.jump_to).exec_() + + @Qt.pyqtSignature("") def on_oneshotAction_triggered (self): current = self.queueList.currentItem() diff --git a/portato/gui/templates/ui/MainWindow.ui b/portato/gui/templates/ui/MainWindow.ui index cd7b40c..e2eb0dc 100644 --- a/portato/gui/templates/ui/MainWindow.ui +++ b/portato/gui/templates/ui/MainWindow.ui @@ -416,7 +416,7 @@ p, li { white-space: pre-wrap; } <x>0</x> <y>0</y> <width>466</width> - <height>27</height> + <height>31</height> </rect> </property> <widget class="QMenu" name="fileMenu" > @@ -441,6 +441,7 @@ p, li { white-space: pre-wrap; } <addaction name="emergeAction" /> <addaction name="unmergeAction" /> <addaction name="updateAction" /> + <addaction name="updateListAction" /> <addaction name="separator" /> <addaction name="syncAction" /> <addaction name="saveAction" /> @@ -534,6 +535,11 @@ p, li { white-space: pre-wrap; } <string>Sort by Name</string> </property> </action> + <action name="updateListAction" > + <property name="text" > + <string>Show &new packages</string> + </property> + </action> </widget> <customwidgets> <customwidget> diff --git a/portato/gui/templates/ui/UpdateDialog.ui b/portato/gui/templates/ui/UpdateDialog.ui new file mode 100644 index 0000000..b783182 --- /dev/null +++ b/portato/gui/templates/ui/UpdateDialog.ui @@ -0,0 +1,93 @@ +<ui version="4.0" > + <class>UpdateDialog</class> + <widget class="QDialog" name="UpdateDialog" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>372</height> + </rect> + </property> + <property name="windowTitle" > + <string>Update List</string> + </property> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QListWidget" name="packageList" > + <property name="alternatingRowColors" > + <bool>true</bool> + </property> + <property name="horizontalScrollMode" > + <enum>QAbstractItemView::ScrollPerPixel</enum> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QPushButton" name="closeBtn" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Close</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="installAllBtn" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Install all</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>closeBtn</sender> + <signal>clicked()</signal> + <receiver>UpdateDialog</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel" > + <x>117</x> + <y>352</y> + </hint> + <hint type="destinationlabel" > + <x>140</x> + <y>368</y> + </hint> + </hints> + </connection> + </connections> +</ui> |