commit
fbf13f70cc
@ -93,8 +93,20 @@ class MainWindow( object ):
|
||||
plugindir = os.path.join( os.path.expanduser( "~" ), ".linuxmint/mintMenu/plugins" )
|
||||
sys.path.append( plugindir )
|
||||
|
||||
self.panelSettings = Gio.Settings.new("org.mate.panel")
|
||||
self.panelSettings.connect( "changed::tooltips-enabled", self.toggleTooltipsEnabled )
|
||||
|
||||
self.settings.connect( "changed::plugins-list", self.RegenPlugins )
|
||||
self.settings.connect( "changed::start-with-favorites", self.toggleStartWithFavorites )
|
||||
self.settings.connect( "changed::tooltips-enabled", self.toggleTooltipsEnabled )
|
||||
self.settings.connect( "changed::use-custom-color", self.toggleUseCustomColor )
|
||||
self.settings.connect( "changed::custom-border-color", self.toggleCustomBorderColor )
|
||||
self.settings.connect( "changed::custom-heading-color", self.toggleCustomHeadingColor )
|
||||
self.settings.connect( "changed::custom-color", self.toggleCustomBackgroundColor )
|
||||
self.settings.connect( "changed::border-width", self.toggleBorderWidth )
|
||||
self.settings.connect( "changed::opacity", self.toggleOpacity )
|
||||
|
||||
self.getSetGSettingEntries()
|
||||
self.SetupMintMenuBorder()
|
||||
|
||||
self.tooltips = Gtk.Tooltips()
|
||||
if self.globalEnableTooltips and self.enableTooltips:
|
||||
@ -103,21 +115,6 @@ class MainWindow( object ):
|
||||
self.tooltips.disable()
|
||||
|
||||
self.PopulatePlugins();
|
||||
|
||||
self.settings.connect( "changed::plugins-list", self.RegenPlugins )
|
||||
|
||||
self.settings.connect( "changed::start-with-favorites", self.toggleStartWithFavorites )
|
||||
globalsettings = Gio.Settings.new("org.mate.panel")
|
||||
globalsettings.connect( "changed::tooltips-enabled", self.toggleTooltipsEnabled )
|
||||
self.settings.connect( "changed::tooltips-enabled", self.toggleTooltipsEnabled )
|
||||
|
||||
self.settings.connect( "changed::use-custom-color", self.toggleUseCustomColor )
|
||||
self.settings.connect( "changed::custom-border-color", self.toggleCustomBorderColor )
|
||||
self.settings.connect( "changed::custom-heading-color", self.toggleCustomHeadingColor )
|
||||
self.settings.connect( "changed::custom-color", self.toggleCustomBackgroundColor )
|
||||
self.settings.connect( "changed::border-width", self.toggleBorderWidth )
|
||||
self.settings.connect( "changed::opacity", self.toggleOpacity )
|
||||
|
||||
self.firstTime = True;
|
||||
|
||||
def on_window1_destroy (self, widget, data=None):
|
||||
@ -154,9 +151,7 @@ class MainWindow( object ):
|
||||
|
||||
def toggleUseCustomColor( self, settings, key, args = None ):
|
||||
self.usecustomcolor = settings.get_boolean(key)
|
||||
self.SetupMintMenuBorder()
|
||||
self.SetPaneColors( self.panesToColor )
|
||||
self.SetHeadingStyle( self.headingsToColor )
|
||||
self.loadTheme()
|
||||
|
||||
def toggleCustomBorderColor( self, settings, key, args = None ):
|
||||
self.custombordercolor = settings.get_string(key)
|
||||
@ -184,14 +179,13 @@ class MainWindow( object ):
|
||||
self.enableTooltips = self.settings.get_boolean( "tooltips-enabled" )
|
||||
self.startWithFavorites = self.settings.get_boolean( "start-with-favorites" )
|
||||
|
||||
mate_settings = Gio.Settings.new("org.mate.panel")
|
||||
self.globalEnableTooltips = mate_settings.get_boolean( "tooltips-enabled" )
|
||||
self.globalEnableTooltips = self.panelSettings.get_boolean( "tooltips-enabled" )
|
||||
|
||||
def SetupMintMenuBorder( self ):
|
||||
def SetupMintMenuBorder( self, defaultStyle = None ):
|
||||
if self.usecustomcolor:
|
||||
self.window.modify_bg( Gtk.StateType.NORMAL, Gdk.color_parse( self.custombordercolor ) )
|
||||
# else:
|
||||
# self.window.modify_bg( Gtk.StateType.NORMAL, self.window.rc_get_style().bg[ Gtk.StateType.SELECTED ] )
|
||||
elif defaultStyle is not None:
|
||||
self.window.modify_bg( Gtk.StateType.NORMAL, defaultStyle.lookup_color('bg_color')[1] )
|
||||
self.border.set_padding( self.borderwidth, self.borderwidth, self.borderwidth, self.borderwidth )
|
||||
|
||||
def SetupMintMenuOpacity( self ):
|
||||
@ -222,10 +216,9 @@ class MainWindow( object ):
|
||||
PluginPane.show()
|
||||
PaneLadder = Gtk.VBox( False, 0 )
|
||||
PluginPane.add( PaneLadder )
|
||||
self.SetPaneColors( [ PluginPane ] )
|
||||
ImageBox = Gtk.EventBox()
|
||||
self.SetPaneColors( [ ImageBox ] )
|
||||
ImageBox.show()
|
||||
self.panesToColor.extend( [ PluginPane, ImageBox ] )
|
||||
|
||||
seperatorImage = GdkPixbuf.Pixbuf.new_from_file( self.dottedfile )
|
||||
|
||||
@ -279,9 +272,7 @@ class MainWindow( object ):
|
||||
print u"Unable to load " + plugin + " plugin :-("
|
||||
|
||||
|
||||
self.SetPaneColors( [MyPlugin.content_holder] )
|
||||
|
||||
|
||||
self.panesToColor.append( MyPlugin.content_holder )
|
||||
MyPlugin.content_holder.show()
|
||||
|
||||
VBox1 = Gtk.VBox( False, 0 )
|
||||
@ -290,14 +281,14 @@ class MainWindow( object ):
|
||||
Align1 = Gtk.Alignment.new( 0, 0, 0, 0 )
|
||||
Align1.set_padding( 10, 5, 10, 0 )
|
||||
Align1.add( Label1 )
|
||||
self.SetHeadingStyle( [Label1] )
|
||||
self.headingsToColor.append( Label1 )
|
||||
Align1.show()
|
||||
Label1.show()
|
||||
|
||||
if not hasattr( MyPlugin, 'sticky' ) or MyPlugin.sticky == True:
|
||||
heading = Gtk.EventBox()
|
||||
Align1.set_padding( 0, 0, 10, 0 )
|
||||
self.SetPaneColors( [heading] )
|
||||
heading.set_visible_window( False )
|
||||
heading.set_size_request( MyPlugin.width, 30 )
|
||||
else:
|
||||
heading = Gtk.HBox()
|
||||
@ -326,7 +317,9 @@ class MainWindow( object ):
|
||||
if hasattr( MyPlugin, 'height' ):
|
||||
MyPlugin.content_holder.set_size_request( -1, MyPlugin.height )
|
||||
if hasattr( MyPlugin, 'itemstocolor' ):
|
||||
self.SetPaneColors( MyPlugin.itemstocolor )
|
||||
self.panesToColor.extend( MyPlugin.itemstocolor )
|
||||
if hasattr( MyPlugin, 'headingstocolor' ):
|
||||
self.headingsToColor.extend( MyPlugin.headingstocolor )
|
||||
except:
|
||||
# create traceback
|
||||
info = sys.exc_info()
|
||||
@ -344,9 +337,8 @@ class MainWindow( object ):
|
||||
PluginPane = Gtk.EventBox()
|
||||
PaneLadder = Gtk.VBox( False, 0 )
|
||||
PluginPane.add( PaneLadder )
|
||||
self.SetPaneColors( [PluginPane] )
|
||||
ImageBox = Gtk.EventBox()
|
||||
self.SetPaneColors( [ImageBox] )
|
||||
self.panesToColor.extend( [ PluginPane, ImageBox ] )
|
||||
ImageBox.show()
|
||||
PluginPane.show_all()
|
||||
|
||||
@ -368,22 +360,30 @@ class MainWindow( object ):
|
||||
self.tooltips.disable()
|
||||
#print u"Loading", (time.time() - start), "s"
|
||||
|
||||
def SetPaneColors( self, items ):
|
||||
for item in items:
|
||||
if item not in self.panesToColor:
|
||||
self.panesToColor.append( item )
|
||||
# A little hacky but works
|
||||
def getDefaultStyle( self ):
|
||||
widget = Gtk.EventBox()
|
||||
widget.show()
|
||||
return Gtk.rc_get_style(widget)
|
||||
|
||||
def loadTheme( self ):
|
||||
defaultStyle = self.getDefaultStyle()
|
||||
self.SetPaneColors( self.panesToColor, defaultStyle )
|
||||
self.SetupMintMenuBorder( defaultStyle )
|
||||
self.SetHeadingStyle( self.headingsToColor )
|
||||
|
||||
def SetPaneColors( self, items, defaultStyle = None ):
|
||||
if self.usecustomcolor:
|
||||
for item in items:
|
||||
item.modify_bg( Gtk.StateType.NORMAL, Gdk.color_parse( self.customcolor ) )
|
||||
# else:
|
||||
# for item in items:
|
||||
# item.modify_bg( Gtk.StateType.NORMAL, self.paneholder.rc_get_style().bg[ Gtk.StateType.NORMAL ] )
|
||||
# TODO: Changing background color isn't working for pixmaps! The following does not work:
|
||||
item.get_style().bg_pixmap[Gtk.StateType.NORMAL] = None
|
||||
elif defaultStyle is not None:
|
||||
for item in items:
|
||||
item.modify_bg( Gtk.StateType.NORMAL, defaultStyle.lookup_color('bg_color')[1] )
|
||||
item.get_style().bg_pixmap[Gtk.StateType.NORMAL] = defaultStyle.bg_pixmap[Gtk.StateType.NORMAL]
|
||||
|
||||
def SetHeadingStyle( self, items ):
|
||||
for item in items:
|
||||
if item not in self.headingsToColor:
|
||||
self.headingsToColor.append( item )
|
||||
|
||||
if self.usecustomcolor:
|
||||
color = self.customheadingcolor
|
||||
else:
|
||||
@ -425,6 +425,7 @@ class MainWindow( object ):
|
||||
|
||||
self.getSetGSettingEntries()
|
||||
self.PopulatePlugins()
|
||||
self.loadTheme()
|
||||
|
||||
#print NAME+u" reloaded"
|
||||
|
||||
@ -497,8 +498,8 @@ class MenuWin( object ):
|
||||
self.settings.connect( "changed::hot-key", self.hotkeyChanged )
|
||||
self.loadSettings()
|
||||
|
||||
mate_settings = Gio.Settings.new("org.mate.interface")
|
||||
mate_settings.connect( "changed::gtk-theme", self.changeTheme )
|
||||
self.mate_settings = Gio.Settings.new("org.mate.interface")
|
||||
self.mate_settings.connect( "changed::gtk-theme", self.changeTheme )
|
||||
|
||||
self.createPanelButton()
|
||||
|
||||
@ -514,6 +515,8 @@ class MenuWin( object ):
|
||||
self.mainwin.window.connect( "size-allocate", lambda *args: self.positionMenu() )
|
||||
|
||||
self.mainwin.window.set_name("mintmenu") # Name used in Gtk RC files
|
||||
self.applyTheme()
|
||||
self.mainwin.loadTheme()
|
||||
|
||||
if self.mainwin.icon:
|
||||
Gtk.Window.set_default_icon_name( self.mainwin.icon )
|
||||
@ -616,12 +619,11 @@ class MenuWin( object ):
|
||||
def changeTheme(self, *args):
|
||||
self.reloadSettings()
|
||||
self.applyTheme()
|
||||
self.mainwin.RegenPlugins()
|
||||
self.mainwin.loadTheme()
|
||||
|
||||
def applyTheme(self):
|
||||
style_settings = Gtk.Settings.get_default()
|
||||
mate_settings = Gio.Settings.new("org.mate.interface")
|
||||
desktop_theme = mate_settings.get_string('gtk-theme')
|
||||
desktop_theme = self.mate_settings.get_string('gtk-theme')
|
||||
if self.theme_name == "default":
|
||||
style_settings.set_property("gtk-theme-name", desktop_theme)
|
||||
else:
|
||||
|
@ -250,7 +250,7 @@ class pluginclass( object ):
|
||||
self.builder.get_object("label7").set_text(_("All applications"))
|
||||
self.builder.get_object("label2").set_text(_("Applications"))
|
||||
|
||||
self.mintMenuWin.SetHeadingStyle( [self.builder.get_object("label6"),self.builder.get_object("label2")] )
|
||||
self.headingstocolor = [self.builder.get_object("label6"),self.builder.get_object("label2")]
|
||||
|
||||
self.numApps = 0
|
||||
# These properties are NECESSARY to maintain consistency
|
||||
@ -265,7 +265,7 @@ class pluginclass( object ):
|
||||
self.content_holder =self.builder.get_object( "Applications" )
|
||||
|
||||
# Items to get custom colors
|
||||
self.itemstocolor = [self.builder.get_object( "viewport1" ),self.builder.get_object( "viewport2" ),self.builder.get_object( "viewport3" ),self.builder.get_object( "notebook2" ) ]
|
||||
self.itemstocolor = [self.builder.get_object( "viewport1" ),self.builder.get_object( "viewport2" ),self.builder.get_object( "viewport3" ) ]
|
||||
|
||||
# Unset all timers
|
||||
self.filterTimer = None
|
||||
@ -648,7 +648,6 @@ class pluginclass( object ):
|
||||
separator.set_visible_window(False)
|
||||
separator.set_size_request(-1, 20)
|
||||
separator.type = "separator"
|
||||
self.mintMenuWin.SetPaneColors( [ separator ] )
|
||||
separator.show_all()
|
||||
self.applicationsBox.add(separator)
|
||||
self.suggestions.append(separator)
|
||||
@ -727,7 +726,6 @@ class pluginclass( object ):
|
||||
last_separator.set_visible_window(False)
|
||||
last_separator.set_size_request(-1, 20)
|
||||
last_separator.type = "separator"
|
||||
self.mintMenuWin.SetPaneColors( [ last_separator ] )
|
||||
last_separator.show_all()
|
||||
self.applicationsBox.add(last_separator)
|
||||
self.suggestions.append(last_separator)
|
||||
@ -783,7 +781,6 @@ class pluginclass( object ):
|
||||
last_separator.set_visible_window(False)
|
||||
last_separator.set_size_request(-1, 20)
|
||||
last_separator.type = "separator"
|
||||
self.mintMenuWin.SetPaneColors( [ last_separator ] )
|
||||
last_separator.show_all()
|
||||
self.applicationsBox.add(last_separator)
|
||||
self.suggestions.append(last_separator)
|
||||
@ -1357,7 +1354,6 @@ class pluginclass( object ):
|
||||
space.connect( "button-press-event", self.favPopup )
|
||||
space.type = "space"
|
||||
|
||||
self.mintMenuWin.SetPaneColors( [ space ] )
|
||||
space.show()
|
||||
|
||||
return space
|
||||
@ -1367,7 +1363,6 @@ class pluginclass( object ):
|
||||
separator.set_size_request( -1, 20 )
|
||||
separator.type = "separator"
|
||||
|
||||
self.mintMenuWin.SetPaneColors( [ separator ] )
|
||||
separator.show_all()
|
||||
box = Gtk.EventBox()
|
||||
box.type = "separator"
|
||||
|
Loading…
Reference in New Issue
Block a user