summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornecoro <>2007-02-16 18:14:08 +0000
committernecoro <>2007-02-16 18:14:08 +0000
commitb4c88233aa6dabd2d9301350a240b8ddcf09255a (patch)
tree8fc90d05b8c6a1804df56e0cb897320a02a04dcb
parentd0b2609768bc854468b56a63cc014650ffe3c51c (diff)
downloadportato-b4c88233aa6dabd2d9301350a240b8ddcf09255a.tar.gz
portato-b4c88233aa6dabd2d9301350a240b8ddcf09255a.tar.bz2
portato-b4c88233aa6dabd2d9301350a240b8ddcf09255a.zip
Use icon instead of the asterisk
Renamed wrong param name "allowed" to "use_keywords" in package.is_testing()
-rw-r--r--portato/backend/flags.py2
-rw-r--r--portato/backend/package.py10
-rw-r--r--portato/gui/gtk/windows.py42
-rw-r--r--portato/gui/gui_helper.py14
4 files changed, 41 insertions, 27 deletions
diff --git a/portato/backend/flags.py b/portato/backend/flags.py
index d1187c9..a7ba125 100644
--- a/portato/backend/flags.py
+++ b/portato/backend/flags.py
@@ -542,7 +542,7 @@ def set_testing (pkg, enable):
if (enable and line != "-1") or (not enable and line == "-1"):
newTesting[cpv].remove((file, line))
- if (enable and not pkg.is_testing(allowed=True)) or (not enable and pkg.is_testing(allowed=True)):
+ if (enable and not pkg.is_testing(use_keywords=True)) or (not enable and pkg.is_testing(use_keywords=True)):
return
if not enable:
diff --git a/portato/backend/package.py b/portato/backend/package.py
index 92194d5..6ba47fe 100644
--- a/portato/backend/package.py
+++ b/portato/backend/package.py
@@ -82,23 +82,23 @@ class Package:
return True
return False
- def is_testing(self, allowed = False):
+ def is_testing(self, use_keywords = False):
"""Checks whether a package is marked as testing.
- @param allowed: Controls whether possible keywords are taken into account or not.
- @type allowed: boolean
+ @param use_keywords: Controls whether possible keywords are taken into account or not.
+ @type use_keywords: boolean
@returns: True if the package is marked as testing; else False.
@rtype: boolean"""
testArch = "~" + self.get_settings("ARCH")
- if not allowed: # keywords are NOT taken into account
+ if not use_keywords: # keywords are NOT taken into account
if testArch in self.get_env_var("KEYWORDS").split():
return True
return False
else: # keywords are taken into account
status = flags.new_testing_status(self.get_cpv())
- if status == None: # we haven't changed it in any way
+ if status is None: # we haven't changed it in any way
if self._status and testArch+" keyword" in self._status:
return True
return False
diff --git a/portato/gui/gtk/windows.py b/portato/gui/gtk/windows.py
index 6eb6dde..a872f3a 100644
--- a/portato/gui/gtk/windows.py
+++ b/portato/gui/gtk/windows.py
@@ -505,7 +505,7 @@ class PackageTable:
self.maskedCheck.hide()
self.testingCheck.hide()
self.emergeBtn.set_sensitive(False)
- else:
+ else: # normal package
self.missingLabel.hide()
self.notInSysLabel.hide()
self.installedCheck.show()
@@ -515,12 +515,12 @@ class PackageTable:
self.emergeBtn.set_sensitive(True)
self.installedCheck.set_active(pkg.is_installed())
self.maskedCheck.set_active(pkg.is_masked())
- if pkg.is_testing(allowed = False) and not pkg.is_testing(allowed=True):
+ if pkg.is_testing(use_keywords = False) and not pkg.is_testing(use_keywords = True):
self.testingCheck.set_label("<i>(Testing)</i>")
self.testingCheck.get_child().set_use_markup(True)
else:
self.testingCheck.set_label("Testing")
- self.testingCheck.set_active(pkg.is_testing(allowed = False))
+ self.testingCheck.set_active(pkg.is_testing(use_keywords = False))
if self.doEmerge:
# set emerge-button-label
@@ -577,16 +577,16 @@ class PackageTable:
"""Callback for toggled testing-checkbox."""
status = button.get_active()
- if self.actual_package().is_testing(allowed = False) == status:
+ if self.actual_package().is_testing(use_keywords = False) == status:
return False
- if not self.actual_package().is_testing(allowed = True):
+ if not self.actual_package().is_testing(use_keywords = True):
self.actual_package().set_testing(False)
button.set_label("Testing")
button.set_active(True)
else:
self.actual_package().set_testing(True)
- if self.actual_package().is_testing(allowed=False):
+ if self.actual_package().is_testing(use_keywords=False):
button.set_label("<i>(Testing)</i>")
button.get_child().set_use_markup(True)
button.set_active(True)
@@ -626,7 +626,7 @@ class MainWindow (Window):
PKG_PAGE = 0
QUEUE_PAGE = 1
CONSOLE_PAGE = 2
-
+
def __init__ (self):
"""Build up window"""
@@ -640,6 +640,9 @@ class MainWindow (Window):
# booleans
self.doUpdate = False
self.packageInit = True
+
+ # installed pixbuf
+ self.instPixbuf = self.window.render_icon(gtk.STOCK_YES, gtk.ICON_SIZE_MENU)
# package db
self.db = Database()
@@ -743,13 +746,24 @@ class MainWindow (Window):
@param name: name of the selected catetegory
@type name: string"""
- store = gtk.ListStore(str)
+ store = gtk.ListStore(str, gtk.gdk.Pixbuf)
self.fill_pkg_store(store,name)
# build view
self.pkgList.set_model(store)
+
+ col = gtk.TreeViewColumn("Packages")
+
+ # adding the pixbuf
+ cell = gtk.CellRendererPixbuf()
+ col.pack_start(cell, False)
+ col.add_attribute(cell, "pixbuf", 1)
+
+ # adding the package name
cell = gtk.CellRendererText()
- col = gtk.TreeViewColumn("Packages", cell, text = 0)
+ col.pack_start(cell, True)
+ col.add_attribute(cell, "text", 0)
+
self.pkgList.append_column(col)
def fill_pkg_store (self, store, name = None):
@@ -763,8 +777,12 @@ class MainWindow (Window):
@rtype: gtk.ListStore"""
if name:
- for p in self.db.get_cat(name):
- store.append([p])
+ for pkg, is_inst in self.db.get_cat(name):
+ if is_inst:
+ icon = self.instPixbuf
+ else:
+ icon = None
+ store.append([pkg, icon])
return store
def jump_to (self, cp):
@@ -778,7 +796,6 @@ class MainWindow (Window):
gobject.idle_add(self.notebook.set_tab_label_text, self.termHB, title)
-
def cb_cat_list_selection (self, view):
"""Callback for a category-list selection. Updates the package list with the packages in the category."""
# get the selected category
@@ -796,7 +813,6 @@ class MainWindow (Window):
store, it = sel.get_selected()
if it:
package = store.get_value(it, 0)
- if package[-1] == '*': package = package[:-1]
self.show_package(self.selCatName+"/"+package, self.queue)
return True
diff --git a/portato/gui/gui_helper.py b/portato/gui/gui_helper.py
index 7808298..be42b52 100644
--- a/portato/gui/gui_helper.py
+++ b/portato/gui/gui_helper.py
@@ -213,21 +213,19 @@ class Database:
list = p.split("/")
cat = list[0]
pkg = list[1]
- if p in installed:
- pkg += "*"
if not cat in self._db: self._db[cat] = []
- self._db[cat].append(pkg)
+ self._db[cat].append((pkg, p in installed))
for key in self._db: # sort alphabetically
- self._db[key].sort(cmp=cmp, key=str.lower)
+ self._db[key].sort(cmp=cmp, key=lambda x: str.lower(x[0]))
def get_cat (self, cat):
"""Returns the packages in the category.
@param cat: category to return the packages from
@type cat: string
- @return: list of packages or []
- @rtype: string[]"""
+ @return: list of tuples: (name, is_installed) or []
+ @rtype: (string, boolean)[]"""
try:
return self._db[cat]
@@ -297,7 +295,7 @@ class EmergeQueue:
# for the beginning: let us create a package object - but it is not guaranteed, that it actually exists in portage
pkg = backend.Package(cpv)
- masked = not (pkg.is_masked() or pkg.is_testing(allowed=True)) # we are setting this to True in case we have unmasked it already, but portage does not know this
+ masked = not (pkg.is_masked() or pkg.is_testing(use_keywords=True)) # we are setting this to True in case we have unmasked it already, but portage does not know this
# and now try to find it in portage
pkg = backend.find_packages("="+cpv, masked = masked)
@@ -307,7 +305,7 @@ class EmergeQueue:
elif unmask: # no pkg returned, but we are allowed to unmask it
pkg = backend.find_packages("="+cpv, masked = True)[0]
- if pkg.is_testing(allowed = True):
+ if pkg.is_testing(use_keywords = True):
pkg.set_testing(True)
if pkg.is_masked():
pkg.set_masked()