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


Python ParallelTask.start方法代码示例

本文整理汇总了Python中entropy.misc.ParallelTask.start方法的典型用法代码示例。如果您正苦于以下问题:Python ParallelTask.start方法的具体用法?Python ParallelTask.start怎么用?Python ParallelTask.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在entropy.misc.ParallelTask的用法示例。


在下文中一共展示了ParallelTask.start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _on_stars_clicked

# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import start [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()
开发者ID:dMaggot,项目名称:entropy,代码行数:30,代码来源:application.py

示例2: launch_package_manager

# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import start [as 别名]
 def launch_package_manager(self, *data, **kwargs):
     args = ["/usr/bin/rigo"]
     if kwargs.get("other_args"):
         args += kwargs["other_args"]
     task = ParallelTask(subprocess.call, args)
     task.daemon = True
     task.start()
开发者ID:Sabayon,项目名称:entropy,代码行数:9,代码来源:interfaces.py

示例3: on_dbBackupButton_clicked

# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import start [as 别名]
    def on_dbBackupButton_clicked(self, widget):

        def _run_backup(callback):
            cl_repo_name = etpConst.get(
                'clientdbid',
                getattr(InstalledPackagesRepository, "NAME", None))
            with self._privileges:
                with self._async_event_execution_lock:
                    status, err_msg = self._entropy.backup_repository(
                        cl_repo_name,
                        os.path.dirname(etpConst['etpdatabaseclientfilepath']))
                    gobject.idle_add(callback, status, err_msg)

        def _backup_complete(status, err_msg):
            self.ui_lock(False)
            self.end_working()
            if not status:
                okDialog( self.ui.main, "%s: %s" % (_("Error during backup"),
                    err_msg,) )
                return
            okDialog(self.ui.main, "%s" % (_("Backup complete"),))
            self.fill_pref_db_backup_page()
            self.dbBackupView.queue_draw()

        self.start_working()
        self.ui_lock(True)
        with self._privileges:
            # make sure to commit any transaction before backing-up
            self._entropy.installed_repository().commit()
            t = ParallelTask(_run_backup, _backup_complete)
            t.start()
开发者ID:Sabayon,项目名称:sulfur,代码行数:33,代码来源:events.py

示例4: _diff_handler

# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import start [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()
开发者ID:Sabayon,项目名称:entropy,代码行数:28,代码来源:configupdate.py

示例5: _vote_submit

# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import start [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()
开发者ID:prescott66,项目名称:entropy,代码行数:10,代码来源:application.py

示例6: setup

# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import start [as 别名]
 def setup(self):
     """
     Reimplemented from NotificationViewController.
     """
     th = ParallelTask(self.__check_connectivity)
     th.daemon = True
     th.name = "CheckConnectivity"
     th.start()
开发者ID:dMaggot,项目名称:entropy,代码行数:10,代码来源:notifications.py

示例7: _comment_submit

# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import start [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()
开发者ID:prescott66,项目名称:entropy,代码行数:11,代码来源:application.py

示例8: _on_remove_comment

# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import start [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
开发者ID:Sabayon,项目名称:entropy,代码行数:12,代码来源:comments.py

示例9: open_url

# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import start [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()
开发者ID:B-Rich,项目名称:entropy,代码行数:12,代码来源:utils.py

示例10: _search

# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import start [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()
开发者ID:Heather,项目名称:entropy,代码行数:13,代码来源:applications.py

示例11: _on_application_activated

# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import start [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()
开发者ID:dMaggot,项目名称:entropy,代码行数:14,代码来源:application.py

示例12: _on_license_activate

# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import start [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
开发者ID:Heather,项目名称:entropy,代码行数:14,代码来源:notifications.py

示例13: _on_reload_state

# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import start [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()
开发者ID:dMaggot,项目名称:entropy,代码行数:15,代码来源:application.py

示例14: add_downloads

# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import start [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)
开发者ID:Sabayon,项目名称:packages-website,代码行数:52,代码来源:service.py

示例15: get_ugc_package_vote_delayed

# 需要导入模块: from entropy.misc import ParallelTask [as 别名]
# 或者: from entropy.misc.ParallelTask import start [as 别名]
 def get_ugc_package_vote_delayed(self):
     if self.pkgset:
         return -1
     atom = self.get_name()
     if not atom:
         return None
     pkg_key = entropy.dep.dep_getkey(atom)
     try:
         vote_raw = self._get_vote_cache_2(pkg_key)
     except KeyError:
         vote_raw = None
         # schedule a new task
         th = ParallelTask(self._get_vote_raw, pkg_key)
         th.start()
     return vote_raw
开发者ID:Sabayon,项目名称:sulfur,代码行数:17,代码来源:package.py


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