Check.py - convert to use gtkbuilder instead of libglade
svn: r12409
This commit is contained in:
parent
0b61b4a8a4
commit
a3f82400ef
@ -49,7 +49,6 @@ log = logging.getLogger(".CheckRepair")
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import gtk
|
import gtk
|
||||||
from gtk import glade
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -376,13 +375,15 @@ class CheckIntegrity:
|
|||||||
self.broken_parent_links.append((mother_handle,family_handle))
|
self.broken_parent_links.append((mother_handle,family_handle))
|
||||||
mother_handle = None
|
mother_handle = None
|
||||||
|
|
||||||
if father_handle and father and family_handle not in father.get_family_handle_list():
|
if father_handle and father and \
|
||||||
|
family_handle not in father.get_family_handle_list():
|
||||||
# The referenced father has no reference back to the family
|
# The referenced father has no reference back to the family
|
||||||
self.broken_parent_links.append((father_handle,family_handle))
|
self.broken_parent_links.append((father_handle,family_handle))
|
||||||
father.add_family_handle(family_handle)
|
father.add_family_handle(family_handle)
|
||||||
self.db.commit_person(father,self.trans)
|
self.db.commit_person(father,self.trans)
|
||||||
if mother_handle and mother \
|
|
||||||
and (family_handle not in mother.get_family_handle_list()):
|
if mother_handle and mother and \
|
||||||
|
family_handle not in mother.get_family_handle_list():
|
||||||
# The referenced mother has no reference back to the family
|
# The referenced mother has no reference back to the family
|
||||||
self.broken_parent_links.append((mother_handle,family_handle))
|
self.broken_parent_links.append((mother_handle,family_handle))
|
||||||
mother.add_family_handle(family_handle)
|
mother.add_family_handle(family_handle)
|
||||||
@ -655,13 +656,13 @@ class CheckIntegrity:
|
|||||||
CHANGE_NOTE),
|
CHANGE_NOTE),
|
||||||
'remove' : self.db.remove_note},
|
'remove' : self.db.remove_note},
|
||||||
}
|
}
|
||||||
for the_type in tables.keys():
|
for the_type, the_func in tables.iteritems():
|
||||||
cursor = tables[the_type]['cursor_func']()
|
cursor = the_func['cursor_func']()
|
||||||
total = tables[the_type]['total_func']()
|
total = the_func['total_func']()
|
||||||
check = tables[the_type]['check_func']
|
check = the_func['check_func']
|
||||||
remove_func = tables[the_type]['remove']
|
remove_func = the_func['remove']
|
||||||
|
|
||||||
self.progress.set_pass(tables[the_type]['progress'],total)
|
self.progress.set_pass(the_func['progress'],total)
|
||||||
|
|
||||||
item = cursor.first()
|
item = cursor.first()
|
||||||
while item:
|
while item:
|
||||||
@ -1057,11 +1058,15 @@ class CheckIntegrity:
|
|||||||
def check_source_references(self):
|
def check_source_references(self):
|
||||||
known_handles = self.db.get_source_handles()
|
known_handles = self.db.get_source_handles()
|
||||||
|
|
||||||
total = self.db.get_number_of_people() + self.db.get_number_of_families() + \
|
total = (
|
||||||
self.db.get_number_of_events() + self.db.get_number_of_places() + \
|
self.db.get_number_of_people() +
|
||||||
self.db.get_number_of_media_objects() + \
|
self.db.get_number_of_families() +
|
||||||
self.db.get_number_of_sources() + \
|
self.db.get_number_of_events() +
|
||||||
|
self.db.get_number_of_places() +
|
||||||
|
self.db.get_number_of_media_objects() +
|
||||||
|
self.db.get_number_of_sources() +
|
||||||
self.db.get_number_of_repositories()
|
self.db.get_number_of_repositories()
|
||||||
|
)
|
||||||
|
|
||||||
self.progress.set_pass(_('Looking for source reference problems'),
|
self.progress.set_pass(_('Looking for source reference problems'),
|
||||||
total)
|
total)
|
||||||
@ -1182,9 +1187,13 @@ class CheckIntegrity:
|
|||||||
def check_media_references(self):
|
def check_media_references(self):
|
||||||
known_handles = self.db.get_media_object_handles(False)
|
known_handles = self.db.get_media_object_handles(False)
|
||||||
|
|
||||||
total = self.db.get_number_of_people() + self.db.get_number_of_families() + \
|
total = (
|
||||||
self.db.get_number_of_events() + self.db.get_number_of_places() + \
|
self.db.get_number_of_people() +
|
||||||
|
self.db.get_number_of_families() +
|
||||||
|
self.db.get_number_of_events() +
|
||||||
|
self.db.get_number_of_places() +
|
||||||
self.db.get_number_of_sources()
|
self.db.get_number_of_sources()
|
||||||
|
)
|
||||||
|
|
||||||
self.progress.set_pass(_('Looking for media object reference problems'),
|
self.progress.set_pass(_('Looking for media object reference problems'),
|
||||||
total)
|
total)
|
||||||
@ -1272,11 +1281,15 @@ class CheckIntegrity:
|
|||||||
def check_note_references(self):
|
def check_note_references(self):
|
||||||
known_handles = self.db.get_note_handles()
|
known_handles = self.db.get_note_handles()
|
||||||
|
|
||||||
total = self.db.get_number_of_people() + self.db.get_number_of_families() + \
|
total = (
|
||||||
self.db.get_number_of_events() + self.db.get_number_of_places() + \
|
self.db.get_number_of_people() +
|
||||||
self.db.get_number_of_media_objects() + \
|
self.db.get_number_of_families() +
|
||||||
self.db.get_number_of_sources() + \
|
self.db.get_number_of_events() +
|
||||||
|
self.db.get_number_of_places() +
|
||||||
|
self.db.get_number_of_media_objects() +
|
||||||
|
self.db.get_number_of_sources() +
|
||||||
self.db.get_number_of_repositories()
|
self.db.get_number_of_repositories()
|
||||||
|
)
|
||||||
|
|
||||||
self.progress.set_pass(_('Looking for note reference problems'),
|
self.progress.set_pass(_('Looking for note reference problems'),
|
||||||
total)
|
total)
|
||||||
@ -1423,21 +1436,22 @@ class CheckIntegrity:
|
|||||||
media_references = len(self.invalid_media_references)
|
media_references = len(self.invalid_media_references)
|
||||||
note_references = len(self.invalid_note_references)
|
note_references = len(self.invalid_note_references)
|
||||||
name_format = len(self.removed_name_format)
|
name_format = len(self.removed_name_format)
|
||||||
empty_objs = ( len(self.empty_objects['persons'])
|
empty_objs = (
|
||||||
+ len(self.empty_objects['families'])
|
len(self.empty_objects['persons']) +
|
||||||
+ len(self.empty_objects['events'])
|
len(self.empty_objects['families']) +
|
||||||
+ len(self.empty_objects['sources'])
|
len(self.empty_objects['events']) +
|
||||||
+ len(self.empty_objects['media'])
|
len(self.empty_objects['sources']) +
|
||||||
+ len(self.empty_objects['places'])
|
len(self.empty_objects['media']) +
|
||||||
+ len(self.empty_objects['repos'])
|
len(self.empty_objects['places']) +
|
||||||
+ len(self.empty_objects['notes'])
|
len(self.empty_objects['repos']) +
|
||||||
|
len(self.empty_objects['notes'])
|
||||||
)
|
)
|
||||||
|
|
||||||
errors = (photos + efam + blink + plink + slink + rel
|
errors = (photos + efam + blink + plink + slink + rel +
|
||||||
+ event_invalid + person
|
event_invalid + person +
|
||||||
+ person_references + place_references + source_references
|
person_references + place_references + source_references +
|
||||||
+ repo_references + media_references + note_references
|
repo_references + media_references + note_references +
|
||||||
+ name_format + empty_objs + invalid_dates
|
name_format + empty_objs + invalid_dates
|
||||||
)
|
)
|
||||||
|
|
||||||
if errors == 0:
|
if errors == 0:
|
||||||
@ -1609,15 +1623,16 @@ class Report(ManagedWindow.ManagedWindow):
|
|||||||
|
|
||||||
base = os.path.dirname(__file__)
|
base = os.path.dirname(__file__)
|
||||||
glade_file = base + os.sep + "summary.glade"
|
glade_file = base + os.sep + "summary.glade"
|
||||||
topDialog = glade.XML(glade_file,"summary","gramps")
|
topDialog = gtk.Builder()
|
||||||
topDialog.get_widget("close").connect('clicked',self.close)
|
topDialog.add_from_file(glade_file)
|
||||||
|
topDialog.get_object("close").connect('clicked',self.close)
|
||||||
window = topDialog.get_widget("summary")
|
window = topDialog.get_object ("summary")
|
||||||
textwindow = topDialog.get_widget("textwindow")
|
textwindow = topDialog.get_object("textwindow")
|
||||||
textwindow.get_buffer().set_text(text)
|
textwindow.get_buffer().set_text(text)
|
||||||
|
|
||||||
self.set_window(window,
|
self.set_window(window,
|
||||||
topDialog.get_widget("title"),
|
#topDialog.get_widget("title"),
|
||||||
|
topDialog.get_object("title"),
|
||||||
_("Integrity Check Results"))
|
_("Integrity Check Results"))
|
||||||
|
|
||||||
self.show()
|
self.show()
|
||||||
|
@ -1,137 +1,128 @@
|
|||||||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
<?xml version="1.0"?>
|
||||||
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
<!--*- mode: xml -*-->
|
||||||
|
<interface>
|
||||||
<glade-interface>
|
<object class="GtkDialog" id="summary">
|
||||||
|
<property name="visible">True</property>
|
||||||
<widget class="GtkDialog" id="summary">
|
<property name="title" translatable="yes"/>
|
||||||
<property name="visible">True</property>
|
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||||
<property name="title" translatable="yes"></property>
|
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
<property name="modal">False</property>
|
||||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
<property name="default_width">450</property>
|
||||||
<property name="modal">False</property>
|
<property name="default_height">400</property>
|
||||||
<property name="default_width">450</property>
|
<property name="resizable">True</property>
|
||||||
<property name="default_height">400</property>
|
<property name="destroy_with_parent">False</property>
|
||||||
<property name="resizable">True</property>
|
<property name="decorated">True</property>
|
||||||
<property name="destroy_with_parent">False</property>
|
<property name="skip_taskbar_hint">False</property>
|
||||||
<property name="decorated">True</property>
|
<property name="skip_pager_hint">False</property>
|
||||||
<property name="skip_taskbar_hint">False</property>
|
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||||
<property name="skip_pager_hint">False</property>
|
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
<property name="focus_on_map">True</property>
|
||||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
<property name="urgency_hint">False</property>
|
||||||
<property name="focus_on_map">True</property>
|
<property name="has_separator">False</property>
|
||||||
<property name="urgency_hint">False</property>
|
<signal handler="on_delete_event" last_modification_time="Thu, 24 Mar 2005 18:53:09 GMT" name="delete_event"/>
|
||||||
<property name="has_separator">False</property>
|
<child internal-child="vbox">
|
||||||
<signal name="delete_event" handler="on_delete_event" last_modification_time="Thu, 24 Mar 2005 18:53:09 GMT"/>
|
<object class="GtkVBox" id="dialog-vbox1">
|
||||||
|
<property name="visible">True</property>
|
||||||
<child internal-child="vbox">
|
<property name="homogeneous">False</property>
|
||||||
<widget class="GtkVBox" id="dialog-vbox1">
|
<property name="spacing">0</property>
|
||||||
<property name="visible">True</property>
|
<child internal-child="action_area">
|
||||||
<property name="homogeneous">False</property>
|
<object class="GtkHButtonBox" id="dialog-action_area1">
|
||||||
<property name="spacing">0</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||||
<child internal-child="action_area">
|
<child>
|
||||||
<widget class="GtkHButtonBox" id="dialog-action_area1">
|
<object class="GtkButton" id="close">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
<property name="can_default">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
<child>
|
<property name="label">gtk-close</property>
|
||||||
<widget class="GtkButton" id="close">
|
<property name="use_stock">True</property>
|
||||||
<property name="visible">True</property>
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
<property name="can_default">True</property>
|
<property name="focus_on_click">True</property>
|
||||||
<property name="can_focus">True</property>
|
<signal handler="destroy_passed_object" name="clicked" object="summary"/>
|
||||||
<property name="label">gtk-close</property>
|
</object>
|
||||||
<property name="use_stock">True</property>
|
</child>
|
||||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
</object>
|
||||||
<property name="focus_on_click">True</property>
|
<packing>
|
||||||
<property name="response_id">0</property>
|
<property name="padding">0</property>
|
||||||
<signal name="clicked" handler="destroy_passed_object" object="summary"/>
|
<property name="expand">False</property>
|
||||||
</widget>
|
<property name="fill">True</property>
|
||||||
</child>
|
<property name="pack_type">GTK_PACK_END</property>
|
||||||
</widget>
|
</packing>
|
||||||
<packing>
|
</child>
|
||||||
<property name="padding">0</property>
|
<child>
|
||||||
<property name="expand">False</property>
|
<object class="GtkVBox" id="vbox1">
|
||||||
<property name="fill">True</property>
|
<property name="border_width">6</property>
|
||||||
<property name="pack_type">GTK_PACK_END</property>
|
<property name="visible">True</property>
|
||||||
</packing>
|
<property name="homogeneous">False</property>
|
||||||
</child>
|
<property name="spacing">6</property>
|
||||||
|
<child>
|
||||||
<child>
|
<object class="GtkLabel" id="title">
|
||||||
<widget class="GtkVBox" id="vbox1">
|
<property name="visible">True</property>
|
||||||
<property name="border_width">6</property>
|
<property name="label" translatable="yes"/>
|
||||||
<property name="visible">True</property>
|
<property name="use_underline">False</property>
|
||||||
<property name="homogeneous">False</property>
|
<property name="use_markup">False</property>
|
||||||
<property name="spacing">6</property>
|
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||||
|
<property name="wrap">False</property>
|
||||||
<child>
|
<property name="selectable">False</property>
|
||||||
<widget class="GtkLabel" id="title">
|
<property name="xalign">0.5</property>
|
||||||
<property name="visible">True</property>
|
<property name="yalign">0.5</property>
|
||||||
<property name="label" translatable="yes"></property>
|
<property name="xpad">0</property>
|
||||||
<property name="use_underline">False</property>
|
<property name="ypad">0</property>
|
||||||
<property name="use_markup">False</property>
|
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
<property name="width_chars">-1</property>
|
||||||
<property name="wrap">False</property>
|
<property name="single_line_mode">False</property>
|
||||||
<property name="selectable">False</property>
|
<property name="angle">0</property>
|
||||||
<property name="xalign">0.5</property>
|
</object>
|
||||||
<property name="yalign">0.5</property>
|
<packing>
|
||||||
<property name="xpad">0</property>
|
<property name="padding">8</property>
|
||||||
<property name="ypad">0</property>
|
<property name="expand">False</property>
|
||||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
<property name="fill">False</property>
|
||||||
<property name="width_chars">-1</property>
|
</packing>
|
||||||
<property name="single_line_mode">False</property>
|
</child>
|
||||||
<property name="angle">0</property>
|
<child>
|
||||||
</widget>
|
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
||||||
<packing>
|
<property name="visible">True</property>
|
||||||
<property name="padding">8</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="expand">False</property>
|
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
<property name="fill">False</property>
|
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
</packing>
|
<property name="shadow_type">GTK_SHADOW_OUT</property>
|
||||||
</child>
|
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||||
|
<child>
|
||||||
<child>
|
<object class="GtkTextView" id="textwindow">
|
||||||
<widget class="GtkScrolledWindow" id="scrolledwindow1">
|
<property name="visible">True</property>
|
||||||
<property name="visible">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="editable">True</property>
|
||||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
<property name="overwrite">False</property>
|
||||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
<property name="accepts_tab">True</property>
|
||||||
<property name="shadow_type">GTK_SHADOW_OUT</property>
|
<property name="justification">GTK_JUSTIFY_LEFT</property>
|
||||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
<property name="wrap_mode">GTK_WRAP_NONE</property>
|
||||||
|
<property name="cursor_visible">True</property>
|
||||||
<child>
|
<property name="pixels_above_lines">0</property>
|
||||||
<widget class="GtkTextView" id="textwindow">
|
<property name="pixels_below_lines">0</property>
|
||||||
<property name="visible">True</property>
|
<property name="pixels_inside_wrap">0</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="left_margin">0</property>
|
||||||
<property name="editable">True</property>
|
<property name="right_margin">0</property>
|
||||||
<property name="overwrite">False</property>
|
<property name="indent">0</property>
|
||||||
<property name="accepts_tab">True</property>
|
</object>
|
||||||
<property name="justification">GTK_JUSTIFY_LEFT</property>
|
</child>
|
||||||
<property name="wrap_mode">GTK_WRAP_NONE</property>
|
</object>
|
||||||
<property name="cursor_visible">True</property>
|
<packing>
|
||||||
<property name="pixels_above_lines">0</property>
|
<property name="padding">0</property>
|
||||||
<property name="pixels_below_lines">0</property>
|
<property name="expand">True</property>
|
||||||
<property name="pixels_inside_wrap">0</property>
|
<property name="fill">True</property>
|
||||||
<property name="left_margin">0</property>
|
</packing>
|
||||||
<property name="right_margin">0</property>
|
</child>
|
||||||
<property name="indent">0</property>
|
</object>
|
||||||
<property name="text" translatable="yes"></property>
|
<packing>
|
||||||
</widget>
|
<property name="padding">0</property>
|
||||||
</child>
|
<property name="expand">True</property>
|
||||||
</widget>
|
<property name="fill">True</property>
|
||||||
<packing>
|
</packing>
|
||||||
<property name="padding">0</property>
|
</child>
|
||||||
<property name="expand">True</property>
|
</object>
|
||||||
<property name="fill">True</property>
|
</child>
|
||||||
</packing>
|
<action-widgets>
|
||||||
</child>
|
<action-widget response="0">close</action-widget>
|
||||||
</widget>
|
</action-widgets>
|
||||||
<packing>
|
</object>
|
||||||
<property name="padding">0</property>
|
</interface>
|
||||||
<property name="expand">True</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
|
|
||||||
</glade-interface>
|
|
||||||
|
Loading…
Reference in New Issue
Block a user