本文整理汇总了Python中easygsettings.EasyGSettings类的典型用法代码示例。如果您正苦于以下问题:Python EasyGSettings类的具体用法?Python EasyGSettings怎么用?Python EasyGSettings使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EasyGSettings类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
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)
示例2: __init__
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 )
示例3: __init__
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( "custom-paths", 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 )
示例4: pluginclass
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" )
#.........这里部分代码省略.........
示例5: __init__
#.........这里部分代码省略.........
self.buttonIconImage = self.builder.get_object("image_button_icon")
self.searchCommand = self.builder.get_object( "search_command" )
self.computertoggle = self.builder.get_object( "computercheckbutton" )
self.homefoldertoggle = self.builder.get_object( "homecheckbutton" )
self.networktoggle = self.builder.get_object( "networkcheckbutton" )
self.desktoptoggle = self.builder.get_object( "desktopcheckbutton" )
self.trashtoggle = self.builder.get_object( "trashcheckbutton" )
self.customplacestree = self.builder.get_object( "customplacestree" )
self.allowPlacesScrollbarToggle = self.builder.get_object( "allowscrollbarcheckbutton" )
self.showgtkbookmarksToggle = self.builder.get_object( "showgtkbookmarkscheckbutton" )
self.placesHeightButton = self.builder.get_object( "placesHeightSpinButton" )
if (self.allowPlacesScrollbarToggle.get_active() == False):
self.placesHeightButton.set_sensitive(False)
self.allowPlacesScrollbarToggle.connect("toggled", self.togglePlacesHeightEnabled )
self.softwareManagerToggle = self.builder.get_object( "softwaremanagercheckbutton" )
self.packageManagerToggle = self.builder.get_object( "packagemanagercheckbutton" )
self.controlCenterToggle = self.builder.get_object( "controlcentercheckbutton" )
self.terminalToggle = self.builder.get_object( "terminalcheckbutton" )
self.lockToggle = self.builder.get_object( "lockcheckbutton" )
self.logoutToggle = self.builder.get_object( "logoutcheckbutton" )
self.quitToggle = self.builder.get_object( "quitcheckbutton" )
self.allowSystemScrollbarToggle = self.builder.get_object( "allowscrollbarcheckbutton1" )
self.systemHeightButton = self.builder.get_object( "systemHeightSpinButton" )
if (self.allowSystemScrollbarToggle.get_active() == False): self.systemHeightButton.set_sensitive(False)
self.allowSystemScrollbarToggle.connect("toggled", self.toggleSystemHeightEnabled )
if os.path.exists("/usr/bin/mintinstall"):
self.builder.get_object( "softwaremanagercheckbutton" ).show()
else:
self.builder.get_object( "softwaremanagercheckbutton" ).hide()
self.builder.get_object( "closeButton" ).connect("clicked", Gtk.main_quit )
self.settings = EasyGSettings( "com.linuxmint.mintmenu" )
self.settingsApplications = EasyGSettings( "com.linuxmint.mintmenu.plugins.applications" )
self.settingsPlaces = EasyGSettings( "com.linuxmint.mintmenu.plugins.places" )
self.settingsSystem = EasyGSettings( "com.linuxmint.mintmenu.plugins.system_management" )
self.useCustomColors.connect( "toggled", self.toggleUseCustomColors )
self.bindGSettingsValueToWidget( self.settings, "bool", "start-with-favorites", self.startWithFavorites, "toggled", self.startWithFavorites.set_active, self.startWithFavorites.get_active )
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, "bool", "swap-generic-name", self.swapGeneric, "toggled", self.swapGeneric.set_active, self.swapGeneric.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.settingsApplications, "int", "fav-cols", self.favCols, "value-changed", self.favCols.set_value, self.favCols.get_value )
self.bindGSettingsValueToWidget( self.settingsApplications, "bool", "remember-filter", self.rememberFilter, "toggled", self.rememberFilter.set_active, self.rememberFilter.get_active)
self.bindGSettingsValueToWidget( self.settingsPlaces, "int", "icon-size", self.placesIconSize, "value-changed", self.placesIconSize.set_value, self.placesIconSize.get_value )
self.bindGSettingsValueToWidget( self.settingsSystem, "int", "icon-size", self.systemIconSize, "value-changed", self.systemIconSize.set_value, self.systemIconSize.get_value )
self.bindGSettingsValueToWidget( self.settings, "int", "border-width", self.borderWidth, "value-changed", self.borderWidth.set_value, self.borderWidth.get_value_as_int )
self.bindGSettingsValueToWidget( self.settings, "int", "opacity", self.opacity, "value-changed", self.opacity.set_value, self.opacity.get_value_as_int )
self.bindGSettingsValueToWidget( self.settings, "bool", "use-custom-color", self.useCustomColors, "toggled", self.useCustomColors.set_active, self.useCustomColors.get_active )
self.bindGSettingsValueToWidget( self.settings, "color", "custom-color", self.backgroundColor, "color-set", self.backgroundColor.set_color, self.getBackgroundColor )
self.bindGSettingsValueToWidget( self.settings, "color", "custom-heading-color", self.headingColor, "color-set", self.headingColor.set_color, self.getHeadingColor )
self.bindGSettingsValueToWidget( self.settings, "color", "custom-border-color", self.borderColor, "color-set", self.borderColor.set_color, self.getBorderColor )
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.hotkeyWidget, "accel-edited", self.hotkeyWidget.set_val, self.hotkeyWidget.get_val )
self.bindGSettingsValueToWidget( self.settings, "string", "applet-icon", self.buttonIconChooser, "file-set", self.setButtonIcon, self.buttonIconChooser.get_filename )
示例6: mintMenuConfig
#.........这里部分代码省略.........
self.buttonIconImage = self.builder.get_object("image_button_icon")
self.searchCommand = self.builder.get_object( "search_command" )
self.computertoggle = self.builder.get_object( "computercheckbutton" )
self.homefoldertoggle = self.builder.get_object( "homecheckbutton" )
self.networktoggle = self.builder.get_object( "networkcheckbutton" )
self.desktoptoggle = self.builder.get_object( "desktopcheckbutton" )
self.trashtoggle = self.builder.get_object( "trashcheckbutton" )
self.customplacestree = self.builder.get_object( "customplacestree" )
self.allowPlacesScrollbarToggle = self.builder.get_object( "allowscrollbarcheckbutton" )
self.showgtkbookmarksToggle = self.builder.get_object( "showgtkbookmarkscheckbutton" )
self.placesHeightButton = self.builder.get_object( "placesHeightSpinButton" )
if (self.allowPlacesScrollbarToggle.get_active() == False):
self.placesHeightButton.set_sensitive(False)
self.allowPlacesScrollbarToggle.connect("toggled", self.togglePlacesHeightEnabled )
self.softwareManagerToggle = self.builder.get_object( "softwaremanagercheckbutton" )
self.packageManagerToggle = self.builder.get_object( "packagemanagercheckbutton" )
self.controlCenterToggle = self.builder.get_object( "controlcentercheckbutton" )
self.terminalToggle = self.builder.get_object( "terminalcheckbutton" )
self.lockToggle = self.builder.get_object( "lockcheckbutton" )
self.logoutToggle = self.builder.get_object( "logoutcheckbutton" )
self.quitToggle = self.builder.get_object( "quitcheckbutton" )
self.allowSystemScrollbarToggle = self.builder.get_object( "allowscrollbarcheckbutton1" )
self.systemHeightButton = self.builder.get_object( "systemHeightSpinButton" )
if (self.allowSystemScrollbarToggle.get_active() == False): self.systemHeightButton.set_sensitive(False)
self.allowSystemScrollbarToggle.connect("toggled", self.toggleSystemHeightEnabled )
if os.path.exists("/usr/bin/mintinstall"):
self.builder.get_object( "softwaremanagercheckbutton" ).show()
else:
self.builder.get_object( "softwaremanagercheckbutton" ).hide()
self.builder.get_object( "closeButton" ).connect("clicked", Gtk.main_quit )
self.settings = EasyGSettings( "com.linuxmint.mintmenu" )
self.settingsApplications = EasyGSettings( "com.linuxmint.mintmenu.plugins.applications" )
self.settingsPlaces = EasyGSettings( "com.linuxmint.mintmenu.plugins.places" )
self.settingsSystem = EasyGSettings( "com.linuxmint.mintmenu.plugins.system_management" )
self.useCustomColors.connect( "toggled", self.toggleUseCustomColors )
self.bindGSettingsValueToWidget( self.settings, "bool", "start-with-favorites", self.startWithFavorites, "toggled", self.startWithFavorites.set_active, self.startWithFavorites.get_active )
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, "bool", "swap-generic-name", self.swapGeneric, "toggled", self.swapGeneric.set_active, self.swapGeneric.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.settingsApplications, "int", "fav-cols", self.favCols, "value-changed", self.favCols.set_value, self.favCols.get_value )
self.bindGSettingsValueToWidget( self.settingsApplications, "bool", "remember-filter", self.rememberFilter, "toggled", self.rememberFilter.set_active, self.rememberFilter.get_active)
self.bindGSettingsValueToWidget( self.settingsPlaces, "int", "icon-size", self.placesIconSize, "value-changed", self.placesIconSize.set_value, self.placesIconSize.get_value )
self.bindGSettingsValueToWidget( self.settingsSystem, "int", "icon-size", self.systemIconSize, "value-changed", self.systemIconSize.set_value, self.systemIconSize.get_value )
self.bindGSettingsValueToWidget( self.settings, "int", "border-width", self.borderWidth, "value-changed", self.borderWidth.set_value, self.borderWidth.get_value_as_int )
self.bindGSettingsValueToWidget( self.settings, "int", "opacity", self.opacity, "value-changed", self.opacity.set_value, self.opacity.get_value_as_int )
self.bindGSettingsValueToWidget( self.settings, "bool", "use-custom-color", self.useCustomColors, "toggled", self.useCustomColors.set_active, self.useCustomColors.get_active )
self.bindGSettingsValueToWidget( self.settings, "color", "custom-color", self.backgroundColor, "color-set", self.backgroundColor.set_color, self.getBackgroundColor )
self.bindGSettingsValueToWidget( self.settings, "color", "custom-heading-color", self.headingColor, "color-set", self.headingColor.set_color, self.getHeadingColor )
self.bindGSettingsValueToWidget( self.settings, "color", "custom-border-color", self.borderColor, "color-set", self.borderColor.set_color, self.getBorderColor )
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.hotkeyWidget, "accel-edited", self.hotkeyWidget.set_val, self.hotkeyWidget.get_val )
self.bindGSettingsValueToWidget( self.settings, "string", "applet-icon", self.buttonIconChooser, "file-set", self.setButtonIcon, self.buttonIconChooser.get_filename )
示例7: pluginclass
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"
#.........这里部分代码省略.........
示例8: __init__
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)
self.builder.get_object("themesCombo").connect("changed", self.set_theme)
self.mainWindow.present()