Move the 'Clear Markup' button to the right end of the toolbar.

svn: r10628
This commit is contained in:
Zsolt Foldvari 2008-04-23 12:35:44 +00:00
parent a4e1be7d62
commit 40884d66f6

View File

@ -72,7 +72,7 @@ FORMAT_TOOLBAR = '''
<toolitem action="%d"/> <toolitem action="%d"/>
<toolitem action="%d"/> <toolitem action="%d"/>
<toolitem action="%d"/> <toolitem action="%d"/>
<separator/> <toolitem action="spring"/>
<toolitem action="clear"/> <toolitem action="clear"/>
</toolbar> </toolbar>
</ui> </ui>
@ -357,6 +357,9 @@ class StyledTextEditor(gtk.TextView):
fontsize_action = ComboToolAction(str(StyledTextTagType.FONTSIZE), fontsize_action = ComboToolAction(str(StyledTextTagType.FONTSIZE),
_("Font size"), _("Font size"),
_("Font size"), None) _("Font size"), None)
spring = SpringSeparatorAction("spring", "", "", None)
# action accelerators
self.action_accels = { self.action_accels = {
'<Control>i': 'italic', '<Control>i': 'italic',
'<Control>b': 'bold', '<Control>b': 'bold',
@ -369,6 +372,7 @@ class StyledTextEditor(gtk.TextView):
self.action_group.add_actions(format_actions) self.action_group.add_actions(format_actions)
self.action_group.add_action(fontface_action) self.action_group.add_action(fontface_action)
self.action_group.add_action(fontsize_action) self.action_group.add_action(fontsize_action)
self.action_group.add_action(spring)
# define the toolbar and create the proxies via ensure_update() # define the toolbar and create the proxies via ensure_update()
uimanager = gtk.UIManager() uimanager = gtk.UIManager()
@ -385,11 +389,7 @@ class StyledTextEditor(gtk.TextView):
StyledTextTagType.FONTSIZE) StyledTextTagType.FONTSIZE)
set_fontsize_toolitem(fontsize, self._on_combotoolitem_changed) set_fontsize_toolitem(fontsize, self._on_combotoolitem_changed)
##separator = uimanager.get_widget('/ToolBar/abcdef') # get the toolbar and set it's style
##separator = gtk.SeparatorToolItem()
##separator.set_expand(True)
##separator.set_draw(False)
toolbar = uimanager.get_widget('/ToolBar') toolbar = uimanager.get_widget('/ToolBar')
toolbar.set_style(gtk.TOOLBAR_ICONS) toolbar.set_style(gtk.TOOLBAR_ICONS)
@ -638,6 +638,35 @@ class ComboToolAction(gtk.Action):
##self.activate() ##self.activate()
ComboToolAction.set_tool_item_type(ComboToolItem) ComboToolAction.set_tool_item_type(ComboToolItem)
#-------------------------------------------------------------------------
#
# SpringSeparatorToolItem class
#
#-------------------------------------------------------------------------
class SpringSeparatorToolItem(gtk.SeparatorToolItem):
__gtype_name__ = "SpringSeparatorToolItem"
def __init__(self):
gtk.SeparatorToolItem.__init__(self)
self.set_draw(False)
self.set_expand(True)
#-------------------------------------------------------------------------
#
# SpringSeparatorAction class
#
#-------------------------------------------------------------------------
class SpringSeparatorAction(gtk.Action):
__gtype_name__ = "SpringSeparatorAction"
def __init__(self, name, label, tooltip, stock_id):
gtk.Action.__init__(self, name, label, tooltip, stock_id)
SpringSeparatorAction.set_tool_item_type(SpringSeparatorToolItem)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Module functions # Module functions