示例#1
0
    def _realize_cb(self, drawwindow):
        # Deferred setup: anything that needs to be done when self.app is fully
        # initialized.
        if self._done_realize:
            return
        self._done_realize = True

        doc = self.app.doc
        tdw = doc.tdw
        assert tdw is self.app.builder.get_object("app_canvas")
        tdw.display_overlays.append(FrameOverlay(doc))
        tdw.display_overlays.append(SymmetryOverlay(doc))
        self.update_overlays()
        self._init_actions()
        kbm = self.app.kbm
        kbm.add_extra_key('Menu', 'ShowPopupMenu')
        kbm.add_extra_key('Tab', 'FullscreenAutohide')
        self._init_stategroups()

        self._init_menubar()
        self._init_toolbars()
        topbar = self.app.builder.get_object("app_topbar")
        topbar.menubar = self.menubar
        topbar.toolbar1 = self._toolbar1
        topbar.toolbar2 = self._toolbar2

        # Workspace setup
        ws = self.app.workspace
        ws.tool_widget_added += self.app_workspace_tool_widget_added_cb
        ws.tool_widget_removed += self.app_workspace_tool_widget_removed_cb

        # Footer bar updates
        self.app.brush.observers.append(self._update_footer_color_widgets)
        tdw.transformation_updated += self._update_footer_scale_label
        doc.modes.changed += self._modestack_changed_cb
        context_id = self.app.statusbar.get_context_id("active-mode")
        self._active_mode_context_id = context_id
        self._update_status_bar_mode_widgets(doc.modes.top)
        mode_img = self.app.builder.get_object("app_current_mode_icon")
        mode_img.connect("query-tooltip", self._mode_icon_query_tooltip_cb)
        mode_img.set_has_tooltip(True)

        # Update picker action sensitivity
        layerstack = doc.model.layer_stack
        layerstack.layer_inserted += self._update_layer_pick_action
        layerstack.layer_deleted += self._update_layer_pick_action
示例#2
0
    def _realize_cb(self, drawwindow):
        # Deferred setup: anything that needs to be done when self.app is fully
        # initialized.
        if self._done_realize:
            return
        self._done_realize = True

        doc = self.app.doc
        tdw = doc.tdw
        assert tdw is self.app.builder.get_object("app_canvas")
        tdw.display_overlays.append(FrameOverlay(doc))
        self.update_overlays()
        self._init_actions()
        kbm = self.app.kbm
        kbm.add_extra_key('Menu', 'ShowPopupMenu')
        kbm.add_extra_key('Tab', 'FullscreenAutohide')
        self._init_stategroups()

        self._init_menubar()
        self._init_toolbar()
        topbar = self.app.builder.get_object("app_topbar")
        topbar.menubar = self.menubar
        topbar.toolbar = self.toolbar

        # Workspace setup
        ws = self.app.workspace
        ws.tool_widget_shown += self.app_workspace_tool_widget_shown_cb
        ws.tool_widget_hidden += self.app_workspace_tool_widget_hidden_cb

        # Footer bar updates
        self.app.brush.observers.append(self._update_footer_color_widgets)
        btn = self.app.builder.get_object("footer_mode_options_button")
        action = self.app.find_action("ModeOptionsTool")
        btn.set_related_action(action)
        tdw.transformation_updated += self._update_footer_scale_label
        doc.modes.observers.append(self._update_status_bar_mode_widgets)
        context_id = self.app.statusbar.get_context_id("active-mode")
        self._active_mode_context_id = context_id
        self._update_status_bar_mode_widgets(doc.modes.top)
        mode_img = self.app.builder.get_object("app_current_mode_icon")
        mode_img.connect("query-tooltip", self._mode_icon_query_tooltip_cb)
        mode_img.set_has_tooltip(True)

        self.ani = self.app.doc.ani