Some styling fixes, gsettings stuff

This commit is contained in:
Michael Webster 2013-03-08 19:31:58 -05:00
parent c36cbfe690
commit dc52e6d953

View File

@ -121,7 +121,8 @@ class MainWindow( object ):
self.settings.connect( "changed::plugins_list", self.RegenPlugins ) self.settings.connect( "changed::plugins_list", self.RegenPlugins )
self.settings.connect( "changed::start_with_favorites", self.toggleStartWithFavorites ) self.settings.connect( "changed::start_with_favorites", self.toggleStartWithFavorites )
self.settings.connect( "changed::/apps/panel/global/tooltips_enabled", self.toggleTooltipsEnabled ) 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::tooltips_enabled", self.toggleTooltipsEnabled )
self.settings.connect( "changed::use_custom_color", self.toggleUseCustomColor ) self.settings.connect( "changed::use_custom_color", self.toggleUseCustomColor )
@ -141,48 +142,46 @@ class MainWindow( object ):
if hasattr( plugin, "destroy" ): if hasattr( plugin, "destroy" ):
plugin.wake() plugin.wake()
def toggleTooltipsEnabled( self, client, connection_id, entry, args ): def toggleTooltipsEnabled( self, settings, key, args = None):
if entry.get_key() == "/apps/panel/global/tooltips_enabled": if key == "tooltips-enabled":
self.globalEnableTooltips = entry.get_value().get_bool() self.globalEnableTooltips = settings.get_boolean(key)
else: else:
self.enableTooltips = entry.get_value().get_bool() self.enableTooltips = settings.get_boolean(key)
if self.globalEnableTooltips and self.enableTooltips: if self.globalEnableTooltips and self.enableTooltips:
self.tooltips.enable() self.tooltips.enable()
else: else:
self.tooltips.disable() self.tooltips.disable()
def toggleStartWithFavorites( self, client, connection_id, entry, args ): def toggleStartWithFavorites( self, settings, key, args = None ):
self.startWithFavorites = entry.get_value().get_bool() self.startWithFavorites = settings.get_boolean(key)
def toggleBorderWidth( self, client, connection_id, entry, args ): def toggleBorderWidth( self, settings, key, args = None ):
self.borderwidth = entry.get_value().get_int() self.borderwidth = settings.get_int(key)
self.SetupMintMenuBorder() self.SetupMintMenuBorder()
def toggleOpacity( self, client, connection_id, entry, args ): def toggleOpacity( self, settings, key, args = None ):
self.opacity = entry.get_value().get_int() self.opacity = settings.get_int(key)
self.SetupMintMenuOpacity() self.SetupMintMenuOpacity()
def toggleUseCustomColor( self, client, connection_id, entry, args ): def toggleUseCustomColor( self, settings, key, args = None ):
self.usecustomcolor = entry.get_value().get_bool() self.usecustomcolor = settings.get_boolean(key)
self.SetupMintMenuBorder() self.SetupMintMenuBorder()
self.SetPaneColors( self.panesToColor ) self.SetPaneColors( self.panesToColor )
self.SetHeadingStyle( self.headingsToColor ) self.SetHeadingStyle( self.headingsToColor )
def toggleCustomBorderColor( self, settings, key, args = None ):
def toggleCustomBorderColor( self, client, connection_id, entry, args ): self.custombordercolor = settings.get_string(key)
self.custombordercolor = entry.get_value().get_string()
self.SetupMintMenuBorder() self.SetupMintMenuBorder()
def toggleCustomBackgroundColor( self, client, connection_id, entry, args ): def toggleCustomBackgroundColor( self, settings, key, args = None):
self.customcolor = entry.get_value().get_string() self.customcolor = settings.get_string(key)
self.SetPaneColors( self.panesToColor ) self.SetPaneColors( self.panesToColor )
def toggleCustomHeadingColor( self, client, connection_id, entry, args ): def toggleCustomHeadingColor( self, settings, key, args = None ):
self.customheadingcolor = entry.get_value().get_string() self.customheadingcolor = settings.get_string(key)
self.SetHeadingStyle( self.headingsToColor ) self.SetHeadingStyle( self.headingsToColor )
def getSetGconfEntries( self ): def getSetGconfEntries( self ):
self.dottedfile = os.path.join( self.path, "dotted.png") self.dottedfile = os.path.join( self.path, "dotted.png")
@ -201,8 +200,8 @@ class MainWindow( object ):
self.globalEnableTooltips = mate_settings.get_boolean( "tooltips-enabled" ) self.globalEnableTooltips = mate_settings.get_boolean( "tooltips-enabled" )
def SetupMintMenuBorder( self ): def SetupMintMenuBorder( self ):
# if self.usecustomcolor: if self.usecustomcolor:
# self.window.modify_bg( Gtk.StateType.NORMAL, Gdk.color_parse( self.custombordercolor ) ) self.window.modify_bg( Gtk.StateType.NORMAL, Gdk.color_parse( self.custombordercolor ) )
# else: # else:
# self.window.modify_bg( Gtk.StateType.NORMAL, self.window.rc_get_style().bg[ Gtk.StateType.SELECTED ] ) # self.window.modify_bg( Gtk.StateType.NORMAL, self.window.rc_get_style().bg[ Gtk.StateType.SELECTED ] )
self.border.set_padding( self.borderwidth, self.borderwidth, self.borderwidth, self.borderwidth ) self.border.set_padding( self.borderwidth, self.borderwidth, self.borderwidth, self.borderwidth )
@ -384,39 +383,35 @@ class MainWindow( object ):
#print u"Loading", (time.time() - start), "s" #print u"Loading", (time.time() - start), "s"
def SetPaneColors( self, items ): def SetPaneColors( self, items ):
# for item in items: print "SET PANE COLORS"
# if item not in self.panesToColor: for item in items:
# self.panesToColor.append( item ) if item not in self.panesToColor:
# if self.usecustomcolor: self.panesToColor.append( item )
# for item in items: if self.usecustomcolor:
# item.modify_bg( Gtk.StateType.NORMAL, Gdk.color_parse( self.customcolor ) ) for item in items:
item.modify_bg( Gtk.StateType.NORMAL, Gdk.color_parse( self.customcolor ) )
# else: # else:
# for item in items: # for item in items:
# item.modify_bg( Gtk.StateType.NORMAL, self.paneholder.rc_get_style().bg[ Gtk.StateType.NORMAL ] ) # item.modify_bg( Gtk.StateType.NORMAL, self.paneholder.rc_get_style().bg[ Gtk.StateType.NORMAL ] )
pass
def SetHeadingStyle( self, items ): def SetHeadingStyle( self, items ):
return
for item in items: for item in items:
if item not in self.headingsToColor: if item not in self.headingsToColor:
self.headingsToColor.append( item ) self.headingsToColor.append( item )
HeadingStyle = Pango.AttrList()
attr = Pango.AttrSize( 12000, 0, -1 )
HeadingStyle.insert( attr )
if self.usecustomcolor: if self.usecustomcolor:
headingcolor = Gdk.color_parse( self.customheadingcolor ) color = self.customheadingcolor
attr = Pango.AttrForeground( headingcolor.red, headingcolor.green, headingcolor.blue, 0, -1 ) else:
HeadingStyle.insert( attr ) color = None
# else:
# headingcolor = self.window.rc_get_style().bg[ Gtk.StateType.SELECTED ]
attr = Pango.AttrWeight( Pango.Weight.BOLD, 0, -1 )
HeadingStyle.insert( attr )
for item in items: for item in items:
item.set_attributes( HeadingStyle ) item.set_use_markup(True)
text = item.get_text()
if color == None:
markup = '<span size="12000" weight="bold">%s</span>' % (text)
else:
markup = '<span size="12000" weight="bold" color="%s">%s</span>' % (color, text)
item.set_markup( markup )
def setTooltip( self, widget, tip, tipPrivate = None ): def setTooltip( self, widget, tip, tipPrivate = None ):
self.tooltips.set_tip( widget, tip, tipPrivate ) self.tooltips.set_tip( widget, tip, tipPrivate )