本文整理汇总了Python中src.util.workflow函数的典型用法代码示例。如果您正苦于以下问题:Python workflow函数的具体用法?Python workflow怎么用?Python workflow使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了workflow函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: menu
def menu(self, args):
workflow().add_item(
"Search for projects",
"Search for projects and open the project page in your default browser",
autocomplete=":projects ",
icon=icons.PROJECTS,
)
workflow().add_item(
"Search for repositories",
"Search for repositories and open the repository page in your default browser",
autocomplete=":repos ",
icon=icons.REPOSITORIES,
)
workflow().add_item(
"Search or raise pull requests",
"Search for pull requests or raise new ones based on Stash's suggestions",
autocomplete=":pullrequests ",
icon=icons.PULL_REQUESTS,
)
workflow().add_item(
"Preferences",
"Change Stash connection settings, refresh the cache or the workflow itself",
autocomplete=":config ",
icon=icons.SETTINGS,
)
workflow().add_item(
"Help", "Get help about the workflow and how to get support", autocomplete=":help ", icon=icons.HELP
)
开发者ID:mibexsoftware,项目名称:alfred-stash-workflow,代码行数:28,代码来源:index.py
示例2: _add_to_result_list
def _add_to_result_list(self, project):
workflow().add_item(title=project.name,
subtitle=project.description,
arg=':projects {}'.format(project.key),
valid=True,
largetext=project.name,
icon=workflow().cachefile('{}/{}'.format(PROJECT_AVATAR_DIR, project.key)))
开发者ID:f440,项目名称:alfred-stash-workflow,代码行数:7,代码来源:projects.py
示例3: menu
def menu(self, args):
workflow().add_item(
'Search for projects',
'Search for projects and open the project page in your default browser',
autocomplete=':projects ',
icon=icons.PROJECTS
)
workflow().add_item(
'Search for repositories',
'Search for repositories and open the repository page in your default browser',
autocomplete=':repos ',
icon=icons.REPOSITORIES
)
workflow().add_item(
'Search for pull requests',
'Search for pull requests and open them in your default browser',
autocomplete=':pullrequests ',
icon=icons.PULL_REQUESTS
)
workflow().add_item(
'Preferences',
'Change Stash connection settings, refresh the cache or the workflow itself',
autocomplete=':config ',
icon=icons.SETTINGS
)
workflow().add_item(
'Help',
'Get help about the workflow and how to get support',
autocomplete=':help ',
icon=icons.HELP
)
开发者ID:f440,项目名称:alfred-stash-workflow,代码行数:31,代码来源:index.py
示例4: menu
def menu(self, args):
if len(args) == 2:
workflow().add_item(
u"Suggested pull requests {}".format(_num_pull_requests("suggestions")),
"Suggested pull requests to raise based on your recent commits",
arg=":pullrequests suggestions",
icon=icons.PR_SUGGESTIONS,
valid=True,
)
workflow().add_item(
u"All open pull requests {}".format(_num_pull_requests("open")),
"Search in all open pull requests",
arg=":pullrequests open",
icon=icons.OPEN,
valid=True,
)
workflow().add_item(
u"Your pull requests to review {}".format(_num_pull_requests("review")),
"Search in pull requests you have to review",
arg=":pullrequests review",
icon=icons.REVIEW,
valid=True,
)
workflow().add_item(
u"Your created pull requests {}".format(_num_pull_requests("created")),
"Search in pull requests you created",
arg=":pullrequests created",
icon=icons.CREATED,
valid=True,
)
workflow().add_item("Main menu", autocomplete="", icon=icons.GO_BACK)
else:
cache_key, update_interval = _pull_request_modes[args[-2]]
pull_request_menu = PullRequestFilterableMenu(args, update_interval, cache_key)
return pull_request_menu.run()
开发者ID:mibexsoftware,项目名称:alfred-stash-workflow,代码行数:35,代码来源:pull_requests.py
示例5: _add_to_result_list
def _add_to_result_list(self, pull_request):
workflow().add_item(title=u'{} #{}: {} → {}'.format(pull_request.repo_name, pull_request.pull_request_id,
pull_request.from_branch, pull_request.to_branch),
subtitle=pull_request.title,
arg=':pullrequests ' + pull_request.link,
largetext=pull_request.title,
valid=True,
icon=workflow().cachefile('{}/{}'.format(PROJECT_AVATAR_DIR, pull_request.project_key)))
开发者ID:f440,项目名称:alfred-stash-workflow,代码行数:8,代码来源:pull_requests.py
示例6: _notify_if_upgrade_available
def _notify_if_upgrade_available():
if workflow().update_available:
new_version = workflow().cached_data('__workflow_update_status', max_age=0)['version']
workflow().add_item('An update is available!',
'Update the workflow from version {} to {}'.format(__version__, new_version),
arg=':config update',
valid=True,
icon=icons.UPDATE)
开发者ID:f440,项目名称:alfred-stash-workflow,代码行数:8,代码来源:routing.py
示例7: _add_to_result_list
def _add_to_result_list(self, plan):
workflow().add_item(title=u'{} {}'.format(plan.name, FAVOURITE_PLAN if plan.is_favourite else ''),
subtitle=plan.description,
largetext=plan.name,
arg=':plans ' + plan.plan_key,
modifier_subtitles={u'shift': u'Trigger build execution for this plan'},
# `cmd``, ``ctrl``, ``shift``, ``alt`` and ``fn``
copytext='{}/browse/{}'.format(workflow().settings.get(HOST_URL), plan.plan_key),
valid=True)
开发者ID:mibexsoftware,项目名称:alfred-bamboo-workflow,代码行数:9,代码来源:plans.py
示例8: _add_to_result_list
def _add_to_result_list(self, pull_request):
workflow().add_item(
title=unicode(pull_request),
subtitle=pull_request.title,
arg=":pullrequests " + pull_request.link,
largetext=pull_request.title,
valid=True,
icon=workflow().cachefile("{}/{}".format(PROJECT_AVATAR_DIR, pull_request.project_key)),
)
开发者ID:mibexsoftware,项目名称:alfred-stash-workflow,代码行数:9,代码来源:pull_requests.py
示例9: _add_to_result_list
def _add_to_result_list(self, repo):
workflow().add_item(title=u'{} / {} {} {}'.format(repo.project_name,
repo.name,
PUBLIC if repo.public else '',
FORK if repo.fork else ''),
arg=':repos {}/{}'.format(repo.project_key, repo.slug),
valid=True,
largetext=repo.name,
copytext=repo.clone_url, # allows to use CMD+C to copy the clone URL
icon=workflow().cachefile('{}/{}'.format(PROJECT_AVATAR_DIR, repo.project_key)))
开发者ID:f440,项目名称:alfred-stash-workflow,代码行数:10,代码来源:repositories.py
示例10: _add_to_result_list
def _add_to_result_list(self, branch):
workflow().add_item(title=branch.name,
subtitle=branch.description,
largetext=branch.name,
arg=':branches ' + branch.key,
modifier_subtitles={
u'shift': u'Trigger build execution for this plan branch'
}, # `cmd``, ``ctrl``, ``shift``, ``alt`` and ``fn``
copytext='{}/browse/{}'.format(workflow().settings.get(HOST_URL), branch.key),
valid=True)
开发者ID:mibexsoftware,项目名称:alfred-bamboo-workflow,代码行数:10,代码来源:branches.py
示例11: execute
def execute(self, args, ctrl_pressed, shift_pressed):
if 'sethost' in args:
workflow().settings[HOST_URL] = args[-1]
print('New Bamboo host: {}'.format(args[-1]))
elif 'setuser' in args:
workflow().settings[USER_NAME] = args[-1]
print('New Bamboo user: {}'.format(args[-1]))
elif 'setpw' in args:
workflow().save_password(USER_PW, args[-1])
print('Saved Bamboo password in keychain')
elif 'verifycert' in args:
verify_cert = workflow().settings.get(VERIFY_CERT, 'false') == 'true'
toggle = (str(not verify_cert)).lower()
workflow().settings[VERIFY_CERT] = toggle
print('Enabled certificate verification' if toggle == 'true' else 'Disabled certificate verification')
elif 'sync' in args:
workflow().clear_cache()
update_bamboo_cache()
print('Bamboo data synchronization triggered')
elif 'update' in args:
try:
if workflow().start_update():
print('Update of workflow finished')
else:
print('You already have the latest workflow version')
except Exception, e:
print('Update of workflow failed: {}'.format(str(e)))
开发者ID:mibexsoftware,项目名称:alfred-bamboo-workflow,代码行数:27,代码来源:configure.py
示例12: _fetch_bamboo_data_if_necessary
def _fetch_bamboo_data_if_necessary(bamboo_facade):
# cached_data can only take a bare callable (no args),
# so we need to wrap callables needing arguments in a function
# that needs none.
def wrapper_projects():
return bamboo_facade.projects()
projects = workflow().cached_data(PROJECTS_CACHE_KEY, wrapper_projects, max_age=UPDATE_INTERVAL_PROJECTS)
workflow().logger.debug('{} projects cached'.format(len(projects)))
def wrapper_plans():
plans_with_branches = bamboo_facade.plans()
for plan in plans_with_branches:
branches = bamboo_facade.branches(plan.plan_key)
plan.branches = branches
return plans_with_branches
plans = workflow().cached_data(PLANS_CACHE_KEY, wrapper_plans, max_age=UPDATE_INTERVAL_PLANS)
workflow().logger.debug('{} plans cached'.format(len(plans)))
def wrapper_results():
return bamboo_facade.results()
results = workflow().cached_data(STATUS_CACHE_KEY, wrapper_results, max_age=UPDATE_INTERVAL_STATUS)
workflow().logger.debug('{} build results cached'.format(len(results)))
开发者ID:mibexsoftware,项目名称:alfred-bamboo-workflow,代码行数:25,代码来源:sync.py
示例13: build_bamboo_facade
def build_bamboo_facade():
bamboo_host = workflow().settings.get(HOST_URL, None)
if not bamboo_host:
raise ValueError("Bamboo host URL not set.")
bamboo_user = workflow().settings.get(USER_NAME, None)
try:
bamboo_pw = workflow().get_password(USER_PW)
except PasswordNotFound:
bamboo_pw = None
verify_cert = workflow().settings.get(VERIFY_CERT, "false") == "true"
return BambooFacade(bamboo_host, bamboo_user, bamboo_pw, verify_cert)
开发者ID:mibexsoftware,项目名称:alfred-bamboo-workflow,代码行数:11,代码来源:__init__.py
示例14: build_stash_facade
def build_stash_facade():
stash_host = workflow().settings.get(HOST_URL, None)
if stash_host is None:
raise ValueError("Stash host URL not set.")
stash_user = workflow().settings.get(USER_NAME, None)
try:
stash_pw = workflow().get_password(USER_PW)
except PasswordNotFound:
stash_pw = None
verify_cert = workflow().settings.get(VERIFY_CERT, "false") == "true"
return StashFacade(stash_host, stash_user, stash_pw, verify_cert)
开发者ID:mibexsoftware,项目名称:alfred-stash-workflow,代码行数:11,代码来源:__init__.py
示例15: menu
def menu(self, args):
if len(args) == 2:
workflow().add_item(
u'All open pull requests {}'.format(_num_pull_requests('open')),
'Search in all open pull requests',
arg=':pullrequests open',
icon=icons.OPEN,
valid=True
)
workflow().add_item(
u'Your pull requests to review {}'.format(_num_pull_requests('review')),
'Search in pull requests you have to review',
arg=':pullrequests review',
icon=icons.REVIEW,
valid=True
)
workflow().add_item(
u'Your created pull requests {}'.format(_num_pull_requests('created')),
'Search in pull requests you created',
arg=':pullrequests created',
icon=icons.CREATED,
valid=True
)
workflow().add_item(
'Main menu',
autocomplete='', icon=icons.GO_BACK
)
else:
cache_key, update_interval = _pull_request_modes[args[-2]]
pull_request_menu = PullRequestFilterableMenu(args, update_interval, cache_key)
return pull_request_menu.run()
开发者ID:f440,项目名称:alfred-stash-workflow,代码行数:31,代码来源:pull_requests.py
示例16: execute
def execute(self, args, ctrl_pressed, shift_pressed):
import webbrowser
host_url = workflow().settings.get(HOST_URL)
if args[-1] == 'viewAgents':
webbrowser.open('{}/admin/agent/viewAgents.action'.format(host_url))
elif shift_pressed:
from src.actions import build_bamboo_facade
bamboo_facade = build_bamboo_facade()
try:
bamboo_facade.stop_build(args[-1])
print('Successfully stopped build for {}'.format(args[-1]))
except Exception, e:
workflow().logger.debug('workflow ' + str(e))
print('Failed to stop build for {}: {}'.format(args[-1], str(e)))
开发者ID:mibexsoftware,项目名称:alfred-bamboo-workflow,代码行数:14,代码来源:dashboard.py
示例17: alfred_is_dark
def alfred_is_dark():
# copied from wunderlist workflow:
background_rgba = workflow().alfred_env['theme_background']
if background_rgba:
rgb = [int(x) for x in background_rgba[5:-6].split(',')]
return (0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]) / 255 < 0.5
return False
开发者ID:mibexsoftware,项目名称:alfred-stash-workflow,代码行数:7,代码来源:icons.py
示例18: get_data_from_cache
def get_data_from_cache(cache_key, update_interval):
# Set `data_func` to None, as we don't want to update the cache in this script and `max_age` to 0
# because we want the cached data regardless of age
try:
data = workflow().cached_data(cache_key, None, max_age=0)
except Exception:
# this might happen when there are incompatible model changes and the pickle cache cannot be deserialzed
# anymore => in this case it is better to clear the cache and to re-trigger data syncing
workflow().clear_cache()
data = []
# Start update script if cached data is too old (or doesn't exist)
if not workflow().cached_data_fresh(cache_key, max_age=update_interval):
update_stash_cache()
return data
开发者ID:mibexsoftware,项目名称:alfred-stash-workflow,代码行数:16,代码来源:__init__.py
示例19: _add_to_result_list
def _add_to_result_list(self, build_result):
build_result_info = u'{} / #{}'.format(build_result.plan_name, str(build_result.build_number))
workflow().add_item(title=build_result_info,
icon=self._icon_for_build_status(build_result.build_state),
subtitle=u'{}, duration: {}, {}, {}'.format(build_result.test_summary,
build_result.duration_desc,
build_result.relative_time,
strip_tags(build_result.build_reason)),
modifier_subtitles={
u'ctrl': u'Open page of artifacts to download',
u'shift': u'Trigger build execution for this plan'
}, # `cmd``, ``ctrl``, ``shift``, ``alt`` and ``fn``
largetext=build_result_info,
arg=':results {} {}'.format(build_result.build_result_key, build_result.plan_key),
copytext='{}/browse/{}'.format(workflow().settings.get(HOST_URL),
build_result.build_result_key),
valid=True)
开发者ID:mibexsoftware,项目名称:alfred-bamboo-workflow,代码行数:17,代码来源:status.py
示例20: icon_theme
def icon_theme():
global _icon_theme
if not _icon_theme:
icon_theme = workflow().settings.get(ICON_THEME)
if icon_theme:
_icon_theme = icon_theme
else:
_icon_theme = 'light' if alfred_is_dark() else 'dark'
return _icon_theme
开发者ID:mibexsoftware,项目名称:alfred-stash-workflow,代码行数:9,代码来源:icons.py
注:本文中的src.util.workflow函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论