summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/Changelog1
-rw-r--r--doc/TODO1
-rw-r--r--portato/backend/package.py21
-rw-r--r--portato/gui/gtk/usetips.py21
-rw-r--r--portato/gui/gtk/windows.py30
5 files changed, 63 insertions, 11 deletions
diff --git a/doc/Changelog b/doc/Changelog
index c85d8c5..0497207 100644
--- a/doc/Changelog
+++ b/doc/Changelog
@@ -1,5 +1,6 @@
next:
- first plugin support
+- collapsed USE_EXPAND-variables
0.6.0:
- general support for different backend systems
diff --git a/doc/TODO b/doc/TODO
index 11733c1..c019509 100644
--- a/doc/TODO
+++ b/doc/TODO
@@ -11,4 +11,3 @@ GTK:
----
- make oneshot better
- better infos in queue for "newuse"
-- do not show "linguas_" variables as extra ones (perhaps backend?)
diff --git a/portato/backend/package.py b/portato/backend/package.py
index ebe9e85..0039fc0 100644
--- a/portato/backend/package.py
+++ b/portato/backend/package.py
@@ -134,6 +134,27 @@ class Package:
else:
return False
+ def use_expanded (self, flag, suggest = None):
+ """Tests whether a useflag is an expanded one. If it is, this method returns the USE_EXPAND-value.
+
+ @param flag: the flag to check
+ @type flag: string
+ @param suggest: try this suggestion first
+ @type suggest: string
+ @returns: USE_EXPAND-value on success
+ @rtype: string or None"""
+
+ if not suggest is None:
+ if flag.startswith(suggest.lower()):
+ return suggest
+
+ for exp in self.get_global_settings("USE_EXPAND").split(" "):
+ lexp = exp.lower()
+ if flag.startswith(lexp):
+ return exp
+
+ return None
+
def get_cpv(self):
"""Returns full Category/Package-Version string.
diff --git a/portato/gui/gtk/usetips.py b/portato/gui/gtk/usetips.py
index 75bb63f..db970c1 100644
--- a/portato/gui/gtk/usetips.py
+++ b/portato/gui/gtk/usetips.py
@@ -51,26 +51,35 @@ class UseTips (TreeViewTooltips):
pkg = system.new_package(cpv)
enabled = []
disabled = []
+ expanded = set()
pkg_flags = pkg.get_all_use_flags()
- if len(pkg_flags) == 0: # no flags - stop here
+ if not pkg_flags: # no flags - stop here
return None
pkg_flags.sort()
for use in pkg_flags:
- if pkg.is_use_flag_enabled(use):
- enabled.append(use)
+ exp = pkg.use_expanded(use)
+ if exp:
+ expanded.add(exp)
+
else:
- disabled.append(use)
+ if pkg.is_use_flag_enabled(use):
+ enabled.append(use)
+ else:
+ disabled.append(use)
string = ""
- if len(enabled) > 0:
+ if enabled:
string = "<b>+%s</b>" % ("\n+".join(enabled),)
if len(disabled) > 0:
string = string + "\n"
- if len(disabled) > 0:
+ if disabled:
string = string+"<i>- %s</i>" % ("\n- ".join(disabled),)
+ if expanded:
+ string = string+"\n\n"+"\n".join(expanded)
+
return string
diff --git a/portato/gui/gtk/windows.py b/portato/gui/gtk/windows.py
index 2e5fd85..d67bcfd 100644
--- a/portato/gui/gtk/windows.py
+++ b/portato/gui/gtk/windows.py
@@ -439,14 +439,27 @@ class PackageTable:
pkg = self.actual_package()
pkg_flags = pkg.get_all_use_flags()
pkg_flags.sort()
+
+ actual_exp = None
+ actual_exp_it = None
+
for use in pkg_flags:
- store.append([pkg.is_use_flag_enabled(use), use, system.get_use_desc(use, self.cp)])
+ exp = pkg.use_expanded(use, suggest = actual_exp)
+ if exp is not None:
+ if exp != actual_exp:
+ actual_exp_it = store.append(None, [None, exp, "<i>This is an expanded use flag and cannot be selected</i>"])
+ actual_exp = exp
+ else:
+ actual_exp_it = None
+ actual_exp = None
+
+ store.append(actual_exp_it, [pkg.is_use_flag_enabled(use), use, system.get_use_desc(use, self.cp)])
return store
def build_use_list (self):
"""Builds the useList."""
- store = gtk.ListStore(bool, str, str)
+ store = gtk.TreeStore(bool, str, str)
self.fill_use_list(store)
# build view
@@ -457,7 +470,10 @@ class PackageTable:
tCell.connect("toggled", self.cb_use_flag_toggled, store)
view.append_column(gtk.TreeViewColumn("Enabled", tCell, active = 0))
view.append_column(gtk.TreeViewColumn("Flags", cell, text = 1))
- view.append_column(gtk.TreeViewColumn("Description", cell, text = 2))
+ view.append_column(gtk.TreeViewColumn("Description", cell, markup = 2))
+
+ view.set_search_column(1)
+ view.set_enable_tree_lines(True)
if store.iter_n_children(None) == 0: # if there are no nodes in the list ...
view.set_child_visible(False) # ... do not show the list
@@ -649,12 +665,18 @@ class PackageTable:
def cb_use_flag_toggled (self, cell, path, store):
"""Callback for a toggled use-flag button."""
+ flag = store[path][1]
+ pkg = self.actual_package()
+
+ if flag in pkg.get_global_settings("USE_EXPAND").split(" "): # ignore expanded flags
+ return False
+
store[path][0] = not store[path][0]
prefix = ""
if not store[path][0]:
prefix = "-"
- self.actual_package().set_use_flag(prefix+store[path][1])
+ pkg.set_use_flag(prefix+flag)
if self.instantChange:
self._update_keywords(True, update = True)