Removed intermediate window in importing
svn: r812
This commit is contained in:
parent
a0796073fc
commit
83cd367728
@ -43,11 +43,8 @@ import gnome.mime
|
||||
ANSEL = 1
|
||||
UNICODE = 2
|
||||
|
||||
topDialog = None
|
||||
db = None
|
||||
callback = None
|
||||
glade_file = None
|
||||
clear_data = 0
|
||||
|
||||
def nocnv(s):
|
||||
return s
|
||||
@ -82,13 +79,10 @@ fromtoRegexp = re.compile(r"\s*FROM\s+@#D([^@]+)@\s*(.*)\s+TO\s+@#D([^@]+)@\s*(.
|
||||
def importData(database, filename):
|
||||
|
||||
global callback
|
||||
global topDialog
|
||||
global glade_file
|
||||
|
||||
# add some checking here
|
||||
|
||||
if clear_data == 1:
|
||||
database.new()
|
||||
glade_file = "%s/gedcomimport.glade" % os.path.dirname(__file__)
|
||||
|
||||
statusTop = libglade.GladeXML(glade_file,"status")
|
||||
statusWindow = statusTop.get_widget("status")
|
||||
@ -1667,51 +1661,32 @@ class GedcomParser:
|
||||
|
||||
self.db.pmapIndex = new_pmax
|
||||
|
||||
def readData(database,active_person,cb):
|
||||
global db
|
||||
global callback
|
||||
|
||||
db = database
|
||||
callback = cb
|
||||
|
||||
top = gtk.GtkFileSelection("%s - GRAMPS" % _("Import from GEDCOM"))
|
||||
top.hide_fileop_buttons()
|
||||
top.ok_button.connect_object('clicked', on_ok_clicked,top)
|
||||
top.cancel_button.connect_object('clicked', Utils.destroy_passed_object,top)
|
||||
top.show()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_ok_clicked(obj):
|
||||
global clear_data
|
||||
|
||||
name = topDialog.get_widget("filename").get_text()
|
||||
name = obj.get_filename()
|
||||
if name == "":
|
||||
return
|
||||
|
||||
if topDialog.get_widget("new").get_active():
|
||||
clear_data = 1
|
||||
else:
|
||||
clear_data = 0
|
||||
|
||||
Utils.destroy_passed_object(obj)
|
||||
importData(db,name)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def readData(database,active_person,cb):
|
||||
global db
|
||||
global topDialog
|
||||
global callback
|
||||
global glade_file
|
||||
|
||||
db = database
|
||||
callback = cb
|
||||
|
||||
glade_file = "%s/gedcomimport.glade" % os.path.dirname(__file__)
|
||||
|
||||
dic = {
|
||||
"destroy_passed_object" : Utils.destroy_passed_object,
|
||||
"on_ok_clicked" : on_ok_clicked
|
||||
}
|
||||
|
||||
topDialog = libglade.GladeXML(glade_file,"gedcomImport")
|
||||
topDialog.signal_autoconnect(dic)
|
||||
topDialog.get_widget("gedcomImport").show()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
|
@ -24,6 +24,8 @@ import libglade
|
||||
from ReadXML import *
|
||||
import Utils
|
||||
import intl
|
||||
import gtk
|
||||
import const
|
||||
|
||||
_ = intl.gettext
|
||||
|
||||
@ -41,46 +43,34 @@ def progress(val):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def readData(database,active_person,cb):
|
||||
global db
|
||||
global topDialog
|
||||
global callback
|
||||
global glade_file
|
||||
|
||||
db = database
|
||||
callback = cb
|
||||
|
||||
base = os.path.dirname(__file__)
|
||||
glade_file = base + os.sep + "grampsimport.glade"
|
||||
|
||||
dic = {
|
||||
"destroy_passed_object" : Utils.destroy_passed_object,
|
||||
"on_ok_clicked" : on_ok_clicked
|
||||
}
|
||||
|
||||
topDialog = libglade.GladeXML(glade_file,"grampsImport")
|
||||
topDialog.signal_autoconnect(dic)
|
||||
topDialog.get_widget("grampsImport").show()
|
||||
ReadNative(database,active_person,cb)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_ok_clicked(obj):
|
||||
global db
|
||||
global topDialog
|
||||
class ReadNative:
|
||||
def __init__(self,database,active_person,cb):
|
||||
self.db = database
|
||||
self.callback = cb
|
||||
|
||||
import const
|
||||
self.top = gtk.GtkFileSelection("%s - GRAMPS" % _("Import from GRAMPS"))
|
||||
self.top.hide_fileop_buttons()
|
||||
self.top.ok_button.connect('clicked', self.on_ok_clicked)
|
||||
self.top.cancel_button.connect_object('clicked', Utils.destroy_passed_object,self.top)
|
||||
self.top.show()
|
||||
|
||||
if topDialog.get_widget("new").get_active():
|
||||
db.new()
|
||||
def on_ok_clicked(self,obj):
|
||||
|
||||
name = topDialog.get_widget("filename").get_text()
|
||||
name = name + os.sep + const.indexFile
|
||||
name = self.top.get_filename()
|
||||
if name == "":
|
||||
return
|
||||
|
||||
Utils.destroy_passed_object(obj)
|
||||
importData(db,name,progress)
|
||||
callback(1)
|
||||
name = "%s/%s" % (name,const.indexFile)
|
||||
Utils.destroy_passed_object(self.top)
|
||||
importData(self.db,name,progress)
|
||||
self.callback(1)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -488,180 +488,4 @@
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkWindow</class>
|
||||
<name>gedcomImport</name>
|
||||
<title>GEDCOM Import - GRAMPS</title>
|
||||
<type>GTK_WINDOW_TOPLEVEL</type>
|
||||
<position>GTK_WIN_POS_CENTER</position>
|
||||
<modal>True</modal>
|
||||
<allow_shrink>False</allow_shrink>
|
||||
<allow_grow>True</allow_grow>
|
||||
<auto_shrink>False</auto_shrink>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox3</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>8</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkHButtonBox</class>
|
||||
<child_name>GnomeDialog:action_area</child_name>
|
||||
<name>hbuttonbox1</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>button4</name>
|
||||
<can_default>True</can_default>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>clicked</name>
|
||||
<handler>on_ok_clicked</handler>
|
||||
<object>gedcomImport</object>
|
||||
<last_modification_time>Thu, 30 Nov 2000 15:48:22 GMT</last_modification_time>
|
||||
</signal>
|
||||
<stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>button5</name>
|
||||
<can_default>True</can_default>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>clicked</name>
|
||||
<handler>destroy_passed_object</handler>
|
||||
<object>gedcomImport</object>
|
||||
<last_modification_time>Thu, 30 Nov 2000 15:03:24 GMT</last_modification_time>
|
||||
</signal>
|
||||
<stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox4</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label3</name>
|
||||
<label>GEDCOM Import</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>5</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHSeparator</class>
|
||||
<name>hseparator2</name>
|
||||
<child>
|
||||
<padding>10</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox2</name>
|
||||
<homogeneous>True</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkRadioButton</class>
|
||||
<name>new</name>
|
||||
<border_width>5</border_width>
|
||||
<can_focus>True</can_focus>
|
||||
<label>New Database</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<group>import</group>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkRadioButton</class>
|
||||
<name>radiobutton2</name>
|
||||
<border_width>5</border_width>
|
||||
<can_focus>True</can_focus>
|
||||
<label>Append to Current Database</label>
|
||||
<active>True</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<group>import</group>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GnomeFileEntry</class>
|
||||
<name>fileentry2</name>
|
||||
<border_width>10</border_width>
|
||||
<width>350</width>
|
||||
<history_id>GedcomImport</history_id>
|
||||
<max_saved>10</max_saved>
|
||||
<title>GEDCOM file</title>
|
||||
<directory>False</directory>
|
||||
<modal>True</modal>
|
||||
<child>
|
||||
<padding>10</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkEntry</class>
|
||||
<child_name>GnomeEntry:entry</child_name>
|
||||
<name>filename</name>
|
||||
<can_focus>True</can_focus>
|
||||
<editable>True</editable>
|
||||
<text_visible>True</text_visible>
|
||||
<text_max_length>0</text_max_length>
|
||||
<text></text>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
</GTK-Interface>
|
||||
|
@ -1,179 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<GTK-Interface>
|
||||
|
||||
<project>
|
||||
<name>GRAMPS Import</name>
|
||||
<program_name>grampsimport</program_name>
|
||||
<directory></directory>
|
||||
<source_directory>src</source_directory>
|
||||
<pixmaps_directory>pixmaps</pixmaps_directory>
|
||||
<language>C</language>
|
||||
<gnome_support>True</gnome_support>
|
||||
<gettext_support>True</gettext_support>
|
||||
</project>
|
||||
|
||||
<widget>
|
||||
<class>GtkWindow</class>
|
||||
<name>grampsImport</name>
|
||||
<title>GRAMPS import - GRAMPS</title>
|
||||
<type>GTK_WINDOW_DIALOG</type>
|
||||
<position>GTK_WIN_POS_CENTER</position>
|
||||
<modal>True</modal>
|
||||
<allow_shrink>False</allow_shrink>
|
||||
<allow_grow>True</allow_grow>
|
||||
<auto_shrink>False</auto_shrink>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox3</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>8</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkHButtonBox</class>
|
||||
<child_name>GnomeDialog:action_area</child_name>
|
||||
<name>hbuttonbox1</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>button4</name>
|
||||
<can_default>True</can_default>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>clicked</name>
|
||||
<handler>on_ok_clicked</handler>
|
||||
<object>grampsImport</object>
|
||||
<last_modification_time>Thu, 30 Nov 2000 15:48:22 GMT</last_modification_time>
|
||||
</signal>
|
||||
<stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>button5</name>
|
||||
<can_default>True</can_default>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>clicked</name>
|
||||
<handler>destroy_passed_object</handler>
|
||||
<object>grampsImport</object>
|
||||
<last_modification_time>Thu, 30 Nov 2000 15:03:24 GMT</last_modification_time>
|
||||
</signal>
|
||||
<stock_button>GNOME_STOCK_BUTTON_CANCEL</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>label3</name>
|
||||
<label>GRAMPS Import</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>5</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHSeparator</class>
|
||||
<name>hseparator2</name>
|
||||
<child>
|
||||
<padding>10</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkRadioButton</class>
|
||||
<name>new</name>
|
||||
<border_width>5</border_width>
|
||||
<can_focus>True</can_focus>
|
||||
<label>New Database</label>
|
||||
<active>True</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<group>import</group>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkRadioButton</class>
|
||||
<name>radiobutton2</name>
|
||||
<border_width>5</border_width>
|
||||
<can_focus>True</can_focus>
|
||||
<label>Append to Current Database</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<group>import</group>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GnomeFileEntry</class>
|
||||
<name>fileentry2</name>
|
||||
<border_width>10</border_width>
|
||||
<width>350</width>
|
||||
<history_id>GrampsImport</history_id>
|
||||
<max_saved>10</max_saved>
|
||||
<title>GRAMPS file</title>
|
||||
<directory>False</directory>
|
||||
<modal>True</modal>
|
||||
<child>
|
||||
<padding>10</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkEntry</class>
|
||||
<child_name>GnomeEntry:entry</child_name>
|
||||
<name>filename</name>
|
||||
<can_focus>True</can_focus>
|
||||
<editable>True</editable>
|
||||
<text_visible>True</text_visible>
|
||||
<text_max_length>0</text_max_length>
|
||||
<text></text>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
</GTK-Interface>
|
Loading…
Reference in New Issue
Block a user