diff options
Diffstat (limited to '')
-rw-r--r-- | portato/gui/gtk/__init__.py | 25 | ||||
-rw-r--r-- | portato/gui/qt/__init__.py | 21 | ||||
-rw-r--r-- | portato/gui/qt/windows.py | 3 |
3 files changed, 46 insertions, 3 deletions
diff --git a/portato/gui/gtk/__init__.py b/portato/gui/gtk/__init__.py index 5e164db..db9e6e1 100644 --- a/portato/gui/gtk/__init__.py +++ b/portato/gui/gtk/__init__.py @@ -10,8 +10,31 @@ # # Written by René 'Necoro' Neumann <necoro@necoro.net> -from windows import MainWindow +import gtk +from portato import plugin +from portato.backend import system +from windows import MainWindow, SearchWindow, EbuildWindow def run (): m = MainWindow() m.main() + +def show_ebuild (pkg): + plugin.load_plugins("gtk") + + def _show (pkg): + gtk.main_quit() + + hook = plugin.hook("open_ebuild", pkg, None) + + ew = hook(EbuildWindow)(None, system.new_package(pkg)) + ew.window.connect("destroy", lambda *x: gtk.main_quit()) + ew.window.set_title("Portato Ebuild Viewer - %s" % pkg) + + gtk.main() + + s = SearchWindow(None, [x.get_cpv() for x in system.sort_package_list(system.find_all_packages(pkg, True))], _show) + s.window.set_title("Portato Ebuild Viewer - Search") + s.window.connect("destroy", lambda *x: gtk.main_quit()) + + gtk.main() diff --git a/portato/gui/qt/__init__.py b/portato/gui/qt/__init__.py index df49473..4882a73 100644 --- a/portato/gui/qt/__init__.py +++ b/portato/gui/qt/__init__.py @@ -10,10 +10,29 @@ # # Written by René 'Necoro' Neumann <necoro@necoro.net> +from portato import plugin +from portato.backend import system + from PyQt4.Qt import QApplication -from windows import MainWindow +from windows import MainWindow, EbuildDialog, SearchDialog def run(): app = QApplication([]) m = MainWindow() app.exec_() + +def show_ebuild (pkg): + plugin.load_plugins("qt") + app = QApplication([]) + + def _show (pkg): + hook = plugin.hook("open_ebuild", pkg, None) + + ew = hook(EbuildDialog)(None, system.new_package(pkg)) + ew.setWindowTitle("Portato Ebuild Viewer - %s" % pkg) + ew.exec_() + + s = SearchDialog(None, [x.get_cpv() for x in system.sort_package_list(system.find_all_packages(pkg, True))], _show) + s.setWindowTitle("Portato Ebuild Viewer - Search") + s.show() + app.exec_() diff --git a/portato/gui/qt/windows.py b/portato/gui/qt/windows.py index 16daa5e..d701893 100644 --- a/portato/gui/qt/windows.py +++ b/portato/gui/qt/windows.py @@ -411,7 +411,8 @@ class PackageDetails: return self.packages[self.window.versCombo.currentIndex()] def cb_ebuild_clicked (self): - EbuildDialog(self.window, self.actual_package()).exec_() + hook = plugin.hook("open_ebuild", self.actual_package(), self.window) + hook(EbuildDialog)(self.window, self.actual_package()).exec_() def cb_emerge_clicked (self): """Callback for pressed emerge-button. Adds the package to the EmergeQueue.""" |