From ad74f5cfcda1e740e007f750f242bea33047920d Mon Sep 17 00:00:00 2001 From: necoro <> Date: Mon, 16 Apr 2007 22:34:28 +0000 Subject: added ebuild window for Qt-Frontend --- portato/gui/qt/windows.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'portato/gui/qt/windows.py') diff --git a/portato/gui/qt/windows.py b/portato/gui/qt/windows.py index 3b1de2b..b2949bd 100644 --- a/portato/gui/qt/windows.py +++ b/portato/gui/qt/windows.py @@ -25,6 +25,7 @@ from portato.gui.gui_helper import Database, Config, EmergeQueue # own GUI stuff from terminal import QtConsole from tree import QtTree +from highlighter import EbuildHighlighter from dialogs import * from helper import qCheck, qIsChecked @@ -112,6 +113,30 @@ class SearchDialog (Window): self.done(0) self.jumpTo(s) +class EbuildDialog (Window): + + __metaclass__ = WindowMeta + + def __init__ (self, parent, package): + + Window.__init__(self, parent) + + self.setWindowTitle(package.get_cpv()) + + self.doc = Qt.QTextDocument() + self.hl = EbuildHighlighter(self.doc) + + try: # read ebuild + f = open(package.get_ebuild_path(), "r") + lines = f.readlines() + f.close() + except IOError,e: + io_ex_dialog(self, e) + return + + self.doc.setPlainText("".join(lines)) + self.ebuildEdit.setDocument(self.doc) + class PreferenceWindow (Window): """Window displaying some preferences.""" @@ -202,6 +227,7 @@ class PackageDetails: Qt.QObject.connect(self.window.pkgEmergeBtn, Qt.SIGNAL("clicked()"), self.cb_emerge_clicked) Qt.QObject.connect(self.window.pkgUnmergeBtn, Qt.SIGNAL("clicked()"), self.cb_unmerge_clicked) Qt.QObject.connect(self.window.pkgRevertBtn, Qt.SIGNAL("clicked()"), self.cb_revert_clicked) + Qt.QObject.connect(self.window.pkgEbuildBtn, Qt.SIGNAL("clicked()"), self.cb_ebuild_clicked) # checkboxes Qt.QObject.connect(self.window.maskedCheck, Qt.SIGNAL("clicked(bool)"), self.cb_masked_clicked) @@ -326,6 +352,9 @@ class PackageDetails: return self.packages[self.window.versCombo.currentIndex()] + def cb_ebuild_clicked (self): + EbuildDialog(self.window, self.actual_package()).exec_() + def cb_emerge_clicked (self): """Callback for pressed emerge-button. Adds the package to the EmergeQueue.""" if not am_i_root(): -- cgit v1.2.3-70-g09d2