当前位置: 首页>>代码示例>>Python>>正文


Python EasyGSettings.set方法代码示例

本文整理汇总了Python中easygsettings.EasyGSettings.set方法的典型用法代码示例。如果您正苦于以下问题:Python EasyGSettings.set方法的具体用法?Python EasyGSettings.set怎么用?Python EasyGSettings.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在easygsettings.EasyGSettings的用法示例。


在下文中一共展示了EasyGSettings.set方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from easygsettings import EasyGSettings [as 别名]
# 或者: from easygsettings.EasyGSettings import set [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 )
#.........这里部分代码省略.........
开发者ID:monsta,项目名称:mintmenu,代码行数:103,代码来源:recent.py

示例2: mintMenuConfig

# 需要导入模块: from easygsettings import EasyGSettings [as 别名]
# 或者: from easygsettings.EasyGSettings import set [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" )
#.........这里部分代码省略.........
开发者ID:TheUltimatePotato,项目名称:mintmenu,代码行数:103,代码来源:mintMenuConfig.py

示例3: snowMenuConfig

# 需要导入模块: from easygsettings import EasyGSettings [as 别名]
# 或者: from easygsettings.EasyGSettings import set [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)
#.........这里部分代码省略.........
开发者ID:Snowlinux,项目名称:snowmenu,代码行数:103,代码来源:snowMenuConfig.py


注:本文中的easygsettings.EasyGSettings.set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。