* src/ArgHandler.py: remove DbPrompter dependency

* src/GrampsGconfKeys.py: Support for saving window size
* src/GrampsIniKeys.py: Support for saving window size
* src/GrampsKeys.py: more gracefully handling missing gconf
* src/Makefile.am: Fixed moved files
* src/Report.py: clean up
* src/ScratchPad.py: use GrampsDisplay instead of gnome.help_display
* src/StartupDialog.py: clean up
* src/ViewManager.py: save window size
* src/gramps_main.py: don't require gnome
* src/data/gramps.schemas: keys for saving window size


svn: r5640
This commit is contained in:
Don Allingham 2005-12-29 18:36:59 +00:00
parent 957f6d9b0f
commit b0807932ad
13 changed files with 215 additions and 93 deletions

View File

@ -1,3 +1,16 @@
2005-12-29 Don Allingham <don@gramps-project.org>
* src/ArgHandler.py: remove DbPrompter dependency
* src/GrampsGconfKeys.py: Support for saving window size
* src/GrampsIniKeys.py: Support for saving window size
* src/GrampsKeys.py: more gracefully handling missing gconf
* src/Makefile.am: Fixed moved files
* src/Report.py: clean up
* src/ScratchPad.py: use GrampsDisplay instead of gnome.help_display
* src/StartupDialog.py: clean up
* src/ViewManager.py: save window size
* src/gramps_main.py: don't require gnome
* src/data/gramps.schemas: keys for saving window size
2005-12-29 Martin Hawlisch <Martin.Hawlisch@gmx.de> 2005-12-29 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/PedView.py: Add new submenu showing people that share * src/PedView.py: Add new submenu showing people that share
the same event. This for example lists witnesses. the same event. This for example lists witnesses.

View File

@ -144,28 +144,6 @@ then
fi fi
AC_MSG_RESULT(ok) AC_MSG_RESULT(ok)
AC_MSG_CHECKING(Python bindings for gnome canvas)
cat > conftest.py <<EOF
$pygtk_require
try:
# Do not import gnome.canvas, this can raise a RuntimeError if the
# display cannot be opened. Just search it.
import imp
imp.find_module('gnome/canvas')
out("YES")
except ImportError:
out("NO")
EOF
$PYTHON conftest.py
has_canvas=`cat conftest.out`
rm -f conftest.out conftest.py
if test YES != "$has_canvas"
then
AC_MSG_ERROR([
**** The python bindings for gnome canvas (gnome-python2-canvas) could not be found.])
fi
AC_MSG_RESULT(ok)
AC_MSG_CHECKING(Python bindings for gnome vfs) AC_MSG_CHECKING(Python bindings for gnome vfs)
cat > conftest.py <<EOF cat > conftest.py <<EOF
$pygtk_require $pygtk_require

View File

@ -43,7 +43,6 @@ from gettext import gettext as _
import const import const
import GrampsDb import GrampsDb
import GrampsMime import GrampsMime
import DbPrompter
import QuestionDialog import QuestionDialog
import GrampsKeys import GrampsKeys
import RecentFiles import RecentFiles
@ -277,7 +276,7 @@ class ArgHandler:
"following dialog will let you select " "following dialog will let you select "
"the new database."), "the new database."),
self.parent.topWindow) self.parent.topWindow)
prompter = DbPrompter.NewNativeDbPrompter(self.parent) prompter = NewNativeDbPrompter(self.parent)
if not prompter.chooser(): if not prompter.chooser():
QuestionDialog.ErrorDialog( QuestionDialog.ErrorDialog(
_("New GRAMPS database was not set up"), _("New GRAMPS database was not set up"),
@ -636,3 +635,91 @@ class ArgHandler:
else: else:
print "Unknown action: %s." % action print "Unknown action: %s." % action
os._exit(1) os._exit(1)
#-------------------------------------------------------------------------
#
# NewNativeDbPrompter
#
#-------------------------------------------------------------------------
class NewNativeDbPrompter:
"""
This class allows to set up a new empty native (grdb) database.
The filename is forced to have an '.grdb' extension. If not given,
it is appended.
"""
def __init__(self,parent,parent_window=None):
self.parent = parent
self.parent_window = parent_window
def chooser(self):
"""
Select the new file. Suggest the Untitled_X.grdb name.
Return 1 when selection is made and 0 otherwise.
"""
choose = gtk.FileChooserDialog(_('GRAMPS: Create GRAMPS database'),
self.parent_window,
gtk.FILE_CHOOSER_ACTION_SAVE,
(gtk.STOCK_CANCEL,
gtk.RESPONSE_CANCEL,
gtk.STOCK_OPEN,
gtk.RESPONSE_OK))
self.parent.clear_database()
# Always add automatic (macth all files) filter
add_all_files_filter(choose)
add_grdb_filter(choose)
# Suggested folder: try last open file, import, then last export,
# then home.
default_dir = os.path.split(GrampsKeys.get_lastfile())[0] + os.path.sep
if len(default_dir)<=1:
default_dir = GrampsKeys.get_last_import_dir()
if len(default_dir)<=1:
default_dir = GrampsKeys.get_last_export_dir()
if len(default_dir)<=1:
default_dir = '~/'
new_filename = Utils.get_new_filename('grdb',default_dir)
choose.set_current_folder(default_dir)
choose.set_current_name(os.path.split(new_filename)[1])
while (True):
response = choose.run()
if response == gtk.RESPONSE_OK:
filename = choose.get_filename()
if filename == None:
continue
if os.path.splitext(filename)[1] != ".grdb":
filename = filename + ".grdb"
choose.destroy()
self.parent.db = GrampsDb.gramps_db_factory(const.app_gramps)()
self.parent.read_file(filename)
# Add the file to the recent items
RecentFiles.recent_files(filename,const.app_gramps)
self.parent.build_recent_menu()
return True
else:
choose.destroy()
return False
choose.destroy()
return False
def add_all_files_filter(chooser):
"""
Add an all-permitting filter to the file chooser dialog.
"""
mime_filter = gtk.FileFilter()
mime_filter.set_name(_('All files'))
mime_filter.add_pattern('*')
chooser.add_filter(mime_filter)
def add_grdb_filter(chooser):
"""
Add a GRDB filter to the file chooser dialog.
"""
mime_filter = gtk.FileFilter()
mime_filter.set_name(_('GRAMPS databases'))
mime_filter.add_mime_type(const.app_gramps)
chooser.add_filter(mime_filter)

View File

@ -60,6 +60,18 @@ def get_default_view():
def save_default_view(val): def save_default_view(val):
set_int("/apps/gramps/interface/defaultview",val,(0,1)) set_int("/apps/gramps/interface/defaultview",val,(0,1))
def get_height():
return get_int("/apps/gramps/interface/height")
def save_height(val):
set_int("/apps/gramps/interface/height",val)
def get_width():
return get_int("/apps/gramps/interface/width")
def save_width(val):
set_int("/apps/gramps/interface/width",val)
def get_family_view(): def get_family_view():
return get_int("/apps/gramps/interface/familyview",(0,1)) return get_int("/apps/gramps/interface/familyview",(0,1))

View File

@ -211,6 +211,18 @@ def get_default_view():
def save_default_view(val): def save_default_view(val):
set_int("interface", "defaultview",val,(0,1)) set_int("interface", "defaultview",val,(0,1))
def get_height():
return get_int("interface", "height")
def save_height(val):
set_int("interface", "height",val)
def get_width():
return get_int("interface", "width")
def save_width(val):
set_int("interface", "width",val)
def get_family_view(): def get_family_view():
return get_int("interface", "familyview", (0,1)) return get_int("interface", "familyview", (0,1))

View File

@ -18,9 +18,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# #
import const
if const.no_gconf: try:
from GrampsIniKeys import *
else:
from GrampsGconfKeys import * from GrampsGconfKeys import *
except:
from GrampsIniKeys import *

View File

@ -1,7 +1,7 @@
# $Id$ # $Id$
# This is the src level Makefile for Gramps # This is the src level Makefile for Gramps
SUBDIRS = docgen plugins dates data po SUBDIRS = docgen plugins dates data po GrampsDb RelLib
# For intl. support, how do we compile? # For intl. support, how do we compile?
MOSTLYCLEANFILES = MOSTLYCLEANFILES =
@ -41,7 +41,6 @@ gdir_PYTHON = \
DateParser.py\ DateParser.py\
DateHandler.py\ DateHandler.py\
DateDisplay.py\ DateDisplay.py\
DbPrompter.py\
DdTargets.py\ DdTargets.py\
DisplayModels.py\ DisplayModels.py\
DisplayTrace.py\ DisplayTrace.py\
@ -52,24 +51,16 @@ gdir_PYTHON = \
EventEdit.py\ EventEdit.py\
FamilyView.py\ FamilyView.py\
FontScale.py\ FontScale.py\
GedcomInfo.py\
GenericFilter.py\ GenericFilter.py\
GnomeMime.py\ GnomeMime.py\
GrampsCfg.py\ GrampsCfg.py\
GrampsBSDDB.py\
GrampsDbBase.py\
GrampsDBCallback.py\
GrampsDisplay.py\ GrampsDisplay.py\
GrampsInMemDB.py\
GrampsXMLDB.py\
GrampsGEDDB.py\
GrampsMime.py\ GrampsMime.py\
gramps_main.py\ gramps_main.py\
gramps.py\ gramps.py\
ImageSelect.py\ ImageSelect.py\
ImgManip.py\ ImgManip.py\
latin_ansel.py\ latin_ansel.py\
latin_utf8.py\
ListBox.py\ ListBox.py\
ListModel.py\ ListModel.py\
LocEdit.py\ LocEdit.py\
@ -89,11 +80,8 @@ gdir_PYTHON = \
PluginMgr.py\ PluginMgr.py\
PythonMime.py\ PythonMime.py\
QuestionDialog.py\ QuestionDialog.py\
ReadGedcom.py \
ReadXML.py\
Relationship.py\ Relationship.py\
RelImage.py\ RelImage.py\
RelLib.py\
Report.py\ Report.py\
ReportUtils.py\ ReportUtils.py\
ScratchPad.py\ ScratchPad.py\
@ -114,8 +102,6 @@ gdir_PYTHON = \
UrlEdit.py\ UrlEdit.py\
Utils.py\ Utils.py\
Witness.py\ Witness.py\
WriteGedcom.py \
WriteXML.py\
SelectPerson.py\ SelectPerson.py\
ArgHandler.py\ ArgHandler.py\
Exporter.py\ Exporter.py\
@ -124,8 +110,6 @@ gdir_PYTHON = \
GrampsGconfKeys.py\ GrampsGconfKeys.py\
RecentFiles.py\ RecentFiles.py\
ReportOptions.py\ ReportOptions.py\
ReadGrdb.py\
WriteGrdb.py\
EventView.py\ EventView.py\
SelectEvent.py\ SelectEvent.py\
Spell.py\ Spell.py\

View File

@ -41,6 +41,33 @@ from types import ClassType, InstanceType
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gtk import gtk
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
import const
import Utils
import Plugins
import PluginMgr
import BaseDoc
import StyleEditor
import GrampsKeys
import PaperMenu
import Errors
import GenericFilter
import NameDisplay
from QuestionDialog import ErrorDialog, OptionDialog
#-------------------------------------------------------------------------
#
# Import XML libraries
#
#-------------------------------------------------------------------------
try:
from xml.sax import make_parser,handler,SAXParseException
except:
from _xmlplus.sax import make_parser,handler,SAXParseException
class FileEntry(gtk.HBox): class FileEntry(gtk.HBox):
def __init__(self,defname,title): def __init__(self,defname,title):
@ -109,36 +136,6 @@ class FileEntry(gtk.HBox):
def set_directory_entry(self,opt): def set_directory_entry(self,opt):
self.dir = opt self.dir = opt
#from gnome.ui import FileEntry
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
import const
import Utils
import Plugins
import PluginMgr
import BaseDoc
import StyleEditor
import GrampsKeys
import PaperMenu
import Errors
import GenericFilter
import NameDisplay
from QuestionDialog import ErrorDialog, OptionDialog
#-------------------------------------------------------------------------
#
# Import XML libraries
#
#-------------------------------------------------------------------------
try:
from xml.sax import make_parser,handler,SAXParseException
except:
from _xmlplus.sax import make_parser,handler,SAXParseException
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Constants # Constants

View File

@ -38,7 +38,6 @@ from gettext import gettext as _
import gtk import gtk
import gtk.glade import gtk.glade
from gtk.gdk import ACTION_COPY, BUTTON1_MASK from gtk.gdk import ACTION_COPY, BUTTON1_MASK
from gnome import help_display
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -48,6 +47,7 @@ from gnome import help_display
import const import const
import TreeTips import TreeTips
import DateHandler import DateHandler
import GrampsDisplay
from DdTargets import DdTargets from DdTargets import DdTargets
@ -902,7 +902,7 @@ class ScratchPadWindow:
def on_help_clicked(self,obj): def on_help_clicked(self,obj):
"""Display the relevant portion of GRAMPS manual""" """Display the relevant portion of GRAMPS manual"""
help_display('gramps-manual','tools-util-scratch-pad') GrampsDisplay.help('tools-util-scratch-pad')
def on_close_scratchpad(self,obj): def on_close_scratchpad(self,obj):
self.remove_itself_from_menu() self.remove_itself_from_menu()

View File

@ -229,9 +229,10 @@ class StartupDialog:
box.set_spacing(12) box.set_spacing(12)
p.append_item("",box,"") p.append_item("",box,"")
label = gtk.Label(_('In order to create valid GEDCOM files, the following information ' label = gtk.Label(
'needs to be entered. If you do not plan to generate GEDCOM files, ' _('In order to create valid GEDCOM files, the following '
'you may leave this empty.')) 'information needs to be entered. If you do not plan to '
'generate GEDCOM files, you may leave this empty.'))
label.set_line_wrap(True) label.set_line_wrap(True)
box.pack_start(label) box.pack_start(label)
@ -297,10 +298,12 @@ class StartupDialog:
box.set_spacing(12) box.set_spacing(12)
p.append_item("",box,"") p.append_item("",box,"")
label = gtk.Label(_('GRAMPS has support for LDS Ordinances, which are special event types\n' label = gtk.Label(
'related to the Church of Jesus Christ of Latter Day Saints.\n\n' _('GRAMPS has support for LDS Ordinances, which are special '
'You may choose to either enable or disable this support. You may\n' 'event types\nrelated to the Church of Jesus Christ of '
'change this option in the future in the Preferences dialog.')) 'Latter Day Saints.\n\nYou may choose to either enable '
'or disable this support. You may\nchange this option in '
'the future in the Preferences dialog.'))
box.add(label) box.add(label)
align = gtk.Alignment(0.5,0) align = gtk.Alignment(0.5,0)

View File

@ -162,7 +162,14 @@ class ViewManager:
self.pages = [] self.pages = []
self.window = gtk.Window() self.window = gtk.Window()
self.window.connect('destroy', self.quit) self.window.connect('destroy', self.quit)
self.window.set_size_request(775,500)
try:
width = GrampsKeys.get_width()
height = GrampsKeys.get_height()
print width,height
self.window.set_default_size(width,height)
except:
self.window.set_default_size(775,500)
self.statusbar = gtk.Statusbar() self.statusbar = gtk.Statusbar()
@ -234,6 +241,10 @@ class ViewManager:
def quit(self,obj=None): def quit(self,obj=None):
self.state.db.close() self.state.db.close()
(width,height) = self.window.get_size()
GrampsKeys.save_width(width)
GrampsKeys.save_height(height)
GrampsKeys.sync()
gtk.main_quit() gtk.main_quit()
def set_color(self,obj): def set_color(self,obj):

View File

@ -94,6 +94,30 @@
</locale> </locale>
</schema> </schema>
<schema>
<key>/schemas/apps/gramps/interface/height</key>
<applyto>/apps/gramps/interface/height</applyto>
<owner>gramps</owner>
<type>int</type>
<default>500</default>
<locale name="C">
<short>Height of the interface.</short>
<long>Specifies the height of the interface when GRAMPS starts.</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/gramps/interface/width</key>
<applyto>/apps/gramps/interface/width</applyto>
<owner>gramps</owner>
<type>int</type>
<default>775</default>
<locale name="C">
<short>Width of the interface.</short>
<long>Specifies the width of the interface when GRAMPS starts.</long>
</locale>
</schema>
<schema> <schema>
<key>/schemas/apps/gramps/interface/familyview</key> <key>/schemas/apps/gramps/interface/familyview</key>
<applyto>/apps/gramps/interface/familyview</applyto> <applyto>/apps/gramps/interface/familyview</applyto>

View File

@ -26,7 +26,6 @@
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gtk import gtk
import gnome
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -58,7 +57,6 @@ import TipOfDay
from GrampsMime import mime_type_is_defined from GrampsMime import mime_type_is_defined
from QuestionDialog import ErrorDialog from QuestionDialog import ErrorDialog
iconpaths = [".",const.rootDir] iconpaths = [".",const.rootDir]
def register_stock_icons (): def register_stock_icons ():
@ -113,16 +111,20 @@ class Gramps:
def __init__(self,args): def __init__(self,args):
try: try:
import gnome
self.program = gnome.program_init('gramps',const.version, self.program = gnome.program_init('gramps',const.version,
gnome.libgnome_module_info_get(), gnome.libgnome_module_info_get(),
args, const.popt_table) args, const.popt_table)
except:
self.program = gnome.program_init('gramps',const.version)
self.program.set_property('app-libdir','%s/lib' % const.prefixdir) self.program.set_property('app-libdir',
self.program.set_property('app-datadir','%s/share/gramps' % const.prefixdir) '%s/lib' % const.prefixdir)
self.program.set_property('app-sysconfdir','%s/etc' % 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) self.program.set_property('app-prefix', const.prefixdir)
except:
pass
try: try:
GrampsCfg.loadConfig() GrampsCfg.loadConfig()