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


Python EasyGSettings.notifyAdd方法代码示例

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


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

示例1: __init__

# 需要导入模块: from easygsettings import EasyGSettings [as 别名]
# 或者: from easygsettings.EasyGSettings import notifyAdd [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: pluginclass

# 需要导入模块: from easygsettings import EasyGSettings [as 别名]
# 或者: from easygsettings.EasyGSettings import notifyAdd [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" )

#.........这里部分代码省略.........
开发者ID:Rogentos,项目名称:mintmenu,代码行数:103,代码来源:places.py

示例3: pluginclass

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


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