diff options
Diffstat (limited to 'portato')
-rw-r--r-- | portato/gui/gtk/windows.py | 27 | ||||
-rw-r--r-- | portato/gui/gui_helper.py | 18 | ||||
-rw-r--r-- | portato/gui/qt/windows.py | 9 | ||||
-rw-r--r-- | portato/gui/templates/portato.glade | 419 | ||||
-rw-r--r-- | portato/gui/templates/ui/MainWindow.ui | 16 |
5 files changed, 283 insertions, 206 deletions
diff --git a/portato/gui/gtk/windows.py b/portato/gui/gtk/windows.py index ffeb01f..2f06bc0 100644 --- a/portato/gui/gtk/windows.py +++ b/portato/gui/gtk/windows.py @@ -108,16 +108,20 @@ class AboutWindow (AbstractDialog): AbstractDialog.__init__(self, parent) - label = self.tree.get_widget("aboutLabel") - label.set_markup(""" + img = self.tree.get_widget("portatoImage") + img.set_from_file(APP_ICON) + + hlabel = self.tree.get_widget("highAboutLabel") + hlabel.set_markup(""" <big><b>Portato v.%s</b></big> -A Portage-GUI - -This software is licensed under the terms of the GPLv2. +A Portage-GUI""" % VERSION) + + llabel = self.tree.get_widget("lowAboutLabel") + llabel.set_markup("""This software is licensed under the terms of the GPLv2. Copyright (C) 2006-2007 René 'Necoro' Neumann <necoro@necoro.net> Icon created by wolfden -""" % VERSION) +""") view = self.tree.get_widget("pluginList") store = gtk.ListStore(str,str) @@ -776,6 +780,7 @@ class MainWindow (Window): vpaned.set_position(mHeight/2) # cat and pkg list + self.sortPkgListByName = True self.catList = self.tree.get_widget("catList") self.pkgList = self.tree.get_widget("pkgList") self.build_cat_list() @@ -876,6 +881,8 @@ class MainWindow (Window): self.pkgList.set_model(store) col = gtk.TreeViewColumn("Packages") + col.set_clickable(True) + col.connect("clicked", self.cb_pkg_list_header_clicked) # adding the pixbuf cell = gtk.CellRendererPixbuf() @@ -900,7 +907,7 @@ class MainWindow (Window): @rtype: gtk.ListStore""" if name: - for pkg, is_inst in self.db.get_cat(name): + for pkg, is_inst in self.db.get_cat(name, self.sortPkgListByName): if is_inst: icon = self.instPixbuf else: @@ -947,6 +954,12 @@ class MainWindow (Window): self.show_package(self.selCatName+"/"+package, self.queue) return True + def cb_pkg_list_header_clicked(self, col): + self.sortPkgListByName = not self.sortPkgListByName + self.pkgList.get_model().clear() + self.fill_pkg_store(self.pkgList.get_model(), self.selCatName) + return True + def cb_row_activated (self, view, path, *args): """Callback for an activated row in the emergeQueue. Opens a package window.""" store = self.queueTree diff --git a/portato/gui/gui_helper.py b/portato/gui/gui_helper.py index 86fd6ed..df4e1d7 100644 --- a/portato/gui/gui_helper.py +++ b/portato/gui/gui_helper.py @@ -232,16 +232,30 @@ class Database: for key in self._db: # sort alphabetically self._db[key].sort(cmp=cmp, key=lambda x: str.lower(x[0])) - def get_cat (self, cat): + def get_cat (self, cat, byName = True): """Returns the packages in the category. @param cat: category to return the packages from @type cat: string + @param byName: selects whether to return the list sorted by name or by installation + @type byName: boolean @return: list of tuples: (name, is_installed) or [] @rtype: (string, boolean)[]""" try: - return self._db[cat] + if byName: + return self._db[cat] + else: + inst = [] + ninst = [] + for p, i in self._db[cat]: + if i: + inst.append((p,i)) + else: + ninst.append((p,i)) + + return inst+ninst + except KeyError: # cat is in category list - but not in portage debug("Catched KeyError =>", cat, "seems not to be an available category. Have you played with rsync-excludes?") return [] diff --git a/portato/gui/qt/windows.py b/portato/gui/qt/windows.py index e131bdd..80e193f 100644 --- a/portato/gui/qt/windows.py +++ b/portato/gui/qt/windows.py @@ -611,6 +611,8 @@ class MainWindow (Window): Qt.QObject.connect(action, Qt.SIGNAL("triggered()"), m.call) # the two lists + self.sortPkgListByName = True + self.pkgList.addAction(self.pkgListSortAction) self.build_cat_list() Qt.QObject.connect(self.selCatListModel, Qt.SIGNAL("currentChanged(QModelIndex, QModelIndex)"), self.cb_cat_list_selected) Qt.QObject.connect(self.pkgList, Qt.SIGNAL("currentItemChanged(QListWidgetItem*, QListWidgetItem*)"), self.cb_pkg_list_selected) @@ -669,7 +671,7 @@ class MainWindow (Window): self.pkgList.clear() - for name, inst in self.db.get_cat(cat): + for name, inst in self.db.get_cat(cat, self.sortPkgListByName): if use_icons: if inst: icon = yes @@ -765,6 +767,11 @@ class MainWindow (Window): self.cfg.set_local(pkg, "oneshot_opt", set) self.queue.append(pkg, update = True, oneshot = set, forceUpdate = True) + @Qt.pyqtSignature("bool") + def on_pkgListSortAction_triggered (self, checked): + self.sortPkgListByName = checked + self.fill_pkg_list(self.selCatName) + @Qt.pyqtSignature("") @Window.watch_cursor def on_searchBtn_clicked (self): diff --git a/portato/gui/templates/portato.glade b/portato/gui/templates/portato.glade index 8037ca9..8433fa0 100644 --- a/portato/gui/templates/portato.glade +++ b/portato/gui/templates/portato.glade @@ -372,6 +372,7 @@ <child> <widget class="GtkTreeView" id="pkgList"> <property name="visible">True</property> + <property name="headers_clickable">True</property> <property name="search_column">0</property> <signal name="cursor_changed" handler="cb_pkg_list_selection"/> </widget> @@ -403,72 +404,48 @@ <property name="n_rows">4</property> <property name="n_columns">2</property> <child> - <widget class="GtkScrolledWindow" id="useListScroll"> + <widget class="GtkHBox" id="checkHB"> <property name="visible">True</property> - <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="spacing">1</property> + <property name="homogeneous">True</property> <child> - <widget class="GtkTreeView" id="useList"> + <widget class="GtkCheckButton" id="installedCheck"> <property name="visible">True</property> + <property name="no_show_all">True</property> + <property name="label" translatable="yes">Installed</property> + <property name="draw_indicator">True</property> + <signal name="button_press_event" handler="cb_button_pressed"/> </widget> + <packing> + <property name="fill">False</property> + </packing> </child> - </widget> - <packing> - <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_padding">5</property> - <property name="y_padding">5</property> - </packing> - </child> - <child> - <widget class="GtkVBox" id="comboVB"> - <property name="visible">True</property> <child> - <placeholder/> + <widget class="GtkCheckButton" id="maskedCheck"> + <property name="visible">True</property> + <property name="no_show_all">True</property> + <property name="label" translatable="yes">Masked</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="cb_masked_toggled"/> + </widget> + <packing> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + <child> + <widget class="GtkCheckButton" id="testingCheck"> + <property name="visible">True</property> + <property name="no_show_all">True</property> + <property name="label" translatable="yes">Testing</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="cb_testing_toggled"/> + </widget> + <packing> + <property name="fill">False</property> + <property name="position">2</property> + </packing> </child> - </widget> - <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_options">GTK_FILL</property> - <property name="x_padding">5</property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="descLabel"> - <property name="visible">True</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">True</property> - </widget> - <packing> - <property name="right_attach">2</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - <property name="y_padding">10</property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="missingLabel"> - <property name="visible">True</property> - <property name="no_show_all">True</property> - <property name="label" translatable="yes"><span foreground='red'><b>MISSING KEYWORD</b></span></property> - <property name="use_markup">True</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_options">GTK_FILL</property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="notInSysLabel"> - <property name="visible">True</property> - <property name="no_show_all">True</property> - <property name="label" translatable="yes"><b>Installed, but not in portage anymore</b></property> - <property name="use_markup">True</property> </widget> <packing> <property name="left_attach">1</property> @@ -533,55 +510,79 @@ </packing> </child> <child> - <widget class="GtkHBox" id="checkHB"> + <widget class="GtkLabel" id="notInSysLabel"> + <property name="visible">True</property> + <property name="no_show_all">True</property> + <property name="label" translatable="yes"><b>Installed, but not in portage anymore</b></property> + <property name="use_markup">True</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="y_options">GTK_FILL</property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="missingLabel"> + <property name="visible">True</property> + <property name="no_show_all">True</property> + <property name="label" translatable="yes"><span foreground='red'><b>MISSING KEYWORD</b></span></property> + <property name="use_markup">True</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="y_options">GTK_FILL</property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="descLabel"> + <property name="visible">True</property> + <property name="justify">GTK_JUSTIFY_CENTER</property> + <property name="wrap">True</property> + </widget> + <packing> + <property name="right_attach">2</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> + <property name="y_padding">10</property> + </packing> + </child> + <child> + <widget class="GtkVBox" id="comboVB"> <property name="visible">True</property> - <property name="spacing">1</property> - <property name="homogeneous">True</property> - <child> - <widget class="GtkCheckButton" id="installedCheck"> - <property name="visible">True</property> - <property name="no_show_all">True</property> - <property name="label" translatable="yes">Installed</property> - <property name="draw_indicator">True</property> - <signal name="button_press_event" handler="cb_button_pressed"/> - </widget> - <packing> - <property name="fill">False</property> - </packing> - </child> <child> - <widget class="GtkCheckButton" id="maskedCheck"> - <property name="visible">True</property> - <property name="no_show_all">True</property> - <property name="label" translatable="yes">Masked</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="cb_masked_toggled"/> - </widget> - <packing> - <property name="fill">False</property> - <property name="position">1</property> - </packing> + <placeholder/> </child> + </widget> + <packing> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="y_options">GTK_FILL</property> + <property name="x_padding">5</property> + </packing> + </child> + <child> + <widget class="GtkScrolledWindow" id="useListScroll"> + <property name="visible">True</property> + <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <child> - <widget class="GtkCheckButton" id="testingCheck"> + <widget class="GtkTreeView" id="useList"> <property name="visible">True</property> - <property name="no_show_all">True</property> - <property name="label" translatable="yes">Testing</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="cb_testing_toggled"/> </widget> - <packing> - <property name="fill">False</property> - <property name="position">2</property> - </packing> </child> </widget> <packing> - <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_options">GTK_FILL</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_padding">5</property> + <property name="y_padding">5</property> </packing> </child> </widget> @@ -767,11 +768,39 @@ <widget class="GtkNotebook" id="notebook1"> <property name="visible">True</property> <child> - <widget class="GtkLabel" id="aboutLabel"> + <widget class="GtkVBox" id="vbox3"> <property name="visible">True</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="spacing">5</property> + <child> + <widget class="GtkLabel" id="highAboutLabel"> + <property name="visible">True</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_CENTER</property> + <property name="wrap">True</property> + </widget> + </child> + <child> + <widget class="GtkImage" id="portatoImage"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="stock">gtk-missing-image</property> + </widget> + <packing> + <property name="position">1</property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="lowAboutLabel"> + <property name="visible">True</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_CENTER</property> + <property name="wrap">True</property> + </widget> + <packing> + <property name="position">2</property> + </packing> + </child> </widget> <packing> <property name="tab_expand">False</property> @@ -1147,186 +1176,186 @@ <placeholder/> </child> <child> - <widget class="GtkLabel" id="maskLabel"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="xpad">5</property> - <property name="label" translatable="yes"><u><i>Masking Keywords</i></u></property> - <property name="use_markup">True</property> - <property name="single_line_mode">True</property> - </widget> - <packing> - <property name="top_attach">7</property> - <property name="bottom_attach">8</property> - <property name="y_padding">5</property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="testLabel"> + <widget class="GtkEntry" id="useFileEdit"> <property name="visible">True</property> - <property name="xalign">0</property> - <property name="xpad">5</property> - <property name="label" translatable="yes"><u><i>Testing Keywords</i></u></property> - <property name="use_markup">True</property> - <property name="single_line_mode">True</property> </widget> <packing> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - <property name="y_padding">5</property> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> </packing> </child> <child> - <widget class="GtkLabel" id="useLabel"> + <widget class="GtkLabel" id="useEditLabel"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="xpad">5</property> - <property name="label" translatable="yes"><u><i>Use-Flags</i></u></property> - <property name="use_markup">True</property> + <property name="label" translatable="yes">File name to use, if package.use is a directory: </property> <property name="single_line_mode">True</property> </widget> <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_padding">6</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> </packing> </child> <child> - <widget class="GtkEventBox" id="hintEB"> + <widget class="GtkCheckButton" id="usePerVersionCheck"> <property name="visible">True</property> - <child> - <widget class="GtkFrame" id="hintFrame"> - <property name="visible">True</property> - <property name="label_xalign">0</property> - <property name="shadow_type">GTK_SHADOW_OUT</property> - <child> - <widget class="GtkLabel" id="hintLabel"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes"><u>You may use the following placeholders:</u> - -<i>$(cat)</i>: category -<i>$(pkg)</i>: package name -<i>$(cat-1)/$(cat-2)</i>: first/second part of the category</property> - <property name="use_markup">True</property> - </widget> - </child> - <child> - <placeholder/> - <packing> - <property name="type">label_item</property> - </packing> - </child> - </widget> - </child> + <property name="label" translatable="yes">Add only exact version to package.use</property> + <property name="draw_indicator">True</property> </widget> <packing> <property name="right_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> </packing> </child> <child> - <widget class="GtkCheckButton" id="maskPerVersionCheck"> + <widget class="GtkCheckButton" id="testPerVersionCheck"> <property name="visible">True</property> - <property name="label" translatable="yes">Add only exact version to package.mask/package.unmask</property> + <property name="label" translatable="yes">Add only exact version to package.keywords</property> <property name="draw_indicator">True</property> </widget> <packing> <property name="right_attach">2</property> - <property name="top_attach">8</property> - <property name="bottom_attach">9</property> + <property name="top_attach">5</property> + <property name="bottom_attach">6</property> </packing> </child> <child> - <widget class="GtkLabel" id="maskEditLabel"> + <widget class="GtkLabel" id="testEditLabel"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">File name to use, if package.mask/package.unmask is a directory: </property> + <property name="label" translatable="yes">File name to use, if package.keywords is a directory: </property> <property name="single_line_mode">True</property> </widget> <packing> - <property name="top_attach">9</property> - <property name="bottom_attach">10</property> + <property name="top_attach">6</property> + <property name="bottom_attach">7</property> </packing> </child> <child> - <widget class="GtkEntry" id="maskFileEdit"> + <widget class="GtkEntry" id="testFileEdit"> <property name="visible">True</property> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">9</property> - <property name="bottom_attach">10</property> + <property name="top_attach">6</property> + <property name="bottom_attach">7</property> </packing> </child> <child> - <widget class="GtkEntry" id="testFileEdit"> + <widget class="GtkEntry" id="maskFileEdit"> <property name="visible">True</property> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> + <property name="top_attach">9</property> + <property name="bottom_attach">10</property> </packing> </child> <child> - <widget class="GtkLabel" id="testEditLabel"> + <widget class="GtkLabel" id="maskEditLabel"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">File name to use, if package.keywords is a directory: </property> + <property name="label" translatable="yes">File name to use, if package.mask/package.unmask is a directory: </property> <property name="single_line_mode">True</property> </widget> <packing> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> + <property name="top_attach">9</property> + <property name="bottom_attach">10</property> </packing> </child> <child> - <widget class="GtkCheckButton" id="testPerVersionCheck"> + <widget class="GtkCheckButton" id="maskPerVersionCheck"> <property name="visible">True</property> - <property name="label" translatable="yes">Add only exact version to package.keywords</property> + <property name="label" translatable="yes">Add only exact version to package.mask/package.unmask</property> <property name="draw_indicator">True</property> </widget> <packing> <property name="right_attach">2</property> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> + <property name="top_attach">8</property> + <property name="bottom_attach">9</property> </packing> </child> <child> - <widget class="GtkCheckButton" id="usePerVersionCheck"> + <widget class="GtkEventBox" id="hintEB"> <property name="visible">True</property> - <property name="label" translatable="yes">Add only exact version to package.use</property> - <property name="draw_indicator">True</property> + <child> + <widget class="GtkFrame" id="hintFrame"> + <property name="visible">True</property> + <property name="label_xalign">0</property> + <property name="shadow_type">GTK_SHADOW_OUT</property> + <child> + <widget class="GtkLabel" id="hintLabel"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes"><u>You may use the following placeholders:</u> + +<i>$(cat)</i>: category +<i>$(pkg)</i>: package name +<i>$(cat-1)/$(cat-2)</i>: first/second part of the category</property> + <property name="use_markup">True</property> + </widget> + </child> + <child> + <placeholder/> + <packing> + <property name="type">label_item</property> + </packing> + </child> + </widget> + </child> </widget> <packing> <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> </packing> </child> <child> - <widget class="GtkLabel" id="useEditLabel"> + <widget class="GtkLabel" id="useLabel"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">File name to use, if package.use is a directory: </property> + <property name="xpad">5</property> + <property name="label" translatable="yes"><u><i>Use-Flags</i></u></property> + <property name="use_markup">True</property> <property name="single_line_mode">True</property> </widget> <packing> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="y_padding">6</property> </packing> </child> <child> - <widget class="GtkEntry" id="useFileEdit"> + <widget class="GtkLabel" id="testLabel"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="xpad">5</property> + <property name="label" translatable="yes"><u><i>Testing Keywords</i></u></property> + <property name="use_markup">True</property> + <property name="single_line_mode">True</property> + </widget> + <packing> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + <property name="y_padding">5</property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="maskLabel"> <property name="visible">True</property> + <property name="xalign">0</property> + <property name="xpad">5</property> + <property name="label" translatable="yes"><u><i>Masking Keywords</i></u></property> + <property name="use_markup">True</property> + <property name="single_line_mode">True</property> </widget> <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> + <property name="top_attach">7</property> + <property name="bottom_attach">8</property> + <property name="y_padding">5</property> </packing> </child> </widget> diff --git a/portato/gui/templates/ui/MainWindow.ui b/portato/gui/templates/ui/MainWindow.ui index 5b8d0d9..def2d67 100644 --- a/portato/gui/templates/ui/MainWindow.ui +++ b/portato/gui/templates/ui/MainWindow.ui @@ -71,6 +71,9 @@ </item> <item> <widget class="QListWidget" name="pkgList" > + <property name="contextMenuPolicy" > + <enum>Qt::ActionsContextMenu</enum> + </property> <property name="editTriggers" > <set>QAbstractItemView::NoEditTriggers</set> </property> @@ -78,7 +81,7 @@ <bool>false</bool> </property> <property name="sortingEnabled" > - <bool>true</bool> + <bool>false</bool> </property> </widget> </item> @@ -507,6 +510,17 @@ p, li { white-space: pre-wrap; } <string>&Oneshot</string> </property> </action> + <action name="pkgListSortAction" > + <property name="checkable" > + <bool>true</bool> + </property> + <property name="checked" > + <bool>true</bool> + </property> + <property name="text" > + <string>Sort by Name</string> + </property> + </action> </widget> <customwidgets> <customwidget> |