Skip to content

Commit

Permalink
Display graph inside Gtk image view
Browse files Browse the repository at this point in the history
Ref. #345
  • Loading branch information
Alexander Senier committed Jul 17, 2020
1 parent acf197e commit 0cfe546
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions ide/gnatstudio/recordflux.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import os
import re

from gi.repository import Gdk, GLib, GObject, Gtk

import GPS
import highlighter.common as hl

Expand Down Expand Up @@ -106,8 +108,7 @@
<on-failure>
<shell lang="python" show-command="false">recordflux.parse_output(&quot;&quot;&quot;%1&quot;&quot;&quot;)</shell>
</on-failure>
<shell lang="python" show-command="false">recordflux.find_message_graph(&quot;%F&quot;)</shell>
<external>echo &quot;%1&quot;</external>
<shell lang="python" show-command="false">recordflux.display_message_graph(&quot;%F&quot;)</shell>
</action>
<!-- Aliases -->
Expand Down Expand Up @@ -343,5 +344,22 @@ def graph(filename):
return run([filename], mode="graph", options=["-d", output_dir()])


def find_message_graph(filename):
return output_dir() + "/ICMP_Message.svg"
def get_message_name():
return "ICMP_Message"


def display_message_graph(filename):
message_name = get_message_name()
scrolled_window = Gtk.ScrolledWindow()
scrolled_window.set_border_width(10)
scrolled_window.set_policy(Gtk.PolicyType.ALWAYS, Gtk.PolicyType.ALWAYS)
graph = Gtk.Image()
graph.set_from_file(output_dir() + "/" + message_name + ".svg")
scrolled_window.add_with_viewport(graph)
GPS.MDI.add(
scrolled_window,
"Message graph",
message_name,
group=GPS.MDI.GROUP_GRAPHS,
position=GPS.MDI.POSITION_AUTOMATIC,
)

0 comments on commit 0cfe546

Please sign in to comment.