本文整理汇总了Python中easygsettings.EasyGSettings.get方法的典型用法代码示例。如果您正苦于以下问题:Python EasyGSettings.get方法的具体用法?Python EasyGSettings.get怎么用?Python EasyGSettings.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类easygsettings.EasyGSettings
的用法示例。
在下文中一共展示了EasyGSettings.get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: pluginclass
# 需要导入模块: from easygsettings import EasyGSettings [as 别名]
# 或者: from easygsettings.EasyGSettings import get [as 别名]
class pluginclass( object ):
def __init__( self, mintMenuWin, toggleButton, de ):
self.mintMenuWin = mintMenuWin
self.toggleButton = toggleButton
self.de = de
# Read UI file
builder = Gtk.Builder()
builder.add_from_file(os.path.join( os.path.dirname( __file__ ), "places.glade" ))
self.placesBtnHolder = builder.get_object( "places_button_holder" )
self.editableBtnHolder = builder.get_object( "editable_button_holder" )
self.scrolledWindow=builder.get_object("scrolledwindow2")
# These properties are NECESSARY to maintain consistency
# Set 'window' property for the plugin (Must be the root widget)
self.window = builder.get_object( "mainWindow" )
# Set 'heading' property for plugin
self.heading = _("Places")
# This should be the first item added to the window in glade
self.content_holder = builder.get_object( "Places" )
# Items to get custom colors
self.itemstocolor = [ builder.get_object( "viewport2" ) ]
# Settings
self.settings = EasyGSettings("com.linuxmint.mintmenu.plugins.places")
self.settings.notifyAdd( "icon-size", self.RegenPlugin )
self.settings.notifyAdd( "show-computer", self.RegenPlugin )
self.settings.notifyAdd( "show-desktop", self.RegenPlugin )
self.settings.notifyAdd( "show-home_folder", self.RegenPlugin )
self.settings.notifyAdd( "show-network", self.RegenPlugin )
self.settings.notifyAdd( "show-trash", self.RegenPlugin )
self.settings.notifyAdd( "custom-names", self.RegenPlugin )
self.settings.notifyAdd( "allow-scrollbar", self.RegenPlugin )
self.settings.notifyAdd( "show-gtk-bookmarks", self.RegenPlugin )
self.settings.notifyAdd( "height", self.changePluginSize )
self.settings.notifyAdd( "width", self.changePluginSize )
self.loadSettings()
self.content_holder.set_size_request( self.width, self.height )
def wake (self) :
if ( self.showtrash == True ):
self.refreshTrash()
def destroy( self ):
self.settings.notifyRemoveAll()
def changePluginSize( self, settings, key, args = None):
self.allowScrollbar = self.settings.get( "bool", "allow-scrollbar" )
self.width = self.settings.get( "int", "width" )
if (self.allowScrollbar == False):
self.height = -1
self.scrolledWindow.set_policy( Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.NEVER )
else:
self.scrolledWindow.set_policy( Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC )
self.height = self.settings.get( "int", "height" )
self.content_holder.set_size_request( self.width, self.height )
def RegenPlugin( self, *args, **kargs ):
self.loadSettings()
self.ClearAll()
self.do_standard_places()
self.do_custom_places()
self.do_gtk_bookmarks()
def loadSettings( self ):
self.width = self.settings.get( "int", "width" )
self.allowScrollbar = self.settings.get( "bool", "allow-scrollbar" )
self.showGTKBookmarks = self.settings.get( "bool", "show-gtk-bookmarks" )
self.scrolledWindow.set_policy( Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC )
self.height = self.settings.get( "int", "height" )
self.content_holder.set_size_request( self.width, self.height )
if (self.allowScrollbar == False):
self.height = -1
self.scrolledWindow.set_policy( Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.NEVER )
self.content_holder.set_size_request( self.width, self.height )
self.iconsize = self.settings.get( "int", "icon-size" )
# Check default items
self.showcomputer = self.settings.get( "bool", "show-computer" )
self.showhomefolder = self.settings.get( "bool", "show-home-folder" )
self.shownetwork = self.settings.get( "bool", "show-network" )
self.showdesktop = self.settings.get( "bool", "show-desktop" )
self.showtrash = self.settings.get( "bool", "show-trash" )
# Get paths for custom items
self.custompaths = self.settings.get( "list-string", "custom-paths" )
# Get names for custom items
self.customnames = self.settings.get( "list-string", "custom-names" )
#.........这里部分代码省略.........
示例2: mintMenuConfig
# 需要导入模块: from easygsettings import EasyGSettings [as 别名]
# 或者: from easygsettings.EasyGSettings import get [as 别名]
class mintMenuConfig( object ):
def __init__( self ):
self.path = os.path.abspath( os.path.dirname( sys.argv[0] ) )
# Load glade file and extract widgets
self.builder = Gtk.Builder()
self.builder.add_from_file (os.path.join(self.path, "mintMenuConfig.glade" ))
self.mainWindow=self.builder.get_object("mainWindow")
#i18n
self.mainWindow.set_title(_("Menu preferences"))
self.mainWindow.set_icon_from_file("/usr/lib/linuxmint/mintMenu/icon.svg")
self.builder.get_object("startWithFavorites").set_label(_("Always start with favorites pane"))
self.builder.get_object("showButtonIcon").set_label(_("Show button icon"))
self.builder.get_object("useCustomColors").set_label(_("Use custom colors"))
self.builder.get_object("showRecentPlugin").set_label(_("Show recent documents plugin"))
self.builder.get_object("showApplicationsPlugin").set_label(_("Show applications plugin"))
self.builder.get_object("showSystemPlugin").set_label(_("Show system plugin"))
self.builder.get_object("showPlacesPlugin").set_label(_("Show places plugin"))
self.builder.get_object("showAppComments").set_label(_("Show application comments"))
self.builder.get_object("showCategoryIcons").set_label(_("Show category icons"))
self.builder.get_object("hover").set_label(_("Hover"))
self.builder.get_object("remember_filter").set_label(_("Remember the last category or search"))
self.builder.get_object("use_apt").set_label(_("Search for packages to install"))
self.builder.get_object("swapGeneric").set_label(_("Swap name and generic name"))
self.builder.get_object("label11").set_text(_("Border width:"))
self.builder.get_object("label25").set_text(_("pixels"))
self.builder.get_object("label8").set_text(_("Opacity:"))
self.builder.get_object("label9").set_text("%")
self.builder.get_object("buttonTextLabel").set_text(_("Button text:"))
self.builder.get_object("label1").set_text(_("Options"))
self.builder.get_object("label23").set_text(_("Applications"))
self.builder.get_object("colorsLabel").set_text(_("Theme"))
self.builder.get_object("favLabel").set_text(_("Favorites"))
self.builder.get_object("mainbuttonLabel").set_text(_("Main button"))
self.builder.get_object("pluginsLabel").set_text(_("Plugins"))
self.builder.get_object("backgroundColorLabel").set_text(_("Background:"))
self.builder.get_object("headingColorLabel").set_text(_("Headings:"))
self.builder.get_object("borderColorLabel").set_text(_("Borders:"))
self.builder.get_object("themeLabel").set_text(_("Theme:"))
#self.builder.get_object("applicationsLabel").set_text(_("Applications"))
#self.builder.get_object("favoritesLabel").set_text(_("Favorites"))
self.builder.get_object("numberColumnsLabel").set_text(_("Number of columns:"))
self.builder.get_object("iconSizeLabel").set_text(_("Icon size:"))
self.builder.get_object("iconSizeLabel2").set_text(_("Icon size:"))
self.builder.get_object("placesIconSizeLabel").set_text(_("Icon size:"))
self.builder.get_object("systemIconSizeLabel").set_text(_("Icon size:"))
self.builder.get_object("hoverLabel").set_text(_("Hover delay (ms):"))
self.builder.get_object("label4").set_text(_("Button icon:"))
self.builder.get_object("label5").set_text(_("Search command:"))
self.builder.get_object("placesLabel").set_text(_("Places"))
self.builder.get_object("allowscrollbarcheckbutton").set_label(_("Allow Scrollbar"))
self.builder.get_object("showgtkbookmarkscheckbutton").set_label(_("Show GTK Bookmarks"))
self.builder.get_object("placesHeightEntryLabel").set_text(_("Height:"))
self.builder.get_object("defaultPlacesFrameLabel").set_text(_("Toggle Default Places:"))
self.builder.get_object("computercheckbutton").set_label(_("Computer"))
self.builder.get_object("homecheckbutton").set_label(_("Home Folder"))
self.builder.get_object("networkcheckbutton").set_label(_("Network"))
self.builder.get_object("desktopcheckbutton").set_label(_("Desktop"))
self.builder.get_object("trashcheckbutton").set_label(_("Trash"))
self.builder.get_object("customPlacesFrameLabel").set_text(_("Custom Places:"))
self.builder.get_object("systemLabel").set_text(_("System"))
self.builder.get_object("allowscrollbarcheckbutton1").set_label(_("Allow Scrollbar"))
self.builder.get_object("systemHeightEntryLabel").set_text(_("Height:"))
self.builder.get_object("defaultItemsFrameLabel").set_text(_("Toggle Default Items:"))
self.builder.get_object("softwaremanagercheckbutton").set_label(_("Software Manager"))
self.builder.get_object("packagemanagercheckbutton").set_label(_("Package Manager"))
self.builder.get_object("controlcentercheckbutton").set_label(_("Control Center"))
self.builder.get_object("terminalcheckbutton").set_label(_("Terminal"))
self.builder.get_object("lockcheckbutton").set_label(_("Lock Screen"))
self.builder.get_object("logoutcheckbutton").set_label(_("Log Out"))
self.builder.get_object("quitcheckbutton").set_label(_("Quit"))
self.editPlaceDialogTitle = (_("Edit Place"))
self.newPlaceDialogTitle = (_("New Place"))
self.folderChooserDialogTitle = (_("Select a folder"))
self.startWithFavorites = self.builder.get_object( "startWithFavorites" )
self.showAppComments = self.builder.get_object( "showAppComments" )
self.useAPT = self.builder.get_object( "use_apt" )
self.showCategoryIcons = self.builder.get_object( "showCategoryIcons" )
self.showRecentPlugin = self.builder.get_object( "showRecentPlugin" )
self.showApplicationsPlugin = self.builder.get_object( "showApplicationsPlugin" )
self.showSystemPlugin = self.builder.get_object( "showSystemPlugin" )
self.showPlacesPlugin = self.builder.get_object( "showPlacesPlugin" )
self.swapGeneric = self.builder.get_object("swapGeneric")
self.hover = self.builder.get_object( "hover" )
#.........这里部分代码省略.........
示例3: pluginclass
# 需要导入模块: from easygsettings import EasyGSettings [as 别名]
# 或者: from easygsettings.EasyGSettings import get [as 别名]
class pluginclass( object ):
def __init__( self, mintMenuWin, toggleButton, de ):
self.mintMenuWin = mintMenuWin
self.toggleButton = toggleButton
self.de = de
self.builder = Gtk.Builder()
self.builder.add_from_file (os.path.join( os.path.dirname( __file__ ), "system_management.glade" ))
self.systemBtnHolder = self.builder.get_object( "system_button_holder" )
self.editableBtnHolder = self.builder.get_object( "editable_button_holder" )
self.scrolledWindow = self.builder.get_object( "scrolledwindow2" )
# These properties are NECESSARY to maintain consistency
# Set 'window' property for the plugin (Must be the root widget)
self.window = self.builder.get_object( "mainWindow" )
# Set 'heading' property for plugin
self.heading = _("System")
# This should be the first item added to the window in glade
self.content_holder = self.builder.get_object( "System" )
# Items to get custom colors
self.itemstocolor = [ self.builder.get_object( "viewport2" ) ]
# Gconf stuff
self.settings = EasyGSettings( "com.linuxmint.mintmenu.plugins.system_management" )
self.settings.notifyAdd( "icon-size", self.RegenPlugin )
self.settings.notifyAdd( "show-control-center", self.RegenPlugin )
self.settings.notifyAdd( "show-lock-screen", self.RegenPlugin )
self.settings.notifyAdd( "show-logout", self.RegenPlugin )
self.settings.notifyAdd( "show-package-manager", self.RegenPlugin )
self.settings.notifyAdd( "show-software-manager", self.RegenPlugin )
self.settings.notifyAdd( "show-terminal", self.RegenPlugin )
self.settings.notifyAdd( "show-quit", self.RegenPlugin )
self.settings.notifyAdd( "allow-scrollbar", self.RegenPlugin )
self.settings.notifyAdd( "height", self.changePluginSize )
self.settings.notifyAdd( "width", self.changePluginSize )
self.settings.bindGSettingsEntryToVar( "bool", "sticky", self, "sticky" )
self.GetGSettingsEntries()
self.content_holder.set_size_request( self.width, self.height )
def destroy( self ):
self.settings.notifyRemoveAll()
def wake (self) :
pass
def changePluginSize( self, settings, key, args ):
self.allowScrollbar = self.settings.get( "bool", "allow-scrollbar")
if key == "width":
self.width = settings.get_int(key)
elif key == "height":
if (self.allowScrollbar == False):
self.height = -1
self.scrolledWindow.set_policy( Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.NEVER )
else:
self.scrolledWindow.set_policy( Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC )
self.height = settings.get_int(key)
self.content_holder.set_size_request( self.width, self.height )
def RegenPlugin( self, *args, **kargs ):
self.GetGSettingsEntries()
self.ClearAll()
self.do_standard_items()
def GetGSettingsEntries( self ):
self.width = self.settings.get( "int", "width")
self.allowScrollbar = self.settings.get( "bool", "allow-scrollbar")
self.scrolledWindow.set_policy( Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC )
self.height = self.settings.get( "int", "height")
self.content_holder.set_size_request( self.width, self.height )
if (self.allowScrollbar == False):
self.height = -1
self.scrolledWindow.set_policy( Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.NEVER )
self.content_holder.set_size_request( self.width, self.height )
self.iconsize = self.settings.get( "int","icon-size")
# Check toggles
self.showSoftwareManager = self.settings.get( "bool", "show-software-manager")
self.showPackageManager = self.settings.get( "bool", "show-package-manager")
self.showControlCenter = self.settings.get( "bool", "show-control-center")
self.showTerminal = self.settings.get( "bool", "show-terminal")
self.showLockScreen = self.settings.get( "bool", "show-lock-screen")
self.showLogout = self.settings.get( "bool", "show-logout")
self.showQuit = self.settings.get( "bool", "show-quit")
if self.de == "cinnamon":
self.lock_cmd = "cinnamon-screensaver-command --lock"
#.........这里部分代码省略.........
示例4: __init__
# 需要导入模块: from easygsettings import EasyGSettings [as 别名]
# 或者: from easygsettings.EasyGSettings import get [as 别名]
class pluginclass:
"""This is the main class for the plugin"""
"""It MUST be named pluginclass"""
def __init__( self, mintMenuWin, toggleButton, de ):
self.Win = mintMenuWin
self.toggleButton = toggleButton
self.de = de
self.builder = Gtk.Builder()
#The Glade file for the plugin
self.builder.add_from_file (os.path.join( os.path.dirname( __file__ ), "recent.glade" ))
#Set 'window' property for the plugin (Must be the root widget)
self.window = self.builder.get_object( "window1" )
#Set 'heading' property for plugin
self.heading = _("Recently used")
#This should be the first item added to the window in glade
self.content_holder = self.builder.get_object( "eventbox1" )
self.recentBox = self.builder.get_object("RecentBox")
self.recentAppBox = self.builder.get_object("RecentApps")
RecentHelper.recentAppBox = self.recentAppBox
#self.recentApps = []
self.recentVBox = self.builder.get_object( "vbox1" )
#Specify plugin width
self.width = 250
#Plugin icon
self.icon = 'mate-folder.png'
self.settings = EasyGSettings ("com.linuxmint.mintmenu.plugins.recent")
self.settings.notifyAdd( 'height', self.RegenPlugin )
self.settings.notifyAdd( 'width', self.RegenPlugin )
self.settings.notifyAdd( 'num-recent-docs', self.RegenPlugin )
self.settings.notifyAdd( 'recent-font-size', self.RegenPlugin )
self.appSettings = EasyGSettings( "com.linuxmint.mintmenu.plugins.applications" )
self.appSettings.notifyAdd( "icon-size", self.RegenPlugin )
self.FileList=[]
self.RecManagerInstance = Gtk.RecentManager.get_default()
self.recentManagerId = self.RecManagerInstance.connect("changed", self.DoRecent)
self.RegenPlugin()
self.builder.get_object( "RecentTabs" ).set_current_page(0)
#Connect event handlers
self.builder.get_object("ClrBtn").connect("clicked", self.clrmenu)
def wake (self) :
pass
def destroy( self ):
self.recentBox.destroy()
self.recentVBox.destroy()
self.builder.get_object( "RecentTabs" ).destroy()
self.builder.get_object("ClrBtn").destroy()
self.content_holder.destroy()
self.settings.notifyRemoveAll()
if self.recentManagerId:
self.RecManagerInstance.disconnect(self.recentManagerId)
def RegenPlugin( self, *args, **kargs ):
self.GetGSettingsEntries()
def GetGSettingsEntries( self ):
self.recenth = self.settings.get( 'int', 'height' )
self.recentw = self.settings.get( 'int', 'width' )
self.numentries = self.settings.get( 'int', 'num-recent-docs' )
RecentHelper.numentries = self.numentries
self.recentfontsize = self.settings.get( 'int', 'recent-font-size' )
# Hide vertical dotted separator
self.hideseparator = self.settings.get( "bool", "hide-separator" )
# Plugin icon
self.icon = self.settings.get( "string", 'icon' )
# Allow plugin to be minimized to the left plugin pane
self.sticky = self.settings.get( "bool", "sticky" )
self.minimized = self.settings.get( "bool", "minimized" )
RecentHelper.iconSize = self.appSettings.get( "int", "icon-size")
self.RebuildPlugin()
def SetHidden( self, state ):
if state == True:
self.settings.set( "bool", "minimized", True )
else:
self.settings.set( "bool", "minimized", False )
def RebuildPlugin(self):
self.content_holder.set_size_request(self.recentw, self.recenth )
#.........这里部分代码省略.........
示例5: snowMenuConfig
# 需要导入模块: from easygsettings import EasyGSettings [as 别名]
# 或者: from easygsettings.EasyGSettings import get [as 别名]
class snowMenuConfig( object ):
def __init__( self ):
self.path = os.path.abspath( os.path.dirname( sys.argv[0] ) )
# Load glade file and extract widgets
self.builder = Gtk.Builder()
self.builder.add_from_file (os.path.join(self.path, "mintMenuConfig.glade" ))
self.mainWindow=self.builder.get_object("mainWindow")
#i18n
self.mainWindow.set_title(_("Menu preferences"))
self.mainWindow.set_icon_from_file("/usr/lib/snowlinux/snowMenu/icon.svg")
self.builder.get_object("showButtonIcon").set_label(_("Show button icon"))
self.builder.get_object("showAppComments").set_label(_("Show application comments"))
self.builder.get_object("showCategoryIcons").set_label(_("Show category icons"))
self.builder.get_object("hover").set_label(_("Hover"))
# self.builder.get_object("use_apt").set_label(_("Search for packages to install"))
self.builder.get_object("buttonTextLabel").set_text(_("Button text:"))
self.builder.get_object("label23").set_text(_("Applications"))
self.builder.get_object("label3").set_text(_("Main button"))
self.builder.get_object("themeLabel").set_text(_("Theme:"))
self.builder.get_object("iconSizeLabel").set_text(_("Icon size:"))
self.builder.get_object("iconSizeLabel2").set_text(_("Icon size:"))
self.builder.get_object("hoverLabel").set_text(_("Hover delay (ms):"))
self.builder.get_object("label4").set_text(_("Button icon:"))
self.builder.get_object("label5").set_text(_("Search command:"))
self.editPlaceDialogTitle = (_("Edit Place"))
self.newPlaceDialogTitle = (_("New Place"))
self.folderChooserDialogTitle = (_("Select a folder"))
self.builder.get_object("hotkey_label").set_text(_("Keyboard shortcut:"))
self.showAppComments = self.builder.get_object( "showAppComments" )
# self.useAPT = self.builder.get_object( "use_apt" )
self.showCategoryIcons = self.builder.get_object( "showCategoryIcons" )
self.hover = self.builder.get_object( "hover" )
self.hoverDelay = self.builder.get_object( "hoverDelay" )
self.iconSize = self.builder.get_object( "iconSize" )
self.favIconSize = self.builder.get_object( "favIconSize" )
self.showButtonIcon = self.builder.get_object( "showButtonIcon" )
self.buttonText = self.builder.get_object( "buttonText" )
self.hotkeyText = self.builder.get_object( "hotkeyText" )
self.buttonIcon = self.builder.get_object( "buttonIcon" )
self.buttonIconChooser = self.builder.get_object( "button_icon_chooser" )
self.image_filter = Gtk.FileFilter()
self.image_filter.set_name(_("Images"))
self.image_filter.add_pattern("*.png")
self.image_filter.add_pattern("*.jpg")
self.image_filter.add_pattern("*.jpeg")
self.image_filter.add_pattern("*.bmp")
self.image_filter.add_pattern("*.ico")
self.image_filter.add_pattern("*.xpm")
self.image_filter.add_pattern("*.svg")
self.buttonIconChooser.add_filter(self.image_filter)
self.buttonIconChooser.set_filter(self.image_filter)
self.buttonIconImage = self.builder.get_object("image_button_icon")
self.searchCommand = self.builder.get_object( "search_command" )
self.builder.get_object( "closeButton" ).connect("clicked", Gtk.main_quit )
self.settings = EasyGSettings( "com.snowlinux.snowmenu" )
self.settingsApplications = EasyGSettings( "com.snowlinux.snowmenu.plugins.applications" )
self.bindGSettingsValueToWidget( self.settingsApplications, "bool", "show-application-comments", self.showAppComments, "toggled", self.showAppComments.set_active, self.showAppComments.get_active )
# self.bindGSettingsValueToWidget( self.settingsApplications, "bool", "use-apt", self.useAPT, "toggled", self.useAPT.set_active, self.useAPT.get_active )
self.bindGSettingsValueToWidget( self.settingsApplications, "bool", "show-category-icons", self.showCategoryIcons, "toggled", self.showCategoryIcons.set_active, self.showCategoryIcons.get_active )
self.bindGSettingsValueToWidget( self.settingsApplications, "bool", "categories-mouse-over", self.hover, "toggled", self.hover.set_active, self.hover.get_active )
self.bindGSettingsValueToWidget( self.settingsApplications, "int", "category-hover-delay", self.hoverDelay, "value-changed", self.hoverDelay.set_value, self.hoverDelay.get_value )
self.bindGSettingsValueToWidget( self.settingsApplications, "int", "icon-size", self.iconSize, "value-changed", self.iconSize.set_value, self.iconSize.get_value )
self.bindGSettingsValueToWidget( self.settingsApplications, "int", "favicon-size", self.favIconSize, "value-changed", self.favIconSize.set_value, self.favIconSize.get_value )
self.bindGSettingsValueToWidget( self.settings, "bool", "hide-applet-icon", self.showButtonIcon, "toggled", self.setShowButtonIcon, self.getShowButtonIcon )
self.bindGSettingsValueToWidget( self.settings, "string", "applet-text", self.buttonText, "changed", self.buttonText.set_text, self.buttonText.get_text )
self.bindGSettingsValueToWidget( self.settings, "string", "hot-key", self.hotkeyText, "changed", self.hotkeyText.set_text, self.hotkeyText.get_text )
self.bindGSettingsValueToWidget( self.settings, "string", "applet-icon", self.buttonIconChooser, "file-set", self.setButtonIcon, self.buttonIconChooser.get_filename )
self.bindGSettingsValueToWidget( self.settingsApplications, "string", "search-command", self.searchCommand, "changed", self.searchCommand.set_text, self.searchCommand.get_text )
#Detect themes and show theme here
theme_name = self.settings.get ("string", "theme-name")
themes = commands.getoutput("find /usr/share/themes -name gtkrc")
themes = themes.split("\n")
model = Gtk.ListStore(str, str)
self.builder.get_object("themesCombo").set_model(model)
selected_theme = model.append([_("Desktop theme"), "default"])
for theme in themes:
if theme.startswith("/usr/share/themes") and theme.endswith("/gtk-2.0/gtkrc"):
theme = theme.replace("/usr/share/themes/", "")
theme = theme.replace("gtk-2.0", "")
theme = theme.replace("gtkrc", "")
theme = theme.replace("/", "")
theme = theme.strip()
iter = model.append([theme, theme])
if theme == theme_name:
selected_theme = iter
self.builder.get_object("themesCombo").set_active_iter(selected_theme)
#.........这里部分代码省略.........