gramps/src/StartupDialog.py

91 lines
2.9 KiB
Python
Raw Normal View History

2002-10-20 19:55:16 +05:30
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
import const
import gtk.glade
import gconf
import Utils
_StartupEntry = "/apps/gramps/startup"
2002-10-20 19:55:16 +05:30
def need_to_run():
return 0
client = gconf.client_get_default()
client.add_dir("/apps/gramps",gconf.CLIENT_PRELOAD_NONE)
val = client.get_int(_StartupEntry)
if val == None:
2002-10-20 19:55:16 +05:30
return 1
if val < const.startup:
return 1
return 0
class StartupDialog:
def __init__(self,task,arg):
self.task = task
self.arg = arg
self.druid = gtk.glade.XML(const.configFile,"initDruid")
self.druid.signal_autoconnect({
"on_cancel_clicked" : self.on_cancel_clicked,
"destroy_event": self.destroy,
"on_finish" : self.on_finish
})
self.rlist = ['name','addr','city','state','country',
'postal', 'phone', 'email']
self.client = gconf.client_get_default()
2002-10-20 19:55:16 +05:30
for tag in self.rlist:
val = self.client.get_string("/apps/gramps/researcher-%s" % tag)
2002-10-20 19:55:16 +05:30
if val != None:
self.druid.get_widget(tag).set_text(val)
2002-10-20 19:55:16 +05:30
def destroy(self,obj):
self.task(self.arg)
def on_finish(self,obj,b):
for tag in self.rlist:
val = self.druid.get_widget(tag).get_text()
self.client.set_string("/apps/gramps/researcher-%s" % tag,val)
2002-10-20 19:55:16 +05:30
if self.druid.get_widget("num_us").get_active():
dateFormat = 0
elif self.druid.get_widget("num_eu").get_active():
dateFormat = 1
else:
dateFormat = 2
self.client.set_int("/apps/gramps/dateEntry",dateFormat)
2002-10-20 19:55:16 +05:30
showcal = self.druid.get_widget("altcal").get_active()
self.client.set_int("/apps/gramps/ShowCalendar",showcal)
2002-10-20 19:55:16 +05:30
lds = self.druid.get_widget("enable_lds").get_active()
self.client.set_int("/apps/gramps/UseLDS",lds)
self.client.set_int(_StartupEntry,const.startup)
2002-10-20 19:55:16 +05:30
Utils.destroy_passed_object(obj)
def on_cancel_clicked(self,obj):
self.client.set_int(_StartupEntry,const.startup)
self.client.sync()
2002-10-20 19:55:16 +05:30
Utils.destroy_passed_object(obj)