diff --git a/gramps/src/plugins/ReadGedcom.py b/gramps/src/plugins/ReadGedcom.py
index 2f9d16641..7b1d44220 100644
--- a/gramps/src/plugins/ReadGedcom.py
+++ b/gramps/src/plugins/ReadGedcom.py
@@ -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,14 +79,11 @@ 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")
statusTop.get_widget("close").set_sensitive(0)
@@ -1667,50 +1661,31 @@ 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()
#-------------------------------------------------------------------------
#
diff --git a/gramps/src/plugins/ReadNative.py b/gramps/src/plugins/ReadNative.py
index e5d267a7e..00a3f39aa 100644
--- a/gramps/src/plugins/ReadNative.py
+++ b/gramps/src/plugins/ReadNative.py
@@ -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
+ ReadNative(database,active_person,cb)
- db = database
- callback = cb
-
- base = os.path.dirname(__file__)
- glade_file = base + os.sep + "grampsimport.glade"
+#-------------------------------------------------------------------------
+#
+#
+#
+#-------------------------------------------------------------------------
+class ReadNative:
+ def __init__(self,database,active_person,cb):
+ self.db = database
+ self.callback = cb
- dic = {
- "destroy_passed_object" : Utils.destroy_passed_object,
- "on_ok_clicked" : on_ok_clicked
- }
+ 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()
- topDialog = libglade.GladeXML(glade_file,"grampsImport")
- topDialog.signal_autoconnect(dic)
- topDialog.get_widget("grampsImport").show()
+ def on_ok_clicked(self,obj):
-#-------------------------------------------------------------------------
-#
-#
-#
-#-------------------------------------------------------------------------
-def on_ok_clicked(obj):
- global db
- global topDialog
+ name = self.top.get_filename()
+ if name == "":
+ return
- import const
-
- if topDialog.get_widget("new").get_active():
- db.new()
-
- name = topDialog.get_widget("filename").get_text()
- name = name + os.sep + const.indexFile
-
- 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)
#------------------------------------------------------------------------
#
diff --git a/gramps/src/plugins/gedcomimport.glade b/gramps/src/plugins/gedcomimport.glade
index 017604eb2..9ea3aef47 100644
--- a/gramps/src/plugins/gedcomimport.glade
+++ b/gramps/src/plugins/gedcomimport.glade
@@ -488,180 +488,4 @@
-
- GtkWindow
- gedcomImport
- GEDCOM Import - GRAMPS
- GTK_WINDOW_TOPLEVEL
- GTK_WIN_POS_CENTER
- True
- False
- True
- False
-
-
- GtkVBox
- vbox3
- False
- 8
-
-
- GtkHButtonBox
- GnomeDialog:action_area
- hbuttonbox1
- GTK_BUTTONBOX_END
- 8
- 85
- 27
- 7
- 0
-
- 0
- False
- True
- GTK_PACK_END
-
-
-
- GtkButton
- button4
- True
- True
-
- clicked
- on_ok_clicked
-
- Thu, 30 Nov 2000 15:48:22 GMT
-
- GNOME_STOCK_BUTTON_OK
-
-
-
- GtkButton
- button5
- True
- True
-
- clicked
- destroy_passed_object
-
- Thu, 30 Nov 2000 15:03:24 GMT
-
- GNOME_STOCK_BUTTON_CANCEL
-
-
-
-
- GtkVBox
- vbox4
- False
- 0
-
- 0
- False
- True
-
-
-
- GtkLabel
- label3
-
- GTK_JUSTIFY_CENTER
- False
- 0.5
- 0.5
- 0
- 5
-
- 0
- False
- False
-
-
-
-
- GtkHSeparator
- hseparator2
-
- 10
- False
- False
-
-
-
-
- GtkHBox
- hbox2
- True
- 0
-
- 0
- True
- True
-
-
-
- GtkRadioButton
- new
- 5
- True
-
- False
- True
- import
-
- 0
- False
- True
-
-
-
-
- GtkRadioButton
- radiobutton2
- 5
- True
-
- True
- True
- import
-
- 0
- False
- True
-
-
-
-
-
- GnomeFileEntry
- fileentry2
- 10
- 350
- GedcomImport
- 10
- GEDCOM file
- False
- True
-
- 10
- True
- True
-
-
-
- GtkEntry
- GnomeEntry:entry
- filename
- True
- True
- True
- 0
-
-
-
-
-
-
-
diff --git a/gramps/src/plugins/grampsimport.glade b/gramps/src/plugins/grampsimport.glade
deleted file mode 100644
index f52a73bf7..000000000
--- a/gramps/src/plugins/grampsimport.glade
+++ /dev/null
@@ -1,179 +0,0 @@
-
-
-
-
- GRAMPS Import
- grampsimport
-
- src
- pixmaps
- C
- True
- True
-
-
-
- GtkWindow
- grampsImport
- GRAMPS import - GRAMPS
- GTK_WINDOW_DIALOG
- GTK_WIN_POS_CENTER
- True
- False
- True
- False
-
-
- GtkVBox
- vbox3
- False
- 8
-
-
- GtkHButtonBox
- GnomeDialog:action_area
- hbuttonbox1
- GTK_BUTTONBOX_END
- 8
- 85
- 27
- 7
- 0
-
- 0
- False
- True
- GTK_PACK_END
-
-
-
- GtkButton
- button4
- True
- True
-
- clicked
- on_ok_clicked
-
- Thu, 30 Nov 2000 15:48:22 GMT
-
- GNOME_STOCK_BUTTON_OK
-
-
-
- GtkButton
- button5
- True
- True
-
- clicked
- destroy_passed_object
-
- Thu, 30 Nov 2000 15:03:24 GMT
-
- GNOME_STOCK_BUTTON_CANCEL
-
-
-
-
- GtkVBox
- vbox4
- False
- 0
-
- 0
- True
- True
-
-
-
- GtkLabel
- label3
-
- GTK_JUSTIFY_CENTER
- False
- 0.5
- 0.5
- 0
- 5
-
- 0
- False
- False
-
-
-
-
- GtkHSeparator
- hseparator2
-
- 10
- False
- False
-
-
-
-
- GtkRadioButton
- new
- 5
- True
-
- True
- True
- import
-
- 0
- False
- False
-
-
-
-
- GtkRadioButton
- radiobutton2
- 5
- True
-
- False
- True
- import
-
- 0
- False
- False
-
-
-
-
- GnomeFileEntry
- fileentry2
- 10
- 350
- GrampsImport
- 10
- GRAMPS file
- False
- True
-
- 10
- False
- True
-
-
-
- GtkEntry
- GnomeEntry:entry
- filename
- True
- True
- True
- 0
-
-
-
-
-
-
-
-