Proper handling of startup wizard
svn: r725
This commit is contained in:
parent
050d6007a6
commit
f08d8961f5
@ -114,8 +114,6 @@ panellist = [
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
owner = Researcher()
|
|
||||||
prefsTop = None
|
|
||||||
iprefix = "I"
|
iprefix = "I"
|
||||||
oprefix = "O"
|
oprefix = "O"
|
||||||
sprefix = "S"
|
sprefix = "S"
|
||||||
@ -158,7 +156,6 @@ localprop = 1
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
_name_format = 0
|
_name_format = 0
|
||||||
_callback = None
|
_callback = None
|
||||||
_druid = None
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -193,7 +190,6 @@ def make_path(path):
|
|||||||
def loadConfig(call):
|
def loadConfig(call):
|
||||||
global autoload
|
global autoload
|
||||||
global autosave_int
|
global autosave_int
|
||||||
global owner
|
|
||||||
global usetabs
|
global usetabs
|
||||||
global uselds
|
global uselds
|
||||||
global autocomp
|
global autocomp
|
||||||
@ -211,7 +207,6 @@ def loadConfig(call):
|
|||||||
global nameof
|
global nameof
|
||||||
global display_attr
|
global display_attr
|
||||||
global attr_name
|
global attr_name
|
||||||
global _druid
|
|
||||||
global _name_format
|
global _name_format
|
||||||
global _callback
|
global _callback
|
||||||
global paper_preference
|
global paper_preference
|
||||||
@ -286,15 +281,6 @@ def loadConfig(call):
|
|||||||
else:
|
else:
|
||||||
db_dir = os.path.normpath(db_dir) + os.sep
|
db_dir = os.path.normpath(db_dir) + os.sep
|
||||||
|
|
||||||
name = get_string("/gramps/researcher/name")
|
|
||||||
addr = get_string("/gramps/researcher/addr")
|
|
||||||
city = get_string("/gramps/researcher/city")
|
|
||||||
state = get_string("/gramps/researcher/state")
|
|
||||||
country = get_string("/gramps/researcher/country")
|
|
||||||
postal = get_string("/gramps/researcher/postal")
|
|
||||||
phone = get_string("/gramps/researcher/phone")
|
|
||||||
email = get_string("/gramps/researcher/email")
|
|
||||||
|
|
||||||
en = get_bool("/gramps/color/enableColors")
|
en = get_bool("/gramps/color/enableColors")
|
||||||
if en == None:
|
if en == None:
|
||||||
en = 0
|
en = 0
|
||||||
@ -388,15 +374,6 @@ def loadConfig(call):
|
|||||||
else:
|
else:
|
||||||
nameof = utils.phonebook_name
|
nameof = utils.phonebook_name
|
||||||
|
|
||||||
if name == None:
|
|
||||||
_druid = libglade.GladeXML(const.configFile,"initDruid")
|
|
||||||
_druid.signal_autoconnect({
|
|
||||||
"destroy_passed_object" : druid_cancel_clicked,
|
|
||||||
"on_initDruid_finish" : on_initDruid_finish
|
|
||||||
})
|
|
||||||
else:
|
|
||||||
owner.set(name,addr,city,state,country,postal,phone,email)
|
|
||||||
|
|
||||||
make_path(os.path.expanduser("~/.gramps"))
|
make_path(os.path.expanduser("~/.gramps"))
|
||||||
make_path(os.path.expanduser("~/.gramps/filters"))
|
make_path(os.path.expanduser("~/.gramps/filters"))
|
||||||
make_path(os.path.expanduser("~/.gramps/plugins"))
|
make_path(os.path.expanduser("~/.gramps/plugins"))
|
||||||
@ -415,37 +392,19 @@ def save_last_file(file):
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def on_initDruid_finish(obj,b):
|
def get_researcher():
|
||||||
global owner
|
n = get_string("/gramps/researcher/name")
|
||||||
|
a = get_string("/gramps/researcher/addr")
|
||||||
name = _druid.get_widget("dresname").get_text()
|
c = get_string("/gramps/researcher/city")
|
||||||
addr = _druid.get_widget("dresaddr").get_text()
|
s = get_string("/gramps/researcher/state")
|
||||||
city = _druid.get_widget("drescity").get_text()
|
ct = get_string("/gramps/researcher/country")
|
||||||
state = _druid.get_widget("dresstate").get_text()
|
p = get_string("/gramps/researcher/postal")
|
||||||
country = _druid.get_widget("drescountry").get_text()
|
ph = get_string("/gramps/researcher/phone")
|
||||||
postal = _druid.get_widget("drespostal").get_text()
|
e = get_string("/gramps/researcher/email")
|
||||||
phone = _druid.get_widget("dresphone").get_text()
|
|
||||||
email = _druid.get_widget("dresemail").get_text()
|
|
||||||
|
|
||||||
owner.set(name,addr,city,state,country,postal,phone,email)
|
owner = Researcher()
|
||||||
store_researcher(owner)
|
owner.set(n,a,c,s,ct,p,ph,e)
|
||||||
utils.destroy_passed_object(obj)
|
return owner
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
def store_researcher(res):
|
|
||||||
set_string("/gramps/researcher/name",res.name)
|
|
||||||
set_string("/gramps/researcher/addr",res.addr)
|
|
||||||
set_string("/gramps/researcher/city",res.city)
|
|
||||||
set_string("/gramps/researcher/state",res.state)
|
|
||||||
set_string("/gramps/researcher/country",res.country)
|
|
||||||
set_string("/gramps/researcher/postal",res.postal)
|
|
||||||
set_string("/gramps/researcher/phone",res.phone)
|
|
||||||
set_string("/gramps/researcher/email",res.email)
|
|
||||||
sync()
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -777,14 +736,23 @@ class GrampsPreferences:
|
|||||||
name_menu.set_active(_name_format)
|
name_menu.set_active(_name_format)
|
||||||
name_option.set_menu(name_menu)
|
name_option.set_menu(name_menu)
|
||||||
|
|
||||||
self.top.get_widget("resname").set_text(owner.getName())
|
cname = get_string("/gramps/researcher/name")
|
||||||
self.top.get_widget("resaddr").set_text(owner.getAddress())
|
caddr = get_string("/gramps/researcher/addr")
|
||||||
self.top.get_widget("rescity").set_text(owner.getCity())
|
ccity = get_string("/gramps/researcher/city")
|
||||||
self.top.get_widget("resstate").set_text(owner.getState())
|
cstate = get_string("/gramps/researcher/state")
|
||||||
self.top.get_widget("rescountry").set_text(owner.getCountry())
|
ccountry = get_string("/gramps/researcher/country")
|
||||||
self.top.get_widget("respostal").set_text(owner.getPostalCode())
|
cpostal = get_string("/gramps/researcher/postal")
|
||||||
self.top.get_widget("resphone").set_text(owner.getPhone())
|
cphone = get_string("/gramps/researcher/phone")
|
||||||
self.top.get_widget("resemail").set_text(owner.getEmail())
|
cemail = get_string("/gramps/researcher/email")
|
||||||
|
|
||||||
|
self.top.get_widget("resname").set_text(cname)
|
||||||
|
self.top.get_widget("resaddr").set_text(caddr)
|
||||||
|
self.top.get_widget("rescity").set_text(ccity)
|
||||||
|
self.top.get_widget("resstate").set_text(cstate)
|
||||||
|
self.top.get_widget("rescountry").set_text(ccountry)
|
||||||
|
self.top.get_widget("respostal").set_text(cpostal)
|
||||||
|
self.top.get_widget("resphone").set_text(cphone)
|
||||||
|
self.top.get_widget("resemail").set_text(cemail)
|
||||||
|
|
||||||
cwidget = self.top.get_widget(ODDFGCOLOR)
|
cwidget = self.top.get_widget(ODDFGCOLOR)
|
||||||
cwidget.set_i16(ListColors.oddfg[0],ListColors.oddfg[1],\
|
cwidget.set_i16(ListColors.oddfg[0],ListColors.oddfg[1],\
|
||||||
@ -888,10 +856,10 @@ class GrampsPreferences:
|
|||||||
|
|
||||||
def on_propertybox_apply(self,obj):
|
def on_propertybox_apply(self,obj):
|
||||||
global nameof
|
global nameof
|
||||||
global owner
|
|
||||||
global usetabs
|
global usetabs
|
||||||
global uselds
|
global uselds
|
||||||
global autocomp
|
global autocomp
|
||||||
|
global autosave_int
|
||||||
global mediaref
|
global mediaref
|
||||||
global globalprop
|
global globalprop
|
||||||
global localprop
|
global localprop
|
||||||
@ -919,6 +887,7 @@ class GrampsPreferences:
|
|||||||
global web_dir
|
global web_dir
|
||||||
global db_dir
|
global db_dir
|
||||||
global lastnamegen
|
global lastnamegen
|
||||||
|
global autoload
|
||||||
|
|
||||||
show_detail = self.top.get_widget("showdetail").get_active()
|
show_detail = self.top.get_widget("showdetail").get_active()
|
||||||
autoload = self.top.get_widget("autoload").get_active()
|
autoload = self.top.get_widget("autoload").get_active()
|
||||||
@ -1075,8 +1044,14 @@ class GrampsPreferences:
|
|||||||
save_config_color(EVENBGCOLOR,ListColors.evenbg)
|
save_config_color(EVENBGCOLOR,ListColors.evenbg)
|
||||||
save_config_color(ANCESTORFGCOLOR,ListColors.ancestorfg)
|
save_config_color(ANCESTORFGCOLOR,ListColors.ancestorfg)
|
||||||
|
|
||||||
owner.set(name,addr,city,state,country,postal,phone,email)
|
set_string("/gramps/researcher/name",name)
|
||||||
store_researcher(owner)
|
set_string("/gramps/researcher/addr",addr)
|
||||||
|
set_string("/gramps/researcher/city",city)
|
||||||
|
set_string("/gramps/researcher/state",state)
|
||||||
|
set_string("/gramps/researcher/country",country)
|
||||||
|
set_string("/gramps/researcher/postal",postal)
|
||||||
|
set_string("/gramps/researcher/phone",phone)
|
||||||
|
set_string("/gramps/researcher/email",email)
|
||||||
|
|
||||||
self.db.set_iprefix(iprefix)
|
self.db.set_iprefix(iprefix)
|
||||||
self.db.set_fprefix(fprefix)
|
self.db.set_fprefix(fprefix)
|
||||||
@ -1154,12 +1129,4 @@ def save_sort_cols(name,col,dir):
|
|||||||
set_int("/gramps/sort/%s_dir" % name, dir)
|
set_int("/gramps/sort/%s_dir" % name, dir)
|
||||||
sync()
|
sync()
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
def druid_cancel_clicked(obj,a):
|
|
||||||
utils.destroy_passed_object(obj)
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -145,8 +145,6 @@ class HtmlDoc(TextDoc):
|
|||||||
self.top = _top
|
self.top = _top
|
||||||
|
|
||||||
def open(self,filename):
|
def open(self,filename):
|
||||||
|
|
||||||
|
|
||||||
if filename[-5:] == ".html" or filename[-4:0] == ".htm":
|
if filename[-5:] == ".html" or filename[-4:0] == ".htm":
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
else:
|
else:
|
||||||
|
@ -353,14 +353,22 @@ class Researcher:
|
|||||||
|
|
||||||
def set(self,name,addr,city,state,country,postal,phone,email):
|
def set(self,name,addr,city,state,country,postal,phone,email):
|
||||||
"""sets the information about the database owner"""
|
"""sets the information about the database owner"""
|
||||||
self.name = strip(name)
|
if name:
|
||||||
self.addr = strip(addr)
|
self.name = strip(name)
|
||||||
self.city = strip(city)
|
if addr:
|
||||||
self.state = strip(state)
|
self.addr = strip(addr)
|
||||||
self.country = strip(country)
|
if city:
|
||||||
self.postal = strip(postal)
|
self.city = strip(city)
|
||||||
self.phone = strip(phone)
|
if state:
|
||||||
self.email = strip(email)
|
self.state = strip(state)
|
||||||
|
if country:
|
||||||
|
self.country = strip(country)
|
||||||
|
if postal:
|
||||||
|
self.postal = strip(postal)
|
||||||
|
if phone:
|
||||||
|
self.phone = strip(phone)
|
||||||
|
if email:
|
||||||
|
self.email = strip(email)
|
||||||
|
|
||||||
class Location:
|
class Location:
|
||||||
"""Provides information about a place, including city, county, state,
|
"""Provides information about a place, including city, county, state,
|
||||||
|
63
gramps/src/StartupDialog.py
Normal file
63
gramps/src/StartupDialog.py
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
#
|
||||||
|
# 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 libglade
|
||||||
|
import gnome.config
|
||||||
|
import utils
|
||||||
|
|
||||||
|
class StartupDialog:
|
||||||
|
|
||||||
|
def __init__(self,task,arg):
|
||||||
|
self.task = task
|
||||||
|
self.arg = arg
|
||||||
|
|
||||||
|
self.druid = libglade.GladeXML(const.configFile,"initDruid")
|
||||||
|
self.druid.signal_autoconnect({
|
||||||
|
"destroy_passed_object" : self.on_cancel_clicked,
|
||||||
|
"on_initDruid_finish" : self.on_finish
|
||||||
|
})
|
||||||
|
|
||||||
|
def on_finish(self,obj,b):
|
||||||
|
|
||||||
|
name = self.druid.get_widget("dresname").get_text()
|
||||||
|
addr = self.druid.get_widget("dresaddr").get_text()
|
||||||
|
city = self.druid.get_widget("drescity").get_text()
|
||||||
|
state = self.druid.get_widget("dresstate").get_text()
|
||||||
|
country = self.druid.get_widget("drescountry").get_text()
|
||||||
|
postal = self.druid.get_widget("drespostal").get_text()
|
||||||
|
phone = self.druid.get_widget("dresphone").get_text()
|
||||||
|
email = self.druid.get_widget("dresemail").get_text()
|
||||||
|
|
||||||
|
gnome.config.set_string("/gramps/researcher/name",name)
|
||||||
|
gnome.config.set_string("/gramps/researcher/addr",addr)
|
||||||
|
gnome.config.set_string("/gramps/researcher/city",city)
|
||||||
|
gnome.config.set_string("/gramps/researcher/state",state)
|
||||||
|
gnome.config.set_string("/gramps/researcher/country",country)
|
||||||
|
gnome.config.set_string("/gramps/researcher/postal",postal)
|
||||||
|
gnome.config.set_string("/gramps/researcher/phone",phone)
|
||||||
|
gnome.config.set_string("/gramps/researcher/email",email)
|
||||||
|
gnome.config.sync()
|
||||||
|
utils.destroy_passed_object(obj)
|
||||||
|
self.task(self.arg)
|
||||||
|
|
||||||
|
def on_cancel_clicked(self,obj,a):
|
||||||
|
self.task(self.arg)
|
||||||
|
utils.destroy_passed_object(obj)
|
@ -5,6 +5,7 @@ import intl
|
|||||||
import os
|
import os
|
||||||
import gtk
|
import gtk
|
||||||
import gnome.ui
|
import gnome.ui
|
||||||
|
import gnome.config
|
||||||
import locale
|
import locale
|
||||||
|
|
||||||
if os.environ.has_key("GRAMPSI18N"):
|
if os.environ.has_key("GRAMPSI18N"):
|
||||||
@ -21,11 +22,17 @@ import gramps_main
|
|||||||
import sys
|
import sys
|
||||||
import locale
|
import locale
|
||||||
|
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
arg = sys.argv[1]
|
||||||
|
else:
|
||||||
|
arg = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if len(sys.argv) > 1:
|
if gnome.config.get_string("/gramps/researcher/name") == None:
|
||||||
gramps_main.main(sys.argv[1])
|
from StartupDialog import StartupDialog
|
||||||
|
StartupDialog(gramps_main.main,arg)
|
||||||
else:
|
else:
|
||||||
gramps_main.main(None)
|
gramps_main.main(arg)
|
||||||
except:
|
except:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
@ -34,4 +41,5 @@ except:
|
|||||||
traceback.print_exc(file=errfile)
|
traceback.print_exc(file=errfile)
|
||||||
errfile.close()
|
errfile.close()
|
||||||
|
|
||||||
|
gtk.mainloop()
|
||||||
|
|
||||||
|
@ -1702,8 +1702,10 @@ def post_load(name):
|
|||||||
|
|
||||||
database.setSavePath(name)
|
database.setSavePath(name)
|
||||||
res = database.getResearcher()
|
res = database.getResearcher()
|
||||||
if res.getName() == "" and Config.owner.getName() != "":
|
owner = Config.get_researcher()
|
||||||
database.setResearcher(Config.owner)
|
|
||||||
|
if res.getName() == "" and owner.getName() != "":
|
||||||
|
database.setResearcher(owner)
|
||||||
utils.modified()
|
utils.modified()
|
||||||
|
|
||||||
setup_bookmarks()
|
setup_bookmarks()
|
||||||
@ -2168,8 +2170,7 @@ def main(arg):
|
|||||||
if Config.autosave_int != 0:
|
if Config.autosave_int != 0:
|
||||||
utils.enable_autosave(autosave_database,Config.autosave_int)
|
utils.enable_autosave(autosave_database,Config.autosave_int)
|
||||||
|
|
||||||
database.setResearcher(Config.owner)
|
database.setResearcher(Config.get_researcher())
|
||||||
gtk.mainloop()
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -2262,4 +2263,4 @@ class DbPrompter:
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main(None)
|
main(None)
|
||||||
|
gtk.mainloop()
|
||||||
|
Loading…
Reference in New Issue
Block a user