本文整理汇总了Python中entropy.misc.ParallelTask.name方法的典型用法代码示例。如果您正苦于以下问题:Python ParallelTask.name方法的具体用法?Python ParallelTask.name怎么用?Python ParallelTask.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entropy.misc.ParallelTask
的用法示例。
在下文中一共展示了ParallelTask.name方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _start_managing
# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import name [as 别名]
def _start_managing(self):
"""
Start managing applications passed via argv.
"""
managing = False
if self._nsargs.install:
dependency = self._nsargs.install
task = ParallelTask(
self._avc.install, dependency)
task.name = "AppInstall-%s" % (dependency,)
task.daemon = True
task.start()
managing = True
if self._nsargs.remove:
dependency = self._nsargs.remove
task = ParallelTask(
self._avc.remove, dependency)
task.name = "AppRemove-%s" % (dependency,)
task.daemon = True
task.start()
managing = True
if self._nsargs.package:
path = self._nsargs.package.name
self._nsargs.package.close() # no need, unfortunately
task = ParallelTask(
self._avc.install_package, path)
task.name = "AppInstallPackage-%s" % (path,)
task.daemon = True
task.start()
managing = True
return managing
示例2: _on_stars_clicked
# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import name [as 别名]
def _on_stars_clicked(self, widget, app=None):
"""
Stars clicked, user wants to vote.
"""
if app is None:
app = self._last_app
if app is None:
# wtf
return
def _sender(app, vote):
if not app.is_webservice_available():
GLib.idle_add(self._notify_webservice_na, app,
self.VOTE_NOTIFICATION_CONTEXT_ID)
return
ws_user = app.get_webservice_username()
if ws_user is not None:
GLib.idle_add(self._notify_vote_submit, app, ws_user, vote)
else:
GLib.idle_add(self._notify_login_request, app, vote,
self._on_stars_login_success,
self._on_stars_login_failed,
self.VOTE_NOTIFICATION_CONTEXT_ID)
vote = int(self._stars.get_rating()) # is float
task = ParallelTask(_sender, app, vote)
task.name = "AppViewSendVote"
task.start()
示例3: _diff_handler
# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import name [as 别名]
def _diff_handler(path):
try:
if path == "":
sem_data['res'] = False
return
if not const_file_writable(path):
sem_data['res'] = False
return
proc = open_editor(path)
if proc is None:
self._ignore_remove(path)
sem_data['res'] = False
return
task = ParallelTask(proc.wait)
task.name = "Diff-%s" % (self,)
task.daemon = True
task.start()
sem_data['res'] = True
except Exception as exc:
sem_data['exc'] = exc
finally:
sem_data['sem'].release()
示例4: setup
# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import name [as 别名]
def setup(self):
"""
Reimplemented from NotificationViewController.
"""
th = ParallelTask(self.__check_connectivity)
th.daemon = True
th.name = "CheckConnectivity"
th.start()
示例5: _vote_submit
# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import name [as 别名]
def _vote_submit(self, app, username, vote):
"""
Do the actual vote submit.
"""
task = ParallelTask(self._vote_submit_thread_body, app, username, vote)
task.name = "VoteSubmitThreadBody"
task.daemon = True
task.start()
示例6: _comment_submit
# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import name [as 别名]
def _comment_submit(self, app, username, text):
"""
Actual Comment submit to Web Service.
Here we arrive from the MainThread.
"""
task = ParallelTask(self._comment_submit_thread_body, app, username, text)
task.name = "CommentSubmitThreadBody"
task.daemon = True
task.start()
示例7: _on_remove_comment
# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import name [as 别名]
def _on_remove_comment(self, widget):
"""
We are requested to remove this comment, spawn the request.
"""
self.hide()
task = ParallelTask(self._remove_comment)
task.name = "RemoveComment{%s}" % (self._comment,)
task.daemon = True
task.start()
return True
示例8: open_url
# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import name [as 别名]
def open_url(url):
"""
Open the given URL using xdg-open
"""
def _open_url(url):
subprocess.call(["xdg-open", url])
task = ParallelTask(_open_url, url)
task.name = "UrlOpen"
task.daemon = True
task.start()
示例9: _search
# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import name [as 别名]
def _search(self, old_text, _force=False):
cur_text = self._search_entry.get_text()
if (cur_text == old_text and cur_text) or _force:
search_text = copy.copy(old_text)
search_text = const_convert_to_unicode(
search_text, enctype=etpConst['conf_encoding'])
if _force:
self._search_entry.set_text(search_text)
th = ParallelTask(self.__search_thread, search_text)
th.name = "SearchThread"
th.start()
示例10: _on_license_activate
# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import name [as 别名]
def _on_license_activate(self, widget, uri):
"""
License link clicked.
"""
license_apps = self._licenses.get(uri)
if not license_apps:
return True
task = ParallelTask(self._show_license, uri, license_apps)
task.name = "ShowLicense"
task.daemon = True
task.start()
return True
示例11: _on_application_activated
# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import name [as 别名]
def _on_application_activated(self, avc, app):
"""
Event received from Gtk widgets requesting us to load package
information. Once we're done loading the shit, we just emit
'application-show' and let others do the UI switch.
"""
self._visible = True
self._last_app = app
task = ParallelTask(self.__application_activate, app)
task.name = "ApplicationActivate"
task.daemon = True
task.start()
示例12: _on_reload_state
# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import name [as 别名]
def _on_reload_state(self, srv, app, daemon_action, app_outcome=None):
"""
Reload Application state due to a transaction event.
"""
if not self._visible:
return
last_app = self._last_app
if last_app is not None:
app = last_app
task = ParallelTask(self._reload_application_state, app)
task.daemon = True
task.name = "OnReloadAppState"
task.start()
示例13: add_downloads
# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import name [as 别名]
def add_downloads(self):
"""
Add downloads stats for package.
"""
try:
repository_id = self._get_repository_id()
self._validate_repository_id(repository_id)
except AttributeError:
return self._generic_invalid_request()
try:
package_names = self._get_package_names()
except AttributeError:
return self._generic_invalid_request()
# validate branch
branch = (request.params.get('branch') or "").strip()
if not branch:
return self._generic_invalid_request()
if not entropy.tools.validate_branch_name(branch):
return self._generic_invalid_request()
# validate release_string
release_string = (request.params.get('release_string') or "").strip()
if not release_string:
return self._generic_invalid_request()
if not entropy.tools.is_valid_string(release_string):
return self._generic_invalid_request()
# validate hw_hash
hw_hash = (request.params.get('hw_hash') or "").strip()
if not hw_hash:
return self._generic_invalid_request()
if not entropy.tools.is_valid_string(hw_hash):
return self._generic_invalid_request()
ip_addr = self._get_ip_address(request)
task = ParallelTask(
self._add_downloads,
package_names, branch,
release_string, hw_hash, ip_addr)
task.name = "AddDownloadsThread"
task.daemon = True
task.start()
response = self._api_base_response(
WebService.WEB_SERVICE_RESPONSE_CODE_OK)
response['r'] = True
return self._service_render(response)
示例14: load
# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import name [as 别名]
def load(self):
"""
Request a content (re)load.
"""
const_debug_write(__name__, "RepoVC: load() called")
def _load():
repositories = self._service.list_repositories()
objs = []
for repository_id, description, enabled in repositories:
obj = Repository(repository_id, description, enabled)
objs.append(obj)
self.set_many_safe(objs)
task = ParallelTask(_load)
task.name = "OnRepositoryLoadRequest"
task.daemon = True
task.start()
示例15: load
# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import name [as 别名]
def load(self):
"""
Request a content (re)load.
"""
const_debug_write(__name__, "GroupVC: load() called")
def _load():
groups = self._service.groups()
objs = []
for identifier, data in groups.items():
group = Group(self._avc, identifier, data["name"], data["description"], data["categories"])
objs.append(group)
self.set_many_safe(objs)
task = ParallelTask(_load)
task.name = "OnGroupLoadRequest"
task.daemon = True
task.start()