* src/DbPrompter.py: 2.4 filechooser
* src/gramps_main.py: 2.4 filechooser * src/ReadXML.py: 2.4 filechooser * src/Pluginsd.py: tooltip deprecation fix svn: r3118
This commit is contained in:
parent
3cb7c304ed
commit
04e3e505fb
@ -1,3 +1,9 @@
|
||||
2004-05-02 Don Allingham <donaldallingham@users.sourceforge.net>
|
||||
* src/DbPrompter.py: 2.4 filechooser
|
||||
* src/gramps_main.py: 2.4 filechooser
|
||||
* src/ReadXML.py: 2.4 filechooser
|
||||
* src/Pluginsd.py: tooltip deprecation fix
|
||||
|
||||
2004-05-01 Don Allingham <dona@localhost.localdomain>
|
||||
* src/gramps.glade: rearranged filter apply
|
||||
* src/gramps.py: update to gtk.main()
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000-2003 Donald N. Allingham
|
||||
# Copyright (C) 2000-2004 Donald N. Allingham
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -27,7 +27,6 @@
|
||||
#-------------------------------------------------------------------------
|
||||
import gtk
|
||||
import gtk.glade
|
||||
import gnome
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -65,8 +64,8 @@ class DbPrompter:
|
||||
opendb.signal_autoconnect({
|
||||
"on_open_ok_clicked" : self.open_ok_clicked,
|
||||
"on_open_help_clicked" : self.open_help_clicked,
|
||||
"on_open_cancel_clicked" : self.open_cancel_clicked,
|
||||
"on_opendb_delete_event": self.open_delete_event,
|
||||
"on_open_cancel_clicked" : gtk.main_quit,
|
||||
"on_opendb_delete_event": gtk.main_quit,
|
||||
})
|
||||
|
||||
self.new = opendb.get_widget("new")
|
||||
@ -83,101 +82,57 @@ class DbPrompter:
|
||||
|
||||
def open_help_clicked(self,obj):
|
||||
"""Display the GRAMPS manual"""
|
||||
import gnome
|
||||
gnome.help_display('gramps-manual','choose-db-start')
|
||||
|
||||
def save_as_activate(self):
|
||||
if gtk.pygtk_version[1] >= 3:
|
||||
choose = gtk.FileChooserDialog('Create GRAMPS database',
|
||||
None,
|
||||
gtk.FILE_CHOOSER_ACTION_SAVE,
|
||||
(gtk.STOCK_CANCEL,
|
||||
gtk.RESPONSE_CANCEL,
|
||||
gtk.STOCK_OPEN,
|
||||
gtk.RESPONSE_OK))
|
||||
filter = gtk.FileFilter()
|
||||
filter.set_name(_('GRAMPS databases'))
|
||||
filter.add_pattern('*.grdb')
|
||||
choose.add_filter(filter)
|
||||
choose = gtk.FileChooserDialog('Create GRAMPS database',
|
||||
None,
|
||||
gtk.FILE_CHOOSER_ACTION_SAVE,
|
||||
(gtk.STOCK_CANCEL,
|
||||
gtk.RESPONSE_CANCEL,
|
||||
gtk.STOCK_OPEN,
|
||||
gtk.RESPONSE_OK))
|
||||
filter = gtk.FileFilter()
|
||||
filter.set_name(_('GRAMPS databases'))
|
||||
filter.add_pattern('*.grdb')
|
||||
choose.add_filter(filter)
|
||||
|
||||
filter = gtk.FileFilter()
|
||||
filter.set_name(_('All files'))
|
||||
filter.add_pattern('*')
|
||||
choose.add_filter(filter)
|
||||
filter = gtk.FileFilter()
|
||||
filter.set_name(_('All files'))
|
||||
filter.add_pattern('*')
|
||||
choose.add_filter(filter)
|
||||
|
||||
response = choose.run()
|
||||
if response == gtk.RESPONSE_OK:
|
||||
filename = choose.get_filename()
|
||||
self.db.read_file(filename)
|
||||
choose.destroy()
|
||||
else:
|
||||
wFs = gtk.glade.XML (const.gladeFile, "fileselection","gramps")
|
||||
wFs.signal_autoconnect({
|
||||
"on_ok_button1_clicked": self.save_ok_button_clicked,
|
||||
"destroy_passed_object": self.cancel_button_clicked,
|
||||
})
|
||||
filesel = wFs.get_widget('fileselection')
|
||||
filesel.set_title('%s - GRAMPS' % _('Create database'))
|
||||
|
||||
def save_ok_button_clicked(self,obj):
|
||||
filename = obj.get_filename().encode('iso8859-1')
|
||||
if filename:
|
||||
if self.db.read_file(filename) == 1:
|
||||
Utils.destroy_passed_object(obj)
|
||||
response = choose.run()
|
||||
if response == gtk.RESPONSE_OK:
|
||||
filename = choose.get_filename()
|
||||
self.db.read_file(filename)
|
||||
choose.destroy()
|
||||
|
||||
def open_activate(self):
|
||||
if gtk.pygtk_version[1] >= 3:
|
||||
choose = gtk.FileChooserDialog('Open GRAMPS database',
|
||||
None,
|
||||
gtk.FILE_CHOOSER_ACTION_OPEN,
|
||||
(gtk.STOCK_CANCEL,
|
||||
gtk.RESPONSE_CANCEL,
|
||||
gtk.STOCK_OPEN,
|
||||
gtk.RESPONSE_OK))
|
||||
filter = gtk.FileFilter()
|
||||
filter.set_name(_('GRAMPS databases'))
|
||||
filter.add_pattern('*.grdb')
|
||||
choose.add_filter(filter)
|
||||
choose = gtk.FileChooserDialog('Open GRAMPS database',
|
||||
None,
|
||||
gtk.FILE_CHOOSER_ACTION_OPEN,
|
||||
(gtk.STOCK_CANCEL,
|
||||
gtk.RESPONSE_CANCEL,
|
||||
gtk.STOCK_OPEN,
|
||||
gtk.RESPONSE_OK))
|
||||
filter = gtk.FileFilter()
|
||||
filter.set_name(_('GRAMPS databases'))
|
||||
filter.add_pattern('*.grdb')
|
||||
choose.add_filter(filter)
|
||||
|
||||
filter = gtk.FileFilter()
|
||||
filter.set_name(_('All files'))
|
||||
filter.add_pattern('*')
|
||||
choose.add_filter(filter)
|
||||
filter = gtk.FileFilter()
|
||||
filter.set_name(_('All files'))
|
||||
filter.add_pattern('*')
|
||||
choose.add_filter(filter)
|
||||
|
||||
if GrampsCfg.lastfile:
|
||||
choose.set_filename(GrampsCfg.lastfile)
|
||||
if GrampsCfg.lastfile:
|
||||
choose.set_filename(GrampsCfg.lastfile)
|
||||
|
||||
response = choose.run()
|
||||
if response == gtk.RESPONSE_OK:
|
||||
filename = choose.get_filename()
|
||||
self.db.read_file(filename)
|
||||
choose.destroy()
|
||||
else:
|
||||
wFs = gtk.glade.XML (const.gladeFile, "fileselection","gramps")
|
||||
wFs.signal_autoconnect({
|
||||
"on_ok_button1_clicked": self.ok_button_clicked,
|
||||
"destroy_passed_object": self.cancel_button_clicked,
|
||||
})
|
||||
self.filesel = wFs.get_widget('fileselection')
|
||||
self.filesel.set_title('%s - GRAMPS' % _('Open database'))
|
||||
if GrampsCfg.lastfile:
|
||||
self.filesel.set_filename(GrampsCfg.lastfile)
|
||||
return
|
||||
|
||||
def cancel_button_clicked(self,obj):
|
||||
Utils.destroy_passed_object(obj)
|
||||
self.show()
|
||||
|
||||
def ok_button_clicked(self,obj):
|
||||
filename = self.filesel.get_filename()
|
||||
|
||||
if not filename:
|
||||
return
|
||||
if self.db.read_file(filename) == 1:
|
||||
Utils.destroy_passed_object(obj)
|
||||
|
||||
def open_delete_event(self,obj,event):
|
||||
gtk.main_quit()
|
||||
|
||||
def open_cancel_clicked(self,obj):
|
||||
gtk.main_quit()
|
||||
response = choose.run()
|
||||
if response == gtk.RESPONSE_OK:
|
||||
filename = choose.get_filename()
|
||||
self.db.read_file(filename)
|
||||
choose.destroy()
|
||||
|
||||
|
@ -171,7 +171,7 @@ class PluginDialog:
|
||||
self.apply_button.set_use_underline(gtk.TRUE)
|
||||
if tool_tip:
|
||||
try:
|
||||
tt = gtk.gtk_tooltips_data_get(self.apply_button)
|
||||
tt = gtk.tooltips_data_get(self.apply_button)
|
||||
if tt:
|
||||
tt[0].set_tip(self.apply_button,tool_tip)
|
||||
except AttributeError:
|
||||
|
@ -197,12 +197,29 @@ def importData(database, filename, callback,cl=0):
|
||||
except:
|
||||
pass
|
||||
|
||||
fs_top = gtk.FileSelection("%s - GRAMPS" % _("Select file"))
|
||||
fs_top.hide_fileop_buttons()
|
||||
fs_top.ok_button.connect('clicked',fs_ok_clicked)
|
||||
fs_top.cancel_button.connect('clicked',fs_close_window)
|
||||
fs_top.run()
|
||||
fs_top.destroy()
|
||||
choose = gtk.FileChooserDialog('Select file',
|
||||
None,
|
||||
gtk.FILE_CHOOSER_ACTION_OPEN,
|
||||
(gtk.STOCK_CANCEL,
|
||||
gtk.RESPONSE_CANCEL,
|
||||
gtk.STOCK_OPEN,
|
||||
gtk.RESPONSE_OK))
|
||||
|
||||
filter = gtk.FileFilter()
|
||||
filter.set_name(_('All files'))
|
||||
filter.add_pattern('*')
|
||||
choose.add_filter(filter)
|
||||
|
||||
response = choose.run()
|
||||
if response == gtk.RESPONSE_OK:
|
||||
name = fs_top.get_filename()
|
||||
if os.path.isfile(name):
|
||||
shutil.copyfile(name,newfile)
|
||||
try:
|
||||
shutil.copystat(name,newfile)
|
||||
except:
|
||||
pass
|
||||
choose.destroy()
|
||||
|
||||
del parser
|
||||
return 1
|
||||
|
@ -1,7 +0,0 @@
|
||||
#undef ENABLE_NLS
|
||||
#undef HAVE_CATGETS
|
||||
#undef HAVE_GETTEXT
|
||||
#undef GETTEXT_PACKAGE
|
||||
#undef HAVE_LC_MESSAGES
|
||||
#undef HAVE_STPCPY
|
||||
#undef HAVE_LIBSM
|
@ -1114,24 +1114,27 @@ class Gramps:
|
||||
pass
|
||||
|
||||
def select_clicked():
|
||||
# File is lost => select a file to replace the lost one
|
||||
def fs_close_window(obj):
|
||||
fs_top.destroy()
|
||||
choose = gtk.FileChooserDialog('Open GRAMPS database',
|
||||
None,
|
||||
gtk.FILE_CHOOSER_ACTION_OPEN,
|
||||
(gtk.STOCK_CANCEL,
|
||||
gtk.RESPONSE_CANCEL,
|
||||
gtk.STOCK_OPEN,
|
||||
gtk.RESPONSE_OK))
|
||||
|
||||
def fs_ok_clicked(obj):
|
||||
name = fs_top.get_filename()
|
||||
filter = gtk.FileFilter()
|
||||
filter.set_name(_('All files'))
|
||||
filter.add_pattern('*')
|
||||
choose.add_filter(filter)
|
||||
|
||||
response = choose.run()
|
||||
if response == gtk.RESPONSE_OK:
|
||||
name = choose.get_filename()
|
||||
if os.path.isfile(name):
|
||||
RelImage.import_media_object(name,filename,base)
|
||||
object = self.db.find_object_from_id(ObjectId)
|
||||
object.set_path(newfile)
|
||||
Utils.destroy_passed_object(fs_top)
|
||||
|
||||
fs_top = gtk.FileSelection("%s - GRAMPS" % _("Select file"))
|
||||
fs_top.hide_fileop_buttons()
|
||||
fs_top.ok_button.connect('clicked',fs_ok_clicked)
|
||||
fs_top.cancel_button.connect('clicked',fs_close_window)
|
||||
fs_top.show()
|
||||
fs_top.run()
|
||||
choose.destroy()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
for ObjectId in self.db.get_object_keys():
|
||||
@ -1392,14 +1395,35 @@ class Gramps:
|
||||
|
||||
def on_open_activate(self,obj):
|
||||
|
||||
top = gtk.glade.XML (const.gladeFile, "fileselection","gramps")
|
||||
top.signal_autoconnect({
|
||||
"on_ok_button1_clicked": self.on_ok_button1_clicked,
|
||||
"destroy_passed_object": self.fs_close_window,
|
||||
})
|
||||
self.filesel = top.get_widget('fileselection')
|
||||
choose = gtk.FileChooserDialog('Open GRAMPS database',
|
||||
None,
|
||||
gtk.FILE_CHOOSER_ACTION_OPEN,
|
||||
(gtk.STOCK_CANCEL,
|
||||
gtk.RESPONSE_CANCEL,
|
||||
gtk.STOCK_OPEN,
|
||||
gtk.RESPONSE_OK))
|
||||
|
||||
filter = gtk.FileFilter()
|
||||
filter.set_name(_('GRAMPS databases'))
|
||||
filter.add_pattern('*.grdb')
|
||||
choose.add_filter(filter)
|
||||
|
||||
filter = gtk.FileFilter()
|
||||
filter.set_name(_('All files'))
|
||||
filter.add_pattern('*')
|
||||
choose.add_filter(filter)
|
||||
|
||||
if GrampsCfg.lastfile:
|
||||
self.filesel.set_filename(GrampsCfg.lastfile)
|
||||
choose.set_filename(GrampsCfg.lastfile)
|
||||
|
||||
response = choose.run()
|
||||
if response == gtk.RESPONSE_OK:
|
||||
filename = choose.get_filename()
|
||||
filename = os.path.normpath(os.path.abspath(filename))
|
||||
self.clear_database()
|
||||
if self.auto_save_load(filename) == 0:
|
||||
DbPrompter.DbPrompter(self,0,self.topWindow)
|
||||
choose.destroy()
|
||||
|
||||
def on_revert_activate(self,obj):
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user