* src/GrampsCfg.py: added support for tip of the day

* src/data/tips.xml: tip data
* src/TipOfDay.py: support for tip of the day
* src/gramps_main.py: support for tip of the day
* src/const.py: support for tip of the day
* src/gramps.glade: support for tip of the day


svn: r3178
This commit is contained in:
Don Allingham 2004-05-18 07:00:34 +00:00
parent 2f4d1ae2cb
commit 1e9b3cfc20
9 changed files with 375 additions and 6 deletions

View File

@ -1,3 +1,11 @@
2004-05-18 Don Allingham <dallingham@users.sourceforge.net>
* src/GrampsCfg.py: added support for tip of the day
* src/data/tips.xml: tip data
* src/TipOfDay.py: support for tip of the day
* src/gramps_main.py: support for tip of the day
* src/const.py: support for tip of the day
* src/gramps.glade: support for tip of the day
2004-05-16 Alex Roitman <shura@alex.neuro.umn.edu>
* src/plugins/RelGraph.py: Menu for family options.
* src/plugins/RelGraph.py (_get_event_label): Typo.

View File

@ -1,5 +1,5 @@
%define ver 1.1.0
%define rel 0.CVS20040505
%define rel 0.CVS20040516
%define prefix /usr
%define localstatedir /var/lib
# Ensure that internal RPM macros for configure & makeinstall

View File

@ -1,5 +1,5 @@
%define ver 1.1.0
%define rel 0.CVS20040505
%define rel 0.CVS20040516
%define prefix /usr
%define localstatedir /var/lib
# Ensure that internal RPM macros for configure & makeinstall

View File

@ -155,6 +155,7 @@ globalprop = 1
localprop = 1
defaultview = 0
familyview = 0
usetips = 1
#-------------------------------------------------------------------------
#
@ -221,6 +222,7 @@ def loadConfig(call):
global localprop
global defaultview
global familyview
global usetips
_callback = call
lastfile = get_string("/apps/gramps/recent-file")
@ -231,6 +233,8 @@ def loadConfig(call):
calendar = get_bool("/apps/gramps/show-calendar")
id_edit = get_bool("/apps/gramps/id-edit")
index_visible = get_bool("/apps/gramps/index-visible")
usetips = get_bool("/apps/gramps/use-tips",1)
familyview = get_int("/apps/gramps/familyview")
status_bar = get_int("/apps/gramps/statusbar")
gnome_toolbar_str = get_string("/desktop/gnome/interface/toolbar_style","BOTH")
@ -246,7 +250,6 @@ def loadConfig(call):
else:
toolbar = save_toolbar
defaultview = get_int("/apps/gramps/defaultview")
familyview = get_int("/apps/gramps/familyview")
autoload = get_bool("/apps/gramps/autoload",0)
dateFormat = get_int("/apps/gramps/date-format")
@ -604,6 +607,8 @@ class GrampsPreferences:
else:
self.top.get_widget('familyview2').set_active(1)
self.top.get_widget('usetips').set_active(usetips)
paper_obj = self.top.get_widget("paper_size")
menu = gtk.Menu()
choice = 0
@ -807,6 +812,7 @@ class GrampsPreferences:
global save_toolbar
global defaultview
global familyview
global usetips
global paper_preference
global output_preference
global goutput_preference
@ -850,6 +856,7 @@ class GrampsPreferences:
defaultview = not self.top.get_widget("pvbutton").get_active()
familyview = not self.top.get_widget("familyview1").get_active()
usetips = self.top.get_widget("usetips").get_active()
iprefix = unicode(self.top.get_widget("iprefix").get_text())
if iprefix == "":
@ -894,6 +901,7 @@ class GrampsPreferences:
set_int("/apps/gramps/toolbar",save_toolbar)
set_int("/apps/gramps/defaultview",defaultview)
set_int("/apps/gramps/familyview",familyview)
set_bool("/apps/gramps/use-tips",usetips)
set_string("/apps/gramps/paper-preference",paper_preference)
set_string("/apps/gramps/output-preference",output_preference)
set_string("/apps/gramps/goutput-preference",goutput_preference)

94
src/TipOfDay.py Normal file
View File

@ -0,0 +1,94 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# 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
# 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 xml.parsers.expat
import string
import gtk
import gtk.glade
import const
import GrampsCfg
class TipOfDay:
def __init__(self):
xml = gtk.glade.XML(const.gladeFile, "tod", "gramps")
top = xml.get_widget("tod")
tip = xml.get_widget("tip")
use = xml.get_widget('usetips')
tp = TipParser()
tip_list = tp.get()
use.set_active(GrampsCfg.usetips)
index = 0
rval = 0
while rval == 0:
tip.set_text(tip_list[index])
rval = top.run()
if index >= len(tip_list)-1:
index = 0
else:
index += 1
GrampsCfg.set_bool("/apps/gramps/use-tips",use.get_active())
top.destroy()
class TipParser:
"""
Interface to the document template file
"""
def __init__(self):
"""
Creates a template parser. The parser loads map of tempate names
to the file containing the tempate.
data - dictionary that holds the name to path mappings
fpath - filename of the XML file
"""
self.mylist = []
file = open(const.tipdata)
self.tlist = []
p = xml.parsers.expat.ParserCreate()
p.StartElementHandler = self.startElement
p.EndElementHandler = self.endElement
p.CharacterDataHandler = self.characters
p.ParseFile(file)
file.close()
def get(self):
return self.mylist
def setDocumentLocator(self,locator):
"""Sets the XML document locator"""
self.locator = locator
def startElement(self,tag,attrs):
"""
Loads the dictionary when an XML tag of 'template' is found. The format
XML tag is <template title=\"name\" file=\"path\">
"""
self.tlist = []
def endElement(self,tag):
if tag == "tip":
self.mylist.append(string.join(self.tlist,''))
def characters(self, data):
self.tlist.append(data)

View File

@ -93,6 +93,7 @@ dataDir = "%s/data" % rootDir
gtkrcFile = "%s/gtkrc" % rootDir
template_dir = "%s/templates" % dataDir
papersize = "file:%s/papersize.xml" % dataDir
tipdata = "%s/tips.xml" % dataDir
fdl = "%s/fdl.txt" % dataDir
startup = 1

7
src/data/tips.xml Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<tips>
<tip>You can drag and drop an image from either the Media View or any gallery into another gallery</tip>
<tip>You can add an image to any gallery or the Media View by dragging and dropping from a file manager or a web browser.</tip>
<tip>You can set the birth order of children in a family even if you do not have birth dates by using drag and drop.</tip>
<tip>You can convert an alternate name to the person's preferred name by selecting the desired name in the person's name list, bringing up the context menu by clicking the right mouse button, and selecting from the menu.</tip>
</tips>

View File

@ -18304,7 +18304,7 @@
<widget class="GtkTable" id="table16">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="n_rows">11</property>
<property name="n_rows">12</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
@ -18522,6 +18522,28 @@
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="usetips">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Display Tip of the Day</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">11</property>
<property name="bottom_attach">12</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
@ -31127,4 +31149,231 @@
</child>
</widget>
<widget class="GtkDialog" id="tod">
<property name="visible">True</property>
<property name="title" translatable="yes"></property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="default_width">500</property>
<property name="default_height">350</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="has_separator">True</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="button1">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">0</property>
<child>
<widget class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="stock">gtk-go-forward</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">_Next</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkButton" id="button2">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-7</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkTable" id="table1">
<property name="visible">True</property>
<property name="n_rows">3</property>
<property name="n_columns">3</property>
<property name="homogeneous">False</property>
<property name="row_spacing">0</property>
<property name="column_spacing">0</property>
<child>
<widget class="GtkCheckButton" id="usetips">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Display on startup</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">True</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkImage" id="image1968">
<property name="visible">True</property>
<property name="pixbuf">splash.jpg</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="tip">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">True</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">6</property>
<property name="ypad">6</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;span weight=&quot;bold&quot; size=&quot;larger&quot;&gt;Gramps' Tip of the Day&lt;/span&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">True</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="y_padding">6</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">6</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View File

@ -68,6 +68,7 @@ import GrampsCfg
import EditPerson
import Find
import DbPrompter
import TipOfDay
from QuestionDialog import *
@ -114,8 +115,6 @@ class Gramps:
self.c_details = 6
self.cl = 0
gtk.rc_parse(const.gtkrcFile)
if os.getuid() == 0:
WarningDialog(_("GRAMPS is being run as the 'root' user."),
_("This account is not meant for normal appication use. "
@ -139,6 +138,9 @@ class Gramps:
self.relationship = self.RelClass(self.db)
self.init_interface()
if GrampsCfg.usetips:
TipOfDay.TipOfDay()
if args:
import ArgHandler
ArgHandler.ArgHandler(self,args)