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


Python utils.get_ui_object函数代码示例

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


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

示例1: main

def main():
    global HAS_INDICATOR
    gtk.gdk.threads_init()
    config.loads();
    try:
        import ctypes
        libc = ctypes.CDLL('libc.so.6')
        libc.prctl(15, 'hotot', 0, 0, 0)
    except:
        import dl
        libc = dl.open('/lib/libc.so.6')
        libc.call('prctl', 15, 'hotot', 0, 0, 0)
        
    agent.init_notify()
    app = Hotot()
    agent.app = app
    if HAS_INDICATOR:
        indicator = appindicator.Indicator('hotot',
                                            'hotot',
                                            appindicator.CATEGORY_COMMUNICATIONS)
        indicator.set_status(appindicator.STATUS_ACTIVE)
        indicator.set_icon(utils.get_ui_object('image/ic24_hotot_mono_light.svg'))
        indicator.set_attention_icon(utils.get_ui_object('image/ic24_hotot_mono_dark.svg'))
        indicator.set_menu(app.menu_tray)
        app.indicator = indicator

    from dbus.mainloop.glib import DBusGMainLoop
    DBusGMainLoop(set_as_default=True)
    HDService = HototDbusService(app)

    gtk.gdk.threads_enter()
    gtk.main()
    gtk.gdk.threads_leave()
开发者ID:fma16,项目名称:Hotot,代码行数:33,代码来源:hotot.py

示例2: create_trayicon

 def create_trayicon(self):
     """
     Create status icon and connect signals
     """
     self.trayicon = Gtk.StatusIcon()
     self.trayicon.connect('activate', self.on_trayicon_activate)
     self.trayicon.connect('popup-menu', self.on_trayicon_popup_menu)
     self.trayicon.set_tooltip_text(_("Hotot: Click to Active."))
     self.trayicon_pixbuf[0] = GdkPixbuf.Pixbuf.new_from_file(
         utils.get_ui_object('image/ic24_hotot_mono_light.svg'))
     self.trayicon_pixbuf[1] = GdkPixbuf.Pixbuf.new_from_file(
         utils.get_ui_object('image/ic24_hotot_mono_light_blink.svg'))
     self.trayicon.set_from_pixbuf(self.trayicon_pixbuf[0])
     self.trayicon.set_visible(True)
开发者ID:sarim,项目名称:Hotot,代码行数:14,代码来源:hotot.py

示例3: __init__

    def __init__(self):
        WebView.__init__(self)
        self.load_finish_flag = False
        self.set_property('can-focus', True)
        self.set_property('can-default', True)
        self.set_full_content_zoom(1)
        self.clipbord = gtk.Clipboard()

        settings = self.get_settings()
        try:
            settings.set_property('enable-universal-access-from-file-uris', True)
            settings.set_property('javascript-can-access-clipboard', True)
            settings.set_property('enable-default-context-menu', True)
            settings.set_property('enable-page-cache', True)
            settings.set_property('tab-key-cycles-through-elements', True)
            settings.set_property('enable-file-access-from-file-uris', True)
            settings.set_property('enable-spell-checking', True)
            settings.set_property('enable-caret-browsing', False)
        except:
            print 'Error: settings property was not set.'
        webkit.set_web_database_directory_path(config.DB_DIR)
        webkit.set_default_web_database_quota(1024**3L)
        ## bind events
        self.connect('navigation-requested', self.on_navigation_requested);
        self.connect('new-window-policy-decision-requested', self.on_new_window_requested);
        self.connect('script-alert', self.on_script_alert);
        self.connect('load-finished', self.on_load_finish);
        self.connect("hovering-over-link", self.on_over_link);
        templatefile = utils.get_ui_object(config.TEMPLATE)
        template = open(templatefile, 'rb').read()
        self.load_html_string(template, 'file://' + templatefile)
开发者ID:sdqali,项目名称:Hotot,代码行数:31,代码来源:view.py

示例4: do_notify

 def do_notify(self, summary, body, icon_file=None):
     if icon_file == None or not os.path.isfile(icon_file):
         icon_file = utils.get_ui_object(os.path.join("image", "ic64_hotot.png"))
     icon_file = "file://" + icon_file
     title = _("Hotot Notification")
     text = summary + "\n" + body
     gobject.idle_add(gtknotification.gtknotification, title, text, icon_file)
开发者ID:Nirjhor,项目名称:Hotot,代码行数:7,代码来源:agent.py

示例5: main

def main():
    DBusGMainLoop(set_as_default=True)

    global HAS_INDICATOR
    gtk.gdk.threads_init()
    config.loads();
    try:
        import ctypes
        libc = ctypes.CDLL('libc.so.6')
        libc.prctl(15, 'hermelin', 0, 0, 0)
    except:
        import dl
        libc = dl.open('/lib/libc.so.6')
        libc.call('prctl', 15, 'hermelin', 0, 0, 0)

    agent.init_notify()
    app = Hermelin()
    agent.app = app
    if HAS_INDICATOR:
        indicator = appindicator.Indicator('hermelin',
                                            'hermelin',
                                            appindicator.CATEGORY_COMMUNICATIONS,
                                            utils.get_ui_object('image'))
        indicator.set_status(appindicator.STATUS_ACTIVE)
        indicator.set_icon('ic24_hermelin_mono_light')
        indicator.set_attention_icon('ic24_hermelin_mono_light_blink')
        indicator.set_menu(app.menu_tray)
        app.indicator = indicator


    gtk.gdk.threads_enter()
    gtk.main()
    gtk.gdk.threads_leave()
开发者ID:hermelin,项目名称:hermelin-universal,代码行数:33,代码来源:hermelin.py

示例6: do_notify

 def do_notify(self, summary, body, icon_file = None):
     if (icon_file == None or not os.path.isfile(icon_file)):
         icon_file = utils.get_ui_object(os.path.join('image','ic64_hotot.png'));
     icon_file = 'file://' + icon_file
     title = _("Hotot Notification")
     text = summary + '\n' + body
     gobject.idle_add(gtknotification.gtknotification, title, text, icon_file)
开发者ID:fma16,项目名称:Hotot,代码行数:7,代码来源:agent.py

示例7: init_notify

def init_notify():
    if USE_GTKNOTIFICATION_IN_NATIVE_PLATFORM:
        return
    notify.set_icon_from_pixbuf(
        gtk.gdk.pixbuf_new_from_file(
            utils.get_ui_object(os.path.join('image','ic64_hotot.png'))))
    notify.set_timeout(5000)
开发者ID:fma16,项目名称:Hotot,代码行数:7,代码来源:agent.py

示例8: create_memenu

 def create_memenu(self):
     # Memssage Menu indicator
     self.mm = indicate.indicate_server_ref_default()
     self.mm.set_type('message.hotot')
     self.mm.set_desktop_file(utils.get_ui_object('hotot.desktop'))
     self.mm.connect('server-display', self.on_mm_server_activate)
     self.mm.show()
开发者ID:fma16,项目名称:Hotot,代码行数:7,代码来源:hotot.py

示例9: __init__

    def __init__(self):
        self.is_sign_in = False
        self.active_profile = 'default'
        self.protocol = ''
        self.build_gui()
        self.trayicon_pixbuf = [None, None]
        self.state = {
            'unread_count': 0
        }

        self.inblinking = False

        import dbusservice
        self.dbus_service = dbusservice.DbusService(self)

        if os.environ.get('DESKTOP_SESSION') in ('gnome-2d', 'classic-gnome'):
            self.has_indicator = False
        else:
            try:
                from gi.repository import AppIndicator3 as AppIndicator
            except ImportError:
                self.has_indicator = False
            else:
                self.has_indicator = True

        if self.has_indicator:
            self.indicator = AppIndicator.Indicator.new('hotot', 'hotot', AppIndicator.IndicatorCategory.COMMUNICATIONS)
            self.indicator.set_status(AppIndicator.IndicatorStatus.ACTIVE)
            self.indicator.set_icon_theme_path(utils.get_ui_object('image/'))
            self.indicator.set_icon_full('ic24_hotot_mono_light', 'hotot')
            self.indicator.set_attention_icon_full('ic24_hotot_mono_light_blink', 'hotot')
            self.indicator.set_menu(self.traymenu)
            self.indicatorStatus = AppIndicator.IndicatorStatus
        else:
            self.create_trayicon()
开发者ID:sarim,项目名称:Hotot,代码行数:35,代码来源:hotot.py

示例10: __init__

    def __init__(self, parentWidget):
        WebKit.WebView.__init__(self)
        self.load_finish_flag = False
        self.set_property('can-focus', True)
        self.set_property('can-default', True)
        self.set_full_content_zoom(1)
        self.parentWidget = parentWidget;

        settings = self.get_settings()
        try:
            settings.set_property('enable-universal-access-from-file-uris', True)
            settings.set_property('javascript-can-access-clipboard', True)
            settings.set_property('enable-default-context-menu', True)
            settings.set_property('enable-page-cache', True)
            settings.set_property('tab-key-cycles-through-elements', True)
            settings.set_property('enable-file-access-from-file-uris', True)
            settings.set_property('enable-spell-checking', False)
            settings.set_property('enable-caret-browsing', False)
            settings.set_property('enable-developer-extras', config.ENABLE_INSPECTOR)
            try:
                # Since 1.7.5
                settings.set_property('enable-accelerated-compositing', True)
            except TypeError:
                pass
        except:
            print 'Error: settings property was not set.'

        WebKit.set_web_database_directory_path(config.get_path("db"))
        WebKit.set_default_web_database_quota(1024**3L)
        
        ## bind events
        self.connect('navigation-requested', self.on_navigation_requested);
        self.connect('new-window-policy-decision-requested', self.on_new_window_requested);
        self.connect('script-alert', self.on_script_alert);
        self.connect('load-finished', self.on_load_finish);
        self.connect("hovering-over-link", self.on_over_link);
#       self.connect('drag_data_received', self.on_drag_data_received)
#       self.connect('drag_motion', self.on_drag_motion)
#       self.connect('drag_drop', self.on_drag_drop)
#       # @TODO DND for gir
#       TARGET_TYPE_URI_LIST = 80
#       dnd_list = [ ( 'text/uri-list', 0, TARGET_TYPE_URI_LIST ) ]
#       te = Gtk.TargetEntry.new(
#           'text/uri-list', 0, TARGET_TYPE_URI_LIST)
#       self.drag_dest_set( Gtk.DestDefaults.ALL,
#                 [te], Gdk.DragAction.COPY)

        if config.ENABLE_INSPECTOR:
            from inspector import HermelinInspector
            HermelinInspector(self.get_inspector())

        templatefile = utils.get_ui_object(config.TEMPLATE)
        template = open(templatefile, 'rb').read()
        self.load_string(template, 'text/html', 'UTF-8', 'file://' + templatefile)
开发者ID:hermelin,项目名称:hermelin-universal,代码行数:54,代码来源:view.py

示例11: __init__

    def __init__(self):
        self.is_sign_in = False
        self.active_profile = 'default'
        self.protocol = ''
        self.build_gui()
        self.trayicon_pixbuf = [None, None]
        self.state = {
            'unread_count': 0
        }

        self.inblinking = False

        import dbusservice
        self.dbus_service = dbusservice.DbusService(self)

        if os.environ.get('DESKTOP_SESSION') in ('gnome-2d', 'classic-gnome'):
            self.has_indicator = False
        else:
            try:
                from gi.repository import AppIndicator3 as AppIndicator
            except ImportError:
                self.has_indicator = False
            else:
                self.has_indicator = True

        if self.has_indicator:
            self.indicator = AppIndicator.Indicator.new('hotot', 'hotot', AppIndicator.IndicatorCategory.COMMUNICATIONS)
            self.indicator.set_status(AppIndicator.IndicatorStatus.ACTIVE)
            self.indicator.set_icon_theme_path(utils.get_ui_object('image/'))
            self.indicator.set_icon_full('ic24_hotot_mono_light', 'hotot')
            self.indicator.set_attention_icon_full('ic24_hotot_mono_light_blink', 'hotot')
            self.indicator.set_menu(self.traymenu)
            self.indicatorStatus = AppIndicator.IndicatorStatus
        else:
            self.create_trayicon()
            # workaround for icon display issue in some cases
            #  libgtk-3-0            => 3.4.0-0ubuntu5
            #  libgdk-pixbuf2.0-0    => 2.26.0-1
            #  trayer                => 1.1.1-1ubuntu1
            # ugly but whoever cares
            self.start_blinking()
            self.stop_blinking()
开发者ID:1wingedangel,项目名称:Hotot,代码行数:42,代码来源:hotot.py

示例12: main

def main():
    DBusGMainLoop(set_as_default=True)

    global HAS_INDICATOR
    gtk.gdk.threads_init()
    config.loads();
    try:
        import ctypes
        libc = ctypes.CDLL('libc.so.6')
        libc.prctl(15, 'hotot', 0, 0, 0)
    except:
        import dl
        libc = dl.open('/lib/libc.so.6')
        libc.call('prctl', 15, 'hotot', 0, 0, 0)

    agent.init_notify()
    app = Hotot()
    agent.app = app
    if HAS_INDICATOR:
        indicator = appindicator.Indicator('hotot',
                                            'hotot',
                                            appindicator.CATEGORY_COMMUNICATIONS,
                                            utils.get_ui_object('image'))
        indicator.set_status(appindicator.STATUS_ACTIVE)
        indicator.set_icon('ic24_hotot_mono_light')
        indicator.set_attention_icon('ic24_hotot_mono_light_blink')
        indicator.set_menu(app.menu_tray)
        app.indicator = indicator

    # Set display functions (MeMenu)
    if HAS_MEMENU:
        global ind_server, indicator_unread
        ind_server.connect("server-display", app.on_mitem_resume_activate)
        indicator_unread.connect("user-display", app.on_mitem_resume_activate) 

    gtk.gdk.threads_enter()
    gtk.main()
    gtk.gdk.threads_leave()
开发者ID:ManiacTwister,项目名称:Hotot,代码行数:38,代码来源:hotot.py

示例13: main

def main():
    global HAS_INDICATOR
    gtk.gdk.threads_init()
    config.loads();
    try:
        import dl
        libc = dl.open('/lib/libc.so.6')
        libc.call('prctl', 15, 'hotot', 0, 0, 0)
    except:
        pass
    agent.init_notify()
    app = Hotot()
    agent.app = app
    if HAS_INDICATOR:
        indicator = appindicator.Indicator('hotot',
                                           'hotot',
                                           appindicator.CATEGORY_COMMUNICATIONS)
        indicator.set_status(appindicator.STATUS_ACTIVE)
        indicator.set_attention_icon(utils.get_ui_object('image/ic24_hotot_mono_light.svg'))
        indicator.set_menu(app.menu_tray)
    gtk.gdk.threads_enter()
    gtk.main()
    gtk.gdk.threads_leave()
开发者ID:sdqali,项目名称:Hotot,代码行数:23,代码来源:hotot.py

示例14: build_gui

    def build_gui(self):
        self.window = Gtk.Window()
        self.window.set_default_icon_from_file(
            utils.get_ui_object('image/ic128_hotot.png'))
        self.window.set_icon_from_file(
            utils.get_ui_object('image/ic128_hotot.png'))

        self.window.set_title(_("Hotot"))
        self.window.set_position(Gtk.WindowPosition.CENTER)

        self.window.connect('delete-event', self.on_window_delete)
        # self.window.connect('size-allocate', self.on_window_size_allocate)
        self.window.connect('show', self.on_window_show_or_hide)
        self.window.connect('hide', self.on_window_show_or_hide)

        vbox = Gtk.VBox()
        scrollw = Gtk.ScrolledWindow()

        self.webv = view.MainView(scrollw)

        agent.view = self.webv

        scrollw.add(self.webv)
        vbox.pack_start(scrollw, True, True, 0)
        vbox.show_all()
        self.window.add(vbox)

        self.traymenu = Gtk.Menu()
        mitem_resume = Gtk.MenuItem.new_with_mnemonic(_("_Show"))
        mitem_resume.connect('activate', self.on_mitem_show_activate);
        self.traymenu.append(mitem_resume)
        mitem_resume = Gtk.MenuItem.new_with_mnemonic(_("_Hide"))
        mitem_resume.connect('activate', self.on_mitem_hide_activate);
        self.traymenu.append(mitem_resume)
        mitem_compose = Gtk.MenuItem.new_with_mnemonic(_("_Compose"))
        mitem_compose.connect('activate', self.on_mitem_compose);
        self.traymenu.append(mitem_compose)
        if (config.ENABLE_INSPECTOR):
            mitem_inspector = Gtk.ImageMenuItem.new_with_mnemonic(_("_Inspector"))
            mitem_inspector.set_image(Gtk.Image.new_from_stock(Gtk.STOCK_FIND, Gtk.IconSize.MENU))
            mitem_inspector.connect('activate', self.on_mitem_inspector_activate)
            self.traymenu.append(mitem_inspector)
        mitem_prefs = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_PREFERENCES, None)
        mitem_prefs.connect('activate', self.on_mitem_prefs_activate);
        self.traymenu.append(mitem_prefs)
        mitem_about = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_ABOUT, None)
        mitem_about.connect('activate', self.on_mitem_about_activate);
        self.traymenu.append(mitem_about)
        mitem_quit = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_QUIT, None)
        mitem_quit.connect('activate', self.on_mitem_quit_activate);
        self.traymenu.append(mitem_quit)

        self.traymenu.show_all()

        ## support for ubuntu unity indicator-appmenu
        self.menubar = Gtk.MenuBar()

        menuitem_file = Gtk.MenuItem.new_with_mnemonic(_("_File"))
        menuitem_file_menu = Gtk.Menu()
        mitem_resume = Gtk.MenuItem.new_with_mnemonic(_("_Show"))
        mitem_resume.connect('activate', self.on_mitem_show_activate)
        menuitem_file_menu.append(mitem_resume)
        mitem_compose = Gtk.MenuItem.new_with_mnemonic(_("_Compose"))
        mitem_compose.connect('activate', self.on_mitem_compose)
        menuitem_file_menu.append(mitem_compose)
        mitem_prefs = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_PREFERENCES, None)
        mitem_prefs.connect('activate', self.on_mitem_prefs_activate)
        menuitem_file_menu.append(mitem_prefs)
        if (config.ENABLE_INSPECTOR):
            mitem_inspector = Gtk.ImageMenuItem.new_with_mnemonic(_("_Inspector"))
            mitem_inspector.set_image(Gtk.Image.new_from_stock(Gtk.STOCK_FIND, 16))
            mitem_inspector.connect('activate', self.on_mitem_inspector_activate)
            menuitem_file_menu.append(mitem_inspector)
        menuitem_quit = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_QUIT, None)
        menuitem_quit.connect("activate", self.quit)
        menuitem_file_menu.append(menuitem_quit)
        menuitem_file.set_submenu(menuitem_file_menu)
        self.menubar.append(menuitem_file)

        menuitem_help = Gtk.MenuItem.new_with_mnemonic(_("_Help"))
        menuitem_help_menu = Gtk.Menu()
        menuitem_about = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_ABOUT, None)
        menuitem_about.connect("activate", self.on_mitem_about_activate)
        menuitem_help_menu.append(menuitem_about)
        menuitem_help.set_submenu(menuitem_help_menu)
        self.menubar.append(menuitem_help)

        self.menubar.set_size_request(0, 0)
        self.menubar.show_all()
        self.menubar.hide()
        vport = Gtk.Viewport()
        vport.set_size_request(0, 0)
        vport.add(self.menubar)
        vbox.pack_start(vport, False, False, False)

        ##
        geometry = Gdk.Geometry()
        geometry.min_height = 400
        geometry.min_width = 460
        self.window.set_geometry_hints(self.window, geometry, Gdk.WindowHints.MIN_SIZE)
#.........这里部分代码省略.........
开发者ID:sarim,项目名称:Hotot,代码行数:101,代码来源:hotot.py

示例15: show

 def show(self, summary, body, icon_file = None):
     if icon_file == None or (not os.path.isfile(icon_file)) or os.path.getsize(icon_file) == 0:
         icon_file = utils.get_ui_object(os.path.join('image','ic64_hotot.png'))
     n = self.notification.new(self.escape(summary), self.escape(body), icon_file)
     n.set_timeout(5000)
     n.show()
开发者ID:A5aFk,项目名称:Hotot,代码行数:6,代码来源:notification.py


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