diff options
-rw-r--r-- | lib.py | 42 | ||||
-rw-r--r-- | lib_cman.py | 58 | ||||
-rw-r--r-- | lib_shared.py | 8 |
3 files changed, 82 insertions, 26 deletions
@@ -66,6 +66,7 @@ class LibMeta(type): for akey, avalue in getattr(cls, 'defaults', {}).iteritems(): kwargs.setdefault(akey, avalue) + kwargs['URL'] = "class://" + self.__class__.__name__ old_init(self, *args, **kwargs) super(cls, self).__init__(*args, **kwargs) @@ -133,6 +134,7 @@ def gen_graph(graph, blacklist=(), **kwargs): def xdot_graph(*args, **kwargs): import gtk import gtk.gdk + import pango try: path[:] = [expanduser('~/wrkspc/goss-medium/jrfonseca.xdot')] + path[:] import xdot @@ -140,6 +142,44 @@ def xdot_graph(*args, **kwargs): print 'missing xdot; use "pip install xdot" or equivalent' raise + class LibDotWidget(xdot.DotWidget): + """Overriden so as to serve our info tooltip purpose""" + def __init__(self, *args, **kwargs): + super(LibDotWidget, self).__init__(*args, **kwargs) + self.connect('leave-notify-event', + lambda self, *args: self.set_tooltip_markup(None)) + + def on_click(self, element, event): + if element is None or not element.url: + return False + # create the resulting markup + print element.url + cls = REGISTRY[element.url.split('class://', 1)[1]] + markup = "" + if hasattr(cls, 'summary'): + markup += "<b>" + cls.summary + "</b>\n\n" + if hasattr(cls, 'web'): + markup += "<u>" + cls.web + "</u>\n\n" + if hasattr(cls, 'repo'): + markup += "repository:\n" + for name, value in cls.repo.iteritems(): + markup += "* " + name + ": <u>" + value + "</u>\n" + markup += '\n' + if hasattr(cls, 'man'): + markup += "man:\n" + for item in cls.man: + markup += "* <i>" + item + "</i>\n" + markup += '\n' + if hasattr(cls, 'ids'): + markup += "identifiers:\n" + for name, value in cls.ids.iteritems(): + markup += "* " + name + ": <i>" + value + "</i>\n" + markup += '\n' + markup = markup.rstrip('\n') + print pango.parse_markup(markup)[1].join(2 * ['\n' + 3*'=' + '\n']) + self.set_tooltip_markup(markup) + return False + class LibDotWindow(xdot.DotWindow): # heavily inspired from http://zetcode.com/gui/pygtk/menus/ def on_toggle_item(self, widget): @@ -186,7 +226,7 @@ def xdot_graph(*args, **kwargs): self._args = args self._kwargs = kwargs self._can_change = True - super(LibDotWindow, self).__init__() + super(LibDotWindow, self).__init__(LibDotWidget()) dotcode = gen_graph(*args, **kwargs).to_string() title = dotcode[dotcode.find('digraph', 0, 512) + len('digraph') : diff --git a/lib_cman.py b/lib_cman.py index 198ca34..60a0e63 100644 --- a/lib_cman.py +++ b/lib_cman.py @@ -64,9 +64,11 @@ class CmanCmanTool(Executable): man = [ 'cman_tool(8)' ] - srpm = 'cluster' - rpm = 'cman' - rhbz = 'cluster' + ids = dict( + srpm='cluster', + rpm='cman', + rhbz='cluster', + ) class CmanRicci(Daemon): @@ -83,9 +85,11 @@ class CmanRicci(Daemon): man = [ 'ricci(8)' ] - srpm = 'ricci' - rpm = 'ricci' - rhbz = 'ricci' + ids = dict( + srpm='ricci', + rpm='ricci', + rhbz='ricci', + ) class CmanCcs(Executable): @@ -103,9 +107,11 @@ class CmanCcs(Executable): man = [ 'ccs(8)' ] - srpm = 'ricci' - rpm = 'ccs' - rhbz = 'ricci' + ids = dict( + srpm='ricci', + rpm='ccs', + rhbz='ricci', + ) class CmanCcsSync(Executable): @@ -121,9 +127,11 @@ class CmanCcsSync(Executable): man = [ 'ccs_sync(8)' ] - srpm = 'ricci' - rpm = 'ricci' - rhbz = 'ricci' + ids = dict( + srpm='ricci', + rpm='ricci', + rhbz='ricci', + ) class CmanLuci(Daemon): @@ -139,9 +147,11 @@ class CmanLuci(Daemon): web='https://git.fedorahosted.org/cgit/luci.git', ml='https://lists.fedorahosted.org/mailman/listinfo/luci-commits', ) - srpm = 'luci' - rpm = 'luci' - rhbz = 'luci' + ids = dict( + srpm='luci', + rpm='luci', + rhbz='luci', + ) class CmanModclusterd(Daemon): @@ -154,12 +164,14 @@ class CmanModclusterd(Daemon): git='git://git.fedorahosted.org/git/conga.git', web='https://git.fedorahosted.org/cgit/conga.git', ) - srpm = 'clustermon' - rpm = 'modcluster' - rhbz = 'clustermon' + ids = dict( + srpm='clustermon', + rpm='modcluster', + rhbz='clustermon', + ) -class CmanModcluster(Executable): +class CmanModcluster(Executable): defaults = dict(( LABEL('modcluster'), )) @@ -169,6 +181,8 @@ class CmanModcluster(Executable): git='git://git.fedorahosted.org/git/conga.git', web='https://git.fedorahosted.org/cgit/conga.git', ) - srpm = 'clustermon' - rpm = 'modcluster' - rhbz = 'clustermon' + ids = dict( + srpm='clustermon', + rpm='modcluster', + rhbz='clustermon', + ) diff --git a/lib_shared.py b/lib_shared.py index 55bf527..e58b8d9 100644 --- a/lib_shared.py +++ b/lib_shared.py @@ -46,6 +46,8 @@ class SharedFenceVirt(Executable): 'fence_virt(8)', 'fence_xvm(8)', ] - srpm = 'fence-virt' - rpm = 'fence-virt' - rhbz = 'fence-virt' + ids = dict( + srpm='fence-virt', + rpm='fence-virt', + rhbz='fence-virt', + ) |