From 51258abefb5c88c62dd6bb5861d4d2e8e372799f Mon Sep 17 00:00:00 2001 From: necoro <> Date: Sun, 11 Feb 2007 18:15:38 +0000 Subject: Build new ebuild-window --- portato/backend/package.py | 2 +- portato/constants.py | 2 + portato/gui/gtk/glade/portato.glade | 410 +++++++++++++++++++----------------- portato/gui/gtk/windows.py | 54 +++++ 4 files changed, 276 insertions(+), 192 deletions(-) diff --git a/portato/backend/package.py b/portato/backend/package.py index 056d54c..92194d5 100644 --- a/portato/backend/package.py +++ b/portato/backend/package.py @@ -231,7 +231,7 @@ class Package: return True elif (not self.is_installed()) and flag in self.get_settings("USE").split() \ - and not flags.invert_use_flag(flag) in pkg.get_new_use_flags(): # flags that would be set + and not flags.invert_use_flag(flag) in self.get_new_use_flags(): # flags that would be set return True elif flag in self.get_new_use_flags(): diff --git a/portato/constants.py b/portato/constants.py index c4ffd6e..0e18425 100644 --- a/portato/constants.py +++ b/portato/constants.py @@ -18,3 +18,5 @@ VERSION = 9999 FRONTENDS = ["gtk"] STD_FRONTEND = "gtk" + +USE_GTKSOURCEVIEW = False diff --git a/portato/gui/gtk/glade/portato.glade b/portato/gui/gtk/glade/portato.glade index 9dc48c4..af80213 100644 --- a/portato/gui/gtk/glade/portato.glade +++ b/portato/gui/gtk/glade/portato.glade @@ -97,6 +97,7 @@ + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK gtk-go-forward @@ -110,6 +111,7 @@ True + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK gtk-go-back @@ -136,6 +138,7 @@ True + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK gtk-refresh @@ -150,6 +153,7 @@ + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK gtk-save @@ -387,72 +391,48 @@ 4 2 - + True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC + 1 + True - + True + True + Installed + True + + + False + - - - 2 - 2 - 3 - 5 - 5 - - - - - True - + + True + True + Masked + True + + + + False + 1 + + + + + True + True + Testing + True + + + + False + 2 + - - - 1 - 2 - GTK_FILL - 5 - - - - - True - GTK_JUSTIFY_CENTER - True - - - 2 - GTK_FILL - - 10 - - - - - True - True - <span foreground='red'><b>MISSING KEYWORD</b></span> - True - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - True - True - <b>Installed, but not in portage anymore</b> - True 1 @@ -497,6 +477,17 @@ 2 + + + True + E_build + True + + + + 3 + + 2 @@ -506,55 +497,79 @@ - + + True + True + <b>Installed, but not in portage anymore</b> + True + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + True + True + <span foreground='red'><b>MISSING KEYWORD</b></span> + True + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + True + GTK_JUSTIFY_CENTER + True + + + 2 + GTK_FILL + + 10 + + + + True - 1 - True - - - True - True - Installed - True - - - - False - - - - True - True - Masked - True - - - - False - 1 - + + + + 1 + 2 + GTK_FILL + 5 + + + + + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC - + True - True - Testing - True - - - False - 2 - - 1 2 - 1 - 2 - GTK_FILL + 2 + 3 + 5 + 5 @@ -953,186 +968,186 @@ - + True - 0 - 5 - <u><i>Masking Keywords</i></u> - True - True - 7 - 8 - 5 - - - - - True - 0 - 5 - <u><i>Testing Keywords</i></u> - True - True - - - 4 - 5 - 5 + 1 + 2 + 3 + 4 - + True 0 - 5 - <u><i>Use-Flags</i></u> - True + File name to use, if package.use is a directory: True - 1 - 2 - 6 + 3 + 4 - + 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 + True 2 + 2 + 3 - + True - Add only exact version to package.mask/package.unmask + Add only exact version to package.keywords True 2 - 8 - 9 + 5 + 6 - + 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 1 2 - 9 - 10 + 6 + 7 - + True 1 2 - 6 - 7 + 9 + 10 - + 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 - Add only exact version to package.keywords + Add only exact version to package.mask/package.unmask True 2 - 5 - 6 + 8 + 9 - + True - Add only exact version to package.use - 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 0 - File name to use, if package.use is a directory: + 5 + <u><i>Use-Flags</i></u> + True True - 3 - 4 + 1 + 2 + 6 - + True + 0 + 5 + <u><i>Testing Keywords</i></u> + True + True - 1 - 2 - 3 - 4 + 4 + 5 + 5 + + + + + True + 0 + 5 + <u><i>Masking Keywords</i></u> + True + True + + + 7 + 8 + 5 @@ -1186,4 +1201,17 @@ + + True + + + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + + + + + + diff --git a/portato/gui/gtk/windows.py b/portato/gui/gtk/windows.py index 64ff8a1..91153aa 100644 --- a/portato/gui/gtk/windows.py +++ b/portato/gui/gtk/windows.py @@ -16,6 +16,9 @@ pygtk.require("2.0") import gtk import gtk.glade import gobject +from portato.constants import USE_GTKSOURCEVIEW +if USE_GTKSOURCEVIEW: + import gtksourceview #our backend stuff from portato.helper import * @@ -245,6 +248,52 @@ class PreferenceWindow (AbstractDialog): """Just closes - w/o saving.""" self.window.destroy() +class EbuildWindow (AbstractDialog): + """The window showing the ebuild.""" + + def __init__ (self, parent, package): + AbstractDialog.__init__(self,parent) + + # we want it to get minimized + self.window.set_transient_for(None) + + self.window.set_title(package.get_cpv()) + + # set geometry (same as MainWindow) + mHeight = 800 + if gtk.gdk.screen_height() <= 800: mHeight = 600 + self.window.set_geometry_hints (self.window, min_width = 800, min_height = mHeight, max_height = gtk.gdk.screen_height(), max_width = gtk.gdk.screen_width()) + + if USE_GTKSOURCEVIEW: # we want syntax highlighting + # get language + man = gtksourceview.SourceLanguagesManager() + language = [l for l in man.get_available_languages() if l.get_name() == "Gentoo"] + + # set buffer and view + buf = gtksourceview.SourceBuffer() + buf.set_language(language[0]) + buf.set_highlight(True) + view = gtksourceview.SourceView(buf) + else: + buf = gtk.TextBuffer() + view = gtk.TextView(buf) + + view.set_editable(False) + view.set_cursor_visible(False) + + try: # read ebuild + f = open(package.get_ebuild_path(), "r") + lines = f.readlines() + f.close() + except IOError,e: + io_ex_dialog(e) + return + + buf.set_text("".join(lines)) + + self.tree.get_widget("ebuildScroll").add(view) + self.window.show_all() + class PackageTable: """A window with data about a specfic package.""" @@ -279,6 +328,7 @@ class PackageTable: self.emergeBtn = self.tree.get_widget("pkgEmergeBtn") self.unmergeBtn = self.tree.get_widget("pkgUnmergeBtn") self.cancelBtn = self.tree.get_widget("pkgCancelBtn") + self.ebuildBtn = self.tree.get_widget("pkgEbuildBtn") # useList self.useListScroll = self.tree.get_widget("useListScroll") @@ -516,6 +566,10 @@ class PackageTable: self.main.notebook.set_current_page(self.main.QUEUE_PAGE) return True + def cb_package_ebuild_clicked(self, button): + EbuildWindow(self.main.window, self.actual_package()) + return True + def cb_testing_toggled (self, button): """Callback for toggled testing-checkbox.""" status = button.get_active() -- cgit v1.2.3-54-g00ecf