当前位置: 首页>>代码示例>>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;未经允许,请勿转载。