本文整理汇总了Python中scc.actions.Action类的典型用法代码示例。如果您正苦于以下问题:Python Action类的具体用法?Python Action怎么用?Python Action使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Action类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, menu_id, confirm_with=None, cancel_with=None, show_with_release=None):
Action.__init__(self, menu_id, *strip_none(confirm_with, cancel_with, show_with_release))
self.menu_id = menu_id
self.confirm_with = confirm_with or self.DEFAULT_CONFIRM
self.cancel_with = cancel_with or self.DEFAULT_CANCEL
self.show_with_release = show_with_release not in (None, False)
self._stick_distance = 0
示例2: __init__
def __init__(self, *params):
Action.__init__(self, *params)
params = list(params)
for p in params:
if isinstance(p, Action):
self.action = p
params.remove(p)
break
else:
self.action = NoAction()
self._mod_init(*params)
示例3: __init__
def __init__(self, *parameters):
Action.__init__(self, *parameters)
self.action = None
self.timeout = self.DEFAULT_TIMEOUT
if len(parameters) > 1:
# timeout parameter included
self.timeout = parameters[0]
if isinstance(parameters[-1], Action):
self.action = parameters[-1]
self.text = self.action.describe(Action.AC_OSD)
else:
self.text = unicode(parameters[-1])
示例4: __init__
def __init__(self, app):
UserDataManager.__init__(self)
self.app = app
self.setup_widgets()
self._timer = None
self._recursing = False
self.app.config.reload()
Action.register_all(sys.modules['scc.osd.osk_actions'], prefix="OSK")
self.load_settings()
self.load_profile_list()
self._recursing = False
self._eh_ids = (
self.app.dm.connect('reconfigured', self.on_daemon_reconfigured),
)
示例5: __init__
def __init__(self, *parameters):
Action.__init__(self, *parameters)
self.actions = []
self.repeat = False
self._active = False
self._current = None
self._release = None
for p in parameters:
if type(p) == float and len(self.actions):
self.actions[-1].delay_after = p
elif isinstance(p, Macro):
self.actions += p.actions
elif isinstance(p, Action):
self.actions.append(p)
else:
self.actions.append(ButtonAction(p))
示例6: encode
def encode(self):
if self.action:
rv = self.action.encode()
if self.timeout == self.DEFAULT_TIMEOUT:
rv['osd'] = True
else:
rv['osd'] = self.timeout
return rv
else:
return Action.encode(self)
示例7: __init__
def __init__(self, config=None):
self.kbimage = os.path.join(get_config_path(), 'keyboard.svg')
if not os.path.exists(self.kbimage):
# Prefer image in ~/.config/scc, but load default one as fallback
self.kbimage = os.path.join(get_share_path(), "images", 'keyboard.svg')
TimerManager.__init__(self)
OSDWindow.__init__(self, "osd-keyboard")
self.daemon = None
self.mapper = None
self.keymap = Gdk.Keymap.get_default()
self.keymap.connect('state-changed', self.on_keymap_state_changed)
Action.register_all(sys.modules['scc.osd.osk_actions'], prefix="OSK")
self.profile = Profile(TalkingActionParser())
self.config = config or Config()
self.dpy = X.Display(hash(GdkX11.x11_get_default_xdisplay()))
self.group = None
self.limits = {}
self.background = None
cursor = os.path.join(get_share_path(), "images", 'menu-cursor.svg')
self.cursors = {}
self.cursors[LEFT] = Gtk.Image.new_from_file(cursor)
self.cursors[LEFT].set_name("osd-keyboard-cursor")
self.cursors[RIGHT] = Gtk.Image.new_from_file(cursor)
self.cursors[RIGHT].set_name("osd-keyboard-cursor")
self.cursors[CPAD] = Gtk.Image.new_from_file(cursor)
self.cursors[CPAD].set_name("osd-keyboard-cursor")
self._eh_ids = []
self._controller = None
self._stick = 0, 0
self._hovers = { self.cursors[LEFT]: None, self.cursors[RIGHT]: None }
self._pressed = { self.cursors[LEFT]: None, self.cursors[RIGHT]: None }
self._pressed_areas = {}
self.c = Gtk.Box()
self.c.set_name("osd-keyboard-container")
self.f = Gtk.Fixed()
示例8: __init__
def __init__(self, command):
Action.__init__(self, command)
self.command = command
示例9: __init__
def __init__(self, action):
Action.__init__(self, action)
self.action = action
示例10: __init__
def __init__(self, *parameters):
Action.__init__(self, *parameters)
self.actions = parameters
self._current = 0
示例11: on_Dialog_destroy
def on_Dialog_destroy(self, *a):
for x in self._eh_ids:
self.app.dm.disconnect(x)
self._eh_ids = ()
Action.unregister_prefix('OSK')
示例12: __init__
def __init__(self, side):
Action.__init__(self, side)
if hasattr(side, "name"): side = side.name
self.speed = (1.0, 1.0)
self.side = side
示例13: to_string
def to_string(self, multiline=False, pad=0):
return self._mod_to_string(Action.strip_defaults(self), multiline, pad)
示例14: __init__
def __init__(self, action=None):
Action.__init__(self, action)
self.action = action or NoAction()