changeset 1457:416a18409603

Show an empty document in SVG viewer widget
author Thinker K.F. Li <thinker@codemud.net>
date Sat, 16 Apr 2011 22:25:35 +0800
parents 894a4bf35fe6
children 59b90d7fcf57
files pyink/FSM_window.glade pyink/FSM_window.py pyink/comp_dock.py
diffstat 3 files changed, 28 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/pyink/FSM_window.glade	Sat Apr 16 19:41:12 2011 +0800
+++ b/pyink/FSM_window.glade	Sat Apr 16 22:25:35 2011 +0800
@@ -203,7 +203,7 @@
             <property name="hscrollbar_policy">automatic</property>
             <property name="vscrollbar_policy">automatic</property>
             <child>
-              <object class="GtkViewport" id="svg_box">
+              <object class="GtkViewport" id="view_box">
                 <property name="visible">True</property>
                 <property name="resize_mode">queue</property>
                 <child>
--- a/pyink/FSM_window.py	Sat Apr 16 19:41:12 2011 +0800
+++ b/pyink/FSM_window.py	Sat Apr 16 22:25:35 2011 +0800
@@ -61,8 +61,8 @@
     def __init__(self, close_cb, destroy_cb):
         super(FSM_window, self).__init__()
 
-        self._close_cb = close_cb
-        self._destroy_cb = destroy_cb
+        self._close_cb = close_cb # callback to close editor window (hide)
+        self._destroy_cb = destroy_cb # callback to destroy editor window
         pass
 
     def set_svg_view(self, view):
--- a/pyink/comp_dock.py	Sat Apr 16 19:41:12 2011 +0800
+++ b/pyink/comp_dock.py	Sat Apr 16 22:25:35 2011 +0800
@@ -277,17 +277,33 @@
         domview_ui.switch_timeline(timeline_name)
         pass
 
+    def _prepare_FSM_editor(self):
+        def FSM_editor_close():
+            self._fsm_editor_win.hide()
+            pass
+        
+        def FSM_editor_destroy():
+            self._fsm_editor_win = None
+            pass
+        
+        fsm_win = FSM_window.FSM_window(FSM_editor_close,
+                                        FSM_editor_destroy)
+        self._fsm_editor_win = fsm_win
+
+        doc = pybInkscape.createSPDocument()
+        view_widget = pybInkscape.create_svg_view_widget(doc)
+        view_widget.show()
+
+        self._FSM_doc = doc
+        self._FSM_view_widget = view_widget
+
+        fsm_win.set_svg_view(view_widget)
+        pass
+
     def _show_FSM_editor(self):
         if not self._fsm_editor_win:
-            def FSM_editor_close():
-                self._fsm_editor_win.hide()
-                pass
-            def FSM_editor_destroy():
-                self._fsm_editor_win = None
-                pass
-            fsm_win = FSM_window.FSM_window(FSM_editor_close,
-                                            FSM_editor_destroy)
-            self._fsm_editor_win = fsm_win
+            self._prepare_FSM_editor()
+            fsm_win = self._fsm_editor_win
         else:
             fsm_win = self._fsm_editor_win
             pass