summaryrefslogtreecommitdiff
path: root/portato/gui/windows
diff options
context:
space:
mode:
Diffstat (limited to 'portato/gui/windows')
-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
10 files changed, 152 insertions, 47 deletions
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