def create_action(win, name, control, command, icon=None, enabled=ALWAYS, tooltip=None, shortcut=None, status=None, togglecheck=None, checkstate=None, icon_name=None): if icon: action = QAction(get_icon(icon_name, icon), name, win) else: action = QAction(name, win) action.setEnabled(False) if shortcut: try: action.setShortcut(shortcut) except TypeError: action.setShortcuts(shortcut) if tooltip: action.setToolTip(translate('Menus', tooltip)) if togglecheck is not None: action.setCheckable(True) checked = int(checkstate) action.setChecked(bool(checked)) action.togglecheck = togglecheck action.enabled = enabled action.command = command action.control = control action.status = status return action