本文整理汇总了Python中gi.repository.GObject.TYPE_STRING属性的典型用法代码示例。如果您正苦于以下问题:Python GObject.TYPE_STRING属性的具体用法?Python GObject.TYPE_STRING怎么用?Python GObject.TYPE_STRING使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类gi.repository.GObject
的用法示例。
在下文中一共展示了GObject.TYPE_STRING属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_lstore
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import TYPE_STRING [as 别名]
def create_lstore(self,list_of_lists):
lstore_args = []
for cell in list_of_lists[0]:
if type(cell) == type("string"):
lstore_args.append(GObject.TYPE_STRING)
elif type(cell) == type(1):
lstore_args.append(GObject.TYPE_UINT)
elif type(cell) == type(False):
lstore_args.append(GObject.TYPE_BOOLEAN)
else:
raise TypeError("%s" % type(cell))
lstore = Gtk.ListStore(*lstore_args)
for row in list_of_lists:
iter = lstore.append()
index_values = []
for i,v in enumerate(row):
index_values.append(i)
index_values.append(v)
lstore.set(iter,*index_values)
return lstore
示例2: __init__
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import TYPE_STRING [as 别名]
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()
示例3: __init__
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import TYPE_STRING [as 别名]
def __init__(self, model, view):
"""Constructor
"""
assert isinstance(model, AbstractStateModel)
assert isinstance(view, SemanticDataEditorView)
if isinstance(model.state, LibraryState):
model_to_observe = model.state_copy
else:
model_to_observe = model
# define tree store with the values in [key, value Is Dict]
tree_store = Gtk.TreeStore(GObject.TYPE_STRING, GObject.TYPE_STRING, bool, GObject.TYPE_PYOBJECT)
# unfortunately this cannot be down with super, as gtkmvc3 does not use super() consistently
TreeViewController.__init__(self, model_to_observe, view,
view["semantic_data_tree_view"], tree_store, logger)
AbstractExternalEditor.__init__(self)
self.semantic_data_counter = 0
示例4: __init__
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import TYPE_STRING [as 别名]
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))
示例5: __init__
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import TYPE_STRING [as 别名]
def __init__(self, core_config_model, view, gui_config_model):
assert isinstance(view, PreferencesWindowView)
assert isinstance(core_config_model, ConfigModel)
assert isinstance(gui_config_model, ConfigModel)
ExtendedController.__init__(self, core_config_model, view)
self.core_config_model = core_config_model
self.gui_config_model = gui_config_model
self.observe_model(gui_config_model)
# (config_key, config_value, text_visible, toggle_activatable, toggle_visible, text_editable, toggle_value)
self.core_list_store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING, bool, bool, bool, bool, bool)
self.library_list_store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING)
self.gui_list_store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING, bool, bool, bool, bool, bool)
self.shortcut_list_store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING)
self._lib_counter = 0
self._gui_checkbox = Gtk.CheckButton(label="GUI Config")
self._core_checkbox = Gtk.CheckButton(label="Core Config")
self._last_path = self.core_config_model.config.path
示例6: __init__
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import TYPE_STRING [as 别名]
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()
示例7: listStoreFromList
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import TYPE_STRING [as 别名]
def listStoreFromList(list_obj):
list_store = Gtk.ListStore(GObject.TYPE_STRING)
for elem in list_obj:
iter = list_store.append()
list_store.set(iter, 0, elem)
return list_store
示例8: __init__
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import TYPE_STRING [as 别名]
def __init__(self):
View.__init__(self)
Gtk.IconView.__init__(self)
self.props.item_orientation = Gtk.Orientation.HORIZONTAL
self.set_columns(len(self.states))
self.set_margin(0)
self.set_item_width(23)
self.set_spacing(0)
self.set_row_spacing(0)
self.set_column_spacing(0)
liststore = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING)
self.set_model(liststore)
self.set_markup_column(0)
self.set_tooltip_column(1)
for shorthand, state_class, icon in self.states:
liststore.append(['<span font_desc="{font} {size}" color="{color}">{icon}</span> {text}'.format(
font=constants.ICON_FONT_FONTAWESOME,
size=constants.FONT_SIZE_BIG,
color=global_gui_config.colors['BUTTON_TEXT_COLOR'],
icon=icon,
text=shorthand
), "Add/Drag and Drop " + state_class.__name__])
self['state_icon_view'] = self
self.top = 'state_icon_view'
示例9: __init__
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import TYPE_STRING [as 别名]
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()
示例10: __init__
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import TYPE_STRING [as 别名]
def __init__(self, model, view):
# list store order -> gv_name, data_type, data_value, is_locked
super(GlobalVariableManagerController, self).__init__(model, view,
view['global_variable_tree_view'],
Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING), logger)
self.global_variable_counter = 0
self.list_store_iterators = {}
示例11: _get_new_list_store
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import TYPE_STRING [as 别名]
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)
示例12: __init__
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import TYPE_STRING [as 别名]
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)
示例13: __init__
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import TYPE_STRING [as 别名]
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)
示例14: __init__
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import TYPE_STRING [as 别名]
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()
示例15: __translate_widget_strings
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import TYPE_STRING [as 别名]
def __translate_widget_strings(a_widget):
""" Calls gettext on all strings we can find in a_widgets.
Args:
a_widget (:class:`~GObject.Object`): an object built by the builder, usually a widget
"""
for str_prop in (prop.name for prop in a_widget.props if prop.value_type == GObject.TYPE_STRING):
try:
str_val = getattr(a_widget.props, str_prop)
if str_val:
setattr(a_widget.props, str_prop, _(str_val))
except TypeError:
# Thrown when a string property is not readable
pass