DE detected in mintmenu, passed to plugins
This commit is contained in:
parent
ee8889548a
commit
ae4d79763b
@ -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
|
||||||
@ -203,6 +205,15 @@ class MainWindow( object ):
|
|||||||
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 = [ ]
|
||||||
self.headingsToColor = [ ]
|
self.headingsToColor = [ ]
|
||||||
@ -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"
|
||||||
|
@ -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" )
|
||||||
|
|
||||||
|
@ -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" )
|
||||||
@ -67,17 +68,6 @@ class pluginclass( object ):
|
|||||||
|
|
||||||
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 ):
|
||||||
self.refreshTrash()
|
self.refreshTrash()
|
||||||
|
@ -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" )
|
||||||
|
@ -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" )
|
||||||
|
Loading…
Reference in New Issue
Block a user