signature stringlengths 8 3.44k | body stringlengths 0 1.41M | docstring stringlengths 1 122k | id stringlengths 5 17 |
|---|---|---|---|
@property<EOL><INDENT>def default_namespace(self):<DEDENT> | return self.__default_namespace<EOL> | Property for **self.__default_namespace** attribute.
:return: self.__default_namespace.
:rtype: unicode | f13110:c0:m7 |
@default_namespace.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def default_namespace(self, value):<DEDENT> | if value is not None:<EOL><INDENT>assert type(value) is unicode, "<STR_LIT>".format(<EOL>"<STR_LIT>", value)<EOL><DEDENT>self.__default_namespace = value<EOL> | Setter for **self.__default_namespace** attribute.
:param value: Attribute value.
:type value: unicode | f13110:c0:m8 |
@default_namespace.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def default_namespace(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__default_namespace** attribute. | f13110:c0:m9 |
@property<EOL><INDENT>def categories(self):<DEDENT> | return self.__categories<EOL> | Property for **self.__categories** attribute.
:return: self.__categories.
:rtype: dict | f13110:c0:m10 |
@categories.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def categories(self, value):<DEDENT> | if value is not None:<EOL><INDENT>assert type(value) is dict, "<STR_LIT>".format("<STR_LIT>", value)<EOL>for key, element in value.iteritems():<EOL><INDENT>assert type(key) is dict, "<STR_LIT>".format("<STR_LIT>", key)<EOL>assert type(element) is list, "<STR_LIT>".format(<EOL>"<STR_LIT>", element)<EOL><DEDENT><DEDENT>self.__categories = value<EOL> | Setter for **self.__categories** attribute.
:param value: Attribute value.
:type value: dict | f13110:c0:m11 |
@categories.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def categories(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__categories** attribute. | f13110:c0:m12 |
def __getitem__(self, action): | action = self.__normalize_name(action)<EOL>for path, name, object in foundations.walkers.dictionaries_walker(self.__categories):<EOL><INDENT>if action == foundations.namespace.set_namespace(self.__namespace_splitter.join(path), name):<EOL><INDENT>LOGGER.debug("<STR_LIT>".format(action))<EOL>return object<EOL><DEDENT><DEDENT>raise umbra.exceptions.ActionExistsError(<EOL>"<STR_LIT>".format(self.__class__.__name__, action))<EOL> | Reimplements the :meth:`object.__getitem__` method.
:param action: Action name.
:type action: unicode
:return: Action.
:rtype: QAction | f13110:c0:m13 |
def __setitem__(self, action, kwargs): | self.register_action(action, **kwargs)<EOL> | Reimplements the :meth:`object.__setitem__` method.
:param action: Action.
:type action: unicode
:param kwargs: kwargs.
:type kwargs: dict | f13110:c0:m14 |
def __iter__(self): | return foundations.walkers.dictionaries_walker(self.__categories)<EOL> | Reimplements the :meth:`object.__iter__` method.
:return: Actions iterator.
:rtype: object | f13110:c0:m15 |
def __contains__(self, action): | for path, name, object in self:<EOL><INDENT>if foundations.namespace.set_namespace(self.__namespace_splitter.join(path), name) == action:<EOL><INDENT>return True<EOL><DEDENT><DEDENT>return False<EOL> | Reimplements the :meth:`object.__contains__` method.
:param action: Action name.
:type action: unicode
:return: Action existence.
:rtype: bool | f13110:c0:m16 |
def __len__(self): | return len([action for action in self])<EOL> | Reimplements the :meth:`object.__len__` method.
:return: Actions count.
:rtype: int | f13110:c0:m17 |
def __normalize_name(self, name): | if not name.startswith(self.__root_namespace):<EOL><INDENT>name = foundations.namespace.set_namespace(self.__root_namespace,<EOL>foundations.namespace.set_namespace(self.__default_namespace,<EOL>name))<EOL>LOGGER.debug("<STR_LIT>".format(name))<EOL>return name<EOL><DEDENT>else:<EOL><INDENT>LOGGER.debug("<STR_LIT>".format(name))<EOL>return name<EOL><DEDENT> | Normalizes given action name.
:param name: Action name.
:type name: unicode
:return: Normalized name.
:rtype: bool | f13110:c0:m18 |
def __get_category(self, category, name, vivify=False): | namespace = foundations.namespace.get_namespace(name, root_only=True)<EOL>name = foundations.namespace.remove_namespace(name, root_only=True)<EOL>if namespace:<EOL><INDENT>if vivify and namespace not in category:<EOL><INDENT>category[namespace] = {}<EOL><DEDENT>return self.__get_category(category[namespace], name, vivify)<EOL><DEDENT>else:<EOL><INDENT>if vivify and name not in category:<EOL><INDENT>category[name] = {}<EOL><DEDENT>return category[name]<EOL><DEDENT> | Gets recusively requested category, alternately if **vivify** argument is set,
the category will be created.
:param category: Base category.
:type category: dict
:param name: Category to retrieve or vivify.
:type name: unicode
:param vivify: Vivify missing parents in the chain to the requested category.
:type vivify: bool
:return: Requested category.
:rtype: dict | f13110:c0:m19 |
def get(self, action, default=None): | try:<EOL><INDENT>return self.__getitem__(action)<EOL><DEDENT>except KeyError as error:<EOL><INDENT>return default<EOL><DEDENT> | Returns given action value.
:param action: Action name.
:type action: unicode
:param default: Default value if action is not found.
:type default: object
:return: Action.
:rtype: QAction | f13110:c0:m20 |
def list_actions(self): | actions = []<EOL>for path, actionName, action in self:<EOL><INDENT>actions.append(self.__namespace_splitter.join(itertools.chain(path, (actionName,))))<EOL><DEDENT>return sorted(actions)<EOL> | Returns the registered actions.
:return: Actions list.
:rtype: list | f13110:c0:m21 |
@foundations.exceptions.handle_exceptions(umbra.exceptions.CategoryExistsError)<EOL><INDENT>def get_category(self, name, vivify=False):<DEDENT> | category = self.__get_category(self.__categories, name, vivify)<EOL>if isinstance(category, dict):<EOL><INDENT>LOGGER.debug("<STR_LIT>".format(name, category))<EOL>return category<EOL><DEDENT>else:<EOL><INDENT>raise umbra.exceptions.CategoryExistsError("<STR_LIT>".format<EOL>(self.__class__.__name__, name))<EOL><DEDENT> | Returns requested category.
:param name: Category to retrieve.
:type name: unicode
:param vivify: Vivify missing parents in the chain to the requested category.
:type vivify: bool
:return: Category.
:rtype: dict | f13110:c0:m22 |
def add_to_category(self, category, name, action): | category = self.get_category(category, vivify=True)<EOL>if not isinstance(category, dict):<EOL><INDENT>return False<EOL><DEDENT>category[name] = action<EOL>LOGGER.debug("<STR_LIT>".format(category, name))<EOL>return True<EOL> | Adds given action to given category.
:param category: Category to store the action.
:type category: unicode
:param name: Action name.
:type name: unicode
:param action: Action object.
:type action: QAction
:return: Method success.
:rtype: bool | f13110:c0:m23 |
def remove_from_category(self, category, name): | category = self.get_category(category)<EOL>if not isinstance(category, dict):<EOL><INDENT>return False<EOL><DEDENT>del (category[name])<EOL>LOGGER.debug("<STR_LIT>".format(category, name))<EOL>return True<EOL> | Removes given action from given category.
:param category: Category to remove the action from.
:type category: unicode
:param name: Action name.
:type name: unicode
:return: Method success.
:rtype: bool | f13110:c0:m24 |
@foundations.exceptions.handle_exceptions(umbra.exceptions.ActionExistsError)<EOL><INDENT>def get_action(self, action):<DEDENT> | return self[action]<EOL> | Returns requested action.
:param action: Action name.
:type action: unicode
:return: Action.
:rtype: QAction | f13110:c0:m25 |
def is_action_registered(self, name): | return name in self<EOL> | Returns if the given action name is registered.
:param name: Action name.
:type name: unicode
:return: Is action registered.
:rtype: bool | f13110:c0:m26 |
def register_action(self, name, **kwargs): | settings = foundations.data_structures.Structure(**{"<STR_LIT>": None,<EOL>"<STR_LIT:text>": None,<EOL>"<STR_LIT>": None,<EOL>"<STR_LIT>": None,<EOL>"<STR_LIT>": None,<EOL>"<STR_LIT>": None,<EOL>"<STR_LIT>": None,<EOL>"<STR_LIT>": None,<EOL>"<STR_LIT>": None,<EOL>"<STR_LIT>": None,<EOL>"<STR_LIT>": None,<EOL>"<STR_LIT>": None})<EOL>settings.update(kwargs)<EOL>name = self.__normalize_name(name)<EOL>category = foundations.namespace.get_namespace(name)<EOL>name = foundations.namespace.remove_namespace(name)<EOL>action = QAction(name, settings.parent or self)<EOL>self.add_to_category(category, name, action)<EOL>settings.text and action.setText(settings.text)<EOL>settings.icon and action.setIcon(settings.icon)<EOL>settings.icon_text and action.setIconText(settings.icon_text)<EOL>settings.checkable and action.setCheckable(settings.checkable)<EOL>settings.checked and action.set_checked(settings.checked)<EOL>settings.status_tip and action.setStatusTip(settings.status_tip)<EOL>settings.whats_this and action.setWhatsThis(settings.whats_this)<EOL>settings.tool_tip and action.setToolTip(settings.tool_tip)<EOL>settings.shortcut and action.setShortcut(QKeySequence(settings.shortcut))<EOL>settings.shortcut_context and action.setShortcutContext(settings.shortcut_context)<EOL>if settings.slot:<EOL><INDENT>self.__actions_signals_slots[action] = settings.slot<EOL>action.triggered.connect(settings.slot)<EOL><DEDENT>return action<EOL> | Registers given action name, optional arguments like a parent, icon, slot etc ... can be given.
:param name: Action to register.
:type name: unicode
:param \*\*kwargs: Keywords arguments.
:type \*\*kwargs: \*\*
:return: Action.
:rtype: QAction | f13110:c0:m27 |
def unregister_action(self, name): | name = self.__normalize_name(name)<EOL>action = self.get_action(name)<EOL>if not action:<EOL><INDENT>return False<EOL><DEDENT>action.triggered.disconnect(self.__actions_signals_slots.pop(action))<EOL>category = foundations.namespace.get_namespace(name)<EOL>name = foundations.namespace.remove_namespace(name)<EOL>self.remove_from_category(category, name)<EOL>return True<EOL> | Unregisters given action name.
:param name: Action to register.
:type name: unicode
:return: Method success.
:rtype: bool | f13110:c0:m28 |
def is_shortcut_in_use(self, shortcut): | for path, actionName, action in foundations.walkers.dictionaries_walker(self.__categories):<EOL><INDENT>if action.shortcut() == QKeySequence(shortcut):<EOL><INDENT>return True<EOL><DEDENT><DEDENT>return False<EOL> | Returns if given action shortcut is in use.
:param name: Action shortcut.
:type name: unicode
:return: Is shortcut in use.
:rtype: bool | f13110:c0:m29 |
def get_shortcut(self, name): | name = self.__normalize_name(name)<EOL>action = self.get_action(name)<EOL>if not action:<EOL><INDENT>return "<STR_LIT>"<EOL><DEDENT>return action.shortcut().toString()<EOL> | Returns given action shortcut.
:param name: Action to retrieve the shortcut.
:type name: unicode
:return: Action shortcut.
:rtype: unicode | f13110:c0:m30 |
def set_shortcut(self, name, shortcut): | name = self.__normalize_name(name)<EOL>action = self.get_action(name)<EOL>if not action:<EOL><INDENT>return<EOL><DEDENT>action.setShortcut(QKeySequence(shortcut))<EOL>return True<EOL> | Sets given action shortcut.
:param name: Action to set the shortcut.
:type name: unicode
:param shortcut: Shortcut to set.
:type shortcut: unicode
:return: Method success.
:rtype: bool | f13110:c0:m31 |
def _setEncoding(): | import sys<EOL>reload(sys)<EOL>sys.setdefaultencoding(DEFAULT_CODEC)<EOL> | Sets the Package encoding. | f13114:m0 |
def __init__(self, file=None): | LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>self.__file = None<EOL>self.file = file<EOL>self.__settings = QSettings(self.__file, QSettings.IniFormat) if self.__file is not None else QSettings()<EOL>self.__default_settings = None<EOL>self.__default_layouts_settings = None<EOL>self.__get_default_settings()<EOL>self.__get_default_layouts_settings()<EOL> | Initializes the class.
:param file: Current preferences file path.
:type file: unicode | f13115:c0:m0 |
@property<EOL><INDENT>def file(self):<DEDENT> | return self.__file<EOL> | Property for **self.__file** attribute.
:return: self.__file.
:rtype: unicode | f13115:c0:m1 |
@file.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def file(self, value):<DEDENT> | if value is not None:<EOL><INDENT>assert type(value) is unicode, "<STR_LIT>".format(<EOL>"<STR_LIT:file>", value)<EOL><DEDENT>self.__file = value<EOL> | Setter for **self.__file** attribute.
:param value: Attribute value.
:type value: unicode | f13115:c0:m2 |
@file.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def file(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT:file>"))<EOL> | Deleter for **self.__file** attribute. | f13115:c0:m3 |
@property<EOL><INDENT>def settings(self):<DEDENT> | return self.__settings<EOL> | Property for **self.__settings** attribute.
:return: self.__settings.
:rtype: QSettings | f13115:c0:m4 |
@settings.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def settings(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__settings** attribute.
:param value: Attribute value.
:type value: QSettings | f13115:c0:m5 |
@settings.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def settings(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__settings** attribute. | f13115:c0:m6 |
@property<EOL><INDENT>def default_settings(self):<DEDENT> | return self.__default_settings<EOL> | Property for **self.__default_settings** attribute.
:return: self.__default_settings.
:rtype: QSettings | f13115:c0:m7 |
@default_settings.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def default_settings(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__default_settings** attribute.
:param value: Attribute value.
:type value: QSettings | f13115:c0:m8 |
@default_settings.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def default_settings(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__default_settings** attribute. | f13115:c0:m9 |
@property<EOL><INDENT>def default_layouts_settings(self):<DEDENT> | return self.__default_layouts_settings<EOL> | Property for **self.__default_layouts_settings** attribute.
:return: self.__default_layouts_settings.
:rtype: QSettings | f13115:c0:m10 |
@default_layouts_settings.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def default_layouts_settings(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__default_layouts_settings** attribute.
:param value: Attribute value.
:type value: QSettings | f13115:c0:m11 |
@default_layouts_settings.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def default_layouts_settings(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__default_layouts_settings** attribute. | f13115:c0:m12 |
def set_key(self, section, key, value): | LOGGER.debug("<STR_LIT>".format(<EOL>key, section, foundations.strings.to_string(value)))<EOL>self.__settings.beginGroup(section)<EOL>self.__settings.setValue(key, QVariant(value))<EOL>self.__settings.endGroup()<EOL> | Stores given key in settings file.
:param section: Current section to save the key into.
:type section: unicode
:param key: Current key to save.
:type key: unicode
:param value: Current key value to save.
:type value: object | f13115:c0:m13 |
def get_key(self, section, key): | LOGGER.debug("<STR_LIT>".format(key, section))<EOL>self.__settings.beginGroup(section)<EOL>value = self.__settings.value(key)<EOL>LOGGER.debug("<STR_LIT>".format(value))<EOL>self.__settings.endGroup()<EOL>return value<EOL> | Gets key value from settings file.
:param section: Current section to retrieve key from.
:type section: unicode
:param key: Current key to retrieve.
:type key: unicode
:return: Current key value.
:rtype: object | f13115:c0:m14 |
def key_exists(self, section, key): | LOGGER.debug("<STR_LIT>".format(key, section))<EOL>self.__settings.beginGroup(section)<EOL>exists = self.__settings.contains(key)<EOL>self.__settings.endGroup()<EOL>return exists<EOL> | Checks if given key exists.
:param section: Current section to check key in.
:type section: unicode
:param key: Current key to check.
:type key: unicode
:return: Key existence.
:rtype: bool | f13115:c0:m15 |
def __get_default_settings(self): | LOGGER.debug("<STR_LIT>".format(UiConstants.settings_file))<EOL>self.__default_settings = QSettings(<EOL>umbra.ui.common.get_resource_path(UiConstants.settings_file), QSettings.IniFormat)<EOL> | Gets the default settings. | f13115:c0:m16 |
def __get_default_layouts_settings(self): | LOGGER.debug("<STR_LIT>".format(UiConstants.layouts_file))<EOL>self.__default_layouts_settings = QSettings(umbra.ui.common.get_resource_path(UiConstants.layouts_file),<EOL>QSettings.IniFormat)<EOL> | Gets the default layouts settings. | f13115:c0:m17 |
def set_default_preferences(self): | LOGGER.debug("<STR_LIT>")<EOL>for key in self.__default_settings.allKeys():<EOL><INDENT>self.__settings.setValue(key, self.__default_settings.value(key))<EOL><DEDENT>self.set_default_layouts()<EOL>return True<EOL> | Defines the default settings file content.
:return: Method success.
:rtype: bool | f13115:c0:m18 |
def set_default_layouts(self, ignored_layouts=None): | for key in self.__default_layouts_settings.allKeys():<EOL><INDENT>if ignored_layouts:<EOL><INDENT>if tuple((layout for layout in ignored_layouts if layout in key)):<EOL><INDENT>continue<EOL><DEDENT><DEDENT>self.__settings.setValue(key, self.__default_layouts_settings.value(key))<EOL><DEDENT>return True<EOL> | Sets the default layouts in the preferences file.
:param ignored_layouts: Ignored layouts.
:type ignored_layouts: tuple or list
:return: Method success.
:rtype: bool | f13115:c0:m19 |
def __init__(self, parent=None, name=None, *args, **kwargs): | LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>super(PreferencesManager, self).__init__(parent, name, *args, **kwargs)<EOL>self.deactivatable = False<EOL>self.__dock_area = <NUM_LIT:2><EOL>self.__engine = None<EOL>self.__settings = None<EOL> | Initializes the class.
:param parent: Object parent.
:type parent: QObject
:param name: Component name.
:type name: unicode
:param \*args: Arguments.
:type \*args: \*
:param \*\*kwargs: Keywords arguments.
:type \*\*kwargs: \*\* | f13116:c0:m0 |
@property<EOL><INDENT>def dock_area(self):<DEDENT> | return self.__dock_area<EOL> | Property for **self.__dock_area** attribute.
:return: self.__dock_area.
:rtype: int | f13116:c0:m1 |
@dock_area.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def dock_area(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__dock_area** attribute.
:param value: Attribute value.
:type value: int | f13116:c0:m2 |
@dock_area.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def dock_area(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__dock_area** attribute. | f13116:c0:m3 |
@property<EOL><INDENT>def engine(self):<DEDENT> | return self.__engine<EOL> | Property for **self.__engine** attribute.
:return: self.__engine.
:rtype: QObject | f13116:c0:m4 |
@engine.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def engine(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__engine** attribute.
:param value: Attribute value.
:type value: QObject | f13116:c0:m5 |
@engine.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def engine(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__engine** attribute. | f13116:c0:m6 |
@property<EOL><INDENT>def settings(self):<DEDENT> | return self.__settings<EOL> | Property for **self.__settings** attribute.
:return: self.__settings.
:rtype: QSettings | f13116:c0:m7 |
@settings.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def settings(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__settings** attribute.
:param value: Attribute value.
:type value: QSettings | f13116:c0:m8 |
@settings.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def settings(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__settings** attribute. | f13116:c0:m9 |
def activate(self, engine): | LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>self.__engine = engine<EOL>self.__settings = self.__engine.settings<EOL>self.activated = True<EOL>return True<EOL> | Activates the Component.
:param engine: Engine to attach the Component to.
:type engine: QObject
:return: Method success.
:rtype: bool | f13116:c0:m10 |
@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL><INDENT>def deactivate(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, self.__name))<EOL> | Deactivates the Component. | f13116:c0:m11 |
def initialize_ui(self): | LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>umbra.ui.common.set_toolBox_height(self.Preferences_Manager_toolBox)<EOL>self.__Logging_Formatters_comboBox_set_ui()<EOL>self.__Verbose_Level_comboBox_set_ui()<EOL>self.__Restore_Geometry_On_Layout_Change_checkBox_set_ui()<EOL>self.__engine.verbosity_level_changed.connect(self.__engine__verbosity_level_changed)<EOL>self.Logging_Formatters_comboBox.activated.connect(self.__Logging_Formatters_comboBox__activated)<EOL>self.Verbose_Level_comboBox.activated.connect(self.__Verbose_Level_comboBox__activated)<EOL>self.Restore_Geometry_On_Layout_Change_checkBox.stateChanged.connect(<EOL>self.__Restore_Geometry_On_Layout_Change_checkBox__stateChanged)<EOL>self.initialized_ui = True<EOL>return True<EOL> | Initializes the Component ui.
:return: Method success.
:rtype: bool | f13116:c0:m12 |
@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL><INDENT>def uninitialize_ui(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, self.name))<EOL> | Uninitializes the Component ui. | f13116:c0:m13 |
def add_widget(self): | LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>self.__engine.addDockWidget(Qt.DockWidgetArea(self.__dock_area), self)<EOL>return True<EOL> | Adds the Component Widget to the engine.
:return: Method success.
:rtype: bool | f13116:c0:m14 |
@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL><INDENT>def remove_widget(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, self.name))<EOL> | Removes the Component Widget from the engine. | f13116:c0:m15 |
def __engine__verbosity_level_changed(self, verbosity_level): | self.Verbose_Level_comboBox.setCurrentIndex(verbosity_level)<EOL> | Defines the slot triggered by the engine when verbosity level has changed.
:param verbosity_level: Current verbosity level.
:type verbosity_level: int | f13116:c0:m16 |
def __Logging_Formatters_comboBox_set_ui(self): | self.Logging_Formatters_comboBox.clear()<EOL>LOGGER.debug("<STR_LIT>".format("<STR_LIT:U+002CU+0020>".join(RuntimeGlobals.logging_formatters)))<EOL>self.Logging_Formatters_comboBox.insertItems(<NUM_LIT:0>, QStringList(RuntimeGlobals.logging_formatters.keys()))<EOL>logging_formatter = self.__settings.get_key("<STR_LIT>", "<STR_LIT>").toString()<EOL>self.__engine.logging_active_formatter = logging_formatter and logging_formatter or Constants.logging_default_formatter<EOL>self.Logging_Formatters_comboBox.setCurrentIndex(self.Logging_Formatters_comboBox.findText(<EOL>self.__engine.logging_active_formatter, Qt.MatchExactly))<EOL> | Fills **Logging_Formatter_comboBox** Widget. | f13116:c0:m17 |
def __Logging_Formatters_comboBox__activated(self, index): | formatter = foundations.strings.to_string(self.Logging_Formatters_comboBox.currentText())<EOL>LOGGER.debug("<STR_LIT>".format(formatter))<EOL>RuntimeGlobals.logging_active_formatter = formatter<EOL>self.set_logging_formatter()<EOL>self.__settings.set_key("<STR_LIT>", "<STR_LIT>", self.Logging_Formatters_comboBox.currentText())<EOL> | Defines the slot triggered by the **Logging_Formatter_comboBox** Widget when activated.
:param index: ComboBox activated item index.
:type index: int | f13116:c0:m18 |
def __Verbose_Level_comboBox_set_ui(self): | self.Verbose_Level_comboBox.clear()<EOL>LOGGER.debug("<STR_LIT>".format(Constants.verbosity_labels))<EOL>self.Verbose_Level_comboBox.insertItems(<NUM_LIT:0>, QStringList(Constants.verbosity_labels))<EOL>self.__engine.verbosity_level = foundations.common.get_first_item(<EOL>self.__settings.get_key("<STR_LIT>", "<STR_LIT>").toInt())<EOL>self.Verbose_Level_comboBox.setCurrentIndex(self.__engine.verbosity_level)<EOL> | Fills **Verbose_Level_ComboBox** Widget. | f13116:c0:m19 |
def __Verbose_Level_comboBox__activated(self, index): | LOGGER.debug("<STR_LIT>".format(self.Verbose_Level_comboBox.currentText()))<EOL>self.__engine.verbosity_level = index<EOL>foundations.verbose.set_verbosity_level(index)<EOL>self.__settings.set_key("<STR_LIT>", "<STR_LIT>", index)<EOL> | Defines the slot triggered by the **Verbose_Level_ComboBox** Widget when activated.
:param index: ComboBox activated item index.
:type index: int | f13116:c0:m20 |
def __Restore_Geometry_On_Layout_Change_checkBox_set_ui(self): | <EOL>self.__settings.get_key("<STR_LIT>", "<STR_LIT>").isNull() andself.__settings.set_key("<STR_LIT>", "<STR_LIT>", Qt.Unchecked)<EOL>restore_geometry_on_layout_change = foundations.common.get_first_item(<EOL>self.__settings.get_key("<STR_LIT>", "<STR_LIT>").toInt())<EOL>LOGGER.debug("<STR_LIT>".format("<STR_LIT>",<EOL>restore_geometry_on_layout_change))<EOL>self.Restore_Geometry_On_Layout_Change_checkBox.setCheckState(restore_geometry_on_layout_change)<EOL>self.__engine.layouts_manager.restore_geometry_on_layout_change = True if restore_geometry_on_layout_change else False<EOL> | Sets the **Restore_Geometry_On_Layout_Change_checkBox** Widget. | f13116:c0:m21 |
def __Restore_Geometry_On_Layout_Change_checkBox__stateChanged(self, state): | LOGGER.debug("<STR_LIT>".format(state))<EOL>self.__settings.set_key("<STR_LIT>", "<STR_LIT>", state)<EOL>self.__engine.layouts_manager.restore_geometry_on_layout_change = state and True or False<EOL> | Defines the slot triggered by **Restore_Geometry_On_Layout_Change_checkBox** Widget when state changed.
:param state: Checkbox state.
:type state: int | f13116:c0:m22 |
def set_logging_formatter(self): | for handler in (RuntimeGlobals.logging_console_handler,<EOL>RuntimeGlobals.logging_file_handler,<EOL>RuntimeGlobals.logging_session_handler):<EOL><INDENT>handler and handler.setFormatter(<EOL>RuntimeGlobals.logging_formatters[RuntimeGlobals.logging_active_formatter])<EOL><DEDENT> | Sets the logging formatter. | f13116:c0:m23 |
def __init__(self,<EOL>name=None,<EOL>parent=None,<EOL>children=None,<EOL>roles=None,<EOL>node_flags=int(Qt.ItemIsSelectable | Qt.ItemIsEnabled),<EOL>attributes_flags=int(Qt.ItemIsSelectable | Qt.ItemIsEnabled),<EOL>**kwargs): | LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>umbra.ui.nodes.GraphModelNode.__init__(self, name, parent, children, roles, node_flags, **kwargs)<EOL>PathNode.__initialize_node(self, attributes_flags)<EOL> | Initializes the class.
:param name: Node name.
:type name: unicode
:param parent: Node parent.
:type parent: GraphModelNode
:param children: Children.
:type children: list
:param roles: Roles.
:type roles: dict
:param node_flags: Node flags.
:type node_flags: int
:param attributes_flags: Attributes flags.
:type attributes_flags: int
:param \*\*kwargs: Keywords arguments.
:type \*\*kwargs: \*\* | f13117:c0:m0 |
def __initialize_node(self, attributes_flags=int(Qt.ItemIsSelectable | Qt.ItemIsEnabled)): | self["<STR_LIT>"] = umbra.ui.nodes.GraphModelAttribute(name="<STR_LIT>",<EOL>flags=attributes_flags)<EOL>self["<STR_LIT>"] = umbra.ui.nodes.GraphModelAttribute(name="<STR_LIT>",<EOL>flags=attributes_flags)<EOL>self["<STR_LIT>"] = umbra.ui.nodes.GraphModelAttribute(name="<STR_LIT>",<EOL>flags=attributes_flags)<EOL>self["<STR_LIT:version>"] = umbra.ui.nodes.GraphModelAttribute(name="<STR_LIT:version>",<EOL>flags=attributes_flags)<EOL> | Initializes the node.
:param attributes_flags: Attributes flags.
:type attributes_flags: int | f13117:c0:m1 |
def __init__(self,<EOL>component,<EOL>name=None,<EOL>parent=None,<EOL>children=None,<EOL>roles=None,<EOL>node_flags=int(Qt.ItemIsSelectable | Qt.ItemIsEnabled),<EOL>attributes_flags=int(Qt.ItemIsSelectable | Qt.ItemIsEnabled),<EOL>**kwargs): | LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>umbra.ui.nodes.GraphModelNode.__init__(self, name, parent, children, roles, node_flags, **kwargs)<EOL>self.__component = component<EOL>self.__tool_tip_text = """<STR_LIT>"""<EOL>ComponentNode.__initialize_node(self, attributes_flags)<EOL> | Initializes the class.
:param component: Component.
:type component: Component or QWidgetComponent or QObjectComponent
:param name: Node name.
:type name: unicode
:param parent: Node parent.
:type parent: GraphModelNode
:param children: Children.
:type children: list
:param roles: Roles.
:type roles: dict
:param node_flags: Node flags.
:type node_flags: int
:param attributes_flags: Attributes flags.
:type attributes_flags: int
:param \*\*kwargs: Keywords arguments.
:type \*\*kwargs: \*\* | f13117:c1:m0 |
@property<EOL><INDENT>def component(self):<DEDENT> | return self.__component<EOL> | Property for **self.__component** attribute.
:return: self.__component.
:rtype: Component or QWidgetComponent or QObjectComponent | f13117:c1:m1 |
@component.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def component(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__component** attribute.
:param value: Attribute value.
:type value: Component or QWidgetComponent or QObjectComponent | f13117:c1:m2 |
@component.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def component(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__component** attribute. | f13117:c1:m3 |
@property<EOL><INDENT>def tool_tip_text(self):<DEDENT> | return self.__tool_tip_text<EOL> | Property for **self.__tool_tip_text** attribute.
:return: self.__tool_tip_text.
:rtype: unicode | f13117:c1:m4 |
@tool_tip_text.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(AssertionError)<EOL>def tool_tip_text(self, value):<DEDENT> | if value is not None:<EOL><INDENT>assert type(value) is unicode, "<STR_LIT>".format(<EOL>"<STR_LIT>", value)<EOL><DEDENT>self.__tool_tip_text = value<EOL> | Setter for **self.__tool_tip_text** attribute.
:param value: Attribute value.
:type value: unicode | f13117:c1:m5 |
@tool_tip_text.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def tool_tip_text(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__tool_tip_text** attribute. | f13117:c1:m6 |
def __initialize_node(self, attributes_flags=int(Qt.ItemIsSelectable | Qt.ItemIsEnabled)): | attributes = dir(self.__component)<EOL>for attribute in attributes:<EOL><INDENT>if attribute == "<STR_LIT:name>":<EOL><INDENT>continue<EOL><DEDENT>if not "<STR_LIT>".format(attribute) in attributes:<EOL><INDENT>continue<EOL><DEDENT>value = getattr(self.__component, attribute)<EOL>value = "<STR_LIT:U+002CU+0020>".join(value) if type(value) in (tuple, list) else value<EOL>roles = {Qt.DisplayRole: value,<EOL>Qt.EditRole: value}<EOL>self[attribute] = umbra.ui.nodes.GraphModelAttribute(attribute, value, roles, attributes_flags)<EOL><DEDENT>self.update_tool_tip()<EOL> | Initializes the node.
:param attributes_flags: Attributes flags.
:type attributes_flags: int | f13117:c1:m7 |
def update_tool_tip(self): | self.roles[Qt.ToolTipRole] = self.__tool_tip_text.format(self.component.name,<EOL>self.component.author,<EOL>self.component.category,<EOL>"<STR_LIT:U+002CU+0020>".join(self.component.require),<EOL>self.component.version,<EOL>self.component.description)<EOL>return True<EOL> | Updates the node tooltip.
:return: Method success.
:rtype: bool | f13117:c1:m8 |
def __init__(self, parent=None, name=None, *args, **kwargs): | LOGGER.debug("<STR_LIT>".format(self.__class__.__name__))<EOL>super(ComponentsManagerUi, self).__init__(parent, name, *args, **kwargs)<EOL>self.deactivatable = False<EOL>self.__ui_resources_directory = "<STR_LIT>"<EOL>self.__ui_activated_image = "<STR_LIT>"<EOL>self.__ui_deactivated_image = "<STR_LIT>"<EOL>self.__ui_category_affixe = "<STR_LIT>"<EOL>self.__dock_area = <NUM_LIT:1><EOL>self.__engine = None<EOL>self.__settings = None<EOL>self.__model = None<EOL>self.__view = None<EOL>self.__headers = OrderedDict([("<STR_LIT>", "<STR_LIT:name>"),<EOL>("<STR_LIT>", "<STR_LIT>"),<EOL>("<STR_LIT>", "<STR_LIT>"),<EOL>("<STR_LIT>", "<STR_LIT>"),<EOL>("<STR_LIT>", "<STR_LIT:version>")])<EOL>self.__tree_view_inner_margins = QMargins(<NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:12>)<EOL>self.__components_informations_default_text ="<STR_LIT>"<EOL>self.__components_informations_text = """<STR_LIT>"""<EOL> | Initializes the class.
:param parent: Object parent.
:type parent: QObject
:param name: Component name.
:type name: unicode
:param \*args: Arguments.
:type \*args: \*
:param \*\*kwargs: Keywords arguments.
:type \*\*kwargs: \*\* | f13118:c0:m0 |
@property<EOL><INDENT>def ui_resources_directory(self):<DEDENT> | return self.__ui_resources_directory<EOL> | Property for **self.__ui_resources_directory** attribute.
:return: self.__ui_resources_directory.
:rtype: unicode | f13118:c0:m1 |
@ui_resources_directory.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def ui_resources_directory(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__ui_resources_directory** attribute.
:param value: Attribute value.
:type value: unicode | f13118:c0:m2 |
@ui_resources_directory.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def ui_resources_directory(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__ui_resources_directory** attribute. | f13118:c0:m3 |
@property<EOL><INDENT>def ui_activated_image(self):<DEDENT> | return self.__ui_activated_image<EOL> | Property for **self.__ui_activated_image** attribute.
:return: self.__ui_activated_image.
:rtype: unicode | f13118:c0:m4 |
@ui_activated_image.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def ui_activated_image(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__ui_activated_image** attribute.
:param value: Attribute value.
:type value: unicode | f13118:c0:m5 |
@ui_activated_image.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def ui_activated_image(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__ui_activated_image** attribute. | f13118:c0:m6 |
@property<EOL><INDENT>def ui_deactivated_image(self):<DEDENT> | return self.__ui_deactivated_image<EOL> | Property for **self.__ui_deactivated_image** attribute.
:return: self.__ui_deactivated_image.
:rtype: unicode | f13118:c0:m7 |
@ui_deactivated_image.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def ui_deactivated_image(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__ui_deactivated_image** attribute.
:param value: Attribute value.
:type value: unicode | f13118:c0:m8 |
@ui_deactivated_image.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def ui_deactivated_image(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__ui_deactivated_image** attribute. | f13118:c0:m9 |
@property<EOL><INDENT>def ui_category_affixe(self):<DEDENT> | return self.__ui_category_affixe<EOL> | Property for **self.__ui_category_affixe** attribute.
:return: self.__ui_category_affixe.
:rtype: unicode | f13118:c0:m10 |
@ui_category_affixe.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def ui_category_affixe(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__ui_category_affixe** attribute.
:param value: Attribute value.
:type value: unicode | f13118:c0:m11 |
@ui_category_affixe.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def ui_category_affixe(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__ui_category_affixe** attribute. | f13118:c0:m12 |
@property<EOL><INDENT>def dock_area(self):<DEDENT> | return self.__dock_area<EOL> | Property for **self.__dock_area** attribute.
:return: self.__dock_area.
:rtype: int | f13118:c0:m13 |
@dock_area.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def dock_area(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__dock_area** attribute.
:param value: Attribute value.
:type value: int | f13118:c0:m14 |
@dock_area.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def dock_area(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__dock_area** attribute. | f13118:c0:m15 |
@property<EOL><INDENT>def engine(self):<DEDENT> | return self.__engine<EOL> | Property for **self.__engine** attribute.
:return: self.__engine.
:rtype: QObject | f13118:c0:m16 |
@engine.setter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def engine(self, value):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Setter for **self.__engine** attribute.
:param value: Attribute value.
:type value: QObject | f13118:c0:m17 |
@engine.deleter<EOL><INDENT>@foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)<EOL>def engine(self):<DEDENT> | raise foundations.exceptions.ProgrammingError(<EOL>"<STR_LIT>".format(self.__class__.__name__, "<STR_LIT>"))<EOL> | Deleter for **self.__engine** attribute. | f13118:c0:m18 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.