当前位置: 首页>>代码示例>>Python>>正文


Python Action.get_actions方法代码示例

本文整理汇总了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))
开发者ID:bdineshssdi,项目名称:nuxeo-drive,代码行数:27,代码来源:application.py

示例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,
        )
开发者ID:ssdi-drive,项目名称:nuxeo-drive,代码行数:36,代码来源:application.py

示例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
开发者ID:nuxeo,项目名称:nuxeo-drive,代码行数:23,代码来源:test_action.py


注:本文中的nxdrive.engine.activity.Action.get_actions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。