diff options
Diffstat (limited to 'portato/gui')
25 files changed, 253 insertions, 79 deletions
diff --git a/portato/gui/__init__.py b/portato/gui/__init__.py index e3f1172..bbe21d8 100644 --- a/portato/gui/__init__.py +++ b/portato/gui/__init__.py @@ -3,7 +3,7 @@ # File: portato/gui/__init__.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. @@ -27,9 +27,11 @@ def run (): from .windows.main import MainWindow try: m = MainWindow(s) - s.hide() + s.destroy() + del s + m.main() except PreReqError, e: error("Prerequisite not matched. Aborting.") prereq_error_dialog(e) - s.hide() + s.destroy() diff --git a/portato/gui/dialogs.py b/portato/gui/dialogs.py index d7ac41b..6044a5b 100644 --- a/portato/gui/dialogs.py +++ b/portato/gui/dialogs.py @@ -3,7 +3,7 @@ # File: portato/gui/dialogs.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. @@ -68,7 +68,7 @@ def nothing_found_dialog (): def changed_flags_dialog (what = "flags"): check = gtk.CheckButton(_("Do not show this dialog again.")) hintMB = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, _("Changed %s") % what) - hintMB.format_secondary_text(_("Portato will write these changes into the appropriate files.\nPlease backup them if you think it is necessairy.")) + hintMB.format_secondary_text(_("Portato will write these changes into the appropriate files.\nPlease backup them if you think it is necessary.")) hintMB.vbox.add(check) hintMB.vbox.show_all() ret = hintMB.run() diff --git a/portato/gui/exception_handling.py b/portato/gui/exception_handling.py index c973e6b..dbafa7e 100644 --- a/portato/gui/exception_handling.py +++ b/portato/gui/exception_handling.py @@ -3,7 +3,7 @@ # File: portato/gui/exception_handling.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. @@ -97,10 +97,13 @@ def convert (version): return ".".join(map(str, version)) def get_version_infos(): - from ..constants import VERSION + from ..constants import VERSION, REVISION from ..backend import system from ..db import _TYPE as db_type + if REVISION: + VERSION = "%s (git: %s)" % (VERSION, REVISION) + return "\n".join(( "Portato version: %s" % VERSION, "System: %s" % " ".join(get_runsystem()), diff --git a/portato/gui/exceptions.py b/portato/gui/exceptions.py index 17041dc..3e35caa 100644 --- a/portato/gui/exceptions.py +++ b/portato/gui/exceptions.py @@ -3,7 +3,7 @@ # File: portato/gui/exceptions.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. diff --git a/portato/gui/queue.py b/portato/gui/queue.py index e73891d..b18e4e7 100644 --- a/portato/gui/queue.py +++ b/portato/gui/queue.py @@ -3,7 +3,7 @@ # File: portato/gui/queue.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. @@ -144,7 +144,7 @@ class EmergeQueue: old = system.find_packages(pkg.get_slot_cp(), system.SET_INSTALLED) if old: old = old[0] # assume we have only one there - cmp = pkg.compare_version(old) + cmp = pkg.__cmp__(old) if cmp > 0: update = True elif cmp < 0: diff --git a/portato/gui/session.py b/portato/gui/session.py index 7aa890d..549a2c9 100644 --- a/portato/gui/session.py +++ b/portato/gui/session.py @@ -3,7 +3,7 @@ # File: portato/gui/session.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. diff --git a/portato/gui/slots.py b/portato/gui/slots.py index c7f20e6..75f4d77 100644 --- a/portato/gui/slots.py +++ b/portato/gui/slots.py @@ -3,7 +3,7 @@ # File: portato/gui/slots.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. diff --git a/portato/gui/templates/AboutWindow.ui b/portato/gui/templates/AboutWindow.ui index ce612b3..5590e2b 100644 --- a/portato/gui/templates/AboutWindow.ui +++ b/portato/gui/templates/AboutWindow.ui @@ -16,7 +16,7 @@ <property name="has_separator">False</property> <property name="program_name">Portato</property> <property name="copyright">This software is licensed under the terms of the GPLv2. -Copyright (C) 2006-2009 René 'Necoro' Neumann <necoro@necoro.net></property> +Copyright (C) 2006-2010 René 'Necoro' Neumann <necoro@necoro.net></property> <property name="comments">A Portage GUI</property> <property name="website">http://portato.necoro.net</property> <property name="authors">René 'Necoro' Neumann @@ -27,6 +27,7 @@ Thanks goto: - the Sabayon-Distro for making Portato the default Portage-GUI</property> <property name="translator_credits">Catalan - Roger Calvó German - René 'Necoro' Neumann +Italian - Ponsi Polish - Tomasz Osiński Portugese (Brazilian) - Alberto Federman Neto Spanish - Daniel Halens @@ -40,6 +41,39 @@ Turkish - Gürkan 'seqizz' Gür</property> <property name="orientation">vertical</property> <property name="spacing">2</property> <child> + <object class="GtkHBox" id="gitHB"> + <property name="visible">True</property> + <property name="no_show_all">True</property> + <property name="spacing">5</property> + <child> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="label"><b>Git revision:</b></property> + <property name="use_markup">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="gitLabel"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label">label</property> + <property name="use_markup">True</property> + <property name="selectable">True</property> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="position">2</property> + </packing> + </child> + <child> <placeholder/> </child> <child internal-child="action_area"> diff --git a/portato/gui/templates/MainWindow.menu b/portato/gui/templates/MainWindow.menu index 1cce3be..e9c8f7a 100644 --- a/portato/gui/templates/MainWindow.menu +++ b/portato/gui/templates/MainWindow.menu @@ -16,7 +16,7 @@ <child> <object class="GtkAction" id="fileMenuAction"> <property name="name">fileMenuAction</property> - <property name="label" translatable="yes">_File</property> + <property name="label" translatable="yes">_General</property> </object> </child> <child> @@ -72,7 +72,7 @@ <child> <object class="GtkAction" id="updateAction"> <property name="name">updateAction</property> - <property name="label" translatable="yes">Update _World</property> + <property name="label" translatable="yes">Up_date World</property> <signal handler="cb_update_clicked" name="activate"/> </object> </child> @@ -84,6 +84,13 @@ </object> </child> <child> + <object class="GtkAction" id="showWorldPkgsAction"> + <property name="name">showWorldPkgsAction</property> + <property name="label" translatable="yes">Show _World Packages</property> + <signal handler="cb_show_world_clicked" name="activate"/> + </object> + </child> + <child> <object class="GtkToggleAction" id="showInstalledAction"> <property name="name">showInstalledAction</property> <property name="label" translatable="yes">Show _Only Installed Packages</property> @@ -151,7 +158,7 @@ <object class="GtkAction" id="pluginsAction"> <property name="stock_id">gtk-connect</property> <property name="name">pluginsAction</property> - <property name="label" translatable="yes">_Plugins</property> + <property name="label" translatable="yes">Plu_gins</property> <signal handler="cb_plugins_clicked" name="activate"/> </object> </child> @@ -161,6 +168,7 @@ <menubar name="menubar"> <menu name="fileMenu" action="fileMenuAction"> <menuitem name="prefMenuItem" action="prefAction"/> + <menuitem name="pluginsMenuItem" action="pluginsAction"/> <menuitem name="reloadMenuItem" action="reloadAction"/> <separator/> <menuitem name="closeMenuItem" action="closeAction"/> @@ -170,6 +178,7 @@ <menuitem name="unmergeMenuItem" action="unmergeAction"/> <menuitem name="updateMenuItem" action="updateAction"/> <menuitem name="showUpdatesMenuItem" action="showUpdatesAction"/> + <menuitem name="showWorldPkgsMenuItem" action="showWorldPkgsAction" /> <menuitem name="showInstalledMenuItem" action="showInstalledAction"/> <separator/> <menuitem name="syncMenuItem" action="syncAction"/> @@ -181,7 +190,6 @@ <menu name="pluginMenu" action="pluginMenuAction"/> <menu name="helpMenu" action="helpMenuAction"> <menuitem name="aboutMenuItem" action="aboutAction"/> - <menuitem name="pluginsMenuItem" action="pluginsAction"/> </menu> </menubar> <popup name="systrayPopup"> diff --git a/portato/gui/templates/MainWindow.ui b/portato/gui/templates/MainWindow.ui index 8e8c3b4..05e9545 100644 --- a/portato/gui/templates/MainWindow.ui +++ b/portato/gui/templates/MainWindow.ui @@ -30,6 +30,16 @@ <property name="visible">True</property> <property name="border_width">3</property> <child> + <object class="GtkComboBox" id="typeCombo"> + <property name="visible">True</property> + <signal name="changed" handler="cb_type_combo_changed"/> + </object> + <packing> + <property name="expand">False</property> + <property name="position">0</property> + </packing> + </child> + <child> <object class="GtkEntry" id="searchEntry"> <property name="visible">True</property> <signal name="changed" handler="cb_search_changed"/> @@ -38,12 +48,12 @@ </object> <packing> <property name="padding">5</property> - <property name="position">0</property> + <property name="position">1</property> </packing> </child> <child> <object class="GtkButton" id="deleteSearchButton"> - <property name="label">gtk-delete</property> + <property name="label">gtk-clear</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -54,7 +64,7 @@ <packing> <property name="expand">False</property> <property name="padding">5</property> - <property name="position">1</property> + <property name="position">2</property> </packing> </child> <child> @@ -69,7 +79,7 @@ <packing> <property name="expand">False</property> <property name="padding">5</property> - <property name="position">2</property> + <property name="position">3</property> </packing> </child> </object> diff --git a/portato/gui/templates/UpdateWindow.ui b/portato/gui/templates/PkgListWindow.ui index ec8288e..fdcdb23 100644 --- a/portato/gui/templates/UpdateWindow.ui +++ b/portato/gui/templates/PkgListWindow.ui @@ -2,9 +2,8 @@ <interface> <requires lib="gtk+" version="2.14"/> <!-- interface-naming-policy toplevel-contextual --> - <object class="GtkWindow" id="UpdateWindow"> + <object class="GtkWindow" id="PkgListWindow"> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="title" translatable="yes">Updatable Packages</property> <property name="window_position">center-on-parent</property> <property name="destroy_with_parent">True</property> <property name="urgency_hint">True</property> @@ -92,6 +91,22 @@ <property name="position">2</property> </packing> </child> + <child> + <object class="GtkButton" id="uninstallBtn"> + <property name="label" translatable="yes">_Uninstall Selected</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">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="use_underline">True</property> + <signal name="clicked" handler="cb_uninstall_clicked"/> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">3</property> + </packing> + </child> </object> <packing> <property name="expand">False</property> diff --git a/portato/gui/templates/PreferenceWindow.ui b/portato/gui/templates/PreferenceWindow.ui index c7a00e0..d2135d0 100644 --- a/portato/gui/templates/PreferenceWindow.ui +++ b/portato/gui/templates/PreferenceWindow.ui @@ -784,8 +784,6 @@ <child> <object class="GtkHBox" id="hbox4"> <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="orientation">vertical</property> <property name="homogeneous">True</property> <child> <object class="GtkLabel" id="label21"> diff --git a/portato/gui/updater.py b/portato/gui/updater.py index 7ce7c51..6539913 100644 --- a/portato/gui/updater.py +++ b/portato/gui/updater.py @@ -3,7 +3,7 @@ # File: portato/gui/updater.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. diff --git a/portato/gui/utils.py b/portato/gui/utils.py index 8b88b23..ce5971e 100644 --- a/portato/gui/utils.py +++ b/portato/gui/utils.py @@ -3,7 +3,7 @@ # File: portato/gui/utils.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. @@ -21,7 +21,7 @@ from threading import Thread import gtk # some backend things -from ..backend import flags, set_system +from ..backend import flags, system from ..helper import debug, info from ..log import set_log_level from ..constants import APP, LOCALE_DIR @@ -90,9 +90,8 @@ class Config (ConfigParser): set_log_level(level) def modify_system_config (self): - """Sets the system config. - @see: L{backend.set_system()}""" - set_system(self.get("system")) + """Sets the system config.""" + system.set_system(self.get("system")) def modify_external_configs (self): """Convenience function setting all external configs.""" diff --git a/portato/gui/views.py b/portato/gui/views.py index 3fc965f..699a832 100644 --- a/portato/gui/views.py +++ b/portato/gui/views.py @@ -3,7 +3,7 @@ # File: portato/gui/views.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. diff --git a/portato/gui/windows/__init__.py b/portato/gui/windows/__init__.py index 6a4ac82..5be95ce 100644 --- a/portato/gui/windows/__init__.py +++ b/portato/gui/windows/__init__.py @@ -3,7 +3,7 @@ # File: portato/gui/gtk/__init__.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. diff --git a/portato/gui/windows/about.py b/portato/gui/windows/about.py index 1b8a981..a15fd24 100644 --- a/portato/gui/windows/about.py +++ b/portato/gui/windows/about.py @@ -3,7 +3,7 @@ # File: portato/gui/windows/about.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. @@ -15,7 +15,7 @@ from __future__ import absolute_import import gtk from .basic import AbstractDialog -from ...constants import VERSION +from ...constants import VERSION, REVISION class AboutWindow (AbstractDialog): """A window showing the "about"-informations.""" @@ -27,5 +27,11 @@ class AboutWindow (AbstractDialog): self.window.set_version(VERSION) self.window.set_logo(None) + if REVISION: + gitlabel = self.tree.get_widget("gitLabel") + gitlabel.set_label(REVISION) + else: + self.tree.get_widget("gitHB").hide() + self.window.show_all() diff --git a/portato/gui/windows/basic.py b/portato/gui/windows/basic.py index 542cf7f..92c35f4 100644 --- a/portato/gui/windows/basic.py +++ b/portato/gui/windows/basic.py @@ -3,7 +3,7 @@ # File: portato/gui/windows/basic.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. @@ -32,6 +32,7 @@ except OSError: else: getlib.textdomain(APP) getlib.bindtextdomain(APP, LOCALE_DIR) + getlib.bind_textdomain_codeset(APP, "UTF-8") # some debugging output about the current codeset used nll = getlib.nl_langinfo diff --git a/portato/gui/windows/mailinfo.py b/portato/gui/windows/mailinfo.py index 0cc79f2..0ee232a 100644 --- a/portato/gui/windows/mailinfo.py +++ b/portato/gui/windows/mailinfo.py @@ -3,7 +3,7 @@ # File: portato/gui/windows/mailinfo.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py index 29eb728..a06756d 100644 --- a/portato/gui/windows/main.py +++ b/portato/gui/windows/main.py @@ -3,7 +3,7 @@ # File: portato/gui/windows/main.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. @@ -29,6 +29,7 @@ from ... import get_listener from ...helper import debug, warning, error, info from ...session import Session from ...db import Database +from ...db.database import UnsupportedSearchTypeError from ...constants import CONFIG_LOCATION, VERSION, APP_ICON, ICON_DIR from ...backend.exceptions import PackageNotFoundException, BlockedException, VersionsNotFoundException @@ -50,7 +51,7 @@ from .about import AboutWindow from .plugin import PluginWindow from .preference import PreferenceWindow from .search import SearchWindow -from .update import UpdateWindow +from .pkglist import UpdateWindow, WorldListWindow class PackageTable: """A window with data about a specfic package.""" @@ -565,6 +566,10 @@ class MainWindow (Window): splash(_("Finishing startup")) + # depends on session + self.typeCombo = self.tree.get_widget("typeCombo") + self.build_type_combo() + self.window.show_all() def show_package (self, pkg = None, cpv = None, cp = None, version = None, **kwargs): @@ -884,6 +889,26 @@ class MainWindow (Window): else: # no selCatName -> so no category selected --> ignore debug("No category selected --> should be no harm.") + def build_type_combo (self): + model = gtk.ListStore(int, str) + for k,v in self.db.TYPES.iteritems(): + model.append((k,v)) + + self.typeCombo.set_model(model) + cell = gtk.CellRendererText() + self.typeCombo.pack_start(cell) + self.typeCombo.set_attributes(cell, text = 1) + + + for i, (k, v) in enumerate(model): + if k == self.db.type: break + + self.typeCombo.set_active(i) + + types = self.db.search_types() + if types == 1 or types % 2 == 0: + self.typeCombo.set_sensitive(False) + def load_session(self, sessionEx = None, defaults_only = False): """ Loads the session data. @@ -1000,6 +1025,14 @@ class MainWindow (Window): return _save + # SEARCH TYPE + def load_search_type (t): + t = int(t) + try: + self.db.type = t + except UnsupportedSearchTypeError: + info("Cannot set search type. '%s' not supported by database '%s'.", t, self.db.__class__.__name__) + # SESSION VERSION def load_session_version (version): @@ -1028,7 +1061,8 @@ class MainWindow (Window): (["width", "height"], lambda w,h: self.window.resize(int(w), int(h)), self.window.get_size), (["vpanedpos", "hpanedpos"], load_paned, save_paned), (["catsel"], load_cat_selection, save_cat_selection, ["app-portage@0"]), - (["pkgsel"], load_pkg_selection, save_pkg_selection, ["portato@0"]) + (["pkgsel"], load_pkg_selection, save_pkg_selection, ["portato@0"]), + (["searchtype"], load_search_type, lambda: self.db.type) #([("merge", "queue"), ("unmerge", "queue"), ("oneshot", "queue")], load_queue, save_queue), ]) @@ -1575,7 +1609,13 @@ class MainWindow (Window): return False # not again ;) - gobject.timeout_add(100, __update) + gobject.timeout_add(200, __update) + + def cb_type_combo_changed (self, *args): + model = self.typeCombo.get_model() + active = self.typeCombo.get_active() + + self.db.type = model[active][0] def cb_delete_search_clicked (self, *args): self.searchEntry.set_text("") @@ -1607,34 +1647,52 @@ class MainWindow (Window): PluginWindow(self.window, plugins, self.queue) return True - - def cb_show_updates_clicked (self, *args): - """ - Show the list of updateble packages. - """ - def __update(): - def cb_idle_show(packages): - """ - Callback opening the menu when the calculation is finished. + def show_package_list (self, pkg_generator, klass, thread_name = "PkgList Update Thread"): + + def cb_idle_show(packages): + """ + Callback opening the menu when the calculation is finished. - @returns: False to signal that it is finished - """ - UpdateWindow(self.window, packages, self.queue, self.jump_to) - return False - + @returns: False to signal that it is finished + """ + klass(self.window, packages, self.queue, self.jump_to) + return False + + def __update(): watch = gtk.gdk.Cursor(gtk.gdk.WATCH) self.window.window.set_cursor(watch) packages = [] try: - packages.extend(system.get_updated_packages()) + packages.extend(pkg_generator()) finally: self.window.window.set_cursor(None) gobject.idle_add(cb_idle_show, packages) - GtkThread(name="Show Updates Thread", target = __update).start() + GtkThread(name = thread_name, target = __update).start() + return True + + def cb_show_updates_clicked (self, *args): + """ + Show the list of updateble packages. + """ + + self.show_package_list( + lambda: (x.get_cpv() for x in system.get_updated_packages()), + UpdateWindow, "Show Updates Thread") + + return True + + def cb_show_world_clicked (self, *args): + """ + Show the list of world packages. + """ + self.show_package_list( + lambda: system.find_packages(pkgSet = "world", only_cpv = True), + WorldListWindow) + return True def cb_show_installed_toggled (self, *args): diff --git a/portato/gui/windows/update.py b/portato/gui/windows/pkglist.py index 8e32dd9..df3ef46 100644 --- a/portato/gui/windows/update.py +++ b/portato/gui/windows/pkglist.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- # -# File: portato/gui/windows/update.py +# File: portato/gui/windows/pkglist.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. @@ -19,15 +19,27 @@ from ...backend import system from ...backend.exceptions import PackageNotFoundException, BlockedException from ...helper import debug -class UpdateWindow (AbstractDialog): +class PkgListWindow (AbstractDialog): - def __init__ (self, parent, packages, queue, jump_to): + # need this, so it can be safely subclassed + __file__ = __window__ = "PkgListWindow" + + def __init__ (self, title, parent, packages, queue, jump_to): AbstractDialog.__init__(self, parent) + self.window.set_title(title) + + self.installBtn = self.tree.get_widget("installBtn") + self.uninstallBtn = self.tree.get_widget("uninstallBtn") + + self.selectBtnLabels = { + False: _("Select _All"), + True: _("Unselect _All")} + + self.all_selected = False self.queue = queue self.jump = jump_to - - self.packages = system.sort_package_list(packages) + self.packages = system.sort_package_list(packages, only_cpv = True) self.build_list() @@ -48,7 +60,7 @@ class UpdateWindow (AbstractDialog): self.view.append_column(gtk.TreeViewColumn(_("Package"), cell, text = 1)) for p in self.packages: - store.append([False, p.get_cpv()]) + store.append([False, p]) def cb_set_size (self, *args): """ @@ -66,16 +78,20 @@ class UpdateWindow (AbstractDialog): self.window.set_geometry_hints(self.window, min_height = val) def cb_select_all_clicked (self, btn): + sel = self.all_selected = not self.all_selected + + btn.set_label(self.selectBtnLabels[sel]) + model = self.view.get_model() iter = model.get_iter_first() while iter: - model.set_value(iter, 0, True) + model.set_value(iter, 0, sel) iter = model.iter_next(iter) return True - def cb_install_clicked (self, btn): + def install_uninstall (self, type): model = self.view.get_model() iter = model.get_iter_first() if iter is None: return @@ -86,20 +102,30 @@ class UpdateWindow (AbstractDialog): items.append(model.get_value(iter, 1)) iter = model.iter_next(iter) - for item in items: - try: + if type == "install": + for item in items: try: - self.queue.append(item, type = "install", oneshot = True) - except PackageNotFoundException, e: - if unmask_dialog(e[0]) == gtk.RESPONSE_YES : - self.queue.append(item, type = "install", unmask = True, oneshot = True) - - except BlockedException, e: - blocked_dialog(e[0], e[1]) + try: + self.queue.append(item, "install", oneshot = True) + except PackageNotFoundException, e: + if unmask_dialog(e[0]) == gtk.RESPONSE_YES : + self.queue.append(item, "install", unmask = True, oneshot = True) + + except BlockedException, e: + blocked_dialog(e[0], e[1]) + else: + for item in items: + self.queue.append(item, "uninstall") self.close() return True + def cb_install_clicked (self, btn): + return self.install_uninstall("install") + + def cb_uninstall_clicked (self, btn): + return self.install_uninstall("uninstall") + def cb_package_selected (self, view): sel = view.get_selection() store, it = sel.get_selected() @@ -115,3 +141,12 @@ class UpdateWindow (AbstractDialog): store = self.view.get_model() store[path][0] = not store[path][0] return True + +class UpdateWindow (PkgListWindow): + def __init__ (self, *args, **kwargs): + PkgListWindow.__init__(self, _("Updatable Packages"), *args, **kwargs) + +class WorldListWindow (UpdateWindow): + def __init__ (self, *args, **kwargs): + PkgListWindow.__init__(self, _("World Packages"), *args, **kwargs) + self.installBtn.hide() diff --git a/portato/gui/windows/plugin.py b/portato/gui/windows/plugin.py index 755ad58..89d38f5 100644 --- a/portato/gui/windows/plugin.py +++ b/portato/gui/windows/plugin.py @@ -3,7 +3,7 @@ # File: portato/gui/windows/plugin.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. diff --git a/portato/gui/windows/preference.py b/portato/gui/windows/preference.py index 4bd7551..021788c 100644 --- a/portato/gui/windows/preference.py +++ b/portato/gui/windows/preference.py @@ -3,7 +3,7 @@ # File: portato/gui/windows/preference.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. diff --git a/portato/gui/windows/search.py b/portato/gui/windows/search.py index c531507..f9191d7 100644 --- a/portato/gui/windows/search.py +++ b/portato/gui/windows/search.py @@ -3,7 +3,7 @@ # File: portato/gui/windows/search.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. diff --git a/portato/gui/windows/splash.py b/portato/gui/windows/splash.py index 39ba00d..2e9d5a8 100644 --- a/portato/gui/windows/splash.py +++ b/portato/gui/windows/splash.py @@ -3,7 +3,7 @@ # File: portato/gui/windows/splash.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. @@ -40,6 +40,7 @@ class SplashScreen (Window): gtk.main_iteration() def show (self): + self.window.set_keep_above(True) self.window.show_all() self.do_iteration() @@ -47,4 +48,8 @@ class SplashScreen (Window): self.window.hide() self.do_iteration() + def destroy(self): + self.window.destroy() + self.do_iteration() + __call__ = set_descr |