• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python utils.handle_gui_exception函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中subscription_manager.gui.utils.handle_gui_exception函数的典型用法代码示例。如果您正苦于以下问题:Python handle_gui_exception函数的具体用法?Python handle_gui_exception怎么用?Python handle_gui_exception使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: search_button_clicked

    def search_button_clicked(self, widget=None):
        """
        Reload the subscriptions from the server when the Search button
        is clicked.
        """
        if not self.date_picker.date_entry_validate():
            return
        try:
            pb_title = _("Searching")
            pb_label = _("Searching for subscriptions. Please wait.")
            if self.pb:
                self.pb.set_title(pb_title)
                self.pb.set_label(pb_label)
            else:
                # show pulsating progress bar while we wait for results
                self.pb = progress.Progress(pb_title, pb_label)
                self.timer = ga_GObject.timeout_add(100, self.pb.pulse)
                self.pb.set_transient_for(self.parent_win)

            # fire off async refresh
            async_stash = async_utils.AsyncPool(self.pool_stash)
            async_stash.refresh(self.date_picker.date, self._update_display)
        except Exception as e:
            handle_gui_exception(e, _("Error fetching subscriptions from server:  %s"),
                    self.parent_win)
开发者ID:Januson,项目名称:subscription-manager,代码行数:25,代码来源:allsubs.py


示例2: _on_get_owner_list_cb

    def _on_get_owner_list_cb(self, owners, error=None):
        if error != None:
            handle_gui_exception(error, REGISTER_ERROR,
                    self.registerWin)
            self._finish_registration(failed=True)
            return

        owners = [(owner['key'], owner['displayName']) for owner in owners]

        if len(owners) == 0:
            handle_gui_exception(None,
                    _("<b>User %s is not able to register with any orgs.</b>") \
                            % (self.uname.get_text().strip()),
                    self.registerWin)
            self._finish_registration(failed=True)
            return

        if len(owners) == 1:
            self.owner_key = owners[0][0]
            self.async.get_environment_list(self.owner_key, self._on_get_environment_list_cb)

        else:
            owner_model = gtk.ListStore(str, str)
            for owner in owners:
                owner_model.append(owner)

            self.owner_treeview.set_model(owner_model)

            self.owner_treeview.get_selection().select_iter(
                    owner_model.get_iter_first())

            self.cancel_button.set_sensitive(True)
            self.register_button.set_sensitive(True)
            self.register_notebook.set_page(OWNER_SELECT_PAGE)
开发者ID:bkearney,项目名称:subscription-manager,代码行数:34,代码来源:registergui.py


示例3: _init_sla

    def _init_sla(self):
        if self.skip_auto_subscribe():
            return self._move_to_manual_install(_("You have opted to skip auto-subscribe."))

        # sla autosubscribe time. load up the possible slas, to decide if
        # we need to display the selection screen, or go to the confirm
        # screen.
        # XXX this should really be done async.

        controller = autobind.init_controller(self.backend, self.consumer,
                Facts())

        # XXX see autobind.AutobindWizard load() and _show_initial_screen
        # for matching error handling.
        try:
            controller.load()
        except autobind.ServiceLevelNotSupportedException:
            message = _("Unable to auto-subscribe, server does not support service levels. Please run 'Subscription Manager' to manually subscribe.")
            return self._move_to_manual_install(message)

        except autobind.NoProductsException:
            message = _("No installed products on system. No need to update certificates at this time.")
            return self._move_to_manual_install(message)

        except autobind.AllProductsCoveredException:
            message = _("All installed products are covered by valid entitlements. Please run 'Subscription Manager' to subscribe to additional products.")
            return self._move_to_manual_install(message)

        except socket.error, e:
            handle_gui_exception(e, None, self.registerWin)
            return
开发者ID:bkearney,项目名称:subscription-manager,代码行数:31,代码来源:rhsm_login.py


示例4: _on_get_environment_list_cb

    def _on_get_environment_list_cb(self, result_tuple, error=None):
        environments = result_tuple
        if error != None:
            handle_gui_exception(error, REGISTER_ERROR, self.registerWin)
            self._finish_registration(failed=True)
            return

        if not environments:
            self._run_register_step(self.owner_key, None)
            return

        envs = [(env['id'], env['name']) for env in environments]
        if len(envs) == 1:
            self._run_register_step(self.owner_key, envs[0][0])
        else:
            environment_model = gtk.ListStore(str, str)
            for env in envs:
                environment_model.append(env)

            self.environment_treeview.set_model(environment_model)

            self.environment_treeview.get_selection().select_iter(
                    environment_model.get_iter_first())

            self.cancel_button.set_sensitive(True)
            self.register_button.set_sensitive(True)
            self.register_notebook.set_page(ENVIRONMENT_SELECT_PAGE)
开发者ID:bkearney,项目名称:subscription-manager,代码行数:27,代码来源:registergui.py


示例5: _on_get_owner_list_cb

    def _on_get_owner_list_cb(self, owners, error=None):
        if error is not None:
            handle_gui_exception(error, REGISTER_ERROR,
                    self._parent.window)
            self._parent.pre_done(CREDENTIALS_PAGE)
            return

        owners = [(owner['key'], owner['displayName']) for owner in owners]
        # Sort by display name so the list doesn't randomly change.
        owners = sorted(owners, key=lambda item: item[1])

        if len(owners) == 0:
            handle_gui_exception(None,
                                 _("<b>User %s is not able to register with any orgs.</b>") %
                                   (self._parent.username),
                    self._parent.parent)
            self._parent.finish_registration(failed=True)
            return

        if len(owners) == 1:
            self._owner_key = owners[0][0]
            self._parent.pre_done(ENVIRONMENT_SELECT_PAGE)
        else:
            self.set_model(owners)
            self._parent.pre_done(DONT_CHANGE)
开发者ID:NehaRawat,项目名称:subscription-manager,代码行数:25,代码来源:registergui.py


示例6: apply

    def apply(self, interface, testing=False):
        """
        'Next' button has been clicked - try to register with the
        provided user credentials and return the appropriate result
        value.
        """

        # on el5 we can't just move to another page, we have to set the next
        # page then do an apply. since we've already done our work async, skip
        # this time through
        if self._skip_apply_for_page_jump:
            self._skip_apply_for_page_jump = False
            return self._RESULT_SUCCESS

        self.interface = interface

        self._read_rhn_proxy_settings()

        credentials = self._get_credentials_hash()

        # bad proxy settings can cause socket.error or friends here
        # see bz #810363
        try:
            valid_registration = self.register(testing=testing)
        except socket.error, e:
            handle_gui_exception(e, e, self.registerWin)
            return self._RESULT_FAILURE
开发者ID:bkearney,项目名称:subscription-manager,代码行数:27,代码来源:rhsm_login.py


示例7: _repos_item_clicked

 def _repos_item_clicked(self, widget):
     try:
         self.repos_dialog.show()
     except Exception as e:
         handle_gui_exception(e, _("Error in repos dialog. "
                                   "Please see /var/log/rhsm/rhsm.log for more information."),
                              self._get_window())
开发者ID:Januson,项目名称:subscription-manager,代码行数:7,代码来源:managergui.py


示例8: _on_refresh_cb

    def _on_refresh_cb(self, error=None):
        if error is not None:
            handle_gui_exception(error, _("Error subscribing: %s"), self._parent.parent)
            self._parent.finish_registration(failed=True)
            return

        self._parent.pre_done(FINISH)
开发者ID:jaredjennings,项目名称:subscription-manager,代码行数:7,代码来源:registergui.py


示例9: _on_registration_finished_cb

    def _on_registration_finished_cb(self, new_account, error=None):
        if error is not None:
            handle_gui_exception(error, registergui.REGISTER_ERROR,
                    self._parent.window)
            self._parent.finish_registration(failed=True)
            return

        try:
            managerlib.persist_consumer_cert(new_account)
            self._parent.backend.cs.force_cert_check()  # Ensure there isn't much wait time

            if self._parent.activation_keys:
                self._parent.pre_done(registergui.REFRESH_SUBSCRIPTIONS_PAGE)
            elif self._parent.skip_auto_bind:
                message = _("You have opted to skip auto-attach.")
                self._parent.manual_message = message
                self._parent.pre_done(MANUALLY_SUBSCRIBE_PAGE)
            else:
                self._parent.pre_done(registergui.SELECT_SLA_PAGE)

        # If we get errors related to consumer name on register,
        # go back to the credentials screen where we set the
        # consumer name. See bz#865954
        except RestlibException, e:
            handle_gui_exception(e, registergui.REGISTER_ERROR,
                self._parent.window)
            if e.code == 404 and self._parent.activation_keys:
                self._parent.pre_done(registergui.ACTIVATION_KEY_PAGE)
            if e.code == 400:
                self._parent.pre_done(registergui.CREDENTIALS_PAGE)
开发者ID:tkolhar,项目名称:subscription-manager,代码行数:30,代码来源:rhsm_login.py


示例10: apply

    def apply(self, interface, testing=False):
        """
        'Next' button has been clicked - try to register with the
        provided user credentials and return the appropriate result
        value.
        """

        # on el5 we can't just move to another page, we have to set the next
        # page then do an apply. since we've already done our work async, skip
        # this time through
        if self._skip_apply_for_page_jump:
            self._skip_apply_for_page_jump = False
            # Reset back to first screen in our module in case the user hits back.
            # The firstboot register screen subclass will handle unregistering
            # if necessary when it runs again.
            self.show()
            return self._RESULT_SUCCESS

        self.interface = interface

        self._read_rhn_proxy_settings()

        # bad proxy settings can cause socket.error or friends here
        # see bz #810363
        try:
            valid_registration = self.register()
        except socket.error, e:
            handle_gui_exception(e, e, self.window)
            return self._RESULT_FAILURE
开发者ID:tkolhar,项目名称:subscription-manager,代码行数:29,代码来源:rhsm_login.py


示例11: _on_subscribing_finished_cb

    def _on_subscribing_finished_cb(self, unused, error=None):
        if error is not None:
            handle_gui_exception(error, _("Error subscribing: %s"), self._parent.parent)
            self._parent.finish_registration(failed=True)
            return

        self._parent.pre_done(FINISH)
        self._parent.backend.cs.force_cert_check()
开发者ID:jaredjennings,项目名称:subscription-manager,代码行数:8,代码来源:registergui.py


示例12: _update_certificates_button_clicked

 def _update_certificates_button_clicked(self, widget):
     # Catch exceptions in the autobind wizard initialization (only)
     try:
         autobind_wizard = AutobindWizard(self.backend, self.consumer, self.facts,
                 self._get_window())
         autobind_wizard.show()
     except Exception, e:
         handle_gui_exception(e, _("Error in autobind wizard"), self._get_window())
开发者ID:bkearney,项目名称:subscription-manager,代码行数:8,代码来源:managergui.py


示例13: _update_display

    def _update_display(self, data, error):
        self._clear_progress_bar()

        if error:
            handle_gui_exception(error, _("Unable to search for subscriptions:  %s"),
                    self.parent_win)
        else:
            self.display_pools()
开发者ID:Januson,项目名称:subscription-manager,代码行数:8,代码来源:allsubs.py


示例14: update

 def update(self, widget_update, backend_method, args=[], kwargs={}, exception_msg=None, callback=None):
     try:
         result = backend_method(*args, **kwargs)
         if callback:
             callback(result)
     except Exception, e:
         message = exception_msg or str(e)
         handle_gui_exception(e, message, self.parent_window)
开发者ID:cgwalters,项目名称:subscription-manager,代码行数:8,代码来源:stubs.py


示例15: _preferences_item_clicked

 def _preferences_item_clicked(self, widget):
     try:
         self.preferences_dialog.show()
     except Exception, e:
         handle_gui_exception(
             e,
             _("Error in preferences dialog." "Please see /var/log/rhsm/rhsm.log for more information."),
             self._get_window(),
         )
开发者ID:alikins,项目名称:subscription-manager,代码行数:9,代码来源:managergui.py


示例16: _handle_unbind_exception

 def _handle_unbind_exception(self, e, selection):
     self._clear_progress_bar()
     handle_gui_exception(
         e,
         _("There was an error removing %s with serial number %s")
         % (selection["subscription"], selection["serial"]),
         self.parent_win,
         format_msg=False,
     )
开发者ID:alikins,项目名称:subscription-manager,代码行数:9,代码来源:mysubstab.py


示例17: update_facts

    def update_facts(self):
        """Sends the current system facts to the UEP server."""
        consumer_uuid = self.consumer.uuid

        try:
            self.facts.update_check(self.backend.uep, consumer_uuid, force=True)
        except Exception, e:
            log.error("Could not update system facts \nError: %s" % e)
            handle_gui_exception(e, linkify(str(e)), self.system_facts_dialog)
开发者ID:bkearney,项目名称:subscription-manager,代码行数:9,代码来源:factsgui.py


示例18: _on_subscribing_finished_cb

    def _on_subscribing_finished_cb(self, unused, error=None):
        try:
            if error != None:
                raise error
            self._parent.pre_done(FINISH)

        except Exception, e:
            handle_gui_exception(e, _("Error subscribing: %s"),
                                 self._parent.window)
            self._parent.finish_registration(failed=True)
开发者ID:beav,项目名称:subscription-manager,代码行数:10,代码来源:registergui.py


示例19: update_facts

    def update_facts(self):
        """Sends the current system facts to the UEP server."""

        identity = inj.require(inj.IDENTITY)

        try:
            self.facts.update_check(self.cp_provider.get_consumer_auth_cp(), identity.uuid, force=True)
        except Exception, e:
            log.error("Could not update system facts \nError: %s" % e)
            handle_gui_exception(e, linkify(str(e)), self.system_facts_dialog)
开发者ID:belonesox,项目名称:subscription-manager,代码行数:10,代码来源:factsgui.py


示例20: _perform_unregister

 def _perform_unregister(self):
     try:
         managerlib.unregister(self.backend.cp_provider.get_consumer_auth_cp(), self.identity.uuid)
     except Exception, e:
         log.error("Error unregistering system with entitlement platform.")
         handle_gui_exception(e, _("<b>Errors were encountered during unregister.</b>") +
                                   "\n%s\n" +
                                   _("Please see /var/log/rhsm/rhsm.log for more information."),
                             self.main_window,
                             log_msg="Consumer may need to be manually cleaned up: %s" %
                             self.identity.uuid)
开发者ID:belonesox,项目名称:subscription-manager,代码行数:11,代码来源:managergui.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.linkify函数代码示例发布时间:2022-05-27
下一篇:
Python ga.GObject类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap