summaryrefslogtreecommitdiff
path: root/portato/gui
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--portato/gui/gtk/windows.py14
-rw-r--r--portato/gui/gui_helper.py51
2 files changed, 39 insertions, 26 deletions
diff --git a/portato/gui/gtk/windows.py b/portato/gui/gtk/windows.py
index d67bcfd..a27d156 100644
--- a/portato/gui/gtk/windows.py
+++ b/portato/gui/gtk/windows.py
@@ -24,7 +24,7 @@ from portato.backend import flags, system
from portato.backend.exceptions import *
# plugins
-from portato.plugin import PluginQueue
+from portato import plugin
# more GUI stuff
from portato.gui.gui_helper import Database, Config, EmergeQueue
@@ -626,7 +626,7 @@ class PackageTable:
return True
def cb_package_ebuild_clicked(self, button):
- hook = self.main.pluginQueue.hook("open_ebuild", self.actual_package(), self.window)
+ hook = plugin.hook("open_ebuild", self.actual_package(), self.window)
hook(EbuildWindow)(self.window, self.actual_package())
return True
@@ -720,8 +720,7 @@ class MainWindow (Window):
self.cfg.modify_external_configs()
- # plugins
- self.pluginQueue = PluginQueue()
+ plugin.load_plugins()
# set vpaned position
vpaned = self.tree.get_widget("vpaned")
@@ -1020,7 +1019,12 @@ class MainWindow (Window):
return True
def cb_about_clicked (self, button):
- AboutWindow(self.window, self.pluginQueue.get_plugin_data())
+ queue = plugin.get_plugins()
+ if queue is None:
+ queue = []
+ else:
+ queue = queue.get_plugin_data()
+ AboutWindow(self.window, queue)
return True
def cb_right_click (self, object, event):
diff --git a/portato/gui/gui_helper.py b/portato/gui/gui_helper.py
index 79064b6..ecc3ba6 100644
--- a/portato/gui/gui_helper.py
+++ b/portato/gui/gui_helper.py
@@ -14,6 +14,7 @@
from portato import backend
from portato.backend import flags, system, set_system
from portato.helper import *
+from portato import plugin
# parser
from portato.config_parser import ConfigParser
@@ -280,7 +281,7 @@ class EmergeQueue:
self.db = db
self.title_update = title_update
-
+
# our iterators pointing at the toplevels; they are set to None if we do not have a tree
if self.tree:
self.emergeIt = self.tree.get_emerge_it()
@@ -455,11 +456,15 @@ class EmergeQueue:
if self.title_update: self.title_update(None)
- for p in packages:
- if p in ["world", "system"]: continue
- cat = system.split_cpv(p)[0] # get category
- self.db.reload(cat)
- debug("Category %s refreshed" % cat)
+ @plugin.hook("after_emerge", packages)
+ def update_packages():
+ for p in packages:
+ if p in ["world", "system"]: continue
+ cat = system.split_cpv(p)[0] # get category
+ self.db.reload(cat)
+ debug("Category %s refreshed" % cat)
+
+ update_packages()
def _emerge (self, options, packages, it, command = None):
"""Calls emerge and updates the terminal.
@@ -473,22 +478,26 @@ class EmergeQueue:
@param command: the command to execute - default is "/usr/bin/python /usr/bin/emerge"
@type command: string[]"""
- if command is None:
- command = system.get_merge_command()
+ @plugin.hook("emerge", packages, command)
+ def sub_emerge(command):
+ if command is None:
+ command = system.get_merge_command()
- # open tty
- (master, slave) = pty.openpty()
- self.console.set_pty(master)
-
- # start emerge
- self.process = Popen(command+options+packages, stdout = slave, stderr = STDOUT, shell = False)
-
- # start thread waiting for the stop of emerge
- Thread(name="Emerge-Thread", target=self._update_packages, args=(packages+self.deps.keys(), self.process)).start()
-
- # remove
- for i in it:
- self.remove_with_children(i)
+ # open tty
+ (master, slave) = pty.openpty()
+ self.console.set_pty(master)
+
+ # start emerge
+ self.process = Popen(command+options+packages, stdout = slave, stderr = STDOUT, shell = False)
+
+ # start thread waiting for the stop of emerge
+ Thread(name="Emerge-Thread", target=self._update_packages, args=(packages+self.deps.keys(), self.process)).start()
+
+ # remove
+ for i in it:
+ self.remove_with_children(i)
+
+ sub_emerge(command)
def emerge (self, force = False):
"""Emerges everything in the merge-queue.