Saves title override; removed title_id
svn: r16994
This commit is contained in:
parent
452538b370
commit
1d2ed8bf36
@ -81,7 +81,6 @@ def GET_AVAILABLE_GRAMPLETS(name):
|
|||||||
"height": gplug.height,
|
"height": gplug.height,
|
||||||
"expand": gplug.expand,
|
"expand": gplug.expand,
|
||||||
"title": gplug.gramplet_title, # translated
|
"title": gplug.gramplet_title, # translated
|
||||||
"title_id": gplug.gramplet_title_id, # untranslated
|
|
||||||
"content": gplug.gramplet,
|
"content": gplug.gramplet,
|
||||||
"detached_width": gplug.detached_width,
|
"detached_width": gplug.detached_width,
|
||||||
"detached_height": gplug.detached_height,
|
"detached_height": gplug.detached_height,
|
||||||
@ -779,7 +778,6 @@ class GridGramplet(GuiGramplet):
|
|||||||
"""
|
"""
|
||||||
result = self.set_title(widget.get_text())
|
result = self.set_title(widget.get_text())
|
||||||
if result: # if ok to set title to that
|
if result: # if ok to set title to that
|
||||||
self.title_override = True
|
|
||||||
self.titlelabel.show()
|
self.titlelabel.show()
|
||||||
widget.hide()
|
widget.hide()
|
||||||
return False # Return False for gtk requirement
|
return False # Return False for gtk requirement
|
||||||
@ -899,10 +897,12 @@ class GridGramplet(GuiGramplet):
|
|||||||
self.scrolledwindow.set_size_request(-1, self.height)
|
self.scrolledwindow.set_size_request(-1, self.height)
|
||||||
self.set_state(self.gstate)
|
self.set_state(self.gstate)
|
||||||
|
|
||||||
def set_title(self, new_title):
|
def set_title(self, new_title, set_override=True):
|
||||||
# can't do it if already titled that way
|
# can't do it if already titled that way
|
||||||
if self.title == new_title: return True
|
if self.title == new_title: return True
|
||||||
if new_title in self.pane.gramplet_map: return False
|
if new_title in self.pane.gramplet_map: return False
|
||||||
|
if set_override:
|
||||||
|
self.title_override = True
|
||||||
del self.pane.gramplet_map[self.title]
|
del self.pane.gramplet_map[self.title]
|
||||||
self.title = new_title
|
self.title = new_title
|
||||||
if self.detached_window:
|
if self.detached_window:
|
||||||
@ -971,18 +971,21 @@ class GrampletPane(gtk.ScrolledWindow):
|
|||||||
all_opts["state"] = "maximized"
|
all_opts["state"] = "maximized"
|
||||||
if "title" not in all_opts:
|
if "title" not in all_opts:
|
||||||
all_opts["title"] = _("Untitled Gramplet")
|
all_opts["title"] = _("Untitled Gramplet")
|
||||||
all_opts["title_id"] = "Untitled Gramplet"
|
set_override = False
|
||||||
|
else:
|
||||||
|
set_override = True
|
||||||
# May have to change title
|
# May have to change title
|
||||||
g = make_requested_gramplet(GridGramplet, self, all_opts,
|
g = make_requested_gramplet(GridGramplet, self, all_opts,
|
||||||
self.dbstate, self.uistate)
|
self.dbstate, self.uistate)
|
||||||
if g:
|
if g:
|
||||||
|
g.title_override = set_override # to continue to override, when this is saved
|
||||||
# make a unique title:
|
# make a unique title:
|
||||||
unique = g.get_title()
|
unique = g.get_title()
|
||||||
cnt = 1
|
cnt = 1
|
||||||
while unique in self.gramplet_map:
|
while unique in self.gramplet_map:
|
||||||
unique = g.get_title() + ("-%d" % cnt)
|
unique = g.get_title() + ("-%d" % cnt)
|
||||||
cnt += 1
|
cnt += 1
|
||||||
g.set_title(unique)
|
g.set_title(unique, set_override=False)
|
||||||
self.gramplet_map[unique] = g
|
self.gramplet_map[unique] = g
|
||||||
self.frame_map[str(g.mainframe)] = g
|
self.frame_map[str(g.mainframe)] = g
|
||||||
else:
|
else:
|
||||||
@ -1137,8 +1140,9 @@ class GrampletPane(gtk.ScrolledWindow):
|
|||||||
fp.write(("[%s]" + NL) % gramplet.gname)
|
fp.write(("[%s]" + NL) % gramplet.gname)
|
||||||
for key in base_opts:
|
for key in base_opts:
|
||||||
if key == "content": continue
|
if key == "content": continue
|
||||||
elif key == "title": continue
|
elif key == "title":
|
||||||
elif key == "title_id": continue
|
if gramplet.title_override:
|
||||||
|
fp.write(("title=%s" + NL)% base_opts[key])
|
||||||
elif key == "tname": continue
|
elif key == "tname": continue
|
||||||
elif key == "column": continue
|
elif key == "column": continue
|
||||||
elif key == "row": continue
|
elif key == "row": continue
|
||||||
@ -1169,8 +1173,9 @@ class GrampletPane(gtk.ScrolledWindow):
|
|||||||
fp.write(("[%s]" + NL) % gramplet.title)
|
fp.write(("[%s]" + NL) % gramplet.title)
|
||||||
for key in base_opts:
|
for key in base_opts:
|
||||||
if key == "content": continue
|
if key == "content": continue
|
||||||
elif key == "title": continue
|
elif key == "title":
|
||||||
elif key == "title_id": continue
|
if self.title_override:
|
||||||
|
fp.write(("title=%s" + NL)% base_opts[key])
|
||||||
elif key == "tname": continue
|
elif key == "tname": continue
|
||||||
elif key == "version": continue # code, don't save
|
elif key == "version": continue # code, don't save
|
||||||
elif key == "gramps": continue # code, don't save
|
elif key == "gramps": continue # code, don't save
|
||||||
|
Loading…
Reference in New Issue
Block a user