summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/Changelog1
-rwxr-xr-xportato.py23
-rw-r--r--portato/gui/gtk/__init__.py25
-rw-r--r--portato/gui/qt/__init__.py21
-rw-r--r--portato/gui/qt/windows.py3
5 files changed, 64 insertions, 9 deletions
diff --git a/doc/Changelog b/doc/Changelog
index fcac18b..9dbec15 100644
--- a/doc/Changelog
+++ b/doc/Changelog
@@ -1,6 +1,7 @@
next:
- new icon by p4r4d0x
- sync command now accepts "&&"
+- added ebuild-viewer
0.7.4.2:
- bugfix in PortageSystem
diff --git a/portato.py b/portato.py
index 3a81dec..08d7123 100755
--- a/portato.py
+++ b/portato.py
@@ -17,6 +17,8 @@ import sys
def main ():
uimod = STD_FRONTEND
+ do_ebuild = False
+ ebuild_pkg = None
for arg in sys.argv[1:]:
if arg in ("--help","--version","-h","-v"):
@@ -29,18 +31,24 @@ There is NO WARRANTY, to the extent permitted by law.
Written by René 'Necoro' Neumann <necoro@necoro.net>""" % VERSION
sys.exit(0)
- if arg == "--check": # run pychecker
+ elif arg == "--check": # run pychecker
import os
os.environ['PYCHECKER'] = "--limit 50"
import pychecker.checker
- continue
- uimod = arg
- break
+ elif arg in ("--ebuild", "-e"):
+ do_ebuild = True
+
+ elif do_ebuild:
+ ebuild_pkg = arg
+ do_ebuild = False
+
+ else:
+ uimod = arg
if uimod in FRONTENDS:
try:
- exec ("from portato.gui.%s import run" % uimod)
+ exec ("from portato.gui.%s import run, show_ebuild" % uimod)
except ImportError, e:
print "'%s' should be installed, but cannot be imported. This is definitly a bug. (%s)" % (uimod, e[0])
sys.exit(1)
@@ -51,7 +59,10 @@ Written by René 'Necoro' Neumann <necoro@necoro.net>""" % VERSION
print
sys.exit(1)
- run()
+ if ebuild_pkg:
+ show_ebuild(ebuild_pkg)
+ else:
+ run()
if __name__ == "__main__":
main()
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."""