FreeBSD Bugzilla – Attachment 172440 Details for
Bug 211059
[NEW PORT] x11/py-xdot: Interactive viewer for Graphviz dot files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
py-xdot.shar
py-xdot.shar (text/plain), 21.44 KB, created by
Danilo G. Baio
on 2016-07-12 21:54:28 UTC
(
hide
)
Description:
py-xdot.shar
Filename:
MIME Type:
Creator:
Danilo G. Baio
Created:
2016-07-12 21:54:28 UTC
Size:
21.44 KB
patch
obsolete
># This is a shell archive. Save it in a file, remove anything before ># this line, and then unpack it by entering "sh file". Note, it may ># create directories; files and directories will be owned by you and ># have default permissions. ># ># This archive contains: ># ># py-xdot ># py-xdot/distinfo ># py-xdot/Makefile ># py-xdot/files ># py-xdot/files/patch-xdot.py ># py-xdot/pkg-descr ># >echo c - py-xdot >mkdir -p py-xdot > /dev/null 2>&1 >echo x - py-xdot/distinfo >sed 's/^X//' >py-xdot/distinfo << '75a976cc274d892635ebb411342b7e18' >XTIMESTAMP = 1468125369 >XSHA256 (xdot-0.7.tar.gz) = d2100c3201d974915d1b89220ce52f380334eb365ab48903573a8135f51d0ee0 >XSIZE (xdot-0.7.tar.gz) = 22089 >75a976cc274d892635ebb411342b7e18 >echo x - py-xdot/Makefile >sed 's/^X//' >py-xdot/Makefile << '64ec116b11d62d332300ef043959dfb5' >X# $FreeBSD$ >X >XPORTNAME= xdot >XPORTVERSION= 0.7 >XCATEGORIES= x11 python >XMASTER_SITES= CHEESESHOP >XPKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} >X >XMAINTAINER= dbaio@bsd.com.br >XCOMMENT= Interactive viewer for Graphviz dot files >X >XLICENSE= LGPL3+ >X >XNO_ARCH= yes >XUSES= python >XUSE_PYTHON= autoplist distutils >X >X.include <bsd.port.mk> >64ec116b11d62d332300ef043959dfb5 >echo c - py-xdot/files >mkdir -p py-xdot/files > /dev/null 2>&1 >echo x - py-xdot/files/patch-xdot.py >sed 's/^X//' >py-xdot/files/patch-xdot.py << 'f53546b23e132151358e894ab5d395c8' >X--- xdot.py.orig 2016-03-07 15:58:48 UTC >X+++ xdot.py >X@@ -30,13 +30,13 @@ import time >X import re >X import optparse >X >X-from gi.repository import GLib >X-from gi.repository import GObject >X-from gi.repository import Gtk >X-from gi.repository import Gdk >X-from gi.repository import GdkPixbuf >X-from gi.repository import Pango >X-from gi.repository import PangoCairo >X+import glib >X+import gobject >X+import gtk >X+import gtk.gdk >X+import gtk.keysyms >X+import pango >X+import pangocairo >X import cairo >X >X >X@@ -120,7 +120,7 @@ class TextShape(Shape): >X try: >X layout = self.layout >X except AttributeError: >X- layout = PangoCairo.create_layout(cr) >X+ layout = pangcairo.create_layout(cr) >X >X # set font options >X # see http://lists.freedesktop.org/archives/cairo/2007-February/009688.html >X@@ -130,21 +130,21 @@ class TextShape(Shape): >X fo.set_hint_style(cairo.HINT_STYLE_NONE) >X fo.set_hint_metrics(cairo.HINT_METRICS_OFF) >X try: >X- PangoCairo.context_set_font_options(context, fo) >X+ pangcairo.context_set_font_options(context, fo) >X except TypeError: >X # XXX: Some broken pangocairo bindings show the error >X # 'TypeError: font_options must be a cairo.FontOptions or None' >X pass >X except KeyError: >X- # cairo.FontOptions is not registered as a foreign struct in older PyGObject versions. >X+ # cairo.FontOptions is not registered as a foreign struct in older Pygobject versions. >X # https://git.gnome.org/browse/pygobject/commit/?id=b21f66d2a399b8c9a36a1758107b7bdff0ec8eaa >X pass >X >X # set font >X- font = Pango.FontDescription() >X+ font = pango.FontDescription() >X >X- # https://developer.gnome.org/pango/stable/PangoMarkupFormat.html >X- markup = GObject.markup_escape_text(self.t) >X+ # https://developer.gnome.org/pango/stable/pangoMarkupFormat.html >X+ markup = gobject.markup_escape_text(self.t) >X if self.pen.bold: >X markup = '<b>' + markup + '</b>' >X if self.pen.italic: >X@@ -158,12 +158,12 @@ class TextShape(Shape): >X if self.pen.subscript: >X markup = '<sub><small>' + markup + '</small></sub>' >X >X- success, attrs, text, accel_char = Pango.parse_markup(markup, -1, '\x00') >X+ success, attrs, text, accel_char = pango.parse_markup(markup, -1, '\x00') >X assert success >X layout.set_attributes(attrs) >X >X font.set_family(self.pen.fontname) >X- font.set_absolute_size(self.pen.fontsize*Pango.SCALE) >X+ font.set_absolute_size(self.pen.fontsize*pango.SCALE) >X layout.set_font_description(font) >X >X # set text >X@@ -172,13 +172,13 @@ class TextShape(Shape): >X # cache it >X self.layout = layout >X else: >X- PangoCairo.update_layout(cr, layout) >X+ pangcairo.update_layout(cr, layout) >X >X descent = 2 # XXX get descender from font metrics >X >X width, height = layout.get_size() >X- width = float(width)/Pango.SCALE >X- height = float(height)/Pango.SCALE >X+ width = float(width)/pango.SCALE >X+ height = float(height)/pango.SCALE >X >X # we know the width that dot thinks this text should have >X # we do not necessarily have a font with the same metrics >X@@ -207,7 +207,7 @@ class TextShape(Shape): >X cr.save() >X cr.scale(f, f) >X cr.set_source_rgba(*self.select_pen(highlight).color) >X- PangoCairo.show_layout(cr, layout) >X+ pangcairo.show_layout(cr, layout) >X cr.restore() >X >X if 0: # DEBUG >X@@ -239,13 +239,13 @@ class ImageShape(Shape): >X self.path = path >X >X def draw(self, cr, highlight=False): >X- pixbuf = GdkPixbuf.Pixbuf.new_from_file(self.path) >X+ pixbuf = gtk.gdk.pixbuf_new_from_file(self.path) >X sx = float(self.w)/float(pixbuf.get_width()) >X sy = float(self.h)/float(pixbuf.get_height()) >X cr.save() >X cr.translate(self.x0, self.y0 - self.h) >X cr.scale(sx, sy) >X- Gdk.cairo_set_source_pixbuf(cr, pixbuf, 0, 0) >X+ gdk.cairo_set_source_pixbuf(cr, pixbuf, 0, 0) >X cr.paint() >X cr.restore() >X >X@@ -631,7 +631,7 @@ class XDotAttrParser: >X >X def lookup_color(self, c): >X try: >X- color = Gdk.color_parse(c) >X+ color = gdk.color_parse(c) >X except ValueError: >X pass >X else: >X@@ -1318,12 +1318,12 @@ class Animation(object): >X self.timeout_id = None >X >X def start(self): >X- self.timeout_id = GLib.timeout_add(int(self.step * 1000), self.tick) >X+ self.timeout_id = glib.timeout_add(int(self.step * 1000), self.tick) >X >X def stop(self): >X self.dot_widget.animation = NoAnimation(self.dot_widget) >X if self.timeout_id is not None: >X- GLib.source_remove(self.timeout_id) >X+ glib.source_remove(self.timeout_id) >X self.timeout_id = None >X >X def tick(self): >X@@ -1453,7 +1453,7 @@ class NullAction(DragAction): >X if item is None: >X item = dot_widget.get_jump(x, y) >X if item is not None: >X- dot_widget.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.HAND2)) >X+ dot_widget.get_window().set_cursor(gdk.Cursor(gdk.CursorType.HAND2)) >X dot_widget.set_highlight(item.highlight) >X else: >X dot_widget.get_window().set_cursor(None) >X@@ -1463,7 +1463,7 @@ class NullAction(DragAction): >X class PanAction(DragAction): >X >X def start(self): >X- self.dot_widget.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.FLEUR)) >X+ self.dot_widget.get_window().set_cursor(gdk.Cursor(gdk.CursorType.FLEUR)) >X >X def drag(self, deltax, deltay): >X self.dot_widget.x += deltax / self.dot_widget.zoom_ratio >X@@ -1518,18 +1518,18 @@ class ZoomAreaAction(DragAction): >X self.dot_widget.queue_draw() >X >X >X-class DotWidget(Gtk.DrawingArea): >X+class DotWidget(gtk.DrawingArea): >X """GTK widget that draws dot graphs.""" >X >X- #TODO GTK3: Second argument has to be of type Gdk.EventButton instead of object. >X+ #TODO GTK3: Second argument has to be of type gdk.EventButton instead of object. >X __gsignals__ = { >X- 'clicked' : (GObject.SIGNAL_RUN_LAST, None, (str, object)) >X+ 'clicked' : (gobject.SIGNAL_RUN_LAST, None, (str, object)) >X } >X >X filter = 'dot' >X >X def __init__(self): >X- Gtk.DrawingArea.__init__(self) >X+ gtk.DrawingArea.__init__(self) >X >X self.graph = Graph() >X self.openfilename = None >X@@ -1537,13 +1537,13 @@ class DotWidget(Gtk.DrawingArea): >X self.set_can_focus(True) >X >X self.connect("draw", self.on_draw) >X- self.add_events(Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK) >X+ self.add_events(gdk.EventMask.BUTTON_PRESS_MASK | gdk.EventMask.BUTTON_RELEASE_MASK) >X self.connect("button-press-event", self.on_area_button_press) >X self.connect("button-release-event", self.on_area_button_release) >X- self.add_events(Gdk.EventMask.POINTER_MOTION_MASK | >X- Gdk.EventMask.POINTER_MOTION_HINT_MASK | >X- Gdk.EventMask.BUTTON_RELEASE_MASK | >X- Gdk.EventMask.SCROLL_MASK) >X+ self.add_events(gdk.EventMask.POINTER_MOTION_MASK | >X+ gdk.EventMask.POINTER_MOTION_HINT_MASK | >X+ gdk.EventMask.BUTTON_RELEASE_MASK | >X+ gdk.EventMask.SCROLL_MASK) >X self.connect("motion-notify-event", self.on_area_motion_notify) >X self.connect("scroll-event", self.on_area_scroll_event) >X self.connect("size-allocate", self.on_area_size_allocate) >X@@ -1551,7 +1551,7 @@ class DotWidget(Gtk.DrawingArea): >X self.connect('key-press-event', self.on_key_press_event) >X self.last_mtime = None >X >X- GLib.timeout_add(1000, self.update) >X+ glib.timeout_add(1000, self.update) >X >X self.x, self.y = 0.0, 0.0 >X self.zoom_ratio = 1.0 >X@@ -1729,59 +1729,59 @@ class DotWidget(Gtk.DrawingArea): >X POS_INCREMENT = 100 >X >X def on_key_press_event(self, widget, event): >X- if event.keyval == Gdk.KEY_Left: >X+ if event.keyval == gdk.KEY_Left: >X self.x -= self.POS_INCREMENT/self.zoom_ratio >X self.queue_draw() >X return True >X- if event.keyval == Gdk.KEY_Right: >X+ if event.keyval == gdk.KEY_Right: >X self.x += self.POS_INCREMENT/self.zoom_ratio >X self.queue_draw() >X return True >X- if event.keyval == Gdk.KEY_Up: >X+ if event.keyval == gdk.KEY_Up: >X self.y -= self.POS_INCREMENT/self.zoom_ratio >X self.queue_draw() >X return True >X- if event.keyval == Gdk.KEY_Down: >X+ if event.keyval == gdk.KEY_Down: >X self.y += self.POS_INCREMENT/self.zoom_ratio >X self.queue_draw() >X return True >X- if event.keyval in (Gdk.KEY_Page_Up, >X- Gdk.KEY_plus, >X- Gdk.KEY_equal, >X- Gdk.KEY_KP_Add): >X+ if event.keyval in (gdk.KEY_Page_Up, >X+ gdk.KEY_plus, >X+ gdk.KEY_equal, >X+ gdk.KEY_KP_Add): >X self.zoom_image(self.zoom_ratio * self.ZOOM_INCREMENT) >X self.queue_draw() >X return True >X- if event.keyval in (Gdk.KEY_Page_Down, >X- Gdk.KEY_minus, >X- Gdk.KEY_KP_Subtract): >X+ if event.keyval in (gdk.KEY_Page_Down, >X+ gdk.KEY_minus, >X+ gdk.KEY_KP_Subtract): >X self.zoom_image(self.zoom_ratio / self.ZOOM_INCREMENT) >X self.queue_draw() >X return True >X- if event.keyval == Gdk.KEY_Escape: >X+ if event.keyval == gdk.KEY_Escape: >X self.drag_action.abort() >X self.drag_action = NullAction(self) >X return True >X- if event.keyval == Gdk.KEY_r: >X+ if event.keyval == gdk.KEY_r: >X self.reload() >X return True >X- if event.keyval == Gdk.KEY_f: >X+ if event.keyval == gdk.KEY_f: >X win = widget.get_toplevel() >X find_toolitem = win.uimanager.get_widget('/ToolBar/Find') >X textentry = find_toolitem.get_children() >X win.set_focus(textentry[0]) >X return True >X- if event.keyval == Gdk.KEY_q: >X- Gtk.main_quit() >X+ if event.keyval == gdk.KEY_q: >X+ gtk.main_quit() >X return True >X- if event.keyval == Gdk.KEY_p: >X+ if event.keyval == gdk.KEY_p: >X self.on_print() >X return True >X return False >X >X print_settings = None >X def on_print(self, action=None): >X- print_op = Gtk.PrintOperation() >X+ print_op = gtk.PrintOperation() >X >X if self.print_settings != None: >X print_op.set_print_settings(self.print_settings) >X@@ -1789,8 +1789,8 @@ class DotWidget(Gtk.DrawingArea): >X print_op.connect("begin_print", self.begin_print) >X print_op.connect("draw_page", self.draw_page) >X >X- res = print_op.run(Gtk.PrintOperationAction.PRINT_DIALOG, self.get_toplevel()) >X- if res == Gtk.PrintOperationResult.APPLY: >X+ res = print_op.run(gtk.PrintOperationAction.PRINT_DIALOG, self.get_toplevel()) >X+ if res == gtk.PrintOperationResult.APPLY: >X self.print_settings = print_op.get_print_settings() >X >X def begin_print(self, operation, context): >X@@ -1810,10 +1810,10 @@ class DotWidget(Gtk.DrawingArea): >X def get_drag_action(self, event): >X state = event.state >X if event.button in (1, 2): # left or middle button >X- modifiers = Gtk.accelerator_get_default_mod_mask() >X- if state & modifiers == Gdk.ModifierType.CONTROL_MASK: >X+ modifiers = gtk.accelerator_get_default_mod_mask() >X+ if state & modifiers == gdk.ModifierType.CONTROL_MASK: >X return ZoomAction >X- elif state & modifiers == Gdk.ModifierType.SHIFT_MASK: >X+ elif state & modifiers == gdk.ModifierType.SHIFT_MASK: >X return ZoomAreaAction >X else: >X return PanAction >X@@ -1831,7 +1831,7 @@ class DotWidget(Gtk.DrawingArea): >X return False >X >X def is_click(self, event, click_fuzz=4, click_timeout=1.0): >X- assert event.type == Gdk.EventType.BUTTON_RELEASE >X+ assert event.type == gdk.EventType.BUTTON_RELEASE >X if self.presstime is None: >X # got a button release without seeing the press? >X return False >X@@ -1873,11 +1873,11 @@ class DotWidget(Gtk.DrawingArea): >X return False >X >X def on_area_scroll_event(self, area, event): >X- if event.direction == Gdk.ScrollDirection.UP: >X+ if event.direction == gdk.ScrollDirection.UP: >X self.zoom_image(self.zoom_ratio * self.ZOOM_INCREMENT, >X pos=(event.x, event.y)) >X return True >X- if event.direction == Gdk.ScrollDirection.DOWN: >X+ if event.direction == gdk.ScrollDirection.DOWN: >X self.zoom_image(self.zoom_ratio / self.ZOOM_INCREMENT, >X pos=(event.x, event.y)) >X return True >X@@ -1918,14 +1918,14 @@ class DotWidget(Gtk.DrawingArea): >X return self.graph.get_jump(x, y) >X >X >X-class FindMenuToolAction(Gtk.Action): >X+class FindMenuToolAction(gtk.Action): >X __gtype_name__ = "FindMenuToolAction" >X >X def do_create_tool_item(self): >X- return Gtk.ToolItem() >X+ return gtk.ToolItem() >X >X >X-class DotWindow(Gtk.Window): >X+class DotWindow(gtk.Window): >X >X ui = ''' >X <ui> >X@@ -1947,7 +1947,7 @@ class DotWindow(Gtk.Window): >X base_title = 'Dot Viewer' >X >X def __init__(self, widget=None): >X- Gtk.Window.__init__(self) >X+ gtk.Window.__init__(self) >X >X self.graph = Graph() >X >X@@ -1955,31 +1955,31 @@ class DotWindow(Gtk.Window): >X >X window.set_title(self.base_title) >X window.set_default_size(512, 512) >X- vbox = Gtk.VBox() >X+ vbox = gtk.VBox() >X window.add(vbox) >X >X self.dotwidget = widget or DotWidget() >X >X # Create a UIManager instance >X- uimanager = self.uimanager = Gtk.UIManager() >X+ uimanager = self.uimanager = gtk.UIManager() >X >X # Add the accelerator group to the toplevel window >X accelgroup = uimanager.get_accel_group() >X window.add_accel_group(accelgroup) >X >X # Create an ActionGroup >X- actiongroup = Gtk.ActionGroup('Actions') >X+ actiongroup = gtk.ActionGroup('Actions') >X self.actiongroup = actiongroup >X >X # Create actions >X actiongroup.add_actions(( >X- ('Open', Gtk.STOCK_OPEN, None, None, None, self.on_open), >X- ('Reload', Gtk.STOCK_REFRESH, None, None, None, self.on_reload), >X- ('Print', Gtk.STOCK_PRINT, None, None, "Prints the currently visible part of the graph", self.dotwidget.on_print), >X- ('ZoomIn', Gtk.STOCK_ZOOM_IN, None, None, None, self.dotwidget.on_zoom_in), >X- ('ZoomOut', Gtk.STOCK_ZOOM_OUT, None, None, None, self.dotwidget.on_zoom_out), >X- ('ZoomFit', Gtk.STOCK_ZOOM_FIT, None, None, None, self.dotwidget.on_zoom_fit), >X- ('Zoom100', Gtk.STOCK_ZOOM_100, None, None, None, self.dotwidget.on_zoom_100), >X+ ('Open', gtk.STOCK_OPEN, None, None, None, self.on_open), >X+ ('Reload', gtk.STOCK_REFRESH, None, None, None, self.on_reload), >X+ ('Print', gtk.STOCK_PRINT, None, None, "Prints the currently visible part of the graph", self.dotwidget.on_print), >X+ ('ZoomIn', gtk.STOCK_ZOOM_IN, None, None, None, self.dotwidget.on_zoom_in), >X+ ('ZoomOut', gtk.STOCK_ZOOM_OUT, None, None, None, self.dotwidget.on_zoom_out), >X+ ('ZoomFit', gtk.STOCK_ZOOM_FIT, None, None, None, self.dotwidget.on_zoom_fit), >X+ ('Zoom100', gtk.STOCK_ZOOM_100, None, None, None, self.dotwidget.on_zoom_100), >X )) >X >X find_action = FindMenuToolAction("Find", None, >X@@ -2004,8 +2004,8 @@ class DotWindow(Gtk.Window): >X >X # Add Find text search >X find_toolitem = uimanager.get_widget('/ToolBar/Find') >X- self.textentry = Gtk.Entry(max_length=20) >X- self.textentry.set_icon_from_stock(0, Gtk.STOCK_FIND) >X+ self.textentry = gtk.Entry(max_length=20) >X+ self.textentry.set_icon_from_stock(0, gtk.STOCK_FIND) >X find_toolitem.add(self.textentry) >X >X self.textentry.set_activates_default(True) >X@@ -2073,23 +2073,23 @@ class DotWindow(Gtk.Window): >X self.error_dialog(str(ex)) >X >X def on_open(self, action): >X- chooser = Gtk.FileChooserDialog(title="Open dot File", >X- action=Gtk.FileChooserAction.OPEN, >X- buttons=(Gtk.STOCK_CANCEL, >X- Gtk.ResponseType.CANCEL, >X- Gtk.STOCK_OPEN, >X- Gtk.ResponseType.OK)) >X- chooser.set_default_response(Gtk.ResponseType.OK) >X+ chooser = gtk.FileChooserDialog(title="Open dot File", >X+ action=gtk.FileChooserAction.OPEN, >X+ buttons=(gtk.STOCK_CANCEL, >X+ gtk.ResponseType.CANCEL, >X+ gtk.STOCK_OPEN, >X+ gtk.ResponseType.OK)) >X+ chooser.set_default_response(gtk.ResponseType.OK) >X chooser.set_current_folder(self.last_open_dir) >X- filter = Gtk.FileFilter() >X+ filter = gtk.FileFilter() >X filter.set_name("Graphviz dot files") >X filter.add_pattern("*.dot") >X chooser.add_filter(filter) >X- filter = Gtk.FileFilter() >X+ filter = gtk.FileFilter() >X filter.set_name("All files") >X filter.add_pattern("*") >X chooser.add_filter(filter) >X- if chooser.run() == Gtk.ResponseType.OK: >X+ if chooser.run() == gtk.ResponseType.OK: >X filename = chooser.get_filename() >X self.last_open_dir = chooser.get_current_folder() >X chooser.destroy() >X@@ -2101,9 +2101,9 @@ class DotWindow(Gtk.Window): >X self.dotwidget.reload() >X >X def error_dialog(self, message): >X- dlg = Gtk.MessageDialog(type=Gtk.MessageType.ERROR, >X+ dlg = gtk.MessageDialog(type=gtk.MessageType.ERROR, >X message_format=message, >X- buttons=Gtk.ButtonsType.OK) >X+ buttons=gtk.ButtonsType.OK) >X dlg.set_title(self.base_title) >X dlg.run() >X dlg.destroy() >X@@ -2150,14 +2150,14 @@ Shortcuts: >X parser.error('incorrect number of arguments') >X >X win = DotWindow() >X- win.connect('delete-event', Gtk.main_quit) >X+ win.connect('delete-event', gtk.main_quit) >X win.set_filter(options.filter) >X if len(args) >= 1: >X if args[0] == '-': >X win.set_dotcode(sys.stdin.read()) >X else: >X win.open_file(args[0]) >X- Gtk.main() >X+ gtk.main() >X >X >X # Apache-Style Software License for ColorBrewer software and ColorBrewer Color >f53546b23e132151358e894ab5d395c8 >echo x - py-xdot/pkg-descr >sed 's/^X//' >py-xdot/pkg-descr << '512a3676f904a1fa73d82185655ae8c9' >Xxdot.py is an interactive viewer for graphs written in Graphviz's dot >Xlanguage. It uses internally the Graphviz's xdot output format as an >Xintermediate format, and PyGTK and Cairo for rendering. >Xxdot.py can be used either as a standalone application from command >Xline, or as a library embedded in your python application. >X >XWWW: https://pypi.python.org/pypi/xdot >512a3676f904a1fa73d82185655ae8c9 >exit >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 211059
: 172440