...
|
...
|
@@ -592,9 +592,9 @@ class DotWindow(Gtk.Window):
|
592
|
592
|
|
593
|
593
|
# Create actions
|
594
|
594
|
actiongroup.add_actions((
|
595
|
|
- ('Open', Gtk.STOCK_OPEN, None, None, None, self.on_open),
|
596
|
|
- ('Export', Gtk.STOCK_SAVE_AS, None, None, "Save graph as picture.", self.on_export),
|
597
|
|
- ('Reload', Gtk.STOCK_REFRESH, None, None, None, self.on_reload),
|
|
595
|
+ ('Open', Gtk.STOCK_OPEN, None, None, "Open dot-file", self.on_open),
|
|
596
|
+ ('Export', Gtk.STOCK_SAVE_AS, None, None, "Export graph to other format", self.on_export),
|
|
597
|
+ ('Reload', Gtk.STOCK_REFRESH, None, None, "Reload graph", self.on_reload),
|
598
|
598
|
('Print', Gtk.STOCK_PRINT, None, None,
|
599
|
599
|
"Prints the currently visible part of the graph", self.dotwidget.on_print),
|
600
|
600
|
('ZoomIn', Gtk.STOCK_ZOOM_IN, None, None, None, self.dotwidget.on_zoom_in),
|
...
|
...
|
@@ -766,12 +766,23 @@ class DotWindow(Gtk.Window):
|
766
|
766
|
subprocess.check_call(cmd)
|
767
|
767
|
|
768
|
768
|
def on_export(self, action):
|
|
769
|
+
|
|
770
|
+ if self.dotwidget.openfilename is None:
|
|
771
|
+ return
|
|
772
|
+
|
|
773
|
+ default_filter = "PNG image"
|
|
774
|
+
|
769
|
775
|
output_formats = {
|
|
776
|
+ "dot file": "dot",
|
|
777
|
+ "GIF image": "gif",
|
|
778
|
+ "JPG image": "jpg",
|
|
779
|
+ "JSON": "json",
|
|
780
|
+ "PDF": "pdf",
|
770
|
781
|
"PNG image": "png",
|
|
782
|
+ "PostScript": "ps",
|
771
|
783
|
"SVG image": "svg",
|
772
|
|
- "PDF image": "pdf",
|
773
|
|
- "GIF image": "gif",
|
774
|
|
- "PDF image": "pdf",
|
|
784
|
+ "XFIG image": "fig",
|
|
785
|
+ "xdot file": "xdot",
|
775
|
786
|
}
|
776
|
787
|
buttons = (
|
777
|
788
|
Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
|
...
|
...
|
@@ -793,7 +804,9 @@ class DotWindow(Gtk.Window):
|
793
|
804
|
filter_.set_name(name)
|
794
|
805
|
filter_.add_pattern('*.' + ext)
|
795
|
806
|
chooser.add_filter(filter_)
|
796
|
|
-
|
|
807
|
+ if name == default_filter:
|
|
808
|
+ chooser.set_filter(filter_)
|
|
809
|
+
|
797
|
810
|
if chooser.run() == Gtk.ResponseType.OK:
|
798
|
811
|
filename = chooser.get_filename()
|
799
|
812
|
format_ = output_formats[chooser.get_filter().get_name()]
|