Export progress window

svn: r430
This commit is contained in:
Don Allingham 2001-09-25 23:51:11 +00:00
parent 93a0b869a7
commit 7dfc3016a5
2 changed files with 314 additions and 3 deletions

View File

@ -482,7 +482,7 @@ def write_person(g,person):
#
#
#-------------------------------------------------------------------------
def exportData(database, filename):
def exportData(database, filename, pbar, fbar, sbar):
g = open(filename,"w")
@ -520,9 +520,18 @@ def exportData(database, filename):
g.write("1 PHON " + cnvtxt(owner.getPhone()) + "\n")
people_list.sort(sortById)
nump = float(len(people_list))
index = 0.0
for person in people_list:
write_person(g,person)
index = index + 1
pbar.set_value((100*index)/nump)
while(events_pending()):
mainiteration()
pbar.set_value(100.0)
nump = float(len(family_list))
index = 0.0
for family in family_list:
g.write("0 @F%s@ FAM\n" % family.getId())
person = family.getFather()
@ -555,7 +564,14 @@ def exportData(database, filename):
for person in family.getChildList():
g.write("1 CHIL @I%s@\n" % person.getId())
index = index + 1
fbar.set_value((100*index)/nump)
while(events_pending()):
mainiteration()
fbar.set_value(100.0)
nump = float(len(source_list))
index = 0.0
for source in source_list:
g.write("0 @S%s@ SOUR\n" % source.getId())
if source.getTitle() != "":
@ -570,6 +586,11 @@ def exportData(database, filename):
g.write("1 CALN %s\n" % cnvtxt(source.getCallNumber()))
if source.getNote() != "":
write_long_text(g,"NOTE",1,source.getNote())
index = index + 1
sbar.set_value((100*index)/nump)
while(events_pending()):
mainiteration()
sbar.set_value(100.0)
g.write("0 TRLR\n")
@ -650,8 +671,20 @@ def on_ok_clicked(obj):
name = topDialog.get_widget("filename").get_text()
filter()
exportData(db,name)
utils.destroy_passed_object(obj)
base = os.path.dirname(__file__)
glade_file = base + os.sep + "gedcomexport.glade"
progress = GladeXML(glade_file,"exportprogress")
progress.signal_autoconnect({"on_close_clicked":utils.destroy_passed_object})
fbar = progress.get_widget("fbar")
pbar = progress.get_widget("pbar")
sbar = progress.get_widget("sbar")
closebtn = progress.get_widget("close")
closebtn.connect("clicked",utils.destroy_passed_object)
closebtn.set_sensitive(0)
exportData(db,name,pbar,fbar,sbar)
closebtn.set_sensitive(1)
#-------------------------------------------------------------------------
#

View File

@ -279,4 +279,282 @@
</widget>
</widget>
<widget>
<class>GnomeDialog</class>
<name>exportprogress</name>
<title>Export GEDCOM file</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_CENTER</position>
<modal>False</modal>
<allow_shrink>False</allow_shrink>
<allow_grow>True</allow_grow>
<auto_shrink>False</auto_shrink>
<auto_close>False</auto_close>
<hide_on_close>False</hide_on_close>
<widget>
<class>GtkVBox</class>
<child_name>GnomeDialog:vbox</child_name>
<name>dialog-vbox2</name>
<homogeneous>False</homogeneous>
<spacing>8</spacing>
<child>
<padding>4</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkHButtonBox</class>
<child_name>GnomeDialog:action_area</child_name>
<name>dialog-action_area2</name>
<layout_style>GTK_BUTTONBOX_END</layout_style>
<spacing>8</spacing>
<child_min_width>85</child_min_width>
<child_min_height>27</child_min_height>
<child_ipad_x>7</child_ipad_x>
<child_ipad_y>0</child_ipad_y>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
<pack>GTK_PACK_END</pack>
</child>
<widget>
<class>GtkButton</class>
<name>close</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_close_clicked</handler>
<object>exportprogress</object>
<last_modification_time>Tue, 25 Sep 2001 23:46:20 GMT</last_modification_time>
</signal>
<stock_button>GNOME_STOCK_BUTTON_CLOSE</stock_button>
</widget>
</widget>
<widget>
<class>GtkVBox</class>
<name>vbox4</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>label1</name>
<label>GEDCOM Export</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkHSeparator</class>
<name>hseparator2</name>
<child>
<padding>5</padding>
<expand>False</expand>
<fill>True</fill>
</child>
</widget>
<widget>
<class>GtkTable</class>
<name>table1</name>
<rows>3</rows>
<columns>2</columns>
<homogeneous>False</homogeneous>
<row_spacing>0</row_spacing>
<column_spacing>0</column_spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>label4</name>
<label>Sources</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label3</name>
<label>Families</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label2</name>
<label>People</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkProgressBar</class>
<name>pbar</name>
<value>0</value>
<lower>0</lower>
<upper>100</upper>
<bar_style>GTK_PROGRESS_CONTINUOUS</bar_style>
<orientation>GTK_PROGRESS_LEFT_TO_RIGHT</orientation>
<activity_mode>False</activity_mode>
<show_text>False</show_text>
<format>%P %%</format>
<text_xalign>0.5</text_xalign>
<text_yalign>0.5</text_yalign>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkProgressBar</class>
<name>fbar</name>
<value>0</value>
<lower>0</lower>
<upper>100</upper>
<bar_style>GTK_PROGRESS_CONTINUOUS</bar_style>
<orientation>GTK_PROGRESS_LEFT_TO_RIGHT</orientation>
<activity_mode>False</activity_mode>
<show_text>False</show_text>
<format>%P %%</format>
<text_xalign>0.5</text_xalign>
<text_yalign>0.5</text_yalign>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkProgressBar</class>
<name>sbar</name>
<value>0</value>
<lower>0</lower>
<upper>100</upper>
<bar_style>GTK_PROGRESS_CONTINUOUS</bar_style>
<orientation>GTK_PROGRESS_LEFT_TO_RIGHT</orientation>
<activity_mode>False</activity_mode>
<show_text>False</show_text>
<format>%P %%</format>
<text_xalign>0.5</text_xalign>
<text_yalign>0.5</text_yalign>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
</widget>
</widget>
</widget>
</widget>
</GTK-Interface>