Python gtk 模块,StatusIcon() 实例源码

我们从Python开源项目中,提取了以下12个代码示例,用于说明如何使用gtk.StatusIcon()

项目:pyttrss    作者:balanceofcowards    | 项目源码 | 文件源码
def __init__(self, ttrss):
        self.ttrss = ttrss
        self.menu = gtk.Menu()
        quitter = gtk.ImageMenuItem(gtk.STOCK_QUIT)
        quitter.set_always_show_image(True)
        self.menu.append(quitter)
        quitter.show()
        quitter.connect("activate", gtk.main_quit)
        self.viewer = ArticleViewer()
        self.viewer.on_hide = self.update_articles
        self.status_icon = gtk.StatusIcon()
        self.status_icon.set_from_icon_name("mail-read")
        self.update_headlines()
        self.to = gtk.timeout_add(1000 * 60, self.update_headlines)
        self.status_icon.connect("activate", self.toggle_viewer)
        self.status_icon.connect("popup-menu", self.show_menu)
项目:Intranet-Penetration    作者:yuxiaokui    | 项目源码 | 文件源码
def gtk_trayicon(self, logo_filename):
        trayicon = gtk.StatusIcon()
        trayicon.set_from_file(logo_filename)

        trayicon.connect('popup-menu', lambda i, b, t: self.make_menu().popup(None, None, gtk.status_icon_position_menu, b, t, self.trayicon))
        trayicon.connect('activate', self.show_control_web)
        trayicon.set_tooltip('XX-Net')
        trayicon.set_visible(True)

        return trayicon
项目:MKFQ    作者:maojingios    | 项目源码 | 文件源码
def gtk_trayicon(self, logo_filename):
        trayicon = gtk.StatusIcon()
        trayicon.set_from_file(logo_filename)

        trayicon.connect('popup-menu', lambda i, b, t: self.make_menu().popup(None, None, gtk.status_icon_position_menu, b, t, self.trayicon))
        trayicon.connect('activate', self.show_control_web)
        trayicon.set_tooltip('XX-Net')
        trayicon.set_visible(True)

        return trayicon
项目:PiJuice    作者:PiSupply    | 项目源码 | 文件源码
def __init__(self):
        self.tray = gtk.StatusIcon()
        self.tray.connect('activate', self.refresh)

        # Create menu
        menu = gtk.Menu()

        i = gtk.MenuItem("Configure")
        i.show()
        i.connect("activate", self.ConfigurePiJuice)
        menu.append(i)

        i = gtk.MenuItem("About...")
        i.show()
        i.connect("activate", self.show_about)
        menu.append(i)

        self.tray.connect('popup-menu', self.show_menu, menu)

        self.pijuice = PiJuice(1,0x14)

        # Initalise and start battery display
        self.refresh(None)
        self.tray.set_visible(True)

        gobject.timeout_add(REFRESH_INTERVAL, self.refresh, False)
项目:PiJuice    作者:PiSupply    | 项目源码 | 文件源码
def __init__(self):
        self.tray = gtk.StatusIcon()
        self.tray.connect('activate', self.refresh)

        # Create menu
        menu = gtk.Menu()

        i = gtk.MenuItem("Configure")
        i.show()
        i.connect("activate", self.ConfigurePiJuice)
        menu.append(i)

        i = gtk.MenuItem("About...")
        i.show()
        i.connect("activate", self.show_about)
        menu.append(i)

        self.tray.connect('popup-menu', self.show_menu, menu)

        self.pijuice = PiJuice(1,0x14)

        # Initalise and start battery display
        self.refresh(None)
        self.tray.set_visible(True)

        gobject.timeout_add(REFRESH_INTERVAL, self.refresh, False)
项目:PiJuice    作者:PiSupply    | 项目源码 | 文件源码
def __init__(self):
        self.tray = gtk.StatusIcon()
        self.tray.connect('activate', self.refresh)

        # Create menu
        menu = gtk.Menu()

        i = gtk.MenuItem("Configure")
        i.show()
        i.connect("activate", self.ConfigurePiJuice)
        menu.append(i)

        i = gtk.MenuItem("About...")
        i.show()
        i.connect("activate", self.show_about)
        menu.append(i)

        self.tray.connect('popup-menu', self.show_menu, menu)

        self.pijuice = PiJuice(1,0x14)

        # Initalise and start battery display
        self.refresh(None)
        self.tray.set_visible(True)

        gobject.timeout_add(REFRESH_INTERVAL, self.refresh, False)
项目:PiJuice    作者:PiSupply    | 项目源码 | 文件源码
def __init__(self):
        self.tray = gtk.StatusIcon()
        self.tray.connect('activate', self.refresh)

        # Create menu
        menu = gtk.Menu()

        i = gtk.MenuItem("Configure")
        i.show()
        i.connect("activate", self.ConfigurePiJuice)
        menu.append(i)

        i = gtk.MenuItem("About...")
        i.show()
        i.connect("activate", self.show_about)
        menu.append(i)

        self.tray.connect('popup-menu', self.show_menu, menu)

        self.pijuice = PiJuice(1,0x14)

        # Initalise and start battery display
        self.refresh(None)
        self.tray.set_visible(True)

        gobject.timeout_add(REFRESH_INTERVAL, self.refresh, False)
项目:PiJuice    作者:PiSupply    | 项目源码 | 文件源码
def __init__(self):
        self.tray = gtk.StatusIcon()
        self.tray.connect('activate', self.refresh)

        # Create menu
        menu = gtk.Menu()

        i = gtk.MenuItem("Configure")
        i.show()
        i.connect("activate", self.ConfigurePiJuice)
        menu.append(i)

        i = gtk.MenuItem("About...")
        i.show()
        i.connect("activate", self.show_about)
        menu.append(i)

        self.tray.connect('popup-menu', self.show_menu, menu)

        self.pijuice = PiJuice(1,0x14)

        # Initalise and start battery display
        self.refresh(None)
        self.tray.set_visible(True)

        gobject.timeout_add(REFRESH_INTERVAL, self.refresh, False)
项目:xxNet    作者:drzorm    | 项目源码 | 文件源码
def gtk_trayicon(self, logo_filename):
        trayicon = gtk.StatusIcon()
        trayicon.set_from_file(logo_filename)

        trayicon.connect('popup-menu', lambda i, b, t: self.make_menu().popup(None, None, gtk.status_icon_position_menu, b, t, self.trayicon))
        trayicon.connect('activate', self.show_control_web)
        trayicon.set_tooltip('XX-Net')
        trayicon.set_visible(True)

        return trayicon
项目:Docker-XX-Net    作者:kuanghy    | 项目源码 | 文件源码
def gtk_trayicon(self, logo_filename):
        trayicon = gtk.StatusIcon()
        trayicon.set_from_file(logo_filename)

        trayicon.connect('popup-menu', lambda i, b, t: self.make_menu().popup(None, None, gtk.status_icon_position_menu, b, t, self.trayicon))
        trayicon.connect('activate', self.show_control_web)
        trayicon.set_tooltip('XX-Net')
        trayicon.set_visible(True)

        return trayicon
项目:Proxy-Factory    作者:ping99    | 项目源码 | 文件源码
def __init__(self, window, terminal):
        self.window = window
        self.window.set_size_request(652, 447)
        self.window.set_position(gtk.WIN_POS_CENTER)
        self.window.connect('delete-event',self.delete_event)
        self.terminal = terminal

        for cmd in ('python2.7', 'python27', 'python2'):
            if os.system('which %s' % cmd) == 0:
                self.command[1] = cmd
                break

        self.window.add(terminal)
        self.childpid = self.terminal.fork_command(self.command[0], self.command, os.getcwd())
        if self.childpid > 0:
            self.childexited = self.terminal.connect('child-exited', self.on_child_exited)
            self.window.connect('delete-event', lambda w, e: gtk.main_quit())
        else:
            self.childexited = None

        spawn_later(0.5, self.show_startup_notify)

        if should_visible():
            self.window.show_all()

        logo_filename = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'goagent-logo.png')
        if not os.path.isfile(logo_filename):
            with open(logo_filename, 'wb') as fp:
                fp.write(base64.b64decode(GOAGENT_LOGO_DATA))
        self.window.set_icon_from_file(logo_filename)

        if appindicator:
            self.trayicon = appindicator.Indicator('GoAgent', 'indicator-messages', appindicator.CATEGORY_APPLICATION_STATUS)
            self.trayicon.set_status(appindicator.STATUS_ACTIVE)
            self.trayicon.set_attention_icon('indicator-messages-new')
            self.trayicon.set_icon(logo_filename)
            self.trayicon.set_menu(self.make_menu())
        else:
            self.trayicon = gtk.StatusIcon()
            self.trayicon.set_from_file(logo_filename)
            self.trayicon.connect('popup-menu', lambda i, b, t: self.make_menu().popup(None, None, gtk.status_icon_position_menu, b, t, self.trayicon))
            self.trayicon.connect('activate', self.show_hide_toggle)
            self.trayicon.set_tooltip('GoAgent')
            self.trayicon.set_visible(True)
项目:XX-Net-Mini    作者:GFWParty    | 项目源码 | 文件源码
def __init__(self, window, terminal):
        self.window = window
        self.window.set_size_request(652, 447)
        self.window.set_position(gtk.WIN_POS_CENTER)
        self.window.connect('delete-event',self.delete_event)
        self.terminal = terminal

        for cmd in ('python2.7', 'python27', 'python2'):
            if os.system('which %s' % cmd) == 0:
                self.command[1] = cmd
                break

        self.window.add(terminal)
        self.childpid = self.terminal.fork_command(self.command[0], self.command, os.getcwd())
        if self.childpid > 0:
            self.childexited = self.terminal.connect('child-exited', self.on_child_exited)
            self.window.connect('delete-event', lambda w, e: gtk.main_quit())
        else:
            self.childexited = None

        spawn_later(0.5, self.show_startup_notify)

        if should_visible():
            self.window.show_all()

        logo_filename = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'goagent-logo.png')
        if not os.path.isfile(logo_filename):
            with open(logo_filename, 'wb') as fp:
                fp.write(base64.b64decode(GOAGENT_LOGO_DATA))
        self.window.set_icon_from_file(logo_filename)

        if appindicator:
            self.trayicon = appindicator.Indicator('XX-Mini', 'indicator-messages', appindicator.CATEGORY_APPLICATION_STATUS)
            self.trayicon.set_status(appindicator.STATUS_ACTIVE)
            self.trayicon.set_attention_icon('indicator-messages-new')
            self.trayicon.set_icon(logo_filename)
            self.trayicon.set_menu(self.make_menu())
        else:
            self.trayicon = gtk.StatusIcon()
            self.trayicon.set_from_file(logo_filename)
            self.trayicon.connect('popup-menu', lambda i, b, t: self.make_menu().popup(None, None, gtk.status_icon_position_menu, b, t, self.trayicon))
            self.trayicon.connect('activate', self.show_hide_toggle)
            self.trayicon.set_tooltip('XX-Mini')
            self.trayicon.set_visible(True)