summaryrefslogtreecommitdiff
path: root/portato/gui
diff options
context:
space:
mode:
Diffstat (limited to 'portato/gui')
-rw-r--r--portato/gui/__init__.py8
-rw-r--r--portato/gui/dialogs.py4
-rw-r--r--portato/gui/exception_handling.py7
-rw-r--r--portato/gui/exceptions.py2
-rw-r--r--portato/gui/queue.py4
-rw-r--r--portato/gui/session.py2
-rw-r--r--portato/gui/slots.py2
-rw-r--r--portato/gui/templates/AboutWindow.ui36
-rw-r--r--portato/gui/templates/MainWindow.menu16
-rw-r--r--portato/gui/templates/MainWindow.ui18
-rw-r--r--portato/gui/templates/PkgListWindow.ui (renamed from portato/gui/templates/UpdateWindow.ui)19
-rw-r--r--portato/gui/templates/PreferenceWindow.ui2
-rw-r--r--portato/gui/updater.py2
-rw-r--r--portato/gui/utils.py9
-rw-r--r--portato/gui/views.py2
-rw-r--r--portato/gui/windows/__init__.py2
-rw-r--r--portato/gui/windows/about.py10
-rw-r--r--portato/gui/windows/basic.py3
-rw-r--r--portato/gui/windows/mailinfo.py2
-rw-r--r--portato/gui/windows/main.py98
-rw-r--r--portato/gui/windows/pkglist.py (renamed from portato/gui/windows/update.py)71
-rw-r--r--portato/gui/windows/plugin.py2
-rw-r--r--portato/gui/windows/preference.py2
-rw-r--r--portato/gui/windows/search.py2
-rw-r--r--portato/gui/windows/splash.py7
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&#xE9; 'Necoro' Neumann &lt;necoro@necoro.net&gt;</property>
+Copyright (C) 2006-2010 Ren&#xE9; 'Necoro' Neumann &lt;necoro@necoro.net&gt;</property>
<property name="comments">A Portage GUI</property>
<property name="website">http://portato.necoro.net</property>
<property name="authors">Ren&#xE9; '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&#xF3;
German - Ren&#xE9; 'Necoro' Neumann
+Italian - Ponsi
Polish - Tomasz Osi&#x144;ski
Portugese (Brazilian) - Alberto Federman Neto
Spanish - Daniel Halens
@@ -40,6 +41,39 @@ Turkish - G&#xFC;rkan 'seqizz' G&#xFC;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">&lt;b&gt;Git revision:&lt;/b&gt;</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