* src/data/mainX.css: enable formatted notes on narrative web
	* src/plugins/NarrativeWeb.py: enable formatted notes on narrative web
	* src/MarkupText.py: properly reset xml generator output: fix #924
	* src/ManagedWindow.py: enable accelerators in editor windows 
	* src/Editors/_EditPrimary.py: enable accelerators in editor windows
	* src/Editors/_EditSecondary.py: enable accelerators in editor windows
	* src/Editors/_EditReference.py: enable accelerators in editor windows
	* src/DisplayTabs/_NoteTab.py: enable accelerators in editor windows 
	* src/DisplayTabs/_ButtonTab.py: enable accelerators in editor windows
	* src/DisplayTabs/_GrampsTab.py: enable accelerators in editor windows



svn: r8137
This commit is contained in:
Zsolt Foldvari
2007-02-16 21:20:36 +00:00
parent b49ef36e5d
commit d3b383109d
16 changed files with 164 additions and 48 deletions

View File

@@ -60,7 +60,14 @@ class ButtonTab(GrampsTab):
'del' : _('Remove'),
'edit' : _('Edit'),
'share' : _('Share'),
}
}
_ACCEL = {
'add': 'Insert',
'del': 'Delete',
'edit': '<Control>E',
'share': '<Control>S',
}
def __init__(self, dbstate, uistate, track, name, share_button=False):
"""
@@ -97,6 +104,13 @@ class ButtonTab(GrampsTab):
self.tooltips.set_tip(self.edit_btn, self._MSG['edit'])
self.tooltips.set_tip(self.del_btn, self._MSG['del'])
key, mod = gtk.accelerator_parse(self._ACCEL['add'])
self.add_btn.add_accelerator('activate', self.accel_group, key, mod, gtk.ACCEL_VISIBLE)
key, mod = gtk.accelerator_parse(self._ACCEL['edit'])
self.edit_btn.add_accelerator('activate', self.accel_group, key, mod, gtk.ACCEL_VISIBLE)
key, mod = gtk.accelerator_parse(self._ACCEL['del'])
self.del_btn.add_accelerator('activate', self.accel_group, key, mod, gtk.ACCEL_VISIBLE)
if share_button:
self.share_btn = SimpleButton(gtk.STOCK_INDEX, self.share_button_clicked)
self.tooltips.set_tip(self.share_btn, self._MSG['share'])

View File

@@ -73,6 +73,7 @@ class GrampsTab(gtk.HBox):
self.label_container = self.build_label_widget()
# build the interface
self.accel_group = gtk.AccelGroup()
self.share_btn = None
self.build_interface()
@@ -158,3 +159,4 @@ class GrampsTab(gtk.HBox):
can be used to add widgets to the interface.
"""
pass

View File

@@ -79,11 +79,16 @@ class NoteTab(GrampsTab):
return self.buf.get_char_count() == 0
def build_interface(self):
BUTTON = [(_('Italic'),gtk.STOCK_ITALIC,'<i>i</i>','<Control>I'),
(_('Bold'),gtk.STOCK_BOLD,'<b>b</b>','<Control>B'),
(_('Underline'),gtk.STOCK_UNDERLINE,'<u>u</u>','<Control>U'),
]
vbox = gtk.VBox()
self.text = gtk.TextView()
self.text.set_accepts_tab(True)
self.flowed = gtk.RadioButton(None, _('Flowed'))
self.format = gtk.RadioButton(self.flowed, _('Formatted'))
@@ -112,25 +117,29 @@ class NoteTab(GrampsTab):
hbox.set_border_width(6)
hbox.pack_start(self.flowed, False)
hbox.pack_start(self.format, False)
vbox.pack_start(hbox, False)
self.pack_start(vbox, True)
self.buf = EditorBuffer()
self.text.set_buffer(self.buf)
tooltips = gtk.Tooltips()
for tip,stock,font in [('Italic',gtk.STOCK_ITALIC,'<i>i</i>'),
('Bold',gtk.STOCK_BOLD,'<b>b</b>'),
('Underline',gtk.STOCK_UNDERLINE,'<u>u</u>'),
]:
button = gtk.ToggleButton()
for tip, stock, markup, accel in BUTTON:
image = gtk.Image()
image.set_from_stock(stock, gtk.ICON_SIZE_MENU)
button = gtk.ToggleButton()
button.set_image(image)
tooltips.set_tip(button, tip)
button.set_relief(gtk.RELIEF_NONE)
self.buf.setup_widget_from_xml(button,font)
tooltips.set_tip(button, tip)
self.buf.setup_widget_from_xml(button, markup)
key, mod = gtk.accelerator_parse(accel)
button.add_accelerator('activate', self.accel_group,
key, mod, gtk.ACCEL_VISIBLE)
hbox.pack_start(button, False)
if self.note_obj:
self.empty = False
self.buf.set_text(self.note_obj.get(markup=True))