2006-05-28 Alex Roitman <shura@gramps-project.org>
* src/plugins/Verify.py: Add double-clicking and mark/unmark/invert. svn: r6804
This commit is contained in:
parent
cb7bf9f5d3
commit
a10de04d28
@ -1,3 +1,6 @@
|
|||||||
|
2006-05-28 Alex Roitman <shura@gramps-project.org>
|
||||||
|
* src/plugins/Verify.py: Add double-clicking and mark/unmark/invert.
|
||||||
|
|
||||||
2006-05-28 Brian Matherly <brian@gramps-project.org>
|
2006-05-28 Brian Matherly <brian@gramps-project.org>
|
||||||
* src/docgen/OpenOfficeDoc.py: Allow large cells to span pages (bug 0000165)
|
* src/docgen/OpenOfficeDoc.py: Allow large cells to span pages (bug 0000165)
|
||||||
|
|
||||||
|
@ -211,6 +211,7 @@ class Verify(Tool.Tool, ManagedWindow, UpdateCallback):
|
|||||||
ManagedWindow.__init__(self,uistate,[],self.__class__)
|
ManagedWindow.__init__(self,uistate,[],self.__class__)
|
||||||
UpdateCallback.__init__(self,self.uistate.pulse_progressbar)
|
UpdateCallback.__init__(self,self.uistate.pulse_progressbar)
|
||||||
|
|
||||||
|
self.dbstate = dbstate
|
||||||
if uistate:
|
if uistate:
|
||||||
self.init_gui()
|
self.init_gui()
|
||||||
else:
|
else:
|
||||||
@ -318,7 +319,7 @@ class Verify(Tool.Tool, ManagedWindow, UpdateCallback):
|
|||||||
self.top.get_widget(
|
self.top.get_widget(
|
||||||
"estimate").get_active()
|
"estimate").get_active()
|
||||||
|
|
||||||
vr = VerifyResults(self.uistate, self.track)
|
vr = VerifyResults(self.dbstate, self.uistate, self.track)
|
||||||
self.add_results = vr.add_results
|
self.add_results = vr.add_results
|
||||||
vr.load_ignored(self.db.full_name)
|
vr.load_ignored(self.db.full_name)
|
||||||
|
|
||||||
@ -422,11 +423,13 @@ class Verify(Tool.Tool, ManagedWindow, UpdateCallback):
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class VerifyResults(ManagedWindow):
|
class VerifyResults(ManagedWindow):
|
||||||
def __init__(self,uistate,track):
|
def __init__(self,dbstate,uistate,track):
|
||||||
self.title = _('Database Verification Results')
|
self.title = _('Database Verification Results')
|
||||||
|
|
||||||
ManagedWindow.__init__(self,uistate,track,self.__class__)
|
ManagedWindow.__init__(self,uistate,track,self.__class__)
|
||||||
|
|
||||||
|
self.dbstate = dbstate
|
||||||
|
|
||||||
base = os.path.dirname(__file__)
|
base = os.path.dirname(__file__)
|
||||||
self.glade_file = base + os.sep + "verify.glade"
|
self.glade_file = base + os.sep + "verify.glade"
|
||||||
|
|
||||||
@ -439,9 +442,22 @@ class VerifyResults(ManagedWindow):
|
|||||||
})
|
})
|
||||||
|
|
||||||
self.warn_tree = self.top.get_widget('warn_tree')
|
self.warn_tree = self.top.get_widget('warn_tree')
|
||||||
|
self.warn_tree.connect('button_press_event', self.double_click)
|
||||||
|
|
||||||
|
self.selection = self.warn_tree.get_selection()
|
||||||
|
|
||||||
self.hide_button = self.top.get_widget('hide_button')
|
self.hide_button = self.top.get_widget('hide_button')
|
||||||
self.hide_button.connect('toggled',self.hide_toggled)
|
self.hide_button.connect('toggled',self.hide_toggled)
|
||||||
|
|
||||||
|
self.mark_button = self.top.get_widget('mark_all')
|
||||||
|
self.mark_button.connect('clicked',self.mark_clicked)
|
||||||
|
|
||||||
|
self.unmark_button = self.top.get_widget('unmark_all')
|
||||||
|
self.unmark_button.connect('clicked',self.unmark_clicked)
|
||||||
|
|
||||||
|
self.invert_button = self.top.get_widget('invert_all')
|
||||||
|
self.invert_button.connect('clicked',self.invert_clicked)
|
||||||
|
|
||||||
self.real_model = gtk.ListStore(bool,str,str,str,str,int,str,str,
|
self.real_model = gtk.ListStore(bool,str,str,str,str,int,str,str,
|
||||||
bool,bool)
|
bool,bool)
|
||||||
self.filt_model = self.real_model.filter_new()
|
self.filt_model = self.real_model.filter_new()
|
||||||
@ -455,7 +471,7 @@ class VerifyResults(ManagedWindow):
|
|||||||
self.bool_renderer.connect('toggled',self.selection_toggled)
|
self.bool_renderer.connect('toggled',self.selection_toggled)
|
||||||
|
|
||||||
self.warn_tree.append_column(
|
self.warn_tree.append_column(
|
||||||
gtk.TreeViewColumn(_('Hide'),self.bool_renderer,active=0))
|
gtk.TreeViewColumn(_('Mark'),self.bool_renderer,active=0))
|
||||||
|
|
||||||
img_column = gtk.TreeViewColumn(None, self.img_renderer )
|
img_column = gtk.TreeViewColumn(None, self.img_renderer )
|
||||||
img_column.set_cell_data_func(self.img_renderer,self.get_image)
|
img_column.set_cell_data_func(self.img_renderer,self.get_image)
|
||||||
@ -547,7 +563,7 @@ class VerifyResults(ManagedWindow):
|
|||||||
self.filt_model.set_visible_column(8)
|
self.filt_model.set_visible_column(8)
|
||||||
self.sort_model = gtk.TreeModelSort(self.filt_model)
|
self.sort_model = gtk.TreeModelSort(self.filt_model)
|
||||||
self.warn_tree.set_model(self.sort_model)
|
self.warn_tree.set_model(self.sort_model)
|
||||||
button.set_label(_("_Hide selected"))
|
button.set_label(_("_Hide marked"))
|
||||||
|
|
||||||
def selection_toggled(self,cell,path_string):
|
def selection_toggled(self,cell,path_string):
|
||||||
sort_path = tuple([int (i) for i in path_string.split(':')])
|
sort_path = tuple([int (i) for i in path_string.split(':')])
|
||||||
@ -558,6 +574,56 @@ class VerifyResults(ManagedWindow):
|
|||||||
row[9] = not row[0]
|
row[9] = not row[0]
|
||||||
self.real_model.row_changed(real_path,row.iter)
|
self.real_model.row_changed(real_path,row.iter)
|
||||||
|
|
||||||
|
def mark_clicked(self,mark_button):
|
||||||
|
for row_num in range(len(self.real_model)):
|
||||||
|
path = (row_num,)
|
||||||
|
row = self.real_model[path]
|
||||||
|
row[0] = True
|
||||||
|
row[9] = False
|
||||||
|
self.filt_model.refilter()
|
||||||
|
|
||||||
|
def unmark_clicked(self,unmark_button):
|
||||||
|
for row_num in range(len(self.real_model)):
|
||||||
|
path = (row_num,)
|
||||||
|
row = self.real_model[path]
|
||||||
|
row[0] = False
|
||||||
|
row[9] = True
|
||||||
|
self.filt_model.refilter()
|
||||||
|
|
||||||
|
def invert_clicked(self,invert_button):
|
||||||
|
for row_num in range(len(self.real_model)):
|
||||||
|
path = (row_num,)
|
||||||
|
row = self.real_model[path]
|
||||||
|
row[0] = not row[0]
|
||||||
|
row[9] = not row[9]
|
||||||
|
self.filt_model.refilter()
|
||||||
|
|
||||||
|
def double_click(self,obj,event):
|
||||||
|
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
|
||||||
|
(model,node) = self.selection.get_selected()
|
||||||
|
if not node:
|
||||||
|
return
|
||||||
|
sort_path = self.sort_model.get_path(node)
|
||||||
|
filt_path = self.sort_model.convert_path_to_child_path(sort_path)
|
||||||
|
real_path = self.filt_model.convert_path_to_child_path(filt_path)
|
||||||
|
row = self.real_model[real_path]
|
||||||
|
the_type = row[4]
|
||||||
|
handle = row[6]
|
||||||
|
if the_type == 'Person':
|
||||||
|
try:
|
||||||
|
from Editors import EditPerson
|
||||||
|
person = self.dbstate.db.get_person_from_handle(handle)
|
||||||
|
EditPerson(self.dbstate, self.uistate, [], person)
|
||||||
|
except Errors.WindowActiveError:
|
||||||
|
pass
|
||||||
|
elif the_type == 'Family':
|
||||||
|
try:
|
||||||
|
from Editors import EditFamily
|
||||||
|
family = self.dbstate.db.get_family_from_handle(handle)
|
||||||
|
EditFamily(self.dbstate, self.uistate, [], family)
|
||||||
|
except Errors.WindowActiveError:
|
||||||
|
pass
|
||||||
|
|
||||||
def get_image(self, column, cell, model, iter, user_data=None):
|
def get_image(self, column, cell, model, iter, user_data=None):
|
||||||
the_type = model.get_value(iter, 4)
|
the_type = model.get_value(iter, 4)
|
||||||
if the_type == 'Person':
|
if the_type == 'Person':
|
||||||
@ -824,7 +890,7 @@ class OldAge(PersonRule):
|
|||||||
|
|
||||||
def broken(self):
|
def broken(self):
|
||||||
age_at_death = get_age_at_death(self.db,self.obj,self.est)
|
age_at_death = get_age_at_death(self.db,self.obj,self.est)
|
||||||
return (age_at_death > self.old_age)
|
return (age_at_death/365 > self.old_age)
|
||||||
|
|
||||||
def get_message(self):
|
def get_message(self):
|
||||||
return _("Old age at death")
|
return _("Old age at death")
|
||||||
@ -875,7 +941,7 @@ class OldUnmarried(PersonRule):
|
|||||||
def broken(self):
|
def broken(self):
|
||||||
age_at_death = get_age_at_death(self.db,self.obj,self.est)
|
age_at_death = get_age_at_death(self.db,self.obj,self.est)
|
||||||
n_spouses = len(self.obj.get_family_handle_list())
|
n_spouses = len(self.obj.get_family_handle_list())
|
||||||
return (age_at_death>self.old_unm and n_spouses==0)
|
return (age_at_death/365>self.old_unm and n_spouses==0)
|
||||||
|
|
||||||
def get_message(self):
|
def get_message(self):
|
||||||
return _("Old and unmarried")
|
return _("Old and unmarried")
|
||||||
@ -970,7 +1036,8 @@ class LargeAgeGapFamily(FamilyRule):
|
|||||||
father_birth_date = get_birth_date(self.db,father,self.est)
|
father_birth_date = get_birth_date(self.db,father,self.est)
|
||||||
mother_birth_date_ok = mother_birth_date > 0
|
mother_birth_date_ok = mother_birth_date > 0
|
||||||
father_birth_date_ok = father_birth_date > 0
|
father_birth_date_ok = father_birth_date > 0
|
||||||
large_diff = abs(father_birth_date-mother_birth_date) > self.hw_diff
|
large_diff = \
|
||||||
|
abs(father_birth_date-mother_birth_date)/365 > self.hw_diff
|
||||||
return (mother_birth_date_ok and father_birth_date_ok and large_diff)
|
return (mother_birth_date_ok and father_birth_date_ok and large_diff)
|
||||||
|
|
||||||
def get_message(self):
|
def get_message(self):
|
||||||
@ -1023,9 +1090,9 @@ class MarriageAfterDeath(FamilyRule):
|
|||||||
father_death_date_ok = father_death_date > 0
|
father_death_date_ok = father_death_date > 0
|
||||||
|
|
||||||
father_broken = (father_death_date_ok and marr_date_ok
|
father_broken = (father_death_date_ok and marr_date_ok
|
||||||
and (father_death_date > marr_date))
|
and (father_death_date < marr_date))
|
||||||
mother_broken = (mother_death_date_ok and marr_date_ok
|
mother_broken = (mother_death_date_ok and marr_date_ok
|
||||||
and (mother_death_date > marr_date))
|
and (mother_death_date < marr_date))
|
||||||
|
|
||||||
return (father_broken or mother_broken)
|
return (father_broken or mother_broken)
|
||||||
|
|
||||||
@ -1051,10 +1118,10 @@ class EarlyMarriage(FamilyRule):
|
|||||||
mother_birth_date_ok = mother_birth_date > 0
|
mother_birth_date_ok = mother_birth_date > 0
|
||||||
father_birth_date_ok = father_birth_date > 0
|
father_birth_date_ok = father_birth_date > 0
|
||||||
|
|
||||||
father_broken = (father_birth_date_ok and marr_date_ok
|
father_broken = (father_birth_date_ok and marr_date_ok and
|
||||||
and (marr_date - father_birth_date < self.yng_mar))
|
((marr_date - father_birth_date)/365 < self.yng_mar))
|
||||||
mother_broken = (mother_birth_date_ok and marr_date_ok
|
mother_broken = (mother_birth_date_ok and marr_date_ok and
|
||||||
and (marr_date - mother_birth_date < self.yng_mar))
|
((marr_date - mother_birth_date)/365 < self.yng_mar))
|
||||||
|
|
||||||
return (father_broken or mother_broken)
|
return (father_broken or mother_broken)
|
||||||
|
|
||||||
@ -1080,10 +1147,10 @@ class LateMarriage(FamilyRule):
|
|||||||
mother_birth_date_ok = mother_birth_date > 0
|
mother_birth_date_ok = mother_birth_date > 0
|
||||||
father_birth_date_ok = father_birth_date > 0
|
father_birth_date_ok = father_birth_date > 0
|
||||||
|
|
||||||
father_broken = (father_birth_date_ok and marr_date_ok
|
father_broken = (father_birth_date_ok and marr_date_ok and
|
||||||
and (marr_date - father_birth_date > self.old_mar))
|
((marr_date - father_birth_date)/365 > self.old_mar))
|
||||||
mother_broken = (mother_birth_date_ok and marr_date_ok
|
mother_broken = (mother_birth_date_ok and marr_date_ok and
|
||||||
and (marr_date - mother_birth_date > self.old_mar))
|
((marr_date - mother_birth_date)/365 > self.old_mar))
|
||||||
|
|
||||||
return (father_broken or mother_broken)
|
return (father_broken or mother_broken)
|
||||||
|
|
||||||
@ -1132,14 +1199,14 @@ class OldParent(FamilyRule):
|
|||||||
child_birth_date_ok = child_birth_date > 0
|
child_birth_date_ok = child_birth_date > 0
|
||||||
if not child_birth_date_ok:
|
if not child_birth_date_ok:
|
||||||
continue
|
continue
|
||||||
father_broken = (father_birth_date_ok and (
|
father_broken = (father_birth_date_ok and
|
||||||
father_birth_date - child_birth_date > self.old_dad))
|
((child_birth_date - father_birth_date)/365 > self.old_dad))
|
||||||
if father_broken:
|
if father_broken:
|
||||||
self.get_message = self.father_message
|
self.get_message = self.father_message
|
||||||
return True
|
return True
|
||||||
|
|
||||||
mother_broken = (mother_birth_date_ok and (
|
mother_broken = (mother_birth_date_ok and
|
||||||
mother_birth_date - child_birth_date > self.old_mom))
|
((child_birth_date - mother_birth_date)/365 > self.old_mom))
|
||||||
if mother_broken:
|
if mother_broken:
|
||||||
self.get_message = self.mother_message
|
self.get_message = self.mother_message
|
||||||
return True
|
return True
|
||||||
@ -1174,14 +1241,14 @@ class YoungParent(FamilyRule):
|
|||||||
child_birth_date_ok = child_birth_date > 0
|
child_birth_date_ok = child_birth_date > 0
|
||||||
if not child_birth_date_ok:
|
if not child_birth_date_ok:
|
||||||
continue
|
continue
|
||||||
father_broken = (father_birth_date_ok and (
|
father_broken = (father_birth_date_ok and
|
||||||
father_birth_date - child_birth_date < self.yng_dad))
|
((child_birth_date - father_birth_date)/365 < self.yng_dad))
|
||||||
if father_broken:
|
if father_broken:
|
||||||
self.get_message = self.father_message
|
self.get_message = self.father_message
|
||||||
return True
|
return True
|
||||||
|
|
||||||
mother_broken = (mother_birth_date_ok and (
|
mother_broken = (mother_birth_date_ok and
|
||||||
mother_birth_date - child_birth_date < self.yng_mom))
|
((child_birth_date - mother_birth_date)/365 < self.yng_mom))
|
||||||
if mother_broken:
|
if mother_broken:
|
||||||
self.get_message = self.mother_message
|
self.get_message = self.mother_message
|
||||||
return True
|
return True
|
||||||
@ -1283,8 +1350,9 @@ class LargeChildrenSpan(FamilyRule):
|
|||||||
child_birh_dates = get_child_birth_dates(self.db,self.obj,self.est)
|
child_birh_dates = get_child_birth_dates(self.db,self.obj,self.est)
|
||||||
child_birh_dates.sort()
|
child_birh_dates.sort()
|
||||||
|
|
||||||
return (child_birh_dates and
|
return (child_birh_dates and ((child_birh_dates[-1]
|
||||||
(child_birh_dates[-1] - child_birh_dates[0] > self.cb_span))
|
- child_birh_dates[0])/365
|
||||||
|
> self.cb_span))
|
||||||
|
|
||||||
def get_message(self):
|
def get_message(self):
|
||||||
return _("Large year span for all children")
|
return _("Large year span for all children")
|
||||||
@ -1303,7 +1371,7 @@ class LargeChildrenAgeDiff(FamilyRule):
|
|||||||
for i in range(len(child_birh_dates)-1) ]
|
for i in range(len(child_birh_dates)-1) ]
|
||||||
|
|
||||||
return (child_birh_dates_diff and
|
return (child_birh_dates_diff and
|
||||||
max(child_birh_dates_diff) < self.c_space)
|
max(child_birh_dates_diff)/365 > self.c_space)
|
||||||
|
|
||||||
def get_message(self):
|
def get_message(self):
|
||||||
return _("Large age differences between children")
|
return _("Large age differences between children")
|
||||||
|
@ -1197,21 +1197,19 @@
|
|||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkToggleButton" id="hide_button">
|
<placeholder/>
|
||||||
<property name="visible">True</property>
|
</child>
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="label" translatable="yes">_Hide selected</property>
|
<child>
|
||||||
<property name="use_underline">True</property>
|
<placeholder/>
|
||||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
</child>
|
||||||
<property name="focus_on_click">True</property>
|
|
||||||
<property name="active">False</property>
|
<child>
|
||||||
<property name="inconsistent">False</property>
|
<placeholder/>
|
||||||
</widget>
|
</child>
|
||||||
<packing>
|
|
||||||
<property name="padding">0</property>
|
<child>
|
||||||
<property name="expand">False</property>
|
<placeholder/>
|
||||||
<property name="fill">False</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
@ -1227,6 +1225,87 @@
|
|||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHBox" id="hbox2">
|
||||||
|
<property name="border_width">6</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="homogeneous">False</property>
|
||||||
|
<property name="spacing">18</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHButtonBox" id="hbuttonbox2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="layout_style">GTK_BUTTONBOX_START</property>
|
||||||
|
<property name="spacing">6</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkButton" id="mark_all">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_default">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="label" translatable="yes">_Mark all</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
|
<property name="focus_on_click">True</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkButton" id="unmark_all">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_default">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="label" translatable="yes">_Unmark all</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
|
<property name="focus_on_click">True</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkButton" id="invert_all">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_default">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="label" translatable="yes">In_vert marks</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
|
<property name="focus_on_click">True</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkToggleButton" id="hide_button">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="label" translatable="yes">_Hide marked</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
|
<property name="focus_on_click">True</property>
|
||||||
|
<property name="active">False</property>
|
||||||
|
<property name="inconsistent">False</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="padding">0</property>
|
<property name="padding">0</property>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user