コード例 #1
0
    def _on_item_selected(self, layout, group, item):
        """
        Another page (tab) is put on the front of the diagram notebook.
        A dummy action is executed.
        """
        # TODO: Here the magic happens!
        # TODO: Need to see what the active view is, or make toolbox actions global
        self._clear_ui_settings()

        # Is it a diagram view?
        try:
            tab = item.diagram_tab
        except AttributeError:
            # Not a diagram tab
            return

        self._current_diagram_tab = tab

        #content = self.notebook.get_nth_page(page_num)
        #tab = self.notebook_map.get(content)
        #assert isinstance(tab, DiagramTab), str(tab)

        self.ui_manager.insert_action_group(tab.action_group, -1)
        ui_id = self.ui_manager.add_ui_from_string(tab.menu_xml)
        self._tab_ui_settings = tab.action_group, ui_id
        log.debug('Menus updated with %s, %d' % self._tab_ui_settings)

        # Make sure everyone knows the selection has changed.
        self.component_registry.handle(
            DiagramTabChange(item),
            DiagramSelectionChange(tab.view, tab.view.focused_item,
                                   tab.view.selected_items))
コード例 #2
0
ファイル: diagrampage.py プロジェクト: otomazeli/gaphor
 def _on_view_selection_changed(self, view, selection_or_focus):
     self.event_manager.handle(
         DiagramSelectionChange(view, view.focused_item, view.selected_items)
     )
コード例 #3
0
 def _on_view_selection_changed(self, view, selection_or_focus):
     self.component_registry.handle(DiagramSelectionChange(view, view.focused_item, view.selected_items))