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


Python EasyGConf.get方法代码示例

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


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

示例1: do_standard_places

# 需要导入模块: from easygconf import EasyGConf [as 别名]
# 或者: from easygconf.EasyGConf import get [as 别名]
    def do_standard_places( self ):

        if ( self.showcomputer == True ):
            Button1 = easyButton( "computer", self.iconsize, [_("Computer")], -1, -1 )
            if self.de == "mate":
                Button1.connect( "clicked", self.ButtonClicked, "caja computer:" )
            else:
                Button1.connect( "clicked", self.ButtonClicked, "xdg-open /" )
            Button1.show()
            self.placesBtnHolder.pack_start( Button1, False, False )
            self.mintMenuWin.setTooltip( Button1, _("Browse all local and remote disks and folders accessible from this computer") )

        if ( self.showhomefolder == True ):
            Button2 = easyButton( "user-home", self.iconsize, [_("Home Folder")], -1, -1 )
            if self.de == "mate":
                Button2.connect( "clicked", self.ButtonClicked, "caja %s " % home )
            else:
                Button2.connect( "clicked", self.ButtonClicked, "xdg-open %s " % home )
            Button2.show()
            self.placesBtnHolder.pack_start( Button2, False, False )
            self.mintMenuWin.setTooltip( Button2, _("Open your personal folder") )

        if ( self.shownetwork == True and self.de == "mate"):   
            gconftheme = EasyGConf( "/desktop/mate/interface/" )
            icon_theme = gconftheme.get("string", "icon_theme", "Mint-X")                     
            if "Mint-X" in icon_theme:
                Button3 = easyButton( "notification-network-ethernet-connected", self.iconsize, [_("Network")], -1, -1)
            else:
                Button3 = easyButton( "network-workgroup", self.iconsize, [_("Network")], -1, -1)
            if self.de == "mate":
                Button3.connect( "clicked", self.ButtonClicked, "caja network:" )
            else:
                Button3.connect( "clicked", self.ButtonClicked, "xdg-open network:" )
            Button3.show()
            self.placesBtnHolder.pack_start( Button3, False, False )
            self.mintMenuWin.setTooltip( Button3, _("Browse bookmarked and local network locations") )

        if ( self.showdesktop == True ):
            # Determine where the Desktop folder is (could be localized)
            desktopDir = home + "/Desktop"
            try:
                import sys
                sys.path.append('/usr/lib/linuxmint/common')
                from configobj import ConfigObj
                config = ConfigObj(home + "/.config/user-dirs.dirs")
                tmpdesktopDir = config['XDG_DESKTOP_DIR']
                tmpdesktopDir = commands.getoutput("echo " + tmpdesktopDir)
                if os.path.exists(tmpdesktopDir):
                    desktopDir = tmpdesktopDir
            except Exception, detail:
                print detail
            Button4 = easyButton( "mate-fs-desktop", self.iconsize, [_("Desktop")], -1, -1 )
            if self.de == "mate":
                Button4.connect( "clicked", self.ButtonClicked, "caja \"" + desktopDir + "\"")
            else:
                Button4.connect( "clicked", self.ButtonClicked, "xdg-open \"" + desktopDir + "\"")
            Button4.show()
            self.placesBtnHolder.pack_start( Button4, False, False )
            self.mintMenuWin.setTooltip( Button4, _("Browse items placed on the desktop") )
开发者ID:kevinc,项目名称:mintmenu,代码行数:61,代码来源:places.py

示例2: pluginclass

# 需要导入模块: from easygconf import EasyGConf [as 别名]
# 或者: from easygconf.EasyGConf import get [as 别名]
class pluginclass( object ):
	
	def __init__( self, mintMenuWin, toggleButton ):
		
		self.mintMenuWin = mintMenuWin
		self.toggleButton = toggleButton
		
		# Read GLADE file
		gladefile = os.path.join( os.path.dirname( __file__ ), "places.glade" )
		wTree 	= gtk.glade.XML( gladefile, "mainWindow" )
		self.placesBtnHolder	= wTree.get_widget( "places_button_holder" )
		self.editableBtnHolder 	= wTree.get_widget( "editable_button_holder" )
		self.scrolledWindow=wTree.get_widget("scrolledwindow2")
		# These properties are NECESSARY to maintain consistency

		# Set 'window' property for the plugin (Must be the root widget)
		self.window = wTree.get_widget( "mainWindow" )

		# Set 'heading' property for plugin
		self.heading = _("Places")

		# This should be the first item added to the window in glade
		self.content_holder = wTree.get_widget( "Places" )

		# Items to get custom colors
		self.itemstocolor = [ wTree.get_widget( "viewport2" ) ]

		# Gconf stuff
		self.gconf = EasyGConf( "/apps/mintMenu/plugins/places/" )

		self.gconf.notifyAdd( "icon_size", self.RegenPlugin )
		self.gconf.notifyAdd( "show_computer", self.RegenPlugin )
		self.gconf.notifyAdd( "show_desktop", self.RegenPlugin )
		self.gconf.notifyAdd( "show_home_folder", self.RegenPlugin )
		self.gconf.notifyAdd( "show_network", self.RegenPlugin )
		self.gconf.notifyAdd( "show_trash", self.RegenPlugin )
		self.gconf.notifyAdd( "custom_names", self.RegenPlugin )
		self.gconf.notifyAdd( "custom_paths", self.RegenPlugin )
		self.gconf.notifyAdd( "allowScrollbar", self.RegenPlugin )
		self.gconf.notifyAdd( "height", self.changePluginSize )
		self.gconf.notifyAdd( "width", self.changePluginSize )		
		self.gconf.bindGconfEntryToVar( "bool", "sticky", self, "sticky" )

		self.GetGconfEntries()
		
		self.content_holder.set_size_request( self.width, self.height )

	def wake (self) :
		if ( self.showtrash == True ):
			self.refreshTrash()

	def destroy( self ):
		self.gconf.notifyRemoveAll()		

	def changePluginSize( self, client, connection_id, entry, args ):
		self.allowScrollbar = self.gconf.get( "bool", "allowScrollbar", False)
		if entry.get_key() == self.gconf.gconfDir+"width":
			self.width = entry.get_value().get_int()
		elif entry.get_key() == self.gconf.gconfDir+"height":
			if (self.allowScrollbar == False):
				self.height = -1
				self.scrolledWindow.set_policy( gtk.POLICY_AUTOMATIC, gtk.POLICY_NEVER )
			else:
				self.scrolledWindow.set_policy( gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC )
				self.height = entry.get_value().get_int()

		self.content_holder.set_size_request( self.width, self.height )
		


	def RegenPlugin( self, *args, **kargs ):
		self.GetGconfEntries()
		self.ClearAll()
		self.do_standard_places()
		self.do_custom_places()

	def GetGconfEntries( self ):

		self.width = self.gconf.get( "int", "width", 200 )
		self.allowScrollbar = self.gconf.get( "bool", "allowScrollbar", False)
		self.scrolledWindow.set_policy( gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC )
		self.height = self.gconf.get( "int", "height", 180 )
		self.content_holder.set_size_request( self.width, self.height )
		if (self.allowScrollbar == False):
			self.height = -1
			self.scrolledWindow.set_policy( gtk.POLICY_AUTOMATIC, gtk.POLICY_NEVER )
		self.content_holder.set_size_request( self.width, self.height )
		self.execapp = self.gconf.get( "string", "execute_app", "nautilus" )
		self.iconsize = self.gconf.get( "int","icon_size", 2 )
		
		# Check default items
		
		self.showcomputer = self.gconf.get( "bool", "show_computer", True )
		self.showhomefolder = self.gconf.get( "bool", "show_home_folder", True )
		self.shownetwork = self.gconf.get( "bool", "show_network", True )
		self.showdesktop = self.gconf.get( "bool", "show_desktop", True )
		self.showtrash = self.gconf.get( "bool", "show_trash", True )
		
		# Get paths for custom items
		
#.........这里部分代码省略.........
开发者ID:unamanic,项目名称:mintmenu,代码行数:103,代码来源:places.py

示例3: MainWindow

# 需要导入模块: from easygconf import EasyGConf [as 别名]
# 或者: from easygconf.EasyGConf import get [as 别名]
class MainWindow( object ):
	"""This is the main class for the application"""

	def __init__( self, toggleButton ):

		self.path = PATH
		sys.path.append( os.path.join( self.path, "plugins") )

		self.icon = ICON

		self.toggle = toggleButton
		# Load glade file and extract widgets
		gladefile 	= os.path.join( self.path, "mintMenu.glade" )
		wTree 		= gtk.glade.XML( gladefile, "mainWindow" )
		self.window 	= wTree.get_widget( "mainWindow" )
		self.paneholder = wTree.get_widget( "paneholder" )
		self.sidepane 	= wTree.get_widget( "sidepane" )
		self.pinbutton	= wTree.get_widget( "pin_button" )
		self.pinholder	= wTree.get_widget( "pinholder" )
		self.border	= wTree.get_widget( "border" )

		self.panesToColor = [ ]
		self.headingsToColor = [ ]
		
		self.window.connect( "map-event", self.onMap )
		self.window.connect( "show", self.onShow )
		self.window.connect( "unmap-event", self.onUnmap )
		self.window.connect( "button-press-event", self.onButtonPress )
		self.window.connect( "key-press-event", self.onKeyPress )
		self.window.connect( "grab-broken-event", self.onGrabBroken )

		self.window.stick()

		plugindir = os.path.join( os.path.expanduser( "~" ), ".linuxmint/mintMenu/plugins" )
		sys.path.append( plugindir )

		dic = {"on_window1_destroy" : self.quit_cb,
		       "on_pin_button_toggled" : self.PinMenu}
		wTree.signal_autoconnect( dic )

		self.gconf = EasyGConf( "/apps/mintMenu/" )
		self.gconftheme = EasyGConf( "/desktop/gnome/interface/" )

		self.getSetGconfEntries()
		self.SetupMintMenuBorder()

		self.tooltips = gtk.Tooltips()
		if self.globalEnableTooltips and self.enableTooltips:
			self.tooltips.enable()
		else:
			self.tooltips.disable()

		self.PopulatePlugins();

		self.gconf.notifyAdd( "plugins_list", self.RegenPlugins )
		self.gconftheme.notifyAdd( "gtk_theme", self.RegenPlugins )
		
		self.gconf.notifyAdd( "show_side_pane", self.toggleShowSidepane )
		self.gconf.notifyAdd( "start_with_favorites", self.toggleStartWithFavorites )
		self.gconf.notifyAdd( "/apps/panel/global/tooltips_enabled", self.toggleTooltipsEnabled )
		self.gconf.notifyAdd( "tooltips_enabled", self.toggleTooltipsEnabled )

		self.gconf.notifyAdd( "use_custom_color", self.toggleUseCustomColor )
		self.gconf.notifyAdd( "custom_border_color", self.toggleCustomBorderColor )
		self.gconf.notifyAdd( "custom_heading_color", self.toggleCustomHeadingColor )
		self.gconf.notifyAdd( "custom_color", self.toggleCustomBackgroundColor )
		self.gconf.notifyAdd( "border_width", self.toggleBorderWidth )
		
	def quit_cb (self):
 		gtk.main_quit()
 		sys.exit(0)

	def wakePlugins( self ):		
		# Call each plugin and let them know we're showing up						
		for plugin in self.plugins.values():
			if hasattr( plugin, "destroy" ):
				plugin.wake()

	def toggleTooltipsEnabled( self, client, connection_id, entry, args ):
		if entry.get_key() == "/apps/panel/global/tooltips_enabled":
			self.globalEnableTooltips = entry.get_value().get_bool()
		else:
			self.enableTooltips = entry.get_value().get_bool()

		if self.globalEnableTooltips and self.enableTooltips:
			self.tooltips.enable()
		else:
			self.tooltips.disable()

	def toggleStartWithFavorites( self, client, connection_id, entry, args ):
		self.startWithFavorites = entry.get_value().get_bool()

	def toggleShowSidepane( self, client, connection_id, entry, args ):
		self.sidepanevisible = entry.get_value().get_bool()
		if self.sidepanevisible == False and self.pinmenu == False:
			self.sidepane.hide()
		else:
			self.sidepane.show()

	def toggleBorderWidth( self, client, connection_id, entry, args ):
#.........这里部分代码省略.........
开发者ID:dvictor,项目名称:mintmenu,代码行数:103,代码来源:mintMenu.py

示例4: mintMenuConfig

# 需要导入模块: from easygconf import EasyGConf [as 别名]
# 或者: from easygconf.EasyGConf 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
		gladefile = os.path.join( self.path, "mintMenuConfig.glade" )
		wTree 	  = gtk.glade.XML( gladefile, "mainWindow" )
		self.mainWindow=wTree.get_widget("mainWindow")

		#i18n
		self.mainWindow.set_title(_("Menu preferences"))
		self.mainWindow.set_icon_from_file("/usr/lib/linuxmint/mintMenu/icon.svg")

		wTree.get_widget("startWithFavorites").set_label(_("Always start with favorites pane"))
		wTree.get_widget("showSidepane").set_label(_("Show sidepane"))
		wTree.get_widget("showButtonIcon").set_label(_("Show button icon"))
		wTree.get_widget("useCustomColors").set_label(_("Use custom colors"))
		wTree.get_widget("showRecentPlugin").set_label(_("Show recent documents"))

		wTree.get_widget("showAppComments").set_label(_("Show application comments"))
		wTree.get_widget("showCategoryIcons").set_label(_("Show category icons"))
		wTree.get_widget("hover").set_label(_("Hover"))
		wTree.get_widget("swapGeneric").set_label(_("Swap name and generic name"))

		wTree.get_widget("label11").set_text(_("Border width:"))
		wTree.get_widget("label2").set_text(_("pixels"))

		wTree.get_widget("label8").set_text(_("Opacity:"))
		wTree.get_widget("label9").set_text("%")

		wTree.get_widget("buttonTextLabel").set_text(_("Button text:"))
		wTree.get_widget("label1").set_text(_("Options"))
		wTree.get_widget("label23").set_text(_("Applications"))

		wTree.get_widget("colorsLabel").set_text(_("Colors"))
		wTree.get_widget("favLabel").set_text(_("Favorites"))
		wTree.get_widget("label3").set_text(_("Main button"))
		
		wTree.get_widget("backgroundColorLabel").set_text(_("Background:"))
		wTree.get_widget("headingColorLabel").set_text(_("Headings:"))
		wTree.get_widget("borderColorLabel").set_text(_("Borders:"))
		
		#wTree.get_widget("applicationsLabel").set_text(_("Applications"))
		#wTree.get_widget("favoritesLabel").set_text(_("Favorites"))
		wTree.get_widget("numberColumnsLabel").set_text(_("Number of columns:"))
		wTree.get_widget("iconSizeLabel").set_text(_("Icon size:"))
		wTree.get_widget("iconSizeLabel2").set_text(_("Icon size:"))
		wTree.get_widget("label44").set_text(_("Icon size:"))		
		wTree.get_widget("hoverLabel").set_text(_("Hover delay (ms):"))
		wTree.get_widget("label4").set_text(_("Button icon:"))
		wTree.get_widget("label5").set_text(_("Search command:"))

		wTree.get_widget("placesLabel").set_text(_("Places"))
		wTree.get_widget("allowscrollbarcheckbutton").set_label(_("Allow Scrollbar"))
		wTree.get_widget("placesHeightEntryLabel").set_text(_("Height:"))
		wTree.get_widget("defaultPlacesFrameLabel").set_text(_("Toggle Default Places:"))
		wTree.get_widget("computercheckbutton").set_label(_("Computer"))
		wTree.get_widget("homecheckbutton").set_label(_("Home Folder"))
		wTree.get_widget("networkcheckbutton").set_label(_("Network"))
		wTree.get_widget("desktopcheckbutton").set_label(_("Desktop"))
		wTree.get_widget("trashcheckbutton").set_label(_("Trash"))
		wTree.get_widget("customPlacesFrameLabel").set_text(_("Custom Places:"))

		wTree.get_widget("systemLabel").set_text(_("System"))
		wTree.get_widget("allowscrollbarcheckbutton1").set_label(_("Allow Scrollbar"))
		wTree.get_widget("systemHeightEntryLabel").set_text(_("Height:"))
		wTree.get_widget("defaultItemsFrameLabel").set_text(_("Toggle Default Items:"))
		wTree.get_widget("softwaremanagercheckbutton").set_label(_("Software Manager"))
		wTree.get_widget("packagemanagercheckbutton").set_label(_("Package Manager"))
		wTree.get_widget("controlcentercheckbutton").set_label(_("Control Center"))
		wTree.get_widget("terminalcheckbutton").set_label(_("Terminal"))
		wTree.get_widget("lockcheckbutton").set_label(_("Lock Screen"))
		wTree.get_widget("logoutcheckbutton").set_label(_("Log Out"))
		wTree.get_widget("quitcheckbutton").set_label(_("Quit"))

		self.editPlaceDialogTitle = (_("Edit Place"))
		self.newPlaceDialogTitle = (_("New Place"))
		self.folderChooserDialogTitle = (_("Select a folder"))

		wTree.get_widget("hotkey_label").set_text(_("Keyboard shortcut:"))

		self.startWithFavorites = wTree.get_widget( "startWithFavorites" )
		self.showSidepane = wTree.get_widget( "showSidepane" )
		self.showAppComments = wTree.get_widget( "showAppComments" )
		self.showCategoryIcons = wTree.get_widget( "showCategoryIcons" )
		self.showRecentPlugin = wTree.get_widget( "showRecentPlugin" )
		self.swapGeneric = wTree.get_widget("swapGeneric")
		self.hover = wTree.get_widget( "hover" )
		self.hoverDelay = wTree.get_widget( "hoverDelay" )
		self.bttniconSize = wTree.get_widget( "main_button_icon_size" )
		self.iconSize = wTree.get_widget( "iconSize" )
		self.favIconSize = wTree.get_widget( "favIconSize" )
		self.favCols = wTree.get_widget( "numFavCols" )
		self.borderWidth = wTree.get_widget( "borderWidth" )
		self.opacity = wTree.get_widget( "opacity" )
		self.useCustomColors = wTree.get_widget( "useCustomColors" )
		self.backgroundColor = wTree.get_widget( "backgroundColor" )
		self.borderColor = wTree.get_widget( "borderColor" )
#.........这里部分代码省略.........
开发者ID:intarstudents,项目名称:mintmenu,代码行数:103,代码来源:mintMenuConfig.py

示例5: pluginclass

# 需要导入模块: from easygconf import EasyGConf [as 别名]
# 或者: from easygconf.EasyGConf import get [as 别名]
class pluginclass( object ):

    def __init__( self, mintMenuWin, toggleButton, de ):

        self.mintMenuWin = mintMenuWin
        self.toggleButton = toggleButton
        self.de = de

        # Read GLADE file
        gladefile                               = os.path.join( os.path.dirname( __file__ ), "system_management.glade" )
        wTree                                   = gtk.glade.XML( gladefile, "mainWindow" )
        self.systemBtnHolder    = wTree.get_widget( "system_button_holder" )
        self.editableBtnHolder  = wTree.get_widget( "editable_button_holder" )
        self.scrolledWindow = wTree.get_widget( "scrolledwindow2" )

        # These properties are NECESSARY to maintain consistency

        # Set 'window' property for the plugin (Must be the root widget)
        self.window = wTree.get_widget( "mainWindow" )

        # Set 'heading' property for plugin
        self.heading = _("System")

        # This should be the first item added to the window in glade
        self.content_holder = wTree.get_widget( "System" )

        # Items to get custom colors
        self.itemstocolor = [ wTree.get_widget( "viewport2" ) ]

        # Gconf stuff
        self.gconf = EasyGConf( "/apps/mintMenu/plugins/system-management/" )

        self.gconf.notifyAdd( "icon_size", self.RegenPlugin )
        self.gconf.notifyAdd( "show_control_center", self.RegenPlugin )
        self.gconf.notifyAdd( "show_lock_screen", self.RegenPlugin )
        self.gconf.notifyAdd( "show_logout", self.RegenPlugin )
        self.gconf.notifyAdd( "show_package_manager", self.RegenPlugin )
        self.gconf.notifyAdd( "show_software_manager", self.RegenPlugin )
        self.gconf.notifyAdd( "show_terminal", self.RegenPlugin )
        self.gconf.notifyAdd( "show_quit", self.RegenPlugin )
        self.gconf.notifyAdd( "allowScrollbar", self.RegenPlugin )
        self.gconf.notifyAdd( "height", self.changePluginSize )
        self.gconf.notifyAdd( "width", self.changePluginSize )
        self.gconf.bindGconfEntryToVar( "bool", "sticky", self, "sticky" )

        self.GetGconfEntries()

        self.content_holder.set_size_request( self.width, self.height )

    def destroy( self ):
        self.gconf.notifyRemoveAll()

    def wake (self) :
        pass

    def changePluginSize( self, client, connection_id, entry, args ):
        self.allowScrollbar = self.gconf.get( "bool", "allowScrollbar", False)
        if entry.get_key() == self.gconf.gconfDir+"width":
            self.width = entry.get_value().get_int()
        elif entry.get_key() == self.gconf.gconfDir+"height":
            if (self.allowScrollbar == False):
                self.height = -1
                self.scrolledWindow.set_policy( gtk.POLICY_AUTOMATIC, gtk.POLICY_NEVER )
            else:
                self.scrolledWindow.set_policy( gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC )
                self.height = entry.get_value().get_int()

        self.content_holder.set_size_request( self.width, self.height )


    def RegenPlugin( self, *args, **kargs ):
        self.GetGconfEntries()
        self.ClearAll()
        self.do_standard_items()

    def GetGconfEntries( self ):

        self.width = self.gconf.get( "int", "width", 200 )
        self.allowScrollbar = self.gconf.get( "bool", "allowScrollbar", False)
        self.scrolledWindow.set_policy( gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC )
        self.height = self.gconf.get( "int", "height", 180 )
        self.content_holder.set_size_request( self.width, self.height )
        if (self.allowScrollbar == False):
            self.height = -1
            self.scrolledWindow.set_policy( gtk.POLICY_AUTOMATIC, gtk.POLICY_NEVER )
        self.content_holder.set_size_request( self.width, self.height )
        self.iconsize = self.gconf.get( "int","icon_size", 16 )

        # Check toggles

        self.showSoftwareManager = self.gconf.get( "bool", "show_software_manager", True )
        self.showPackageManager = self.gconf.get( "bool", "show_package_manager", True )
        self.showControlCenter = self.gconf.get( "bool", "show_control_center", True )
        self.showTerminal = self.gconf.get( "bool", "show_terminal", True )
        self.showLockScreen = self.gconf.get( "bool", "show_lock_screen", True )
        self.showLogout = self.gconf.get( "bool", "show_logout", True )
        self.showQuit = self.gconf.get( "bool", "show_quit", True )

        # Hide vertical dotted separator
        self.hideseparator = self.gconf.get( "bool", "hide_separator", False )
#.........这里部分代码省略.........
开发者ID:stefano-k,项目名称:mintmenu,代码行数:103,代码来源:system_management.py

示例6: MainWindow

# 需要导入模块: from easygconf import EasyGConf [as 别名]
# 或者: from easygconf.EasyGConf import get [as 别名]
class MainWindow( object ):
    """This is the main class for the application"""

    def __init__( self, toggleButton ):

        self.path = PATH
        sys.path.append( os.path.join( self.path, "plugins") )

        self.detect_desktop_environment()

        self.icon = ICON

        self.toggle = toggleButton
        # Load glade file and extract widgets
        gladefile       = os.path.join( self.path, "mintMenu.glade" )
        wTree           = gtk.glade.XML( gladefile, "mainWindow" )
        self.window     = wTree.get_widget( "mainWindow" )
        self.paneholder = wTree.get_widget( "paneholder" )        
        self.border     = wTree.get_widget( "border" )

        self.panesToColor = [ ]
        self.headingsToColor = [ ]

        self.window.connect( "map-event", self.onMap )
        self.window.connect( "show", self.onShow )
        self.window.connect( "unmap-event", self.onUnmap )
        self.window.connect( "button-press-event", self.onButtonPress )
        self.window.connect( "key-press-event", self.onKeyPress )
        self.window.connect( "grab-broken-event", self.onGrabBroken )

        self.window.stick()

        plugindir = os.path.join( os.path.expanduser( "~" ), ".linuxmint/mintMenu/plugins" )
        sys.path.append( plugindir )

        dic = {"on_window1_destroy" : self.quit_cb}
        wTree.signal_autoconnect( dic )

        self.gconf = EasyGConf( "/apps/mintMenu/" )

        self.getSetGconfEntries()
        self.SetupMintMenuBorder()
        self.SetupMintMenuOpacity()

        self.tooltips = gtk.Tooltips()
        if self.globalEnableTooltips and self.enableTooltips:
            self.tooltips.enable()
        else:
            self.tooltips.disable()

        self.PopulatePlugins();

        self.gconf.notifyAdd( "plugins_list", self.RegenPlugins )
                
        self.gconf.notifyAdd( "start_with_favorites", self.toggleStartWithFavorites )
        self.gconf.notifyAdd( "/apps/panel/global/tooltips_enabled", self.toggleTooltipsEnabled )
        self.gconf.notifyAdd( "tooltips_enabled", self.toggleTooltipsEnabled )

        self.gconf.notifyAdd( "use_custom_color", self.toggleUseCustomColor )
        self.gconf.notifyAdd( "custom_border_color", self.toggleCustomBorderColor )
        self.gconf.notifyAdd( "custom_heading_color", self.toggleCustomHeadingColor )
        self.gconf.notifyAdd( "custom_color", self.toggleCustomBackgroundColor )
        self.gconf.notifyAdd( "border_width", self.toggleBorderWidth )
        self.gconf.notifyAdd( "opacity", self.toggleOpacity )

    def quit_cb (self):
        gtk.main_quit()
        sys.exit(0)

    def wakePlugins( self ):
        # Call each plugin and let them know we're showing up
        for plugin in self.plugins.values():
            if hasattr( plugin, "destroy" ):
                plugin.wake()

    def toggleTooltipsEnabled( self, client, connection_id, entry, args ):
        if entry.get_key() == "/apps/panel/global/tooltips_enabled":
            self.globalEnableTooltips = entry.get_value().get_bool()
        else:
            self.enableTooltips = entry.get_value().get_bool()

        if self.globalEnableTooltips and self.enableTooltips:
            self.tooltips.enable()
        else:
            self.tooltips.disable()

    def toggleStartWithFavorites( self, client, connection_id, entry, args ):
        self.startWithFavorites = entry.get_value().get_bool()    

    def toggleBorderWidth( self, client, connection_id, entry, args ):
        self.borderwidth = entry.get_value().get_int()
        self.SetupMintMenuBorder()

    def toggleOpacity( self, client, connection_id, entry, args ):
        self.opacity = entry.get_value().get_int()
        self.SetupMintMenuOpacity()

    def toggleUseCustomColor( self, client, connection_id, entry, args ):
        self.usecustomcolor = entry.get_value().get_bool()
        self.SetupMintMenuBorder()
#.........这里部分代码省略.........
开发者ID:kevinc,项目名称:mintmenu,代码行数:103,代码来源:mintMenu.py

示例7: pluginclass

# 需要导入模块: from easygconf import EasyGConf [as 别名]
# 或者: from easygconf.EasyGConf import get [as 别名]
class pluginclass( object ):
	TARGET_TYPE_TEXT = 80
	toButton = [ ( "text/uri-list", 0, TARGET_TYPE_TEXT ) ]
	TARGET_TYPE_FAV = 81
	toFav = [ ( "FAVORITES", gtk.TARGET_SAME_APP, TARGET_TYPE_FAV ), ( "text/plain", 0, 100 ), ( "text/uri-list", 0, 101 ) ]
	fromFav = [ ( "FAVORITES", gtk.TARGET_SAME_APP, TARGET_TYPE_FAV ) ]

	def __init__( self, mintMenuWin, toggleButton ):

		self.mintMenuWin = mintMenuWin
		
		self.mainMenus = [ ]

		self.toggleButton = toggleButton	
		# The Glade file for the plugin
		self.gladefile = os.path.join( os.path.dirname( __file__ ), "applications.glade" )

		# Read GLADE file
		self.wTree = gtk.glade.XML( self.gladefile, "mainWindow" )
		self.searchEntry = self.wTree.get_widget( "searchEntry" )
		self.searchButton = self.wTree.get_widget( "searchButton" )
		self.showAllAppsButton = self.wTree.get_widget( "showAllAppsButton" )
		self.showFavoritesButton = self.wTree.get_widget( "showFavoritesButton" )
		self.applicationsBox = self.wTree.get_widget( "applicationsBox" )
		self.categoriesBox = self.wTree.get_widget( "categoriesBox" )
		self.favoritesBox = self.wTree.get_widget( "favoritesBox" )
		self.applicationsScrolledWindow = self.wTree.get_widget( "applicationsScrolledWindow" )		

		#i18n
		self.wTree.get_widget("searchLabel").set_text("<span weight='bold'>" + _("Filter:") + "</span>")
		self.wTree.get_widget("searchLabel").set_use_markup(True)
		self.wTree.get_widget("label6").set_text("<span weight='bold'>" + _("Favorites") + "</span>")
		self.wTree.get_widget("label6").set_use_markup(True)
		self.wTree.get_widget("label7").set_text(_("All applications"))
		self.wTree.get_widget("label2").set_text("<span weight='bold'>" + _("All applications") + "</span>")
		self.wTree.get_widget("label2").set_use_markup(True)
		self.wTree.get_widget("label3").set_text(_("Favorites"))

		self.numApps = 0
		# These properties are NECESSARY to maintain consistency

		# Set 'window' property for the plugin (Must be the root widget)
		self.window = self.wTree.get_widget( "mainWindow" )

		# Set 'heading' property for plugin
		self.heading = _("Applications")

		# This should be the first item added to the window in glade
		self.content_holder = self.wTree.get_widget( "Applications" )

		# Items to get custom colors
		self.itemstocolor = [ self.wTree.get_widget( "viewport1" ), self.wTree.get_widget( "viewport2" ), self.wTree.get_widget( "viewport3" ), self.wTree.get_widget( "notebook2" ) ]

		# Unset all timers
		self.filterTimer = None
		self.menuChangedTimer = None
		# Hookup for text input
		self.content_holder.connect( "key-press-event", self.keyPress )

		self.favoritesBox.connect( "drag_data_received", self.ReceiveCallback )
		self.favoritesBox.drag_dest_set( gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_HIGHLIGHT | gtk.DEST_DEFAULT_DROP, self.toButton, gtk.gdk.ACTION_COPY )
		self.showFavoritesButton.connect( "drag_data_received", self.ReceiveCallback )
		self.showFavoritesButton.drag_dest_set( gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_HIGHLIGHT | gtk.DEST_DEFAULT_DROP, self.toButton, gtk.gdk.ACTION_COPY )

		self.searchButton.connect( "button_release_event", self.SearchWithButton )

		self.gconfHandlers = []
		# Gconf stuff		
		self.gconf = EasyGConf( "/apps/mintMenu/plugins/applications/" )
		self.GetGconfEntries()
		self.gconf.notifyAdd( "icon_size", self.changeIconSize )
		self.gconf.notifyAdd( "favicon_size", self.changeFavIconSize )
		self.gconf.notifyAdd( "height", self.changePluginSize )
		self.gconf.notifyAdd( "width", self.changePluginSize )
		self.gconf.notifyAdd( "categories_mouse_over", self.changeCategoriesMouseOver )
		self.gconf.notifyAdd( "swap_generic_name", self.changeSwapGenericName )
		self.gconf.notifyAdd( "show_category_icons", self.changeShowCategoryIcons )
		self.gconf.notifyAdd( "show_application_comments", self.changeShowApplicationComments )
		self.gconf.notifyAdd( "fav_cols", self.changeFavCols )
		
		self.gconf.bindGconfEntryToVar( "int", "category_hover_delay", self, "categoryhoverdelay" )
		self.gconf.bindGconfEntryToVar( "bool", "do_not_filter", self, "donotfilterapps" )
		self.gconf.bindGconfEntryToVar( "string", "search_command", self, "searchtool" )
		self.gconf.bindGconfEntryToVar( "int", "default_tab", self, "defaultTab" )

		self.currentFavCol = 0
		self.favorites = []

		self.content_holder.set_size_request( self.width, self.height )
		self.categoriesBox.set_size_request( self.width / 3, -1 )
		self.applicationsBox.set_size_request( self.width / 2, -1 )

		self.buildingButtonList = False
		self.stopBuildingButtonList = False

		self.categoryList = []
		self.applicationList = []
		self.menuFileMonitors = []
		
		self.rebuildLock = False
#.........这里部分代码省略.........
开发者ID:dvictor,项目名称:mintmenu,代码行数:103,代码来源:applications.py


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