* src/DataViews/_PedigreeView.py: Set dirty flag to force redrawing when changing tree style

* src/plugins/TestcaseGenerator.py: Update to new GrampsTypes



svn: r6398
This commit is contained in:
Martin Hawlisch 2006-04-21 20:03:09 +00:00
parent 524c5fe207
commit 267741996a
3 changed files with 23 additions and 18 deletions

View File

@ -1,3 +1,8 @@
2006-04-21 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/DataViews/_PedigreeView.py: Set dirty flag to force redrawing
when changing tree style
* src/plugins/TestcaseGenerator.py: Update to new GrampsTypes
2006-04-21 Don Allingham <don@gramps-project.org> 2006-04-21 Don Allingham <don@gramps-project.org>
* src/Editors/_EditRepository.py: fix warnbox call * src/Editors/_EditRepository.py: fix warnbox call
* src/Editors/_EditPlace.py: fix warnbox call * src/Editors/_EditPlace.py: fix warnbox call

View File

@ -1079,11 +1079,13 @@ class PedigreeView(PageView.PersonNavView):
def change_force_size_cb(self,event,data): def change_force_size_cb(self,event,data):
if data in [0,2,3,4,5]: if data in [0,2,3,4,5]:
self.force_size = data self.force_size = data
self.dirty = True
self.size_request_cb(self.notebook.parent,None) # switch to matching size self.size_request_cb(self.notebook.parent,None) # switch to matching size
def change_tree_style_cb(self,event,data): def change_tree_style_cb(self,event,data):
if data in [0,1]: if data in [0,1]:
if self.tree_style != data: if self.tree_style != data:
self.dirty = True
self.tree_style = data self.tree_style = data
if self.dbstate.active: if self.dbstate.active:
self.rebuild_trees(self.dbstate.active.handle) # Rebuild using new style self.rebuild_trees(self.dbstate.active.handle) # Rebuild using new style
@ -1092,6 +1094,7 @@ class PedigreeView(PageView.PersonNavView):
def change_show_images_cb(self,event): def change_show_images_cb(self,event):
self.show_images = not self.show_images self.show_images = not self.show_images
self.dirty = True
if self.dbstate.active: if self.dbstate.active:
self.rebuild_trees(self.dbstate.active.handle) # Rebuild using new style self.rebuild_trees(self.dbstate.active.handle) # Rebuild using new style
else: else:
@ -1099,6 +1102,7 @@ class PedigreeView(PageView.PersonNavView):
def change_show_marriage_cb(self,event): def change_show_marriage_cb(self,event):
self.show_marriage_data = not self.show_marriage_data self.show_marriage_data = not self.show_marriage_data
self.dirty = True
if self.dbstate.active: if self.dbstate.active:
self.rebuild_trees(self.dbstate.active.handle) # Rebuild using new style self.rebuild_trees(self.dbstate.active.handle) # Rebuild using new style
else: else:

View File

@ -783,25 +783,25 @@ class TestcaseGenerator(Tool.Tool):
# birth # birth
if randint(0,1) == 1: if randint(0,1) == 1:
(birth_year, eref) = self.rand_personal_event( RelLib.Event.BIRTH, by,by) (birth_year, eref) = self.rand_personal_event( RelLib.EventType.BIRTH, by,by)
np.set_birth_ref(eref) np.set_birth_ref(eref)
# baptism # baptism
if randint(0,1) == 1: if randint(0,1) == 1:
(bapt_year, eref) = self.rand_personal_event( (bapt_year, eref) = self.rand_personal_event(
choice( (RelLib.Event.BAPTISM, RelLib.Event.CHRISTEN)), by, by+2) choice( (RelLib.EventType.BAPTISM, RelLib.EventType.CHRISTEN)), by, by+2)
np.add_event_ref(eref) np.add_event_ref(eref)
# death # death
death_year = None death_year = None
if randint(0,1) == 1: if randint(0,1) == 1:
(death_year, eref) = self.rand_personal_event( RelLib.Event.DEATH, dy,dy) (death_year, eref) = self.rand_personal_event( RelLib.EventType.DEATH, dy,dy)
np.set_death_ref(eref) np.set_death_ref(eref)
# burial # burial
if randint(0,1) == 1: if randint(0,1) == 1:
(bur_year, eref) = self.rand_personal_event( (bur_year, eref) = self.rand_personal_event(
choice( (RelLib.Event.BURIAL, RelLib.Event.CREMATION)), dy, dy+2) choice( (RelLib.EventType.BURIAL, RelLib.EventType.CREMATION)), dy, dy+2)
np.add_event_ref(eref) np.add_event_ref(eref)
# some other events # some other events
@ -829,9 +829,9 @@ class TestcaseGenerator(Tool.Tool):
return( person_handle) return( person_handle)
def generate_family(self,person1_h): def generate_family(self,person1_h):
if not person1_h:
return
person1 = self.db.get_person_from_handle(person1_h) person1 = self.db.get_person_from_handle(person1_h)
if not person1:
return
alive_in_year = None alive_in_year = None
if person1_h in self.person_dates: if person1_h in self.person_dates:
(born, died) = self.person_dates[person1_h] (born, died) = self.person_dates[person1_h]
@ -1019,12 +1019,8 @@ class TestcaseGenerator(Tool.Tool):
self.fill_object(a) self.fill_object(a)
o.add_address( a) o.add_address( a)
if isinstance(o,RelLib.Attribute) and isinstance(o,RelLib.Person): if isinstance(o,RelLib.Attribute):
o.set_type( self.rand_type(Utils.personal_attributes)) o.set_type( self.rand_type(RelLib.AttributeType()))
o.set_value( self.rand_text(self.SHORT))
if isinstance(o,RelLib.Attribute) and isinstance(o,RelLib.Family):
o.set_type( self.rand_type(Utils.family_attributes))
o.set_value( self.rand_text(self.SHORT)) o.set_value( self.rand_text(self.SHORT))
if issubclass(o.__class__,RelLib._AttributeBase.AttributeBase): if issubclass(o.__class__,RelLib._AttributeBase.AttributeBase):
@ -1125,7 +1121,7 @@ class TestcaseGenerator(Tool.Tool):
o.set_privacy( randint(0,5) == 1) o.set_privacy( randint(0,5) == 1)
if issubclass(o.__class__,RelLib.PrimaryObject): if issubclass(o.__class__,RelLib.PrimaryObject):
o.set_marker( self.rand_type(Utils.marker_types)) o.set_marker( self.rand_type(RelLib.MarkerType()))
if isinstance(o,RelLib.RepoRef): if isinstance(o,RelLib.RepoRef):
if not self.generated_repos or randint(0,10) == 1: if not self.generated_repos or randint(0,10) == 1:
@ -1136,7 +1132,7 @@ class TestcaseGenerator(Tool.Tool):
o.set_reference_handle( choice( self.generated_repos)) o.set_reference_handle( choice( self.generated_repos))
if randint(0,1) == 1: if randint(0,1) == 1:
o.set_call_number( self.rand_text(self.SHORT)) o.set_call_number( self.rand_text(self.SHORT))
o.set_media_type( self.rand_type(Utils.source_media_types)) o.set_media_type( self.rand_type(RelLib.SourceMediaType()))
if isinstance(o,RelLib.Repository): if isinstance(o,RelLib.Repository):
o.set_type( self.rand_type(RelLib.RepositoryType())) o.set_type( self.rand_type(RelLib.RepositoryType()))
@ -1194,16 +1190,16 @@ class TestcaseGenerator(Tool.Tool):
def rand_personal_event( self, type=None, start=None, end=None): def rand_personal_event( self, type=None, start=None, end=None):
if type: if type:
typeval = (type, Utils.personal_events[type]) typeval = RelLib.EventType(type)
else: else:
typeval = self.rand_type(Utils.personal_events) typeval = self.rand_type(RelLib.EventType())
return self._rand_event( typeval, start, end) return self._rand_event( typeval, start, end)
def rand_family_event( self, type=None, start=None, end=None): def rand_family_event( self, type=None, start=None, end=None):
if type: if type:
typeval = (type, Utils.family_events[type]) typeval = RelLib.EventType(type)
else: else:
typeval = self.rand_type(Utils.family_events) typeval = self.rand_type(RelLib.EventType())
return self._rand_event( typeval, start, end) return self._rand_event( typeval, start, end)
def _rand_event( self, type, start, end): def _rand_event( self, type, start, end):