From a809ccef9d60952608755cc182378c43861c55fd Mon Sep 17 00:00:00 2001
From: necoro <>
Date: Sat, 28 Jul 2007 05:01:25 +0000
Subject: some more pause emerge items
---
portato/gui/gtk/windows.py | 120 ++++++--
portato/gui/templates/portato.glade | 569 +++++++++++++++++++++---------------
2 files changed, 424 insertions(+), 265 deletions(-)
(limited to 'portato/gui')
diff --git a/portato/gui/gtk/windows.py b/portato/gui/gtk/windows.py
index 226daaf..03a7cf5 100644
--- a/portato/gui/gtk/windows.py
+++ b/portato/gui/gtk/windows.py
@@ -40,7 +40,7 @@ GLADE_FILE = DATA_DIR+"portato.glade"
class Window:
def __init__ (self):
- self.tree = gtk.glade.XML(GLADE_FILE, root = self.__class__.__name__)
+ self.tree = self.get_tree(self.__class__.__name__)
self.tree.signal_autoconnect(self)
self.window = self.tree.get_widget(self.__class__.__name__)
self.window.set_icon_from_file(APP_ICON)
@@ -64,10 +64,19 @@ class Window:
return ret
return wrapper
- def create_popup (self, name):
- popupTree = gtk.glade.XML(GLADE_FILE, root = name)
- popupTree.signal_autoconnect(self)
- return popupTree.get_widget(name)
+ def get_tree (self, name):
+ return gtk.glade.XML(GLADE_FILE, root = name)
+
+class Popup:
+
+ def __init__ (self, name, parent):
+ self.tree = gtk.glade.XML(GLADE_FILE, root = name)
+ self.tree.signal_autoconnect(parent)
+ self._popup = self.tree.get_widget(name)
+
+ def popup (self, *args):
+ self._popup.popup(*args)
+
class AbstractDialog (Window):
"""A class all our dialogs get derived from. It sets useful default vars and automatically handles the ESC-Button."""
@@ -261,27 +270,45 @@ class SearchWindow (AbstractDialog):
AbstractDialog.__init__(self, parent)
- self.list = list # list to show
self.jump_to = jump_to # function to call for jumping
+ self.list = list
+ self.list.sort()
# combo box
- self.combo = gtk.combo_box_new_text()
- for x in list:
- self.combo.append_text(x)
- self.combo.set_active(0) # first item
- self.combo.connect("key-press-event", self.cb_key_pressed_combo)
-
- self.window.add(self.combo)
+ self.searchList = self.tree.get_widget("searchList")
+ self.build_sort_list()
+ self.searchList.get_selection().select_path(0)
# finished --> show
self.window.show_all()
+ def build_sort_list (self):
+ """Builds the sort list."""
+
+ store = gtk.ListStore(str)
+ self.searchList.set_model(store)
+
+ # build categories
+ for p in self.list:
+ store.append(["%s/%s" % tuple(p.split("/"))])
+
+ cell = gtk.CellRendererText()
+ col = gtk.TreeViewColumn("Results", cell, markup = 0)
+ self.searchList.append_column(col)
+
+ def ok (self, *args):
+ self.jump()
+ self.close()
+
+ def jump (self, *args):
+ model, iter = self.searchList.get_selection().get_selected()
+ self.jump_to(self.list[model.get_path(iter)[0]])
+
def cb_key_pressed_combo (self, widget, event):
"""Emulates a ok-button-click."""
keyname = gtk.gdk.keyval_name(event.keyval)
if keyname == "Return": # take it as an "OK" if Enter is pressed
- self.window.destroy()
- self.jump_to(self.list[self.combo.get_active()])
+ self.jump()
return True
else:
return False
@@ -500,7 +527,7 @@ class PackageTable:
@param version: if not None, specifies the version to select
@type version: string
@param doEmerge: if False, the emerge buttons are disabled
- @type doEmerge: False
+ @type doEmerge: boolean
@param instantChange: if True the changed keywords are updated instantly
@type instantChange: boolean"""
@@ -953,7 +980,7 @@ class MainWindow (Window):
# set vpaned position
vpaned = self.tree.get_widget("vpaned")
- vpaned.set_position(int(mHeight/2.5))
+ vpaned.set_position(int(mHeight/2))
# cat and pkg list
self.sortPkgListByName = True
@@ -981,9 +1008,19 @@ class MainWindow (Window):
self.packageTable.hide()
# popups
- self.queuePopup = self.create_popup("queuePopup")
- self.consolePopup = self.create_popup("consolePopup")
- self.trayPopup = self.create_popup("systrayPopup")
+ self.queuePopup = Popup("queuePopup", self)
+ self.consolePopup = Popup("consolePopup", self)
+ self.trayPopup = Popup("systrayPopup", self)
+
+ # pause menu items
+ self.emergePaused = False
+ self.pauseItems = {}
+ self.pauseItems["tray"] = self.trayPopup.tree.get_widget("pauseItemTray")
+ self.pauseItems["popup"] = self.consolePopup.tree.get_widget("pauseItemPopup")
+ self.pauseItems["menu"] = self.tree.get_widget("pauseItemMenu")
+
+ for k,v in self.pauseItems.items():
+ self.pauseItems[k] = (v, v.connect_after("activate", self.cb_pause_emerge(k)))
# systray
if self.cfg.get_boolean("systray", "GUI"):
@@ -996,7 +1033,7 @@ class MainWindow (Window):
# set emerge queue
self.queueTree = GtkTree(self.queueList.get_model())
self.queue = EmergeQueue(console = self.console, tree = self.queueTree, db = self.db, title_update = self.title_update)
-
+
self.window.maximize()
def show_package (self, *args, **kwargs):
@@ -1275,8 +1312,12 @@ class MainWindow (Window):
@Window.watch_cursor
def cb_search_clicked (self, entry):
"""Do a search."""
- if entry.get_text() != "":
- packages = system.find_all_packages(entry.get_text(), withVersion = False)
+ text = entry.get_text()
+ if text != "":
+ if "/" not in text:
+ text = "/"+text # only look for package names
+
+ packages = system.find_all_packages(text, withVersion = False)
if packages == []:
nothing_found_dialog()
@@ -1346,16 +1387,33 @@ class MainWindow (Window):
self.cfg.set_local(package, "oneshot", set)
self.queue.append(package, update = True, oneshot = set, forceUpdate = True)
- def cb_stop_cont_toggled (self, cb):
- if not cb.get_active():
- self.queue.continue_emerge()
- else:
- self.queue.stop_emerge()
- return False
-
- def cb_kill_clicked (self, action):
+ def cb_pause_emerge (self, curr):
+ def pause (cb):
+ debug("pause")
+ self.emergePaused = cb.get_active()
+ if not self.emergePaused:
+ self.queue.continue_emerge()
+ else:
+ self.queue.stop_emerge()
+
+ for v in self.pauseItems.itervalues():
+ v[0].handler_block(v[1])
+
+ for k, v in self.pauseItems.iteritems():
+ if k != curr:
+ v[0].set_active(self.emergePaused)
+
+ for v in self.pauseItems.itervalues():
+ v[0].handler_unblock(v[1])
+
+ return False
+ return pause
+
+ def cb_kill_clicked (self, action):
self.queue.kill_emerge()
+ if self.emergePaused:
+ self.pauseItems["menu"][0].set_active(False)
def cb_copy_clicked (self, action):
self.console.copy_clipboard()
diff --git a/portato/gui/templates/portato.glade b/portato/gui/templates/portato.glade
index 7c4644e..b16cec7 100644
--- a/portato/gui/templates/portato.glade
+++ b/portato/gui/templates/portato.glade
@@ -65,18 +65,10 @@
@@ -177,6 +169,14 @@
True
+
+
+
@@ -362,8 +361,8 @@
True
- _Search
- True
+ gtk-find
+ True
0
@@ -451,107 +450,52 @@
5
3
-
+
True
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ 1
+ True
-
+
+ True
+ True
+ Installed
+ 0
+ True
+
+
+
+ False
+
-
-
- 3
- 1
- 2
- GTK_EXPAND
-
-
-
-
-
- True
- True
- <b>Installed, but not in portage anymore</b>
- True
-
-
- 3
- 2
- 3
- GTK_FILL
-
-
-
-
- True
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
- 5
-
+
True
- True
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
- GTK_POLICY_NEVER
- GTK_POLICY_AUTOMATIC
-
-
- True
- True
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
- True
- False
-
-
-
+ True
+ Masked
+ 0
+ True
+
- False
+ False
+ 1
-
+
True
- False
- GTK_POLICY_AUTOMATIC
- GTK_POLICY_AUTOMATIC
-
-
- True
-
-
+ True
+ Testing
+ 0
+ True
+
- 1
+ False
+ 2
-
- 3
- 3
- 4
- 5
- 5
-
-
-
-
- True
- GTK_JUSTIFY_CENTER
- True
-
-
- 3
- GTK_FILL
-
- 10
-
-
-
-
- True
- True
- <span foreground='red'><b>MISSING KEYWORD</b></span>
- True
-
3
2
@@ -618,51 +562,90 @@
-
+
True
- 1
- True
+ True
+ <span foreground='red'><b>MISSING KEYWORD</b></span>
+ True
+
+
+ 3
+ 2
+ 3
+ GTK_FILL
+
+
+
+
+ True
+ GTK_JUSTIFY_CENTER
+ True
+
+
+ 3
+ GTK_FILL
+
+ 10
+
+
+
+
+ True
+ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ 5
-
+
True
- True
- Installed
- 0
- True
-
+ True
+ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ GTK_POLICY_NEVER
+ GTK_POLICY_AUTOMATIC
+
+
+ True
+ True
+ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ True
+ False
+
+
+
- False
+ False
-
+
True
- True
- Masked
- 0
- True
-
+ False
+ GTK_POLICY_AUTOMATIC
+ GTK_POLICY_AUTOMATIC
+
+
+ True
+
+
- False
1
-
-
- True
- True
- Testing
- 0
- True
-
-
-
- False
- 2
-
-
+
+
+ 3
+ 3
+ 4
+ 5
+ 5
+
+
+
+
+ True
+ True
+ <b>Installed, but not in portage anymore</b>
+ True
3
@@ -671,6 +654,22 @@
GTK_FILL
+
+
+ True
+ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+
+
+
+
+
+ 3
+ 1
+ 2
+ GTK_EXPAND
+
+
+
False
@@ -848,21 +847,97 @@
+ 350
+ 250
Search
- False
- True
- GTK_WIN_POS_CENTER_ON_PARENT
1
1
True
True
-
-
-
-
- 5
- Preferences
+
+ True
+ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+
+
+ True
+ True
+ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ GTK_POLICY_AUTOMATIC
+ GTK_POLICY_AUTOMATIC
+
+
+ True
+ True
+ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ False
+ True
+
+
+
+
+
+
+
+ True
+ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ True
+ GTK_BUTTONBOX_SPREAD
+
+
+ True
+ True
+ True
+ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ gtk-cancel
+ True
+ 0
+
+
+
+
+
+ True
+ True
+ True
+ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ gtk-jump-to
+ True
+ 0
+
+
+
+ 1
+
+
+
+
+ True
+ True
+ True
+ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ gtk-ok
+ True
+ 0
+
+
+
+ 2
+
+
+
+
+ False
+ False
+ 1
+
+
+
+
+
+
+ 5
+ Preferences
True
GTK_WIN_POS_CENTER_ON_PARENT
True
@@ -1072,189 +1147,189 @@
-
+
True
+ 0
+ 5
+ <u><i>Masking Keywords</i></u>
+ True
+ True
- 1
- 2
- 3
- 4
+ 7
+ 8
+ 5
-
+
True
0
- File name to use, if package.use is a directory:
+ 5
+ <u><i>Testing Keywords</i></u>
+ True
True
- 3
- 4
+ 4
+ 5
+ 5
-
+
True
- Add only exact version to package.use
- 0
- True
+ 0
+ 5
+ <u><i>Use-Flags</i></u>
+ True
+ True
+
+
+ 1
+ 2
+ 6
+
+
+
+
+ True
+
+
+ True
+ 0
+ GTK_SHADOW_OUT
+
+
+ True
+ 0
+ <u>You may use the following placeholders:</u>
+
+<i>$(cat)</i>: category
+<i>$(pkg)</i>: package name
+<i>$(cat-1)/$(cat-2)</i>: first/second part of the category
+ True
+
+
+
+
+
+ label_item
+
+
+
+
2
- 2
- 3
-
+
True
- Add only exact version to package.keywords
+ Add only exact version to package.mask/package.unmask
0
True
2
- 5
- 6
+ 8
+ 9
-
+
True
0
- File name to use, if package.keywords is a directory:
+ File name to use, if package.mask/package.unmask is a directory:
True
- 6
- 7
+ 9
+ 10
-
+
True
1
2
- 6
- 7
+ 9
+ 10
-
+
True
1
2
- 9
- 10
+ 6
+ 7
-
+
True
0
- File name to use, if package.mask/package.unmask is a directory:
+ File name to use, if package.keywords is a directory:
True
- 9
- 10
+ 6
+ 7
-
+
True
- Add only exact version to package.mask/package.unmask
+ Add only exact version to package.keywords
0
True
2
- 8
- 9
+ 5
+ 6
-
+
True
-
-
- True
- 0
- GTK_SHADOW_OUT
-
-
- True
- 0
- <u>You may use the following placeholders:</u>
-
-<i>$(cat)</i>: category
-<i>$(pkg)</i>: package name
-<i>$(cat-1)/$(cat-2)</i>: first/second part of the category
- True
-
-
-
-
-
- label_item
-
-
-
-
+ Add only exact version to package.use
+ 0
+ True
2
+ 2
+ 3
-
- True
- 0
- 5
- <u><i>Use-Flags</i></u>
- True
- True
-
-
- 1
- 2
- 6
-
-
-
-
+
True
0
- 5
- <u><i>Testing Keywords</i></u>
- True
+ File name to use, if package.use is a directory:
True
- 4
- 5
- 5
+ 3
+ 4
-
+
True
- 0
- 5
- <u><i>Masking Keywords</i></u>
- True
- True
- 7
- 8
- 5
+ 1
+ 2
+ 3
+ 4
@@ -1469,11 +1544,37 @@
True
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
-
+
+
+
+
+
--
cgit v1.2.3-70-g09d2