本文整理汇总了Python中easygconf.EasyGConf类的典型用法代码示例。如果您正苦于以下问题:Python EasyGConf类的具体用法?Python EasyGConf怎么用?Python EasyGConf使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EasyGConf类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_standard_places
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") )
示例2: __init__
def __init__(self, applet, iid):
self.applet = applet
self.gconf = EasyGConf("/apps/mintMenu/")
self.gconf.notifyAdd("applet_text", self.gconfEntriesChanged)
self.gconf.notifyAdd("theme_name", self.changeTheme)
self.gconf.notifyAdd("hot_key", self.gconfEntriesChanged)
self.gconf.notifyAdd("applet_icon", self.gconfEntriesChanged)
self.gconf.notifyAdd("hide_applet_icon", self.gconfEntriesChanged)
self.gconf.notifyAdd("applet_icon_size", self.gconfEntriesChanged)
self.getGconfEntries()
self.gconftheme = EasyGConf("/desktop/gnome/interface/")
self.gconftheme.notifyAdd("gtk_theme", self.changeTheme)
self.createPanelButton()
self.applet.set_applet_flags(gnomeapplet.EXPAND_MINOR)
self.applet.connect("button-press-event", self.showMenu)
self.applet.connect("change-orient", self.changeOrientation)
self.applet.connect("change-background", self.changeBackground)
self.applet.connect("enter-notify-event", self.enter_notify)
self.applet.connect("leave-notify-event", self.leave_notify)
self.mainwin = MainWindow(self.button_box)
self.mainwin.window.connect("map-event", lambda *args: self.applet.set_state(gtk.STATE_SELECTED))
self.mainwin.window.connect("unmap-event", lambda *args: self.applet.set_state(gtk.STATE_NORMAL))
self.mainwin.window.connect("size-allocate", lambda *args: self.positionMenu())
self.mainwin.window.set_name("mintmenu") # Name used in Gtk RC files
icon = iconManager.getIcon(self.mainwin.icon, 1)
if icon:
gtk.window_set_default_icon(icon)
self.propxml = """
<popup name="button3">
<menuitem name="Item 1" verb="Preferences" label="%s" pixtype="stock" pixname="gtk-preferences" />
<menuitem name="Item 1" verb="Edit" label="%s" pixtype="stock" pixname="gtk-edit" />
<menuitem name="Item 2" verb="Reload" label="%s" pixtype="stock" pixname="gtk-refresh" />
<menuitem name="Item 3" verb="About" label="%s" pixtype="stock" pixname="gtk-about" />
</popup>
""" % (
_("Preferences"),
_("Edit menu"),
_("Reload plugins"),
_("About"),
)
self.verbs = [
("Preferences", self.showPreferences),
("Edit", self.showMenuEditor),
("About", self.showAboutDialog),
("Reload", self.mainwin.RegenPlugins),
]
self.bind_hot_key()
示例3: __init__
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.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 )
示例4: MenuWin
class MenuWin( object ):
def __init__( self, applet, iid ):
self.applet = applet
self.gconf = EasyGConf( "/apps/mintMenu/" )
self.gconf.notifyAdd( "applet_text", self.gconfEntriesChanged )
self.gconf.notifyAdd( "hot_key", self.gconfEntriesChanged )
self.gconf.notifyAdd( "applet_icon", self.gconfEntriesChanged )
self.gconf.notifyAdd( "hide_applet_icon", self.gconfEntriesChanged )
self.gconf.notifyAdd( "applet_icon_size", self.gconfEntriesChanged )
self.getGconfEntries()
self.createPanelButton()
self.applet.set_applet_flags( gnomeapplet.EXPAND_MINOR )
self.applet.connect( "button-press-event", self.showMenu )
self.applet.connect( "change-orient", self.changeOrientation )
self.applet.connect( "change-background", self.changeBackground )
self.applet.connect("enter-notify-event", self.enter_notify)
self.applet.connect("leave-notify-event", self.leave_notify)
self.mainwin = MainWindow( self.button_box )
self.mainwin.window.connect( "map-event", lambda *args: self.applet.set_state( gtk.STATE_SELECTED ) )
self.mainwin.window.connect( "unmap-event", lambda *args: self.applet.set_state( gtk.STATE_NORMAL ) )
self.mainwin.window.connect( "size-allocate", lambda *args: self.positionMenu() )
icon = iconManager.getIcon( self.mainwin.icon, 1 )
if icon:
gtk.window_set_default_icon( icon )
self.propxml = """
<popup name="button3">
<menuitem name="Item 1" verb="Preferences" label="%s" pixtype="stock" pixname="gtk-preferences" />
<menuitem name="Item 1" verb="Edit" label="%s" pixtype="stock" pixname="gtk-edit" />
<menuitem name="Item 2" verb="Reload" label="%s" pixtype="stock" pixname="gtk-refresh" />
<menuitem name="Item 3" verb="About" label="%s" pixtype="stock" pixname="gtk-about" />
</popup>
""" % ( _("Preferences"), _("Edit menu"), _("Reload plugins"), _("About") )
self.verbs = [ ("Preferences", self.showPreferences), ("Edit", self.showMenuEditor), ("About", self.showAboutDialog), ("Reload",self.mainwin.RegenPlugins) ]
self.bind_hot_key()
def onBindingPress(self):
try:
if self.mainwin.window.flags() & gtk.VISIBLE:
self.mainwin.window.hide()
self.mainwin.toggle.set_active(False)
else:
MenuWin.showMenu(self,self.mainwin.toggle)
self.mainwin.window.show()
#self.mainwin.wTree.get_widget( 'PluginTabs' ).set_curremenu_editor = SetGconf( self.client, "string", "/apps/usp/menu_editor", "alacarte" )
except Exception, cause:
print cause
示例5: __init__
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 )
示例6: __init__
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__ ), "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( "show_gtk_bookmarks", 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 )
示例7: pluginclass
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
#.........这里部分代码省略.........
示例8: MainWindow
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 ):
#.........这里部分代码省略.........
示例9: __init__
#.........这里部分代码省略.........
self.buttonIconImage = wTree.get_widget( "image_button_icon" )
self.searchCommand = wTree.get_widget( "search_command" )
self.computertoggle = wTree.get_widget( "computercheckbutton" )
self.homefoldertoggle = wTree.get_widget( "homecheckbutton" )
self.networktoggle = wTree.get_widget( "networkcheckbutton" )
self.desktoptoggle = wTree.get_widget( "desktopcheckbutton" )
self.trashtoggle = wTree.get_widget( "trashcheckbutton" )
self.customplacestree = wTree.get_widget( "customplacestree" )
self.allowPlacesScrollbarToggle = wTree.get_widget( "allowscrollbarcheckbutton" )
self.placesHeightButton = wTree.get_widget( "placesHeightSpinButton" )
if (self.allowPlacesScrollbarToggle.get_active() == False):
self.placesHeightButton.set_sensitive(False)
self.allowPlacesScrollbarToggle.connect("toggled", self.togglePlacesHeightEnabled )
self.softwareManagerToggle = wTree.get_widget( "softwaremanagercheckbutton" )
self.packageManagerToggle = wTree.get_widget( "packagemanagercheckbutton" )
self.controlCenterToggle = wTree.get_widget( "controlcentercheckbutton" )
self.packageManagerToggle = wTree.get_widget( "packagemanagercheckbutton" )
self.terminalToggle = wTree.get_widget( "terminalcheckbutton" )
self.lockToggle = wTree.get_widget( "lockcheckbutton" )
self.logoutToggle = wTree.get_widget( "logoutcheckbutton" )
self.quitToggle = wTree.get_widget( "quitcheckbutton" )
self.allowSystemScrollbarToggle = wTree.get_widget( "allowscrollbarcheckbutton1" )
self.systemHeightButton = wTree.get_widget( "systemHeightSpinButton" )
if (self.allowSystemScrollbarToggle.get_active() == False): self.systemHeightButton.set_sensitive(False)
self.allowSystemScrollbarToggle.connect("toggled", self.toggleSystemHeightEnabled )
if os.path.exists("/usr/lib/linuxmint/mintInstall/icon.svg"):
wTree.get_widget( "softwaremanagercheckbutton" ).show()
else:
wTree.get_widget( "softwaremanagercheckbutton" ).hide()
wTree.get_widget( "closeButton" ).connect("clicked", gtk.main_quit )
self.gconf = EasyGConf( "/apps/mintMenu/" )
self.gconfApplications = EasyGConf( "/apps/mintMenu/plugins/applications/" )
self.gconfPlaces = EasyGConf( "/apps/mintMenu/plugins/places/" )
self.gconfSystem = EasyGConf( "/apps/mintMenu/plugins/system-management/" )
self.useCustomColors.connect( "toggled", self.toggleUseCustomColors )
self.bindGconfValueToWidget( self.gconf, "bool", "start_with_favorites", self.startWithFavorites, "toggled", self.startWithFavorites.set_active, self.startWithFavorites.get_active )
self.bindGconfValueToWidget( self.gconf, "bool", "show_side_pane", self.showSidepane, "toggled", self.showSidepane.set_active, self.showSidepane.get_active )
self.bindGconfValueToWidget( self.gconfApplications, "bool", "show_application_comments", self.showAppComments, "toggled", self.showAppComments.set_active, self.showAppComments.get_active )
self.bindGconfValueToWidget( self.gconfApplications, "bool", "show_category_icons", self.showCategoryIcons, "toggled", self.showCategoryIcons.set_active, self.showCategoryIcons.get_active )
self.bindGconfValueToWidget( self.gconfApplications, "bool", "categories_mouse_over", self.hover, "toggled", self.hover.set_active, self.hover.get_active )
self.bindGconfValueToWidget( self.gconfApplications, "bool", "swap_generic_name", self.swapGeneric, "toggled", self.swapGeneric.set_active, self.swapGeneric.get_active )
self.bindGconfValueToWidget( self.gconfApplications, "int", "category_hover_delay", self.hoverDelay, "value-changed", self.hoverDelay.set_value, self.hoverDelay.get_value )
self.bindGconfValueToWidget( self.gconfApplications, "int", "icon_size", self.iconSize, "value-changed", self.iconSize.set_value, self.iconSize.get_value )
self.bindGconfValueToWidget( self.gconf, "int", "applet_icon_size", self.bttniconSize, "value-changed", self.bttniconSize.set_value, self.bttniconSize.get_value )
self.bindGconfValueToWidget( self.gconfApplications, "int", "favicon_size", self.favIconSize, "value-changed", self.favIconSize.set_value, self.favIconSize.get_value )
self.bindGconfValueToWidget( self.gconfApplications, "int", "fav_cols", self.favCols, "value-changed", self.favCols.set_value, self.favCols.get_value )
self.bindGconfValueToWidget( self.gconf, "int", "border_width", self.borderWidth, "value-changed", self.borderWidth.set_value, self.borderWidth.get_value_as_int )
self.bindGconfValueToWidget( self.gconf, "int", "opacity", self.opacity, "value-changed", self.opacity.set_value, self.opacity.get_value_as_int )
self.bindGconfValueToWidget( self.gconf, "bool", "use_custom_color", self.useCustomColors, "toggled", self.useCustomColors.set_active, self.useCustomColors.get_active )
self.bindGconfValueToWidget( self.gconf, "color", "custom_color", self.backgroundColor, "color-set", self.backgroundColor.set_color, self.getBackgroundColor )
self.bindGconfValueToWidget( self.gconf, "color", "custom_heading_color", self.headingColor, "color-set", self.headingColor.set_color, self.getHeadingColor )
self.bindGconfValueToWidget( self.gconf, "color", "custom_border_color", self.borderColor, "color-set", self.borderColor.set_color, self.getBorderColor )
self.bindGconfValueToWidget( self.gconf, "bool", "hide_applet_icon", self.showButtonIcon, "toggled", self.setShowButtonIcon, self.getShowButtonIcon )
self.bindGconfValueToWidget( self.gconf, "string", "applet_text", self.buttonText, "changed", self.buttonText.set_text, self.buttonText.get_text )
self.bindGconfValueToWidget( self.gconf, "string", "hot_key", self.hotkeyText, "changed", self.hotkeyText.set_text, self.hotkeyText.get_text )
self.bindGconfValueToWidget( self.gconf, "string", "applet_icon", self.buttonIcon, "changed", self.setButtonIcon, self.buttonIcon.get_text )
self.bindGconfValueToWidget( self.gconfApplications, "string", "search_command", self.searchCommand, "changed", self.searchCommand.set_text, self.searchCommand.get_text )
self.showRecentPlugin.connect("toggled", self.toggleRecent )
示例10: mintMenuConfig
#.........这里部分代码省略.........
self.buttonIconImage = wTree.get_widget( "image_button_icon" )
self.searchCommand = wTree.get_widget( "search_command" )
self.computertoggle = wTree.get_widget( "computercheckbutton" )
self.homefoldertoggle = wTree.get_widget( "homecheckbutton" )
self.networktoggle = wTree.get_widget( "networkcheckbutton" )
self.desktoptoggle = wTree.get_widget( "desktopcheckbutton" )
self.trashtoggle = wTree.get_widget( "trashcheckbutton" )
self.customplacestree = wTree.get_widget( "customplacestree" )
self.allowPlacesScrollbarToggle = wTree.get_widget( "allowscrollbarcheckbutton" )
self.placesHeightButton = wTree.get_widget( "placesHeightSpinButton" )
if (self.allowPlacesScrollbarToggle.get_active() == False):
self.placesHeightButton.set_sensitive(False)
self.allowPlacesScrollbarToggle.connect("toggled", self.togglePlacesHeightEnabled )
self.softwareManagerToggle = wTree.get_widget( "softwaremanagercheckbutton" )
self.packageManagerToggle = wTree.get_widget( "packagemanagercheckbutton" )
self.controlCenterToggle = wTree.get_widget( "controlcentercheckbutton" )
self.packageManagerToggle = wTree.get_widget( "packagemanagercheckbutton" )
self.terminalToggle = wTree.get_widget( "terminalcheckbutton" )
self.lockToggle = wTree.get_widget( "lockcheckbutton" )
self.logoutToggle = wTree.get_widget( "logoutcheckbutton" )
self.quitToggle = wTree.get_widget( "quitcheckbutton" )
self.allowSystemScrollbarToggle = wTree.get_widget( "allowscrollbarcheckbutton1" )
self.systemHeightButton = wTree.get_widget( "systemHeightSpinButton" )
if (self.allowSystemScrollbarToggle.get_active() == False): self.systemHeightButton.set_sensitive(False)
self.allowSystemScrollbarToggle.connect("toggled", self.toggleSystemHeightEnabled )
if os.path.exists("/usr/lib/linuxmint/mintInstall/icon.svg"):
wTree.get_widget( "softwaremanagercheckbutton" ).show()
else:
wTree.get_widget( "softwaremanagercheckbutton" ).hide()
wTree.get_widget( "closeButton" ).connect("clicked", gtk.main_quit )
self.gconf = EasyGConf( "/apps/mintMenu/" )
self.gconfApplications = EasyGConf( "/apps/mintMenu/plugins/applications/" )
self.gconfPlaces = EasyGConf( "/apps/mintMenu/plugins/places/" )
self.gconfSystem = EasyGConf( "/apps/mintMenu/plugins/system-management/" )
self.useCustomColors.connect( "toggled", self.toggleUseCustomColors )
self.bindGconfValueToWidget( self.gconf, "bool", "start_with_favorites", self.startWithFavorites, "toggled", self.startWithFavorites.set_active, self.startWithFavorites.get_active )
self.bindGconfValueToWidget( self.gconf, "bool", "show_side_pane", self.showSidepane, "toggled", self.showSidepane.set_active, self.showSidepane.get_active )
self.bindGconfValueToWidget( self.gconfApplications, "bool", "show_application_comments", self.showAppComments, "toggled", self.showAppComments.set_active, self.showAppComments.get_active )
self.bindGconfValueToWidget( self.gconfApplications, "bool", "show_category_icons", self.showCategoryIcons, "toggled", self.showCategoryIcons.set_active, self.showCategoryIcons.get_active )
self.bindGconfValueToWidget( self.gconfApplications, "bool", "categories_mouse_over", self.hover, "toggled", self.hover.set_active, self.hover.get_active )
self.bindGconfValueToWidget( self.gconfApplications, "bool", "swap_generic_name", self.swapGeneric, "toggled", self.swapGeneric.set_active, self.swapGeneric.get_active )
self.bindGconfValueToWidget( self.gconfApplications, "int", "category_hover_delay", self.hoverDelay, "value-changed", self.hoverDelay.set_value, self.hoverDelay.get_value )
self.bindGconfValueToWidget( self.gconfApplications, "int", "icon_size", self.iconSize, "value-changed", self.iconSize.set_value, self.iconSize.get_value )
self.bindGconfValueToWidget( self.gconf, "int", "applet_icon_size", self.bttniconSize, "value-changed", self.bttniconSize.set_value, self.bttniconSize.get_value )
self.bindGconfValueToWidget( self.gconfApplications, "int", "favicon_size", self.favIconSize, "value-changed", self.favIconSize.set_value, self.favIconSize.get_value )
self.bindGconfValueToWidget( self.gconfApplications, "int", "fav_cols", self.favCols, "value-changed", self.favCols.set_value, self.favCols.get_value )
self.bindGconfValueToWidget( self.gconf, "int", "border_width", self.borderWidth, "value-changed", self.borderWidth.set_value, self.borderWidth.get_value_as_int )
self.bindGconfValueToWidget( self.gconf, "int", "opacity", self.opacity, "value-changed", self.opacity.set_value, self.opacity.get_value_as_int )
self.bindGconfValueToWidget( self.gconf, "bool", "use_custom_color", self.useCustomColors, "toggled", self.useCustomColors.set_active, self.useCustomColors.get_active )
self.bindGconfValueToWidget( self.gconf, "color", "custom_color", self.backgroundColor, "color-set", self.backgroundColor.set_color, self.getBackgroundColor )
self.bindGconfValueToWidget( self.gconf, "color", "custom_heading_color", self.headingColor, "color-set", self.headingColor.set_color, self.getHeadingColor )
self.bindGconfValueToWidget( self.gconf, "color", "custom_border_color", self.borderColor, "color-set", self.borderColor.set_color, self.getBorderColor )
self.bindGconfValueToWidget( self.gconf, "bool", "hide_applet_icon", self.showButtonIcon, "toggled", self.setShowButtonIcon, self.getShowButtonIcon )
self.bindGconfValueToWidget( self.gconf, "string", "applet_text", self.buttonText, "changed", self.buttonText.set_text, self.buttonText.get_text )
self.bindGconfValueToWidget( self.gconf, "string", "hot_key", self.hotkeyText, "changed", self.hotkeyText.set_text, self.hotkeyText.get_text )
self.bindGconfValueToWidget( self.gconf, "string", "applet_icon", self.buttonIcon, "changed", self.setButtonIcon, self.buttonIcon.get_text )
self.bindGconfValueToWidget( self.gconfApplications, "string", "search_command", self.searchCommand, "changed", self.searchCommand.set_text, self.searchCommand.get_text )
self.showRecentPlugin.connect("toggled", self.toggleRecent )
示例11: pluginclass
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 )
#.........这里部分代码省略.........
示例12: MainWindow
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()
#.........这里部分代码省略.........
示例13: __init__
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
self.activeFilter = (1, "")
self.adminMenu = None
for mainitems in [ "applications.menu", "settings.menu" ]:
mymenu = Menu( mainitems )
mymenu.tree.add_monitor( self.menuChanged, None )
#.........这里部分代码省略.........
示例14: pluginclass
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
#.........这里部分代码省略.........