當前位置: 首頁>>代碼示例>>Python>>正文


Python Theme.on_theme_changed方法代碼示例

本文整理匯總了Python中theme.Theme.on_theme_changed方法的典型用法代碼示例。如果您正苦於以下問題:Python Theme.on_theme_changed方法的具體用法?Python Theme.on_theme_changed怎麽用?Python Theme.on_theme_changed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在theme.Theme的用法示例。


在下文中一共展示了Theme.on_theme_changed方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: DockBar

# 需要導入模塊: from theme import Theme [as 別名]
# 或者: from theme.Theme import on_theme_changed [as 別名]

#.........這裏部分代碼省略.........
        del self.groups
        del self.windows
        if self.theme:
            self.theme.remove()
        gc.collect()

        print "Dockbarx reload"
        self.groups = GroupList()
        self.windows = {}
        # Get the monitor on which dockbarx is.
        gdk_screen = gtk.gdk.screen_get_default()
        win = self.container.window
        if win is not None:
            self.monitor = gdk_screen.get_monitor_at_window(win)
        #--- Generate Gio apps
        self.apps_by_id = {}
        self.app_ids_by_exec = {}
        self.app_ids_by_name = {}
        self.app_ids_by_longname = {}
        self.wine_app_ids_by_program = {}
        for app in gio.app_info_get_all():
            id = app.get_id()
            id = id[:id.rfind('.')].lower()
            name = u""+app.get_name().lower()
            exe = app.get_executable()
            if exe:
                self.apps_by_id[id] = app
                if id[:5] == 'wine-':
                    try:
                        cmd = u""+app.get_commandline().lower()
                    except AttributeError:
                        # Older versions of gio doesn't have get_comandline.
                        cmd = u""
                    if cmd.find('.exe') > 0:
                        program = cmd[:cmd.rfind('.exe')+4]
                        program = program[program.rfind('\\')+1:]
                        self.wine_app_ids_by_program[program] = id
                if name.find(' ')>-1:
                    self.app_ids_by_longname[name] = id
                else:
                    self.app_ids_by_name[name] = id
                if exe not in ('sudo','gksudo',
                                'java','mono',
                                'ruby','python'):
                    if exe[0] == '/':
                        exe = exe[exe.rfind('/')+1:]
                        self.app_ids_by_exec[exe] = id
                    else:
                        self.app_ids_by_exec[exe] = id



        try:
            if self.theme is None:
                self.theme = Theme()
            else:
                self.theme.on_theme_changed()
        except NoThemesError, details:
            print details
            sys.exit(1)

        self.container.set_spacing(self.theme.get_gap())
        self.container.show()

        #--- Initiate launchers
        self.desktop_entry_by_id = {}
        self.d_e_ids_by_exec = {}
        self.d_e_ids_by_name = {}
        self.d_e_ids_by_longname = {}
        self.d_e_ids_by_wine_program = {}

        gconf_pinned_apps = self.globals.get_pinned_apps_from_gconf()


        # Initiate launcher group buttons
        for launcher in gconf_pinned_apps:
            identifier, path = launcher.split(';')
            # Fix for launchers made in previous version of dockbarx
            identifier = identifier.lower()
            if identifier == '':
                identifier = None
            self.add_launcher(identifier, path)
        # Update pinned_apps list to remove any pinned_app that are faulty.
        self.update_pinned_apps_list()

        #--- Initiate windows
        # Initiate group buttons with windows
        for window in self.screen.get_windows():
            self.on_window_opened(self.screen, window)

        self.screen.connect("window-opened", self.on_window_opened)
        self.screen.connect("window-closed", self.on_window_closed)
        self.screen.connect("active-window-changed",
                            self.on_active_window_changed)
        self.screen.connect("viewports-changed",
                            self.on_desktop_changed)
        self.screen.connect("active-workspace-changed",
                            self.on_desktop_changed)

        self.on_active_window_changed(self.screen, None)
開發者ID:valentt,項目名稱:Fusion-Linux-Extras,代碼行數:104,代碼來源:dockbar.py


注:本文中的theme.Theme.on_theme_changed方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。