Python gi.repository.GObject.TYPE_PYOBJECT Examples

The following are 11 code examples of gi.repository.GObject.TYPE_PYOBJECT(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module gi.repository.GObject , or try the search function .
Example #1
Source File: state_machine_tree.py    From RAFCON with Eclipse Public License 1.0 6 votes vote down vote up
def __init__(self, model, view):
        assert isinstance(model, StateMachineManagerModel)
        tree_store = Gtk.TreeStore(GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_PYOBJECT, GObject.TYPE_STRING)
        super(StateMachineTreeController, self).__init__(model, view, view, tree_store)

        self.add_controller("state_right_click_ctrl", StateMachineTreeRightClickMenuController(model, view))

        self.view_is_registered = False

        # view.set_hover_expand(True)
        self.state_row_iter_dict_by_state_path = {}
        self.__my_selected_sm_id = None
        self._selected_sm_model = None

        self.__expansion_state = {}

        self._ongoing_complex_actions = []

        self._state_which_is_updated = None

        self.register() 
Example #2
Source File: outcomes.py    From RAFCON with Eclipse Public License 1.0 6 votes vote down vote up
def __init__(self, model, view):
        assert isinstance(model, AbstractStateModel)
        # initiate data base and tree
        # id, name, to-state, to-outcome, name-color, to-state-color, outcome, state, outcome_model
        list_store = Gtk.ListStore(int, GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_PYOBJECT, GObject.TYPE_PYOBJECT,
                                   GObject.TYPE_PYOBJECT)
        super(StateOutcomesListController, self).__init__(model, view, view['tree_view'], list_store, logger)

        self.to_state_combo_list = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING)
        self.to_outcome_combo_list = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING)
        # key-outcome_id -> label,  to_state_id,  transition_id
        self.dict_to_other_state = {}
        # key-outcome_id ->  label,  to_outcome_id,  transition_id
        self.dict_to_other_outcome = {}
        # not used at the moment key-outcome_id -> label,  from_state_id,  transition_id
        self.dict_from_other_state = {}  # if widget gets extended
        # TODO check why the can happen should not be handed always the LibraryStateModel
        if not (model.state.is_root_state or model.state.is_root_state_of_library):
            self.observe_model(model.parent)

        if self.model.get_state_machine_m() is not None:
            self.observe_model(self.model.get_state_machine_m())
        else:
            logger.warning("State model has no state machine model -> state model: {0}".format(self.model)) 
Example #3
Source File: execution_history.py    From RAFCON with Eclipse Public License 1.0 6 votes vote down vote up
def __init__(self, model=None, view=None):
        assert isinstance(model, StateMachineManagerModel)
        assert isinstance(view, ExecutionHistoryView)

        super(ExecutionHistoryTreeController, self).__init__(model, view)
        self.history_tree_store = Gtk.TreeStore(GObject.TYPE_STRING, GObject.TYPE_PYOBJECT, GObject.TYPE_STRING)
        # a TreeView
        self.history_tree = view['history_tree']
        self.history_tree.set_model(self.history_tree_store)
        view['history_tree'].set_tooltip_column(self.TOOL_TIP_STORAGE_ID)

        self.observe_model(state_machine_execution_model)
        self._expansion_state = {}
        self._update_lock = RLock()

        self.update() 
Example #4
Source File: library_tree.py    From RAFCON with Eclipse Public License 1.0 5 votes vote down vote up
def __init__(self, model, view):
        assert isinstance(model, LibraryManagerModel)
        assert isinstance(view, Gtk.TreeView)
        ExtendedController.__init__(self, model, view)
        self.tree_store = Gtk.TreeStore(GObject.TYPE_STRING, GObject.TYPE_PYOBJECT, GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING)
        view.set_model(self.tree_store)
        view.set_tooltip_column(3)

        # Gtk TODO: solve via Gtk.TargetList? https://python-gtk-3-tutorial.readthedocs.io/en/latest/drag_and_drop.html
        view.drag_source_set(Gdk.ModifierType.BUTTON1_MASK, [Gtk.TargetEntry.new('STRING', 0, 0)], Gdk.DragAction.COPY)

        self.library_row_iter_dict_by_library_path = {}
        self.__expansion_state = None

        self.update() 
Example #5
Source File: io_data_port_list.py    From RAFCON with Eclipse Public License 1.0 5 votes vote down vote up
def _get_new_list_store():
        return Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING, int, bool, GObject.TYPE_STRING, GObject.TYPE_PYOBJECT) 
Example #6
Source File: scoped_variable_list.py    From RAFCON with Eclipse Public License 1.0 5 votes vote down vote up
def get_new_list_store():
        return Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING, int, GObject.TYPE_PYOBJECT) 
Example #7
Source File: data_flows.py    From RAFCON with Eclipse Public License 1.0 5 votes vote down vote up
def __init__(self, model, view):
        """Constructor
        """
        # ListStore for: id, from-state, from-key, to-state, to-key, is_external,
        #                   name-color, to-state-color, data-flow-object, state-object, is_editable, data-flow-model
        list_store = Gtk.ListStore(int, GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING, bool, GObject.TYPE_STRING, GObject.TYPE_STRING,
                               GObject.TYPE_PYOBJECT, GObject.TYPE_PYOBJECT, bool, GObject.TYPE_PYOBJECT)
        self.view_dict = {'data_flows_internal': True, 'data_flows_external': True}

        self.tree_dict_combos = {'internal': {},
                                 'external': {}}
        self.data_flow_dict = {'internal': {},
                               'external': {}}
        self.debug_log = False
        super(StateDataFlowsListController, self).__init__(model, view, view.get_top_widget(), list_store, logger) 
Example #8
Source File: transitions.py    From RAFCON with Eclipse Public License 1.0 5 votes vote down vote up
def __init__(self, model, view):
        # ListStore for: id, from-state, from-outcome, to-state, to-outcome, is_external,
        #                   name-color, to-state-color, transition-object, state-object, is_editable, transition-model
        list_store = Gtk.ListStore(int, GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING, bool,
                                   GObject.TYPE_PYOBJECT, GObject.TYPE_PYOBJECT, bool, GObject.TYPE_PYOBJECT)

        self.view_dict = {'transitions_internal': True, 'transitions_external': True}
        self.combo = {}
        self.debug_log = False
        super(StateTransitionsListController, self).__init__(model, view, view.get_top_widget(), list_store, logger) 
Example #9
Source File: modification_history.py    From RAFCON with Eclipse Public License 1.0 5 votes vote down vote up
def __init__(self, model, view):
        """Constructor
        :param model StateMachineModel should be exchangeable
        """
        assert isinstance(model, StateMachineManagerModel)

        ExtendedController.__init__(self, model, view)
        self.view_is_registered = False

        self._mode = 'branch'
        self.with_tree = True
        self.tree_folded = False

        assert self._mode in ['trail', 'branch']
        self.history_tree_store = Gtk.TreeStore(GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_PYOBJECT, GObject.TYPE_STRING, GObject.TYPE_STRING)
        if view is not None:
            view['history_tree'].set_model(self.history_tree_store)
        view['history_tree'].set_tooltip_column(8)

        # view.set_hover_expand(True)

        self.__my_selected_sm_id = None
        self._selected_sm_model = None

        self.doing_update = False
        self.no_cursor_observation = False
        self.next_activity_focus_self = True
        self.on_toggle_mode_check_gaphas_view_is_meta_data_consistent = True

        self.register() 
Example #10
Source File: treeview_factory.py    From gtg with GNU General Public License v3.0 4 votes vote down vote up
def tags_treeview(self, tree):
        desc = {}

        # Tag id
        col_name = 'tag_id'
        col = {}
        col['renderer'] = ['markup', Gtk.CellRendererText()]
        col['value'] = [str, lambda node: node.get_id()]
        col['visible'] = False
        col['order'] = 0
        col['sorting_func'] = self.tag_sorting
        desc[col_name] = col

        # Tags color
        col_name = 'color'
        col = {}
        render_tags = CellRendererTags()
        render_tags.set_property('ypad', 5)
        col['title'] = _("Tags")
        col['renderer'] = ['tag', render_tags]
        col['value'] = [GObject.TYPE_PYOBJECT, lambda node: node]
        col['expandable'] = False
        col['resizable'] = False
        col['order'] = 1
        desc[col_name] = col

        # Tag names
        col_name = 'tagname'
        col = {}
        render_text = Gtk.CellRendererText()
        render_text.set_property('ypad', 5)
        col['renderer'] = ['markup', render_text]
        col['value'] = [str, self.get_tag_name]
        col['expandable'] = True
        col['new_column'] = False
        col['order'] = 2
        desc[col_name] = col

        # Tag count
        col_name = 'tagcount'
        col = {}
        render_text = Gtk.CellRendererText()
        render_text.set_property('xpad', 17)
        render_text.set_property('ypad', 5)
        render_text.set_property('xalign', 1)
        col['renderer'] = ['markup', render_text]
        col['value'] = [str, self.get_tag_count]
        col['expandable'] = False
        col['new_column'] = False
        col['order'] = 3
        desc[col_name] = col

        return self.build_tag_treeview(tree, desc) 
Example #11
Source File: treeview_factory.py    From gtg with GNU General Public License v3.0 4 votes vote down vote up
def common_desc_for_tasks(self, tree, title_label):
        desc = {}

        # invisible 'task_id' column
        col_name = 'task_id'
        col = {}
        col['renderer'] = ['markup', Gtk.CellRendererText()]
        col['value'] = [str, lambda node: node.get_id()]
        col['visible'] = False
        col['order'] = 0
        desc[col_name] = col

        # invisible 'bg_color' column
        col_name = 'bg_color'
        col = {}
        col['value'] = [str, lambda node: None]
        col['visible'] = False
        desc[col_name] = col

        # invisible 'title' column
        col_name = 'title'
        col = {}
        render_text = Gtk.CellRendererText()
        render_text.set_property("ellipsize", Pango.EllipsizeMode.END)
        col['renderer'] = ['markup', render_text]
        col['value'] = [str, self.get_task_title_column_string]
        col['visible'] = False
        col['order'] = 0
        col['sorting_func'] = self.sort_by_title
        desc[col_name] = col

        # "tags" column (no title)
        col_name = 'tags'
        col = {}
        render_tags = CellRendererTags()
        render_tags.set_property('xalign', 0.0)
        col['renderer'] = ['tag_list', render_tags]
        col['value'] = [GObject.TYPE_PYOBJECT, self.get_task_tags_column_contents]
        col['expandable'] = False
        col['resizable'] = False
        col['order'] = 1
        desc[col_name] = col

        # "label" column
        col_name = 'label'
        col = {}
        col['title'] = title_label
        render_text = Gtk.CellRendererText()
        render_text.set_property("ellipsize", Pango.EllipsizeMode.END)
        col['renderer'] = ['markup', render_text]
        col['value'] = [str, self.get_task_label_column_string]
        col['expandable'] = True
        col['resizable'] = True
        col['sorting'] = 'title'
        col['order'] = 2
        desc[col_name] = col
        return desc