2007-12-19 Benny Malengier <benny.malengier@gramps-project.org>
* src/Editors/_EditPrimary.py: * src/Editors/_EditPlace.py: * src/Editors/_EditSecondary.py: * src/Editors/_EditSourceRef.py: * src/Editors/_EditReference.py: * src/Editors/_EditRepoRef.py: * src/Editors/_EditNote.py: * src/Editors/_EditMediaRef.py: * src/Editors/_EditEventRef.py: * src/Editors/_EditName.py: * src/DisplayTabs/__init__.py: * src/DisplayTabs/_GalleryTab.py: * src/DisplayTabs/_BackRefList.py: * src/DisplayTabs/_ButtonTab.py: * src/DisplayTabs/_GrampsTab.py: Accelator keys on displaytabs, convert _all_ tabs to GrampsTab! Feature #955 #1438 svn: r9545
This commit is contained in:
parent
fb12457651
commit
13bd98097b
19
ChangeLog
19
ChangeLog
@ -1,3 +1,22 @@
|
||||
2007-12-19 Benny Malengier <benny.malengier@gramps-project.org>
|
||||
* src/Editors/_EditPrimary.py:
|
||||
* src/Editors/_EditPlace.py:
|
||||
* src/Editors/_EditSecondary.py:
|
||||
* src/Editors/_EditSourceRef.py:
|
||||
* src/Editors/_EditReference.py:
|
||||
* src/Editors/_EditRepoRef.py:
|
||||
* src/Editors/_EditNote.py:
|
||||
* src/Editors/_EditMediaRef.py:
|
||||
* src/Editors/_EditEventRef.py:
|
||||
* src/Editors/_EditName.py:
|
||||
* src/DisplayTabs/__init__.py:
|
||||
* src/DisplayTabs/_GalleryTab.py:
|
||||
* src/DisplayTabs/_BackRefList.py:
|
||||
* src/DisplayTabs/_ButtonTab.py:
|
||||
* src/DisplayTabs/_GrampsTab.py:
|
||||
Accelator keys on displaytabs, convert _all_ tabs to GrampsTab!
|
||||
Feature #955 #1438
|
||||
|
||||
2007-12-20 Raphael Ackermann <raphael.ackermann@gmail.com>
|
||||
* src/glade/gramps.glade : don't use C or O as accelerator keys on Name Editor, reserved for OK and Cancel buttons #1470
|
||||
* src/glade/edit_person.glade : accelerator keys are used double in person editor #1452
|
||||
|
@ -95,6 +95,9 @@ class BackRefList(EmbeddedList):
|
||||
vbox.pack_start(self.edit_btn, False)
|
||||
vbox.show_all()
|
||||
self.pack_start(vbox, False)
|
||||
|
||||
self.add_btn = None
|
||||
self.del_btn = None
|
||||
|
||||
def _selection_changed(self, obj=None):
|
||||
if self.get_selected():
|
||||
|
@ -45,6 +45,11 @@ import Errors
|
||||
|
||||
_KP_ENTER = gtk.gdk.keyval_from_name("KP_Enter")
|
||||
_RETURN = gtk.gdk.keyval_from_name("Return")
|
||||
_DEL = gtk.gdk.keyval_from_name("Delete")
|
||||
_ADD = gtk.gdk.keyval_from_name("Insert")
|
||||
_OPEN = gtk.gdk.keyval_from_name("o")
|
||||
_LEFT = gtk.gdk.keyval_from_name("Left")
|
||||
_RIGHT = gtk.gdk.keyval_from_name("Right")
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -173,12 +178,29 @@ class ButtonTab(GrampsTab):
|
||||
Handles the return key being pressed on list. If the key is pressed,
|
||||
the Edit button handler is called
|
||||
"""
|
||||
if event.type == gtk.gdk.KEY_PRESS and \
|
||||
event.keyval in (_RETURN, _KP_ENTER):
|
||||
try:
|
||||
self.edit_button_clicked(obj)
|
||||
except Errors.WindowActiveError:
|
||||
pass
|
||||
if event.type == gtk.gdk.KEY_PRESS:
|
||||
if event.keyval in (_RETURN, _KP_ENTER):
|
||||
try:
|
||||
self.edit_button_clicked(obj)
|
||||
except Errors.WindowActiveError:
|
||||
pass
|
||||
elif event.keyval in (_DEL,) and self.del_btn:
|
||||
if self.dirty_selection or self.dbstate.db.readonly:
|
||||
return
|
||||
self.del_button_clicked(obj)
|
||||
elif event.keyval in (_ADD,) and self.add_btn:
|
||||
if self.dirty_selection or self.dbstate.db.readonly:
|
||||
return
|
||||
self.add_button_clicked(obj)
|
||||
elif event.keyval in (_OPEN,) and self.share_btn and \
|
||||
event.state in (gtk.gdk.CONTROL_MASK,):
|
||||
self.share_button_clicked(obj)
|
||||
elif event.keyval in (_LEFT,) and \
|
||||
event.state in (gtk.gdk.MOD1_MASK,):
|
||||
self.prev_page()
|
||||
elif event.keyval in (_RIGHT,) and \
|
||||
event.state in (gtk.gdk.MOD1_MASK,):
|
||||
self.next_page()
|
||||
|
||||
def add_button_clicked(self, obj):
|
||||
"""
|
||||
|
@ -182,6 +182,7 @@ class GalleryTab(ButtonTab):
|
||||
# connect the signals
|
||||
self.iconlist.connect('selection-changed', self._selection_changed)
|
||||
self.iconlist.connect('button_press_event', self.double_click)
|
||||
self.iconlist.connect('key_press_event', self.key_pressed)
|
||||
self._connect_icon_model()
|
||||
|
||||
# create the scrolled window
|
||||
|
@ -27,11 +27,15 @@
|
||||
#-------------------------------------------------------------------------
|
||||
import gtk
|
||||
|
||||
_LEFT = gtk.gdk.keyval_from_name("Left")
|
||||
_RIGHT = gtk.gdk.keyval_from_name("Right")
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Classes
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
class GrampsTab(gtk.HBox):
|
||||
"""
|
||||
This class provides the base level class for 'tabs', which are used to
|
||||
@ -77,6 +81,7 @@ class GrampsTab(gtk.HBox):
|
||||
# build the interface
|
||||
self.share_btn = None
|
||||
self.build_interface()
|
||||
self.parent_notebook = None
|
||||
|
||||
def get_selected(self):
|
||||
return None
|
||||
@ -137,6 +142,20 @@ class GrampsTab(gtk.HBox):
|
||||
"""
|
||||
return self.label_container
|
||||
|
||||
def key_pressed(self, obj, event):
|
||||
"""
|
||||
Handles the key being pressed.
|
||||
The inheriting object must contain a widget that connects at mimimum
|
||||
to this method, eg an eventbox, tree, ...
|
||||
"""
|
||||
if event.type == gtk.gdk.KEY_PRESS:
|
||||
if event.keyval in (_LEFT,) and \
|
||||
event.state in (gtk.gdk.MOD1_MASK,):
|
||||
self.prev_page()
|
||||
elif event.keyval in (_RIGHT,) and \
|
||||
event.state in (gtk.gdk.MOD1_MASK,):
|
||||
self.next_page()
|
||||
|
||||
def add_db_signal_callback(self, add_db_signal):
|
||||
"""
|
||||
The grampstab must be able to react to database signals, however
|
||||
@ -150,7 +169,7 @@ class GrampsTab(gtk.HBox):
|
||||
self._add_db_signal = add_db_signal
|
||||
self.connect_db_signals()
|
||||
|
||||
def _set_label(self):
|
||||
def _set_label(self, show_image=True):
|
||||
"""
|
||||
Updates the label based of if the tab contains information. Tabs
|
||||
without information will not have an icon, and the text will not
|
||||
@ -158,7 +177,10 @@ class GrampsTab(gtk.HBox):
|
||||
the label text will be in bold face.
|
||||
"""
|
||||
if not self.is_empty():
|
||||
self.tab_image.show()
|
||||
if show_image:
|
||||
self.tab_image.show()
|
||||
else:
|
||||
self.tab_image.hide()
|
||||
self.label.set_text("<b>%s</b>" % self.tab_name)
|
||||
self.label.set_use_markup(True)
|
||||
else:
|
||||
@ -182,3 +204,14 @@ class GrampsTab(gtk.HBox):
|
||||
"""
|
||||
pass
|
||||
|
||||
def set_parent_notebook(self, book):
|
||||
self.parent_notebook = book
|
||||
|
||||
def next_page(self):
|
||||
if self.parent_notebook:
|
||||
self.parent_notebook.next_page()
|
||||
|
||||
def prev_page(self):
|
||||
if self.parent_notebook:
|
||||
self.parent_notebook.prev_page()
|
||||
|
||||
|
@ -33,6 +33,7 @@ log = logging.getLogger(".DisplayTabs")
|
||||
from _ChildModel import ChildModel
|
||||
|
||||
# Then import tab classes
|
||||
from _GrampsTab import GrampsTab
|
||||
from _EmbeddedList import EmbeddedList
|
||||
from _AddrEmbedList import AddrEmbedList
|
||||
from _AttrEmbedList import AttrEmbedList
|
||||
|
@ -45,7 +45,7 @@ import gen.lib
|
||||
|
||||
from DisplayTabs import SourceEmbedList,NoteTab,GalleryTab,EventBackRefList,AttrEmbedList
|
||||
from GrampsWidgets import *
|
||||
from _EditReference import EditReference
|
||||
from _EditReference import RefTab, EditReference
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -53,6 +53,7 @@ from _EditReference import EditReference
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# EditEventRef class
|
||||
@ -78,7 +79,20 @@ class EditEventRef(EditReference):
|
||||
self.define_expander(self.top.get_widget("eer_expander"))
|
||||
self.share_btn = self.top.get_widget('share_place')
|
||||
self.add_del_btn = self.top.get_widget('add_del_place')
|
||||
|
||||
|
||||
tblref = self.top.get_widget('table64')
|
||||
notebook = self.top.get_widget('notebook_ref')
|
||||
#recreate start page as GrampsTab
|
||||
notebook.remove_page(0)
|
||||
self.reftab = RefTab(self.dbstate, self.uistate, self.track,
|
||||
_('General'), tblref)
|
||||
tblref = self.top.get_widget('table62')
|
||||
notebook = self.top.get_widget('notebook')
|
||||
#recreate start page as GrampsTab
|
||||
notebook.remove_page(0)
|
||||
self.primtab = RefTab(self.dbstate, self.uistate, self.track,
|
||||
_('General'), tblref)
|
||||
|
||||
def _init_event(self):
|
||||
self.commit_event = self.db.commit_personal_event
|
||||
self.add_event = self.db.add_person_event
|
||||
@ -155,19 +169,19 @@ class EditEventRef(EditReference):
|
||||
|
||||
notebook = self.top.get_widget('notebook')
|
||||
notebook_ref = self.top.get_widget('notebook_ref')
|
||||
|
||||
|
||||
self._add_tab(notebook, self.primtab)
|
||||
self._add_tab(notebook_ref, self.reftab)
|
||||
|
||||
self.srcref_list = self._add_tab(
|
||||
notebook,
|
||||
SourceEmbedList(self.dbstate,self.uistate,self.track,self.source))
|
||||
|
||||
try:
|
||||
self.attr_list = self._add_tab(
|
||||
notebook,
|
||||
AttrEmbedList(self.dbstate, self.uistate, self.track,
|
||||
self.source.get_attribute_list()))
|
||||
except AttributeError:
|
||||
print "Attribute list not available yet"
|
||||
|
||||
self.attr_list = self._add_tab(
|
||||
notebook,
|
||||
AttrEmbedList(self.dbstate, self.uistate, self.track,
|
||||
self.source.get_attribute_list()))
|
||||
|
||||
self.note_tab = self._add_tab(
|
||||
notebook,
|
||||
NoteTab(self.dbstate, self.uistate, self.track,
|
||||
@ -191,13 +205,10 @@ class EditEventRef(EditReference):
|
||||
self.db.find_backlink_handles(self.source.handle),
|
||||
self.enable_warnbox))
|
||||
|
||||
try:
|
||||
self.attr_ref_list = self._add_tab(
|
||||
notebook_ref,
|
||||
AttrEmbedList(self.dbstate, self.uistate, self.track,
|
||||
self.source_ref.get_attribute_list()))
|
||||
except AttributeError:
|
||||
print "Attribute list not available yet"
|
||||
self.attr_ref_list = self._add_tab(
|
||||
notebook_ref,
|
||||
AttrEmbedList(self.dbstate, self.uistate, self.track,
|
||||
self.source_ref.get_attribute_list()))
|
||||
|
||||
self._setup_notebook_tabs( notebook)
|
||||
self._setup_notebook_tabs( notebook_ref)
|
||||
|
@ -48,7 +48,7 @@ from gen.lib import NoteType
|
||||
from DisplayTabs import \
|
||||
SourceEmbedList,AttrEmbedList,MediaBackRefList,NoteTab
|
||||
from GrampsWidgets import *
|
||||
from _EditReference import EditReference
|
||||
from _EditReference import RefTab, EditReference
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -74,6 +74,20 @@ class EditMediaRef(EditReference):
|
||||
self.top.get_widget('title'),
|
||||
_('Media Reference Editor'))
|
||||
self.define_warn_box(self.top.get_widget("warn_box"))
|
||||
|
||||
tblref = self.top.get_widget('table50')
|
||||
notebook = self.top.get_widget('notebook_ref')
|
||||
#recreate start page as GrampsTab
|
||||
notebook.remove_page(0)
|
||||
self.reftab = RefTab(self.dbstate, self.uistate, self.track,
|
||||
_('General'), tblref)
|
||||
tblref = self.top.get_widget('table2')
|
||||
notebook = self.top.get_widget('notebook_shared')
|
||||
#recreate start page as GrampsTab
|
||||
notebook.remove_page(0)
|
||||
self.primtab = RefTab(self.dbstate, self.uistate, self.track,
|
||||
_('General'), tblref)
|
||||
|
||||
|
||||
def _setup_fields(self):
|
||||
|
||||
@ -368,11 +382,13 @@ class EditMediaRef(EditReference):
|
||||
"""
|
||||
Creates the notebook tabs and inserts them into the main
|
||||
window.
|
||||
|
||||
"""
|
||||
notebook_ref = self.top.get_widget('notebook_ref')
|
||||
notebook_src = self.top.get_widget('notebook_shared')
|
||||
|
||||
|
||||
self._add_tab(notebook_src, self.primtab)
|
||||
self._add_tab(notebook_ref, self.reftab)
|
||||
|
||||
self.srcref_list = self._add_tab(
|
||||
notebook_ref,
|
||||
SourceEmbedList(self.dbstate,self.uistate,self.track,
|
||||
|
@ -46,9 +46,53 @@ from BasicUtils import name_displayer
|
||||
from _EditSecondary import EditSecondary
|
||||
from gen.lib import NoteType
|
||||
|
||||
from DisplayTabs import SourceEmbedList,NoteTab
|
||||
from DisplayTabs import GrampsTab,SourceEmbedList,NoteTab
|
||||
from GrampsWidgets import *
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Classes
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
class GeneralNameTab(GrampsTab):
|
||||
"""
|
||||
This class provides the tabpage of the general name tab
|
||||
"""
|
||||
|
||||
def __init__(self, dbstate, uistate, track, name, widget):
|
||||
"""
|
||||
@param dbstate: The database state. Contains a reference to
|
||||
the database, along with other state information. The GrampsTab
|
||||
uses this to access the database and to pass to and created
|
||||
child windows (such as edit dialogs).
|
||||
@type dbstate: DbState
|
||||
@param uistate: The UI state. Used primarily to pass to any created
|
||||
subwindows.
|
||||
@type uistate: DisplayState
|
||||
@param track: The window tracking mechanism used to manage windows.
|
||||
This is only used to pass to generted child windows.
|
||||
@type track: list
|
||||
@param name: Notebook label name
|
||||
@type name: str/unicode
|
||||
@param widget: widget to be shown in the tab
|
||||
@type widge: gtk widget
|
||||
"""
|
||||
GrampsTab.__init__(self, dbstate, uistate, track, name)
|
||||
eventbox = gtk.EventBox()
|
||||
eventbox.add(widget)
|
||||
self.pack_start(eventbox)
|
||||
self._set_label(show_image=False)
|
||||
widget.connect('key_press_event', self.key_pressed)
|
||||
self.show_all()
|
||||
|
||||
def is_empty(self):
|
||||
"""
|
||||
Override base class
|
||||
"""
|
||||
return False
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# EditName class
|
||||
@ -71,21 +115,24 @@ class EditName(EditSecondary):
|
||||
self.top.get_widget("title"),
|
||||
_("Name Editor"))
|
||||
|
||||
tblgnam = self.top.get_widget('table23')
|
||||
notebook = self.top.get_widget('notebook')
|
||||
#recreate start page as GrampsTab
|
||||
notebook.remove_page(0)
|
||||
self.gennam = GeneralNameTab(self.dbstate, self.uistate, self.track,
|
||||
_('General'), tblgnam)
|
||||
|
||||
self.original_group_as = self.obj.get_group_as()
|
||||
self.original_group_set = not (self.original_group_as == '')
|
||||
srn = self.obj.get_surname()
|
||||
self._get_global_grouping(srn)
|
||||
|
||||
self.general_label = self.top.get_widget("general_tab")
|
||||
|
||||
self.group_over = self.top.get_widget('group_over')
|
||||
self.group_over.connect('toggled',self.on_group_over_toggled)
|
||||
self.group_over.set_sensitive(not self.db.readonly)
|
||||
|
||||
self.toggle_dirty = False
|
||||
|
||||
Utils.bold_label(self.general_label)
|
||||
|
||||
def _post_init(self):
|
||||
"""if there is override, set the override toggle active
|
||||
"""
|
||||
@ -195,6 +242,8 @@ class EditName(EditSecondary):
|
||||
|
||||
notebook = self.top.get_widget("notebook")
|
||||
|
||||
self._add_tab(notebook, self.gennam)
|
||||
|
||||
self.srcref_list = self._add_tab(
|
||||
notebook,
|
||||
SourceEmbedList(self.dbstate,self.uistate,self.track,self.obj))
|
||||
|
@ -46,7 +46,7 @@ import Config
|
||||
import GrampsDisplay
|
||||
import MarkupText
|
||||
from _EditPrimary import EditPrimary
|
||||
from DisplayTabs import NoteBackRefList
|
||||
from DisplayTabs import GrampsTab, NoteBackRefList
|
||||
from GrampsWidgets import *
|
||||
from gen.lib import Note
|
||||
|
||||
@ -66,11 +66,57 @@ URLPATH = "/[" + PATHCHARS + "]*[^]'.}>) \t\r\n,\\\"]"
|
||||
|
||||
(GENERAL, HTTP, MAIL) = range(3)
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# NoteTab
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
class NoteTab(GrampsTab):
|
||||
"""
|
||||
This class provides the tabpage of the note
|
||||
"""
|
||||
|
||||
def __init__(self, dbstate, uistate, track, name, widget):
|
||||
"""
|
||||
@param dbstate: The database state. Contains a reference to
|
||||
the database, along with other state information. The GrampsTab
|
||||
uses this to access the database and to pass to and created
|
||||
child windows (such as edit dialogs).
|
||||
@type dbstate: DbState
|
||||
@param uistate: The UI state. Used primarily to pass to any created
|
||||
subwindows.
|
||||
@type uistate: DisplayState
|
||||
@param track: The window tracking mechanism used to manage windows.
|
||||
This is only used to pass to generted child windows.
|
||||
@type track: list
|
||||
@param name: Notebook label name
|
||||
@type name: str/unicode
|
||||
@param widget: widget to be shown in the tab
|
||||
@type widge: gtk widget
|
||||
"""
|
||||
GrampsTab.__init__(self, dbstate, uistate, track, name)
|
||||
eventbox = gtk.EventBox()
|
||||
eventbox.add(widget)
|
||||
self.pack_start(eventbox)
|
||||
self._set_label(show_image=False)
|
||||
eventbox.connect('key_press_event', self.key_pressed)
|
||||
self.show_all()
|
||||
|
||||
def is_empty(self):
|
||||
"""
|
||||
Override base class
|
||||
"""
|
||||
return False
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# EditNote
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
class EditNote(EditPrimary):
|
||||
hand_cursor = gtk.gdk.Cursor(gtk.gdk.HAND2)
|
||||
regular_cursor = gtk.gdk.Cursor(gtk.gdk.XTERM)
|
||||
@ -139,6 +185,13 @@ class EditNote(EditPrimary):
|
||||
settings = gtk.settings_get_default()
|
||||
self.show_unicode = settings.get_property('gtk-show-unicode-menu')
|
||||
settings.set_property('gtk-show-unicode-menu', False)
|
||||
|
||||
vboxnote = self.top.get_widget('vbox131')
|
||||
notebook = self.top.get_widget('note_notebook')
|
||||
#recreate start page as GrampsTab
|
||||
notebook.remove_page(0)
|
||||
self.ntab = NoteTab(self.dbstate, self.uistate, self.track,
|
||||
_('Note'), vboxnote)
|
||||
|
||||
self.build_interface()
|
||||
|
||||
@ -193,7 +246,9 @@ class EditNote(EditPrimary):
|
||||
window.
|
||||
"""
|
||||
notebook = self.top.get_widget("note_notebook")
|
||||
|
||||
|
||||
self._add_tab(notebook, self.ntab)
|
||||
|
||||
self.backref_tab = self._add_tab(
|
||||
notebook,
|
||||
NoteBackRefList(self.dbstate, self.uistate, self.track,
|
||||
@ -202,8 +257,6 @@ class EditNote(EditPrimary):
|
||||
)
|
||||
|
||||
self._setup_notebook_tabs( notebook)
|
||||
|
||||
notebook.show_all()
|
||||
|
||||
def build_interface(self):
|
||||
FORMAT_TOOLBAR = '''
|
||||
|
@ -51,6 +51,49 @@ from DisplayTabs import *
|
||||
from GrampsWidgets import *
|
||||
from PlaceUtils import conv_lat_lon
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Classes
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
class MainLocTab(GrampsTab):
|
||||
"""
|
||||
This class provides the tabpage of the main location tab
|
||||
"""
|
||||
|
||||
def __init__(self, dbstate, uistate, track, name, widget):
|
||||
"""
|
||||
@param dbstate: The database state. Contains a reference to
|
||||
the database, along with other state information. The GrampsTab
|
||||
uses this to access the database and to pass to and created
|
||||
child windows (such as edit dialogs).
|
||||
@type dbstate: DbState
|
||||
@param uistate: The UI state. Used primarily to pass to any created
|
||||
subwindows.
|
||||
@type uistate: DisplayState
|
||||
@param track: The window tracking mechanism used to manage windows.
|
||||
This is only used to pass to generted child windows.
|
||||
@type track: list
|
||||
@param name: Notebook label name
|
||||
@type name: str/unicode
|
||||
@param widget: widget to be shown in the tab
|
||||
@type widge: gtk widget
|
||||
"""
|
||||
GrampsTab.__init__(self, dbstate, uistate, track, name)
|
||||
eventbox = gtk.EventBox()
|
||||
eventbox.add(widget)
|
||||
self.pack_start(eventbox)
|
||||
self._set_label(show_image=False)
|
||||
widget.connect('key_press_event', self.key_pressed)
|
||||
self.show_all()
|
||||
|
||||
def is_empty(self):
|
||||
"""
|
||||
Override base class
|
||||
"""
|
||||
return False
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# EditPlace
|
||||
@ -73,6 +116,12 @@ class EditPlace(EditPrimary):
|
||||
width = Config.get(Config.PLACE_WIDTH)
|
||||
height = Config.get(Config.PLACE_HEIGHT)
|
||||
self.window.resize(width, height)
|
||||
tblmloc = self.top.get_widget('table19')
|
||||
notebook = self.top.get_widget('notebook3')
|
||||
#recreate start page as GrampsTab
|
||||
notebook.remove_page(0)
|
||||
self.mloc = MainLocTab(self.dbstate, self.uistate, self.track,
|
||||
_('Location'), tblmloc)
|
||||
|
||||
def get_menu_title(self):
|
||||
if self.obj and self.obj.get_handle():
|
||||
@ -167,6 +216,8 @@ class EditPlace(EditPrimary):
|
||||
"""
|
||||
notebook = self.top.get_widget('notebook3')
|
||||
|
||||
self._add_tab(notebook, self.mloc)
|
||||
|
||||
self.loc_list = self._add_tab(
|
||||
notebook,
|
||||
LocationEmbedList(self.dbstate,self.uistate, self.track,
|
||||
@ -197,7 +248,7 @@ class EditPlace(EditPrimary):
|
||||
PlaceBackRefList(self.dbstate,self.uistate,self.track,
|
||||
self.db.find_backlink_handles(self.obj.handle)))
|
||||
|
||||
self._setup_notebook_tabs( notebook)
|
||||
self._setup_notebook_tabs(notebook)
|
||||
|
||||
def _cleanup_on_exit(self):
|
||||
self.backref_list.close()
|
||||
|
@ -99,6 +99,7 @@ class EditPrimary(ManagedWindow.ManagedWindow):
|
||||
self._switch_page_on_dnd,
|
||||
notebook,
|
||||
page_no)
|
||||
child.set_parent_notebook(notebook)
|
||||
|
||||
def _switch_page_on_dnd(self, widget, context, x, y, time, notebook, page_no):
|
||||
if notebook.get_current_page() != page_no:
|
||||
|
@ -27,8 +27,52 @@
|
||||
#-------------------------------------------------------------------------
|
||||
import ManagedWindow
|
||||
from GrampsWidgets import *
|
||||
from DisplayTabs import GrampsTab
|
||||
import Config
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Classes
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
class RefTab(GrampsTab):
|
||||
"""
|
||||
This class provides a simple tabpage for use on EditReference
|
||||
"""
|
||||
|
||||
def __init__(self, dbstate, uistate, track, name, widget):
|
||||
"""
|
||||
@param dbstate: The database state. Contains a reference to
|
||||
the database, along with other state information. The GrampsTab
|
||||
uses this to access the database and to pass to and created
|
||||
child windows (such as edit dialogs).
|
||||
@type dbstate: DbState
|
||||
@param uistate: The UI state. Used primarily to pass to any created
|
||||
subwindows.
|
||||
@type uistate: DisplayState
|
||||
@param track: The window tracking mechanism used to manage windows.
|
||||
This is only used to pass to generted child windows.
|
||||
@type track: list
|
||||
@param name: Notebook label name
|
||||
@type name: str/unicode
|
||||
@param widget: widget to be shown in the tab
|
||||
@type widge: gtk widget
|
||||
"""
|
||||
GrampsTab.__init__(self, dbstate, uistate, track, name)
|
||||
eventbox = gtk.EventBox()
|
||||
eventbox.add(widget)
|
||||
self.pack_start(eventbox)
|
||||
self._set_label(show_image=False)
|
||||
widget.connect('key_press_event', self.key_pressed)
|
||||
self.show_all()
|
||||
|
||||
def is_empty(self):
|
||||
"""
|
||||
Override base class
|
||||
"""
|
||||
return False
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# EditReference class
|
||||
@ -96,6 +140,7 @@ class EditReference(ManagedWindow.ManagedWindow):
|
||||
self._switch_page_on_dnd,
|
||||
notebook,
|
||||
page_no)
|
||||
child.set_parent_notebook(notebook)
|
||||
|
||||
def _switch_page_on_dnd(self, widget, context, x, y, time, notebook, page_no):
|
||||
if notebook.get_current_page() != page_no:
|
||||
|
@ -46,7 +46,7 @@ from gen.lib import NoteType
|
||||
|
||||
from DisplayTabs import NoteTab,AddrEmbedList,WebEmbedList,SourceBackRefList
|
||||
from GrampsWidgets import *
|
||||
from _EditReference import EditReference
|
||||
from _EditReference import RefTab, EditReference
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -74,6 +74,19 @@ class EditRepoRef(EditReference):
|
||||
self.define_warn_box(self.top.get_widget("warn_box"))
|
||||
self.define_expander(self.top.get_widget("src_expander"))
|
||||
|
||||
tblref = self.top.get_widget('table70')
|
||||
notebook = self.top.get_widget('notebook_ref')
|
||||
#recreate start page as GrampsTab
|
||||
notebook.remove_page(0)
|
||||
self.reftab = RefTab(self.dbstate, self.uistate, self.track,
|
||||
_('General'), tblref)
|
||||
tblref = self.top.get_widget('table69')
|
||||
notebook = self.top.get_widget('notebook_src')
|
||||
#recreate start page as GrampsTab
|
||||
notebook.remove_page(0)
|
||||
self.primtab = RefTab(self.dbstate, self.uistate, self.track,
|
||||
_('General'), tblref)
|
||||
|
||||
def _connect_signals(self):
|
||||
self.define_ok_button(self.top.get_widget('ok'),self.ok_clicked)
|
||||
self.define_cancel_button(self.top.get_widget('cancel'))
|
||||
@ -132,6 +145,9 @@ class EditRepoRef(EditReference):
|
||||
notebook_src = self.top.get_widget('notebook_src')
|
||||
notebook_ref = self.top.get_widget('notebook_ref')
|
||||
|
||||
self._add_tab(notebook_src, self.primtab)
|
||||
self._add_tab(notebook_ref, self.reftab)
|
||||
|
||||
self.note_tab = self._add_tab(
|
||||
notebook_src,
|
||||
NoteTab(self.dbstate, self.uistate, self.track,
|
||||
|
@ -92,6 +92,7 @@ class EditSecondary(ManagedWindow.ManagedWindow):
|
||||
self._switch_page_on_dnd,
|
||||
notebook,
|
||||
page_no)
|
||||
child.set_parent_notebook(notebook)
|
||||
|
||||
def _switch_page_on_dnd(self, widget, context, x, y, time, notebook, page_no):
|
||||
if notebook.get_current_page() != page_no:
|
||||
|
@ -45,7 +45,7 @@ import gen.lib
|
||||
from DisplayTabs import \
|
||||
NoteTab,TextTab,GalleryTab,SourceBackRefList,DataEmbedList,RepoEmbedList
|
||||
from GrampsWidgets import *
|
||||
from _EditReference import EditReference
|
||||
from _EditReference import RefTab, EditReference
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -69,6 +69,19 @@ class EditSourceRef(EditReference):
|
||||
self.define_warn_box(self.top.get_widget("warn_box"))
|
||||
self.define_expander(self.top.get_widget("src_expander"))
|
||||
|
||||
tblref = self.top.get_widget('table67')
|
||||
notebook = self.top.get_widget('notebook_ref')
|
||||
#recreate start page as GrampsTab
|
||||
notebook.remove_page(0)
|
||||
self.reftab = RefTab(self.dbstate, self.uistate, self.track,
|
||||
_('General'), tblref)
|
||||
tblref = self.top.get_widget('table68')
|
||||
notebook = self.top.get_widget('notebook_src')
|
||||
#recreate start page as GrampsTab
|
||||
notebook.remove_page(0)
|
||||
self.primtab = RefTab(self.dbstate, self.uistate, self.track,
|
||||
_('General'), tblref)
|
||||
|
||||
def _connect_signals(self):
|
||||
self.define_ok_button(self.top.get_widget('ok'),self.ok_clicked)
|
||||
self.define_cancel_button(self.top.get_widget('cancel'))
|
||||
@ -131,12 +144,13 @@ class EditSourceRef(EditReference):
|
||||
"""
|
||||
Creates the notebook tabs and inserts them into the main
|
||||
window.
|
||||
|
||||
"""
|
||||
|
||||
notebook_src = self.top.get_widget('notebook_src')
|
||||
notebook_ref = self.top.get_widget('notebook_ref')
|
||||
|
||||
self._add_tab(notebook_src, self.primtab)
|
||||
self._add_tab(notebook_ref, self.reftab)
|
||||
|
||||
self.note_tab = self._add_tab(
|
||||
notebook_src,
|
||||
NoteTab(self.dbstate, self.uistate, self.track,
|
||||
@ -165,10 +179,6 @@ class EditSourceRef(EditReference):
|
||||
self.enable_warnbox
|
||||
))
|
||||
|
||||
# self.text_tab = self._add_tab(
|
||||
# notebook_ref,
|
||||
# TextTab(self.dbstate, self.uistate, self.track,self.source_ref))
|
||||
|
||||
self.comment_tab = self._add_tab(
|
||||
notebook_ref,
|
||||
NoteTab(self.dbstate, self.uistate, self.track,
|
||||
|
Loading…
Reference in New Issue
Block a user