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

Python ga.GObject类代码示例

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

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



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

示例1: __init__

    def __init__(self, text, parent=None, title=None):
        ga_GObject.GObject.__init__(self)
        self.rc = None

        # this seems to be wordwrapping text passed to
        # it, which is making for ugly error messages
        self.dialog = ga_Gtk.MessageDialog(parent, 0, self.STYLE, self.BUTTONS)

        if title:
            self.dialog.set_title(title)

        # escape product strings see rh bz#633438
        self.dialog.set_markup(text)

        self.dialog.set_default_response(0)

        self.dialog.set_position(ga_Gtk.WindowPosition.CENTER_ON_PARENT)
        self.dialog.show_all()
        self.dialog.set_icon_name('subscription-manager')

        self.dialog.set_modal(True)
        #this seems spurious, but without it, a ref to this obj gets "lost"
        ga_GObject.add_emission_hook(self, 'response', self.noop_hook)

        self.dialog.connect("response", self._on_response_event)
开发者ID:Januson,项目名称:subscription-manager,代码行数:25,代码来源:messageWindow.py


示例2: refresh

 def refresh(self, active_on, callback, data=None):
     """
     Run pool stash refresh asynchronously.
     """
     ga_GObject.idle_add(self._watch_thread)
     threading.Thread(target=self._run_refresh,
             args=(active_on, callback, data)).start()
开发者ID:vritant,项目名称:subscription-manager,代码行数:7,代码来源:async.py


示例3: _clear_progress_bar

    def _clear_progress_bar(self):
        if not self.progress_bar:  # progress bar could be none iff self.test_connection is called directly
            return

        self.progress_bar.hide()
        ga_GObject.source_remove(self.timer)
        self.timer = 0
        self.progress_bar = None
开发者ID:vritant,项目名称:subscription-manager,代码行数:8,代码来源:networkConfig.py


示例4: worker

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


示例5: _run_unbind

    def _run_unbind(self, serial, selection, callback, except_callback):
        """
        Selection is only passed to maintain the gui error message.  This
        can be removed, because it doesn't really give us any more information
        """
        try:
            self.cp_provider.get_consumer_auth_cp().unbindBySerial(self.identity.uuid, serial)
            try:
                self.certlib.update()
            except Disconnected, e:
                pass

            if callback:
                ga_GObject.idle_add(callback)
开发者ID:vritant,项目名称:subscription-manager,代码行数:14,代码来源:async.py


示例6: _create_async_pool

    def _create_async_pool(self):
        provide(inj.CP_PROVIDER, stubs.StubCPProvider())
        inj.provide(inj.PROD_DIR, stubs.StubProductDirectory())
        inj.provide(inj.ENT_DIR, stubs.StubEntitlementDirectory())
        inj.provide(inj.CERT_SORTER, stubs.StubCertSorter())

        self.pool_stash = \
                managerlib.PoolStash(facts=self.stub_facts)

        self.ap = async.AsyncPool(self.pool_stash)

        # add a timeout and a idle handler
        self.idle = ga_GObject.idle_add(self.ap.refresh, datetime.date.today(), self.idle_callback)
        self.timer = ga_GObject.timeout_add(50, self.idle_callback)
        self.mainloop = ga_GObject.MainLoop()
开发者ID:belonesox,项目名称:subscription-manager,代码行数:15,代码来源:test_async.py


示例7: 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


示例8: _display_progress_bar

 def _display_progress_bar(self):
     if self.progress_bar:
         self.progress_bar.set_title(_("Testing Connection"))
         self.progress_bar.set_label(_("Please wait"))
     else:
         self.progress_bar = progress.Progress(_("Testing Connection"), _("Please wait"))
         self.timer = ga_GObject.timeout_add(100, self.progress_bar.pulse)
         self.progress_bar.set_parent_window(self.networkConfigDialog)
开发者ID:vritant,项目名称:subscription-manager,代码行数:8,代码来源:networkConfig.py


示例9: apply_highlight

def apply_highlight(text, highlight):
    """
    Apply pango markup to highlight a search term in a string
    """
    if not highlight:
        return ga_GObject.markup_escape_text(text)

    regex = re.compile("(" + re.escape(highlight) + ")", re.I)
    parts = regex.split(text)

    escaped = []
    # re.split makes every second result be our split term
    on_search_term = False
    for part in parts:
        if on_search_term:
            escaped += "<b>%s</b>" % ga_GObject.markup_escape_text(part)
        else:
            escaped += ga_GObject.markup_escape_text(part)
        on_search_term = not on_search_term

    return "".join(escaped)
开发者ID:Januson,项目名称:subscription-manager,代码行数:21,代码来源:utils.py


示例10: unsubscribe_button_clicked

    def unsubscribe_button_clicked(self, widget):
        selection = widgets.SelectionWrapper(self.top_view.get_selection(), self.store)

        # nothing selected
        if not selection.is_valid():
            return

        # remove all markup, see rh bz#982286
        subscription_text = ga_GObject.markup_escape_text(selection['subscription'])

        prompt = messageWindow.YesNoDialog(_("Are you sure you want to remove %s?") % subscription_text,
                self.content.get_toplevel())
        prompt.connect('response', self._on_unsubscribe_prompt_response, selection)
开发者ID:Lorquas,项目名称:subscription-manager,代码行数:13,代码来源:mysubstab.py


示例11: _on_unsubscribe_prompt_response

    def _on_unsubscribe_prompt_response(self, dialog, response, selection):
        if not response:
            return

        serial = long(selection["serial"])

        if self.identity.is_valid():
            self.pb = progress.Progress(_("Removing"), _("Removing subscription. Please wait."))
            self.timer = ga_GObject.timeout_add(100, self.pb.pulse)
            self.pb.set_transient_for(self.parent_win)
            self.async_bind.unbind(serial, selection, self._unsubscribe_callback, self._handle_unbind_exception)
        else:
            # unregistered, just delete the certs directly
            action = EntCertDeleteAction(self.entitlement_dir)
            action.perform([serial])
            self.update_subscriptions()
开发者ID:alikins,项目名称:subscription-manager,代码行数:16,代码来源:mysubstab.py


示例12: _on_unsubscribe_prompt_response

    def _on_unsubscribe_prompt_response(self, dialog, response, selection):
        if not response:
            return

        serial = long(selection['serial'])

        if self.identity.is_valid():
            self.pb = progress.Progress(_("Removing"),
                    _("Removing subscription. Please wait."))
            self.timer = ga_GObject.timeout_add(100, self.pb.pulse)
            content_toplevel = self.content.get_toplevel()
            if content_toplevel.is_toplevel():
                self.pb.set_parent_window(content_toplevel)
            self.async_bind.unbind(serial, selection, self._unsubscribe_callback, self._handle_unbind_exception)
        else:
            # unregistered, just delete the certs directly
            self.backend.entcertlib.delete([serial])
            self.backend.cs.force_cert_check()
开发者ID:megaumi,项目名称:subscription-manager,代码行数:18,代码来源:mysubstab.py


示例13: _run_bind

 def _run_bind(self, pool, quantity, bind_callback, cert_callback, except_callback):
     try:
         self.plugin_manager.run("pre_subscribe", consumer_uuid=self.identity.uuid,
                 pool_id=pool['id'], quantity=quantity)
         ents = self.cp_provider.get_consumer_auth_cp().bindByEntitlementPool(self.identity.uuid, pool['id'], quantity)
         self.plugin_manager.run("post_subscribe", consumer_uuid=self.identity.uuid, entitlement_data=ents)
         if bind_callback:
             ga_GObject.idle_add(bind_callback)
         fetch_certificates(self.certlib)
         if cert_callback:
             ga_GObject.idle_add(cert_callback)
     except Exception, e:
         ga_GObject.idle_add(except_callback, e)
开发者ID:vritant,项目名称:subscription-manager,代码行数:13,代码来源:async.py


示例14: _contract_selected

    def _contract_selected(self, pool, quantity=1):
        if not valid_quantity(quantity):
            show_error_window(_("Quantity must be a positive number."),
                              parent=self.parent_win)
            return

        self._contract_selection_cancelled()

        # Start the progress bar
        self.pb = progress.Progress(_("Attaching"),
                _("Attaching subscription. Please wait."))
        self.timer = ga_GObject.timeout_add(100, self.pb.pulse)
        self.pb.set_transient_for(self.parent_win)
        # Spin off a thread to handle binding the selected pool.
        # After it has completed the actual bind call, available
        # subs will be refreshed, but we won't re-run compliance
        # until we have serialized the certificates
        self.async_bind.bind(pool, quantity,
                bind_callback=self._async_bind_callback,
                cert_callback=self.backend.cs.force_cert_check,
                except_callback=self._async_bind_exception_callback)
开发者ID:Januson,项目名称:subscription-manager,代码行数:21,代码来源:allsubs.py


示例15: test_registration_error_returns_to_page

    def test_registration_error_returns_to_page(self):
        self.rs.initialize()

        self.correct_page = None

        self.rs.register_notebook.connect('notify::page', self.page_notify_handler)

        self.rs.connect('register-error', self.error_handler)

        ga_GObject.timeout_add(3000, self.gtk_quit_on_fail)
        ga_GObject.idle_add(self.emit_proceed)
        ga_GObject.idle_add(self.emit_error)

        # run till quit or timeout
        # if we get to the state we want we can call quit
        ga_Gtk.main()

        # If we saw any exceptions, raise them now so we fail nosetests
        for exc_info in self.exc_infos:
            six.reraise(*exc_info)

        self.assertTrue(self.correct_page)
开发者ID:Januson,项目名称:subscription-manager,代码行数:22,代码来源:test_registrationgui.py


示例16: test_connection_wrapper

 def test_connection_wrapper(self, proxy_host, proxy_port, proxy_user, proxy_password):
     connection_status = self.test_connection(proxy_host, proxy_port, proxy_user, proxy_password)
     ga_GObject.idle_add(self.on_test_connection_finish, connection_status)
开发者ID:vritant,项目名称:subscription-manager,代码行数:3,代码来源:networkConfig.py


示例17: RHSMSpoke

from subscription_manager import ga_loader

# initial-setup only works with gtk version 3
ga_loader.init_ga(gtk_version="3")

from subscription_manager.ga import GObject as ga_GObject
from subscription_manager.ga import Gtk as ga_Gtk
from subscription_manager.gui import managergui
from subscription_manager.i18n import configure_gettext
from subscription_manager.injectioninit import init_dep_injection
from subscription_manager.gui import registergui
from subscription_manager import utils
from subscription_manager.gui import utils as gui_utils

ga_GObject.threads_init()

__all__ = ["RHSMSpoke"]

configure_gettext()


class RHSMSpoke(FirstbootSpokeMixIn, NormalSpoke):
    """
    Spoke used for registration of system in Anaconda or Initial Setup
    """
    buildrObjects = ["RHSMSpokeWindow"]
    mainWidgetName = "RHSMSpokeWindow"
    uiFile = "rhsm_gui.ui"
    helpFile = "SubscriptionManagerSpoke.xml"
    # Display our spoke in second hub for testing purpose. There is also
开发者ID:Lorquas,项目名称:subscription-manager,代码行数:30,代码来源:rhsm_gui.py


示例18: format_restlib_exception

 def format_restlib_exception(self, restlib_exception, message_template):
     return ga_GObject.markup_escape_text(restlib_exception.msg)
开发者ID:Januson,项目名称:subscription-manager,代码行数:2,代码来源:utils.py


示例19: _clear_progress_bar

 def _clear_progress_bar(self):
     if self.pb:
         self.pb.hide()
         ga_GObject.source_remove(self.timer)
         self.timer = 0
         self.pb = None
开发者ID:jkonecny12,项目名称:subscription-manager,代码行数:6,代码来源:reposgui.py


示例20: _show_progress_bar

 def _show_progress_bar(self, title, label, progress_parent=None):
     self.pb = progress.Progress(title, label, True)
     self.timer = ga_GObject.timeout_add(100, self.pb.pulse)
     self.pb.set_transient_for(progress_parent or self._get_dialog_widget())
开发者ID:jkonecny12,项目名称:subscription-manager,代码行数:4,代码来源:reposgui.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python utils.handle_gui_exception函数代码示例发布时间:2022-05-27
下一篇:
Python cli.system_exit函数代码示例发布时间: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