2008-02-28 Benny Malengier <benny.malengier@gramps-project.org>

* src/plugins/DefaultGramplets.py: improve (??) Pedigree Gramplet
	* src/DataViews/GrampletView.py: add a no-wrap method



svn: r10135
This commit is contained in:
Benny Malengier 2008-02-28 10:30:12 +00:00
parent 5f7c6c1c8a
commit e1cae1a3bc
3 changed files with 28 additions and 9 deletions

View File

@ -1,3 +1,7 @@
2008-02-28 Benny Malengier <benny.malengier@gramps-project.org>
* src/plugins/DefaultGramplets.py: improve (??) Pedigree Gramplet
* src/DataViews/GrampletView.py: add a no-wrap method
2008-02-28 Douglas S. Blank <dblank@cs.brynmawr.edu> 2008-02-28 Douglas S. Blank <dblank@cs.brynmawr.edu>
* src/plugins/DefaultGramplets.py: new Pedigree Gramplet * src/plugins/DefaultGramplets.py: new Pedigree Gramplet
* src/DataViews/GrampletView.py: added help button on undocked windows * src/DataViews/GrampletView.py: added help button on undocked windows

View File

@ -282,6 +282,14 @@ class Gramplet(object):
def set_use_markup(self, value): def set_use_markup(self, value):
self.gui.set_use_markup(value) self.gui.set_use_markup(value)
def no_wrap(self):
"""
The view in gramplet should not wrap.
"""
self.gui.scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC,
gtk.POLICY_AUTOMATIC)
self.gui.textview.set_wrap_mode(gtk.WRAP_NONE)
# Other functions of the gramplet: # Other functions of the gramplet:
def load_data_to_text(self, pos=0): def load_data_to_text(self, pos=0):

View File

@ -462,14 +462,19 @@ class PedigreeGramplet(Gramplet):
def active_changed(self, handle): def active_changed(self, handle):
self.update() self.update()
def get_boxes(self, generation): def get_boxes(self, generation, what):
retval = "" retval = ""
for i in range(generation+1): for i in range(generation+1):
if self._boxes[i]: if self._boxes[i]:
retval += " |" retval += " |"
else: else:
retval += " " retval += " "
return retval + "--" if retval[-1] == ' ':
if what == 'sf':
return retval[:-6] + r' /-'
elif what == 'sm':
return retval[:-6] + r' \-'
return retval + '--'
def process_person(self, handle, generation, what): def process_person(self, handle, generation, what):
if generation > self.max_generations: if generation > self.max_generations:
@ -483,10 +488,10 @@ class PedigreeGramplet(Gramplet):
if father: if father:
self.process_person(father, generation + 1, "f") self.process_person(father, generation + 1, "f")
self._boxes[generation] = 1 self._boxes[generation] = 1
self.process_person(father, generation + 1, "s") self.process_person(father, generation + 1, "sf")
self.process_person(father, generation + 1, "m") self.process_person(father, generation + 1, "m")
if what == "s": if what[0] == "s":
self.append_text(self.get_boxes(generation)) self.append_text(self.get_boxes(generation, what))
self.link(name_displayer.display_name(person.get_primary_name()), self.link(name_displayer.display_name(person.get_primary_name()),
'Person', person.handle) 'Person', person.handle)
self.append_text("\n") self.append_text("\n")
@ -496,7 +501,7 @@ class PedigreeGramplet(Gramplet):
mother = family.get_mother_handle() mother = family.get_mother_handle()
if mother: if mother:
self.process_person(mother, generation + 1, "f") self.process_person(mother, generation + 1, "f")
self.process_person(mother, generation + 1, "s") self.process_person(mother, generation + 1, "sm")
self._boxes[generation] = 0 self._boxes[generation] = 0
self.process_person(mother, generation + 1, "m") self.process_person(mother, generation + 1, "m")
@ -509,8 +514,10 @@ class PedigreeGramplet(Gramplet):
active_person = self.dbstate.get_active_person() active_person = self.dbstate.get_active_person()
if not active_person: if not active_person:
return False return False
#no wrap in Gramplet
self.no_wrap()
self.process_person(active_person.handle, 1, "f") self.process_person(active_person.handle, 1, "f")
self.process_person(active_person.handle, 1, "s") self.process_person(active_person.handle, 0, "s")
self.process_person(active_person.handle, 1, "m") self.process_person(active_person.handle, 1, "m")
self.append_text("", scroll_to="begin") self.append_text("", scroll_to="begin")