summaryrefslogtreecommitdiff
path: root/portato/gui/gtk/windows.py
diff options
context:
space:
mode:
Diffstat (limited to 'portato/gui/gtk/windows.py')
-rw-r--r--portato/gui/gtk/windows.py54
1 files changed, 54 insertions, 0 deletions
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()
r class='logheader'>2008-01-18 r643@Devoty: necoro | 2008-01-16 18:55:49 +0100Necoro14-249/+525 Fixed small bug in PackageTable.cb_package_revert_clicked r646@Devoty: necoro | 2008-01-18 00:12:30 +0100 Make tabpositions being configurable by the user r647@Devoty: necoro | 2008-01-18 01:38:19 +0100 Renamed 'shm' to '_shm' to not hide the global one r648@Devoty: necoro | 2008-01-18 01:38:29 +0100 Renamed 'shm' to '_shm' to not hide the global one r649@Devoty: necoro | 2008-01-18 02:34:43 +0100 Added update queues; general UI improvement 2008-01-14 r634@Devoty: necoro | 2008-01-14 23:48:24 +0100Necoro3-1/+4 Removed the broken plugins until they get replaced 2008-01-14 r632@Devoty: necoro | 2008-01-14 23:44:52 +0100Necoro3-175/+181 small changes 2008-01-14(no commit message)Necoro10-758/+1014 2008-01-14 r621@Devoty: necoro | 2008-01-14 20:21:40 +0100Necoro2-21/+61 adjust changelog r622@Devoty: necoro | 2008-01-14 21:01:11 +0100 Some new views 2008-01-14 r618@Devoty: necoro | 2008-01-14 20:19:05 +0100Necoro2-35/+57 An ALL category 2008-01-14 r617@Devoty: necoro | 2008-01-14 19:12:59 +0100Necoro2-10/+10 Remove unnecessairy loads of the shm module 2008-01-14 r609@Devoty: necoro | 2008-01-14 17:04:38 +0100Necoro9-394/+477 Allowed '-' and '_' in key names. Also use group names instead of their number. r610@Devoty: necoro | 2008-01-14 17:05:42 +0100 Disabled saving of the queues r611@Devoty: necoro | 2008-01-14 17:08:53 +0100 Added the possibility to permanently en-/disable plugins r612@Devoty: necoro | 2008-01-14 17:14:09 +0100 adjust changelog and translations r613@Devoty: necoro | 2008-01-14 17:40:53 +0100 Dropdown should be localized too 2008-01-14 r605@Devoty: necoro | 2008-01-14 11:43:34 +0100Necoro2-26/+129 Updated shm module to version 1.1.4 2008-01-14 r603@Devoty: necoro | 2008-01-14 11:30:26 +0100Necoro4-26/+38 Improved 'update world'; really support new use defaults 2008-01-11 r598@Devoty: necoro | 2008-01-10 16:36:29 +0100Necoro4-10/+50 Handle the new useflag format correctly 2008-01-11 r597@Devoty: necoro | 2008-01-10 14:12:35 +0100Necoro1-3/+3 updated todo 2008-01-10 r595@Devoty: necoro | 2008-01-10 04:04:15 +0100Necoro1-52/+3 Re-Introduced etc-proposals 2008-01-09 r586@Devoty: necoro | 2008-01-09 14:54:18 +0100Necoro1-1/+1 Disabled catapult till it is really usable 2007-12-06 r577@Devoty: necoro | 2007-12-06 20:37:36 +0100Necoro1-1/+1 Fixed desktop file 2007-12-06 r572@Devoty: necoro | 2007-11-28 08:48:15 +0100Necoro1-0/+1 2007-11-27 r570@Devoty: necoro | 2007-11-27 02:08:21 +0100Necoro3-84/+108 Added scrollbars to update window