本文整理匯總了Python中easygsettings.EasyGSettings.bindGSettingsEntryToVar方法的典型用法代碼示例。如果您正苦於以下問題:Python EasyGSettings.bindGSettingsEntryToVar方法的具體用法?Python EasyGSettings.bindGSettingsEntryToVar怎麽用?Python EasyGSettings.bindGSettingsEntryToVar使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類easygsettings.EasyGSettings
的用法示例。
在下文中一共展示了EasyGSettings.bindGSettingsEntryToVar方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: pluginclass
# 需要導入模塊: from easygsettings import EasyGSettings [as 別名]
# 或者: from easygsettings.EasyGSettings import bindGSettingsEntryToVar [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"
#.........這裏部分代碼省略.........