Add a title preview to the place editors
This commit is contained in:
parent
0eb027a095
commit
f0bfce68c2
@ -61,9 +61,10 @@ class PlaceRefEmbedList(EmbeddedList):
|
||||
(_('Date'), 3, 150, TEXT_COL, -1, None),
|
||||
]
|
||||
|
||||
def __init__(self, dbstate, uistate, track, data, handle):
|
||||
def __init__(self, dbstate, uistate, track, data, handle, callback):
|
||||
self.data = data
|
||||
self.handle = handle
|
||||
self.callback = callback
|
||||
EmbeddedList.__init__(self, dbstate, uistate, track,
|
||||
_('Enclosed By'), PlaceRefModel,
|
||||
share_button=True, move_buttons=True)
|
||||
@ -132,6 +133,9 @@ class PlaceRefEmbedList(EmbeddedList):
|
||||
def edit_callback(self, ref, place):
|
||||
self.rebuild()
|
||||
|
||||
def post_rebuild(self, prebuildpath):
|
||||
self.callback()
|
||||
|
||||
def handle_extra_type(self, objtype, obj):
|
||||
if obj in self.get_skip_list(self.handle):
|
||||
ErrorDialog(_("Place cycle detected"),
|
||||
|
@ -115,7 +115,8 @@ class EditPlace(EditPrimary):
|
||||
|
||||
self.name = MonitoredEntry(self.top.get_object("name_entry"),
|
||||
self.obj.set_name, self.obj.get_name,
|
||||
self.db.readonly)
|
||||
self.db.readonly,
|
||||
changed=self.name_changed)
|
||||
|
||||
self.gid = MonitoredEntry(self.top.get_object("gid"),
|
||||
self.obj.set_gramps_id,
|
||||
@ -167,6 +168,13 @@ class EditPlace(EditPrimary):
|
||||
return ValidationError(_("Invalid longitude (syntax: 18\u00b09'") +
|
||||
_('48.21"E, -18.2412 or -18:9:48.21)'))
|
||||
|
||||
def update_title(self):
|
||||
new_title = place_displayer.display(self.db, self.obj)
|
||||
self.top.get_object("preview_title").set_text(new_title)
|
||||
|
||||
def name_changed(self, obj):
|
||||
self.update_title()
|
||||
|
||||
def build_menu_names(self, place):
|
||||
return (_('Edit Place'), self.get_menu_title())
|
||||
|
||||
@ -182,7 +190,8 @@ class EditPlace(EditPrimary):
|
||||
self.uistate,
|
||||
self.track,
|
||||
self.obj.get_placeref_list(),
|
||||
self.obj.handle)
|
||||
self.obj.handle,
|
||||
self.update_title)
|
||||
self._add_tab(notebook, self.placeref_list)
|
||||
self.track_ref_for_deletion("placeref_list")
|
||||
|
||||
|
@ -35,6 +35,7 @@ from gramps.gen.lib import NoteType
|
||||
from gramps.gen.db import DbTxn
|
||||
from gramps.gen.errors import ValidationError
|
||||
from gramps.gen.utils.place import conv_lat_lon
|
||||
from gramps.gen.display.place import displayer as place_displayer
|
||||
from gramps.gen.config import config
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
@ -113,7 +114,8 @@ class EditPlaceRef(EditReference):
|
||||
|
||||
self.name = MonitoredEntry(self.top.get_object("name_entry"),
|
||||
self.source.set_name, self.source.get_name,
|
||||
self.db.readonly)
|
||||
self.db.readonly,
|
||||
changed=self.name_changed)
|
||||
|
||||
self.gid = MonitoredEntry(self.top.get_object("gid"),
|
||||
self.source.set_gramps_id,
|
||||
@ -165,6 +167,13 @@ class EditPlaceRef(EditReference):
|
||||
return ValidationError(_("Invalid longitude (syntax: 18\u00b09'") +
|
||||
_('48.21"E, -18.2412 or -18:9:48.21)'))
|
||||
|
||||
def update_title(self):
|
||||
new_title = place_displayer.display(self.db, self.source)
|
||||
self.top.get_object("preview_title").set_text(new_title)
|
||||
|
||||
def name_changed(self, obj):
|
||||
self.update_title()
|
||||
|
||||
def _create_tabbed_pages(self):
|
||||
"""
|
||||
Create the notebook tabs and inserts them into the main
|
||||
@ -183,7 +192,8 @@ class EditPlaceRef(EditReference):
|
||||
self.uistate,
|
||||
self.track,
|
||||
self.source.get_placeref_list(),
|
||||
self.source.handle)
|
||||
self.source.handle,
|
||||
self.update_title)
|
||||
self._add_tab(notebook, self.placeref_list)
|
||||
self.track_ref_for_deletion("placeref_list")
|
||||
|
||||
|
@ -94,7 +94,7 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -109,7 +109,7 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -124,7 +124,7 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -137,7 +137,7 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
@ -152,7 +152,7 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="top_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -167,7 +167,7 @@ You can set these values via the Geography View by searching the place, or via a
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -182,7 +182,7 @@ You can set these values via the Geography View by searching the place, or via a
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -236,7 +236,7 @@ You can set these values via the Geography View by searching the place, or via a
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="top_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -266,7 +266,7 @@ You can set these values via the Geography View by searching the place, or via a
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">4</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -278,7 +278,7 @@ You can set these values via the Geography View by searching the place, or via a
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">4</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="top_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -290,7 +290,7 @@ You can set these values via the Geography View by searching the place, or via a
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -302,7 +302,7 @@ You can set these values via the Geography View by searching the place, or via a
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -315,7 +315,7 @@ You can set these values via the Geography View by searching the place, or via a
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -334,7 +334,7 @@ You can set these values via the Geography View by searching the place, or via a
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -346,7 +346,7 @@ You can set these values via the Geography View by searching the place, or via a
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="top_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -358,7 +358,23 @@ You can set these values via the Geography View by searching the place, or via a
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="top_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="preview_title">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_bottom">6</property>
|
||||
<property name="xalign">0</property>
|
||||
<attributes>
|
||||
<attribute name="font-desc" value="Sans Bold 12"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -200,7 +200,7 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -214,7 +214,7 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -229,7 +229,7 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="top_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -242,7 +242,7 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -285,7 +285,7 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="width">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
@ -300,7 +300,7 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -314,7 +314,7 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -333,7 +333,7 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -363,7 +363,7 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">4</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -376,7 +376,7 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
@ -390,7 +390,7 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -405,7 +405,7 @@ You can set these values via the Geography View by searching the place, or via a
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -420,7 +420,7 @@ You can set these values via the Geography View by searching the place, or via a
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -474,7 +474,7 @@ You can set these values via the Geography View by searching the place, or via a
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="top_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -486,7 +486,7 @@ You can set these values via the Geography View by searching the place, or via a
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="top_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -498,7 +498,7 @@ You can set these values via the Geography View by searching the place, or via a
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="top_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -510,7 +510,23 @@ You can set these values via the Geography View by searching the place, or via a
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">4</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="top_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="preview_title">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_bottom">6</property>
|
||||
<property name="xalign">0</property>
|
||||
<attributes>
|
||||
<attribute name="font-desc" value="Sans Bold 12"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
Loading…
Reference in New Issue
Block a user