DE detected in mintmenu, passed to plugins

This commit is contained in:
Clement Lefebvre 2011-03-29 18:50:33 +01:00
parent ee8889548a
commit ae4d79763b
5 changed files with 22 additions and 17 deletions

View File

@ -67,6 +67,8 @@ class MainWindow( object ):
self.path = PATH self.path = PATH
sys.path.append( os.path.join( self.path, "plugins") ) sys.path.append( os.path.join( self.path, "plugins") )
self.detect_desktop_environment()
self.icon = ICON self.icon = ICON
self.toggle = toggleButton self.toggle = toggleButton
@ -202,6 +204,15 @@ class MainWindow( object ):
opacity = float(self.opacity) / float(100) opacity = float(self.opacity) / float(100)
print "Setting opacity to: " + str(opacity) print "Setting opacity to: " + str(opacity)
self.window.set_opacity(opacity) self.window.set_opacity(opacity)
def detect_desktop_environment (self):
self.de = "gnome"
try:
de = commands.getoutput("/usr/lib/linuxmint/mintMenu/detectDE")
if de in ["gnome", "kde", "xfce"]:
self.de = de
except Exception, detail:
print detail
def PopulatePlugins( self ): def PopulatePlugins( self ):
self.panesToColor = [ ] self.panesToColor = [ ]
@ -233,7 +244,7 @@ class MainWindow( object ):
MyPlugin = X.pluginclass() MyPlugin = X.pluginclass()
else: else:
# pass mintMenu and togglebutton instance so that the plugin can use it # pass mintMenu and togglebutton instance so that the plugin can use it
MyPlugin = X.pluginclass( self, self.toggle ) MyPlugin = X.pluginclass( self, self.toggle, self.de )
if not MyPlugin.icon: if not MyPlugin.icon:
MyPlugin.icon = "gnome-logo-icon.png" MyPlugin.icon = "gnome-logo-icon.png"

View File

@ -210,12 +210,14 @@ class pluginclass( object ):
fromFav = [ ( "FAVORITES", gtk.TARGET_SAME_APP, TARGET_TYPE_FAV ) ] fromFav = [ ( "FAVORITES", gtk.TARGET_SAME_APP, TARGET_TYPE_FAV ) ]
@print_timing @print_timing
def __init__( self, mintMenuWin, toggleButton ): def __init__( self, mintMenuWin, toggleButton, de ):
self.mintMenuWin = mintMenuWin self.mintMenuWin = mintMenuWin
self.mainMenus = [ ] self.mainMenus = [ ]
self.toggleButton = toggleButton self.toggleButton = toggleButton
self.de = de
# The Glade file for the plugin # The Glade file for the plugin
self.gladefile = os.path.join( os.path.dirname( __file__ ), "applications.glade" ) self.gladefile = os.path.join( os.path.dirname( __file__ ), "applications.glade" )

View File

@ -21,10 +21,11 @@ gettext.install("mintmenu", "/usr/share/linuxmint/locale")
class pluginclass( object ): class pluginclass( object ):
def __init__( self, mintMenuWin, toggleButton ): def __init__( self, mintMenuWin, toggleButton, de ):
self.mintMenuWin = mintMenuWin self.mintMenuWin = mintMenuWin
self.toggleButton = toggleButton self.toggleButton = toggleButton
self.de = de
# Read GLADE file # Read GLADE file
gladefile = os.path.join( os.path.dirname( __file__ ), "places.glade" ) gladefile = os.path.join( os.path.dirname( __file__ ), "places.glade" )
@ -65,18 +66,7 @@ class pluginclass( object ):
self.GetGconfEntries() self.GetGconfEntries()
self.content_holder.set_size_request( self.width, self.height ) self.content_holder.set_size_request( self.width, self.height )
self.detect_desktop_environment()
def detect_desktop_environment (self):
self.de = "gnome"
try:
de = commands.getoutput("/usr/lib/linuxmint/mintMenu/detectDE")
if de in ["gnome", "kde", "xfce"]:
self.de = de
except Exception, detail:
print detail
def wake (self) : def wake (self) :
if ( self.showtrash == True ): if ( self.showtrash == True ):

View File

@ -18,10 +18,11 @@ class pluginclass:
"""This is the main class for the plugin""" """This is the main class for the plugin"""
"""It MUST be named pluginclass""" """It MUST be named pluginclass"""
def __init__( self, mintMenuWin, toggleButton ): def __init__( self, mintMenuWin, toggleButton, de ):
self.Win = mintMenuWin self.Win = mintMenuWin
self.toggleButton = toggleButton self.toggleButton = toggleButton
self.de = de
#The Glade file for the plugin #The Glade file for the plugin
self.gladefile = os.path.join( os.path.dirname( __file__ ), "recent.glade" ) self.gladefile = os.path.join( os.path.dirname( __file__ ), "recent.glade" )

View File

@ -17,10 +17,11 @@ gettext.install("mintmenu", "/usr/share/linuxmint/locale")
class pluginclass( object ): class pluginclass( object ):
def __init__( self, mintMenuWin, toggleButton ): def __init__( self, mintMenuWin, toggleButton, de ):
self.mintMenuWin = mintMenuWin self.mintMenuWin = mintMenuWin
self.toggleButton = toggleButton self.toggleButton = toggleButton
self.de = de
# Read GLADE file # Read GLADE file
gladefile = os.path.join( os.path.dirname( __file__ ), "system_management.glade" ) gladefile = os.path.join( os.path.dirname( __file__ ), "system_management.glade" )