本文整理汇总了Python中nxdrive.engine.activity.Action.get_actions方法的典型用法代码示例。如果您正苦于以下问题:Python Action.get_actions方法的具体用法?Python Action.get_actions怎么用?Python Action.get_actions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nxdrive.engine.activity.Action
的用法示例。
在下文中一共展示了Action.get_actions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_tooltip
# 需要导入模块: from nxdrive.engine.activity import Action [as 别名]
# 或者: from nxdrive.engine.activity.Action import get_actions [as 别名]
def get_tooltip(self):
actions = Action.get_actions()
if actions is None or len(actions) == 0:
return self.get_default_tooltip()
# Display only the first action for now
# TODO Get all actions ? or just file action
action = actions.itervalues().next()
if action is None:
return self.get_default_tooltip()
if isinstance(action, FileAction):
if action.get_percent() is not None:
return ("%s - %s - %s - %d%%" %
(self.get_default_tooltip(),
action.type, action.filename,
action.get_percent()))
else:
return ("%s - %s - %s" % (self.get_default_tooltip(),
action.type, action.filename))
elif action.get_percent() is not None:
return ("%s - %s - %d%%" % (self.get_default_tooltip(),
action.type,
action.get_percent()))
else:
return ("%s - %s" % (self.get_default_tooltip(),
action.type))
示例2: get_tooltip
# 需要导入模块: from nxdrive.engine.activity import Action [as 别名]
# 或者: from nxdrive.engine.activity.Action import get_actions [as 别名]
def get_tooltip(self):
actions = Action.get_actions()
if not actions:
return self.default_tooltip
# Display only the first action for now
for action in actions.itervalues():
if action and not action.type.startswith('_'):
break
else:
return self.default_tooltip
if isinstance(action, FileAction):
if action.get_percent() is not None:
return '%s - %s - %s - %d%%' % (
self.default_tooltip,
action.type, action.filename,
action.get_percent(),
)
return '%s - %s - %s' % (
self.default_tooltip,
action.type, action.filename,
)
elif action.get_percent() is not None:
return '%s - %s - %d%%' % (
self.default_tooltip,
action.type,
action.get_percent(),
)
return '%s - %s' % (
self.default_tooltip,
action.type,
)
示例3: test_action
# 需要导入模块: from nxdrive.engine.activity import Action [as 别名]
# 或者: from nxdrive.engine.activity.Action import get_actions [as 别名]
def test_action():
action = Action("Testing")
assert action.type == "Testing"
assert repr(action)
assert "%" not in repr(action)
actions = Action.get_actions()
assert len(actions) == 1
assert list(actions.values())[0] == action
assert Action.get_current_action() == action
# Will test .get_percent()
details = action.export()
assert details["last_transfer"] == "Testing"
assert details["progress"] == 0.0
assert isinstance(details["uid"], str)
Action.finish_action()
actions = Action.get_actions()
assert len(actions) == 0
assert Action.get_current_action() is None