GeoView : Toolbar optimization.

svn: r14226
This commit is contained in:
Serge Noiraud 2010-02-05 12:13:24 +00:00
parent c04899d3ea
commit 59b2cefd45

View File

@ -755,20 +755,20 @@ class GeoView(HtmlView):
""" """
Specifies the UIManager XML code that defines the menus and buttons Specifies the UIManager XML code that defines the menus and buttons
associated with the interface. associated with the interface.
"""
return '''<ui>
<toolbar name="ToolBar">
<placeholder name="CommonNavigation"> <placeholder name="CommonNavigation">
<toolitem action="Back"/> <toolitem action="Back"/>
<toolitem action="Forward"/> <toolitem action="Forward"/>
<toolitem action="Refresh"/> <toolitem action="Refresh"/>
</placeholder> </placeholder>
<toolitem action="StyleSheet"/>
"""
return '''<ui>
<toolbar name="ToolBar">
<placeholder name="CommonEdit"> <placeholder name="CommonEdit">
<toolitem action="Provider"/> <toolitem action="Provider"/>
<toolitem action="SaveZoom"/> <toolitem action="SaveZoom"/>
<toolitem action="AddPlace"/> <toolitem action="AddPlace"/>
<toolitem action="LinkPlace"/> <toolitem action="LinkPlace"/>
<toolitem action="StyleSheet"/>
<separator/> <separator/>
<toolitem action="PersonMaps"/> <toolitem action="PersonMaps"/>
<toolitem action="FamilyMaps"/> <toolitem action="FamilyMaps"/>
@ -783,9 +783,9 @@ class GeoView(HtmlView):
Required define_actions function for PageView. Builds the action Required define_actions function for PageView. Builds the action
group information required. group information required.
""" """
HtmlView._define_actions_fw_bw(self) #HtmlView._define_actions_fw_bw(self)
self.forward_action.set_sensitive(False) #self.forward_action.set_sensitive(False)
self.back_action.set_sensitive(False) #self.back_action.set_sensitive(False)
self._add_action('AddPlace', gtk.STOCK_ADD, self._add_action('AddPlace', gtk.STOCK_ADD,
_('_Add Place'), _('_Add Place'),
callback=self._add_place, callback=self._add_place,
@ -828,10 +828,10 @@ class GeoView(HtmlView):
self._add_action('EventMaps', 'gramps-event', _('_Event'), self._add_action('EventMaps', 'gramps-event', _('_Event'),
callback=self._event_places, callback=self._event_places,
tip=_("Attempt to view places connected to all events.")) tip=_("Attempt to view places connected to all events."))
self._add_toolmenu_action('StyleSheet', _('Selecting stylesheet ...'), #self._add_toolmenu_action('StyleSheet', _('Selecting stylesheet ...'),
_("Reload the map with new style."), # _("Reload the map with new style."),
self._gotostyle, # self._gotostyle,
_('Select a StyleSheet')) # _('Select a StyleSheet'))
self._add_toggle_action('Filter', None, _('_Filter'), self._add_toggle_action('Filter', None, _('_Filter'),
callback=self.filter_toggle_action, callback=self.filter_toggle_action,
value=config.get('interface.filter')) value=config.get('interface.filter'))
@ -867,29 +867,29 @@ class GeoView(HtmlView):
PageView.change_page(self) PageView.change_page(self)
# menutoolbutton actions are stored in PageView class, # menutoolbutton actions are stored in PageView class,
# obtain the widgets where we need to add to menu # obtain the widgets where we need to add to menu
actionstyles = self.action_toolmenu['StyleSheet'] #actionstyles = self.action_toolmenu['StyleSheet']
widgets = actionstyles.get_proxies() #widgets = actionstyles.get_proxies()
mmenu = self.__create_styles_menu_actions() #mmenu = self.__create_styles_menu_actions()
if not self.stylesheetdata: #if not self.stylesheetdata:
return # return
self.stylesheetlabel = [] #self.stylesheetlabel = []
#store all gtk labels to be able to update label on selection change #store all gtk labels to be able to update label on selection change
for widget in widgets : #for widget in widgets :
if isinstance(widget, gtk.MenuToolButton): # if isinstance(widget, gtk.MenuToolButton):
widget.set_menu(mmenu) # widget.set_menu(mmenu)
if gtk.pygtk_version >= (2, 12, 0): # if gtk.pygtk_version >= (2, 12, 0):
widget.set_arrow_tooltip_text(actionstyles.arrowtooltip) # widget.set_arrow_tooltip_text(actionstyles.arrowtooltip)
lbl = gtk.Label(self._mapstyle_label()) # lbl = gtk.Label(self._mapstyle_label())
self.stylesheetlbl = lbl # self.stylesheetlbl = lbl
lbl.show() # lbl.show()
self.stylesheetlabel.append(lbl) # self.stylesheetlabel.append(lbl)
widget.set_label_widget(self.stylesheetlabel[-1]) # widget.set_label_widget(self.stylesheetlabel[-1])
widget.set_stock_id(gtk.STOCK_SELECT_FONT) # widget.set_stock_id(gtk.STOCK_SELECT_FONT)
self._set_lock_unlock_icon() self._set_lock_unlock_icon()
self._set_mapstylelabel(self.stylesheet) #self._set_mapstylelabel(self.stylesheet)
self._savezoomandposition(500) # every 500 millisecondes self._savezoomandposition(500) # every 500 millisecondes
self.endinit = True self.endinit = True
self.filter_toggle(None, None, None, None) self.filter_toggle(None, None, None, None)
@ -1964,6 +1964,7 @@ class GeoView(HtmlView):
The first one based on the default used by NarrativeWeb. The first one based on the default used by NarrativeWeb.
The second one is specific to GeoView. The second one is specific to GeoView.
""" """
return u''
# Get the default stylesheet. # Get the default stylesheet.
dblp = "<link media=\"screen\" " dblp = "<link media=\"screen\" "
delp = "type=\"text/css\" rel=\"stylesheet\" />\n" delp = "type=\"text/css\" rel=\"stylesheet\" />\n"