* src/gramps_main.py: move gnome program init to gramps.py

* src/gramps.py: add gnome program init
* src/StartupDialog.py: use Assistant instead of gnome.ui.druid


svn: r5642
This commit is contained in:
Don Allingham 2005-12-29 20:33:19 +00:00
parent 597b0c8474
commit 3c353073ee
5 changed files with 50 additions and 105 deletions

View File

@ -1,4 +1,7 @@
2005-12-29 Don Allingham <don@gramps-project.org> 2005-12-29 Don Allingham <don@gramps-project.org>
* src/gramps_main.py: move gnome program init to gramps.py
* src/gramps.py: add gnome program init
* src/StartupDialog.py: use Assistant instead of gnome.ui.druid
* src/Assistant.py: added * src/Assistant.py: added
* src/ArgHandler.py: remove DbPrompter dependency * src/ArgHandler.py: remove DbPrompter dependency
* src/GrampsGconfKeys.py: Support for saving window size * src/GrampsGconfKeys.py: Support for saving window size

View File

@ -128,9 +128,9 @@ class Assistant:
label = gtk.Label(text) label = gtk.Label(text)
label.set_line_wrap(True) label.set_line_wrap(True)
hbox.add(label) hbox.add(label)
self.notebook.insert_page(hbox,position=0) self.notebook.append_page(hbox)
def set_conclusion(self,text): def set_conclusion(self,title,text):
self.conclude_text = text self.conclude_text = text
def add_page(self, title, child): def add_page(self, title, child):
@ -149,7 +149,10 @@ class Assistant:
hbox.add(label) hbox.add(label)
self.notebook.append_page(hbox) self.notebook.append_page(hbox)
self.window.show_all() self.window.show_all()
self.notebook.set_current_page(0)
def destroy(self):
self.window.destroy()
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -34,9 +34,13 @@ from gettext import gettext as _
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gtk import gtk
import gtk.glade import gtk.glade
import gnome
import gnome.ui
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
import Assistant
import const import const
if not const.no_gconf: if not const.no_gconf:
@ -46,12 +50,6 @@ if not const.no_gconf:
import gnome.gconf import gnome.gconf
gconf = gnome.gconf gconf = gnome.gconf
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
import const
import GrampsKeys import GrampsKeys
from QuestionDialog import ErrorDialog from QuestionDialog import ErrorDialog
@ -128,34 +126,16 @@ class StartupDialog:
GrampsKeys.save_startup(const.startup) GrampsKeys.save_startup(const.startup)
self.close(None) self.close(None)
return return
self.w = gtk.Window() self.w = Assistant.Assistant(_('Getting started'),self.complete)
self.fg_color = gtk.gdk.color_parse('#7d684a') self.w.set_intro(_('Welcome to GRAMPS, the Genealogical Research '
self.bg_color = gtk.gdk.color_parse('#e1dbc5') 'and Analysis Management Programming System.\n'
self.logo = gtk.gdk.pixbuf_new_from_file("%s/gramps.png" % const.rootDir) 'Several options and information need to be gathered '
self.splash = gtk.gdk.pixbuf_new_from_file("%s/splash.jpg" % const.rootDir) 'before GRAMPS is ready to be used. Any of this '
'information can be changed in the future in the '
'Preferences dialog under the Settings menu.'))
try: try:
d = gnome.ui.Druid() self.w.add_page(_('Researcher information'),self.build_page2())
except AttributeError: self.w.add_page(_('LDS support'), self.build_page5())
ErrorDialog(_("Broken GNOME libraries"),
_("GRAMPS has detected an incomplete gnome-python "
"library, which is required by GRAMPS. This is "
"frequently seen on Slackware systems, due to the "
"lack of support for GNOME in the Slackware "
"environment. If you are running Slackware, this "
"problem can be resolved by installing Dropline "
"GNOME (http://www.dropline.net/gnome/). If you "
"are running another distribution, please check "
"your GNOME configuration."))
gtk.main_quit()
self.w.add(d)
try:
d.add(self.build_page1())
d.add(self.build_page2())
d.add(self.build_page5())
d.add(self.build_page_last())
except: except:
ErrorDialog(_("Configuration error"), ErrorDialog(_("Configuration error"),
_("\n\nPossibly the installation of GRAMPS was incomplete." _("\n\nPossibly the installation of GRAMPS was incomplete."
@ -163,46 +143,19 @@ class StartupDialog:
gtk.main_quit() gtk.main_quit()
return return
self.w.set_conclusion(_('Complete'),
_('GRAMPS is an Open Source project. Its success '
'depends on the users. User feedback is important. '
'Please join the mailing lists, submit bug reports, '
'suggest improvements, and see how you can '
'contribute.\n\nPlease enjoy using GRAMPS.'))
d.connect('cancel',self.close) self.w.show()
self.w.connect("delete_event", gtk.main_quit)
self.w.show_all()
def close(self,obj): def close(self):
self.task(self.args) self.task(self.args)
def build_page1(self): def complete(self):
p = gnome.ui.DruidPageEdge(0)
p.set_title(_('Getting Started'))
p.set_title_color(self.fg_color)
p.set_bg_color(self.bg_color)
p.set_logo(self.logo)
p.set_watermark(self.splash)
p.set_text(_('Welcome to GRAMPS, the Genealogical Research '
'and Analysis Management Programming System.\n'
'Several options and information need to be gathered '
'before GRAMPS is ready to be used. Any of this '
'information can be changed in the future in the '
'Preferences dialog under the Settings menu.'))
return p
def build_page_last(self):
p = gnome.ui.DruidPageEdge(1)
p.set_title(_('Complete'))
p.set_title_color(self.fg_color)
p.set_bg_color(self.bg_color)
p.set_logo(self.logo)
p.set_watermark(self.splash)
p.connect('finish',self.complete)
p.set_text(_('GRAMPS is an Open Source project. Its success '
'depends on the users. User feedback is important. '
'Please join the mailing lists, submit bug reports, '
'suggest improvements, and see how you can '
'contribute.\n\nPlease enjoy using GRAMPS.'))
return p
def complete(self,obj,obj2):
GrampsKeys.save_researcher_name(unicode(self.name.get_text())) GrampsKeys.save_researcher_name(unicode(self.name.get_text()))
GrampsKeys.save_researcher_addr(unicode(self.addr.get_text())) GrampsKeys.save_researcher_addr(unicode(self.addr.get_text()))
GrampsKeys.save_researcher_city(unicode(self.city.get_text())) GrampsKeys.save_researcher_city(unicode(self.city.get_text()))
@ -219,15 +172,9 @@ class StartupDialog:
self.task(self.args) self.task(self.args)
def build_page2(self): def build_page2(self):
p = gnome.ui.DruidPageStandard()
p.set_title(_('Researcher Information'))
p.set_title_foreground(self.fg_color)
p.set_background(self.bg_color)
p.set_logo(self.logo)
box = gtk.VBox() box = gtk.VBox()
box.set_spacing(12) box.set_spacing(12)
p.append_item("",box,"")
label = gtk.Label( label = gtk.Label(
_('In order to create valid GEDCOM files, the following ' _('In order to create valid GEDCOM files, the following '
@ -253,7 +200,6 @@ class StartupDialog:
box.add(table) box.add(table)
box.show_all() box.show_all()
name = GrampsKeys.get_researcher_name() name = GrampsKeys.get_researcher_name()
if not name or name.strip() == "": if not name or name.strip() == "":
import pwd import pwd
@ -285,18 +231,11 @@ class StartupDialog:
"problem. Please read the INSTALL file in the " "problem. Please read the INSTALL file in the "
"top-level source directory.")) "top-level source directory."))
gtk.main_quit() gtk.main_quit()
return p return box
def build_page5(self): def build_page5(self):
p = gnome.ui.DruidPageStandard()
p.set_title(_('LDS extensions'))
p.set_title_foreground(self.fg_color)
p.set_background(self.bg_color)
p.set_logo(self.logo)
box = gtk.VBox() box = gtk.VBox()
box.set_spacing(12) box.set_spacing(12)
p.append_item("",box,"")
label = gtk.Label( label = gtk.Label(
_('GRAMPS has support for LDS Ordinances, which are special ' _('GRAMPS has support for LDS Ordinances, which are special '
@ -318,7 +257,7 @@ class StartupDialog:
align.add(self.lds) align.add(self.lds)
box.show_all() box.show_all()
return p return box
def make_label(table,val,y,x1,x2,x3,x4): def make_label(table,val,y,x1,x2,x3,x4):
label = gtk.Label(val) label = gtk.Label(val)

View File

@ -86,6 +86,22 @@ signal.signal(signal.SIGCHLD, signal.SIG_DFL)
args = sys.argv args = sys.argv
def run(): def run():
try:
import gnome
self.program = gnome.program_init('gramps',const.version,
gnome.libgnome_module_info_get(),
args, const.popt_table)
self.program.set_property('app-libdir',
'%s/lib' % const.prefixdir)
self.program.set_property('app-datadir',
'%s/share/gramps' % const.prefixdir)
self.program.set_property('app-sysconfdir',
'%s/etc' % const.prefixdir)
self.program.set_property('app-prefix', const.prefixdir)
except:
pass
try: try:
import StartupDialog import StartupDialog

View File

@ -110,22 +110,6 @@ class Gramps:
def __init__(self,args): def __init__(self,args):
try:
import gnome
self.program = gnome.program_init('gramps',const.version,
gnome.libgnome_module_info_get(),
args, const.popt_table)
self.program.set_property('app-libdir',
'%s/lib' % const.prefixdir)
self.program.set_property('app-datadir',
'%s/share/gramps' % const.prefixdir)
self.program.set_property('app-sysconfdir',
'%s/etc' % const.prefixdir)
self.program.set_property('app-prefix', const.prefixdir)
except:
pass
try: try:
GrampsCfg.loadConfig() GrampsCfg.loadConfig()
self.welcome() self.welcome()