""" Created on 04-11-2012 @author: jurek """ from hra_core.special import ImportErrorMessage try: from hra_core.globals import GLOBALS from hra_core.properties import Properties from hra_core.collections_utils import replace_all_by_dict except ImportError as error: ImportErrorMessage(error, __name__) __I18N_PROPERTIES = Properties( GLOBALS.get(I18N_FILE=GLOBALS.ITEM, PARAM1=GLOBALS.LANG), _file_prefix=GLOBALS.SETTINGS_DIR, _use_as_resources=GLOBALS.USE_SETTINGS_EGG, ) def I18N(_id, _default=None, **params): if _id: i18n = __I18N_PROPERTIES.getValue(_id) if i18n: return replace_all_by_dict(i18n, params) return "" if _default == None else _default
if not action_spec.slot == None: #action_spec.slot could be a method or a function slot = action_spec.slot if hasattr(action_spec.slot, '__call__') else \ SlotWrapper(action_spec.slot, parent=parent) if action_spec.signal == None and action_spec.slot: qt_action = QAction(action_spec.title, parent, triggered=slot) else: qt_action = QAction(action_spec.title, parent) if action_spec.iconId: icon = _ICONS_PROPERTIES.getValue(action_spec.iconId) if icon: qt_action.setIcon(get_resource_as_icon(icon)) #qt_action.setIcon(QIcon(":/%s.png" % icon)) #if shortcut is not None: # qt_action.setShortcut(shortcut) if action_spec.tipId: tooltip = _TOOLTIPS_PROPERTIES.getValue(action_spec.tipId) if tooltip: qt_action.setToolTip(tooltip) qt_action.setStatusTip(tooltip) if action_spec.signal and action_spec.slot: parent.connect(qt_action, SIGNAL(action_spec.signal), slot) qt_action.setCheckable(action_spec.checkable) return qt_action _ICONS_PROPERTIES = Properties(GLOBALS.get(ICONS_FILE=GLOBALS.ITEM), _file_prefix=GLOBALS.SETTINGS_DIR, _use_as_resources=GLOBALS.USE_SETTINGS_EGG) _TOOLTIPS_PROPERTIES = Properties(GLOBALS.get(TOOLTIPS_FILE=GLOBALS.ITEM))
''' Created on 04-11-2012 @author: jurek ''' from hra_core.special import ImportErrorMessage try: from hra_core.globals import GLOBALS from hra_core.properties import Properties from hra_core.collections_utils import replace_all_by_dict except ImportError as error: ImportErrorMessage(error, __name__) __I18N_PROPERTIES = Properties(GLOBALS.get(I18N_FILE=GLOBALS.ITEM, PARAM1=GLOBALS.LANG), _file_prefix=GLOBALS.SETTINGS_DIR, _use_as_resources=GLOBALS.USE_SETTINGS_EGG) def I18N(_id, _default=None, **params): if _id: i18n = __I18N_PROPERTIES.getValue(_id) if i18n: return replace_all_by_dict(i18n, params) return "" if _default == None else _default