2008-01-06 Douglas S. Blank <dblank@cs.brynmawr.edu>

* src/DataViews/MyGrampsView.py:
	* src/DataViews/__init__.py:
	* src/DataViews/GrampletView.py:
	* src/DataViews/Makefile.am:
	* src/Config/_GrampsConfigKeys.py:
	* src/plugins/DefaultGramplets.py:
	* src/plugins/Makefile.am:
	* src/plugins/DefaultGadgets.py:
	* src/glade/gramps.glade:
	* po/POTFILES.in:
	Renamed Gadgets -> Gramplets, MyGrampsView -> GrampletView



svn: r9732
This commit is contained in:
Doug Blank 2008-01-06 22:57:34 +00:00
parent 4d08da0c3c
commit e35844de95
9 changed files with 295 additions and 282 deletions

View File

@ -1,3 +1,16 @@
2008-01-06 Douglas S. Blank <dblank@cs.brynmawr.edu>
* src/DataViews/MyGrampsView.py:
* src/DataViews/__init__.py:
* src/DataViews/GrampletView.py:
* src/DataViews/Makefile.am:
* src/Config/_GrampsConfigKeys.py:
* src/plugins/DefaultGramplets.py:
* src/plugins/Makefile.am:
* src/plugins/DefaultGadgets.py:
* src/glade/gramps.glade:
* po/POTFILES.in:
Renamed Gadgets -> Gramplets, MyGrampsView -> GrampletView
2008-01-06 Raphael Ackermann <raphael.ackermann@gmail.com> 2008-01-06 Raphael Ackermann <raphael.ackermann@gmail.com>
* src/DisplayState.py: 0001495: imports in DisplayState.py need fixed. * src/DisplayState.py: 0001495: imports in DisplayState.py need fixed.

View File

@ -72,7 +72,7 @@ src/DataViews/EventView.py
src/DataViews/FamilyList.py src/DataViews/FamilyList.py
src/DataViews/__init__.py src/DataViews/__init__.py
src/DataViews/MediaView.py src/DataViews/MediaView.py
src/DataViews/MyGrampsView.py src/DataViews/GrampletView.py
src/DataViews/NoteView.py src/DataViews/NoteView.py
src/DataViews/PedigreeView.py src/DataViews/PedigreeView.py
src/DataViews/PersonView.py src/DataViews/PersonView.py
@ -256,7 +256,7 @@ src/plugins/Checkpoint.py
src/plugins/Check.py src/plugins/Check.py
src/plugins/CountAncestors.py src/plugins/CountAncestors.py
src/plugins/CustomBookText.py src/plugins/CustomBookText.py
src/plugins/DefaultGadgets.py src/plugins/DefaultGramplets.py
src/plugins/Desbrowser.py src/plugins/Desbrowser.py
src/plugins/DescendChart.py src/plugins/DescendChart.py
src/plugins/DescendReport.py src/plugins/DescendReport.py

View File

@ -282,7 +282,7 @@ default_value = {
MIN_GENERATION_YEARS : 13, MIN_GENERATION_YEARS : 13,
AVG_GENERATION_GAP : 20, AVG_GENERATION_GAP : 20,
GENERATION_DEPTH : 15, GENERATION_DEPTH : 15,
DATA_VIEWS: ('MyGrampsView,PersonView,RelationshipView,FamilyListView,' DATA_VIEWS: ('GrampletView,PersonView,RelationshipView,FamilyListView,'
'PedigreeView,EventView,SourceView,PlaceView,MediaView,' 'PedigreeView,EventView,SourceView,PlaceView,MediaView,'
'RepositoryView,NoteView'), 'RepositoryView,NoteView'),
ADDMEDIA_IMGDIR : '', ADDMEDIA_IMGDIR : '',

View File

@ -18,10 +18,10 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# #
# $Id: _MyGrampsView.py $ # $Id: _GrampletView.py $
""" """
MyGrampsView interface GrampletView interface
""" """
__author__ = "Doug Blank" __author__ = "Doug Blank"
@ -44,60 +44,60 @@ import ConfigParser
import Utils import Utils
from QuickReports import run_quick_report_by_name from QuickReports import run_quick_report_by_name
AVAILABLE_GADGETS = {} AVAILABLE_GRAMPLETS = {}
GADGET_FILENAME = os.path.join(const.HOME_DIR,"gadgets.ini") GRAMPLET_FILENAME = os.path.join(const.HOME_DIR,"gramplets.ini")
NL = "\n" NL = "\n"
debug = False debug = False
def register_gadget(data_dict): def register_gramplet(data_dict):
global AVAILABLE_GADGETS global AVAILABLE_GRAMPLETS
base_opts = {"name":"Unnamed Gadget", base_opts = {"name":"Unnamed Gramplet",
"tname": _("Unnamed Gadget"), "tname": _("Unnamed Gramplet"),
"state":"maximized", "state":"maximized",
"column": -1, "row": -1, "column": -1, "row": -1,
"data": []} "data": []}
base_opts.update(data_dict) base_opts.update(data_dict)
AVAILABLE_GADGETS[base_opts["name"]] = base_opts AVAILABLE_GRAMPLETS[base_opts["name"]] = base_opts
def register(**data): def register(**data):
if "type" in data: if "type" in data:
if data["type"].lower() == "gadget": if data["type"].lower() == "gramplet":
register_gadget(data) register_gramplet(data)
else: else:
print ("Unknown plugin type: '%s'" % data["type"]) print ("Unknown plugin type: '%s'" % data["type"])
else: else:
print ("Plugin did not define type.") print ("Plugin did not define type.")
def get_gadget_opts(name, opts): def get_gramplet_opts(name, opts):
if name in AVAILABLE_GADGETS: if name in AVAILABLE_GRAMPLETS:
data = AVAILABLE_GADGETS[name] data = AVAILABLE_GRAMPLETS[name]
my_data = data.copy() my_data = data.copy()
my_data.update(opts) my_data.update(opts)
return my_data return my_data
else: else:
print ("Unknown gadget name: '%s'" % name) print ("Unknown gramplet name: '%s'" % name)
return {} return {}
def get_gadget_options_by_name(name): def get_gramplet_options_by_name(name):
if debug: print "name:", name if debug: print "name:", name
if name in AVAILABLE_GADGETS: if name in AVAILABLE_GRAMPLETS:
return AVAILABLE_GADGETS[name].copy() return AVAILABLE_GRAMPLETS[name].copy()
else: else:
print ("Unknown gadget name: '%s'" % name) print ("Unknown gramplet name: '%s'" % name)
return None return None
def get_gadget_options_by_tname(name): def get_gramplet_options_by_tname(name):
if debug: print "name:", name if debug: print "name:", name
for key in AVAILABLE_GADGETS: for key in AVAILABLE_GRAMPLETS:
if AVAILABLE_GADGETS[key]["tname"] == name: if AVAILABLE_GRAMPLETS[key]["tname"] == name:
return AVAILABLE_GADGETS[key].copy() return AVAILABLE_GRAMPLETS[key].copy()
print ("Unknown gadget name: '%s'" % name) print ("Unknown gramplet name: '%s'" % name)
return None return None
def make_requested_gadget(viewpage, name, opts, dbstate, uistate): def make_requested_gramplet(viewpage, name, opts, dbstate, uistate):
if name in AVAILABLE_GADGETS: if name in AVAILABLE_GRAMPLETS:
gui = GuiGadget(viewpage, dbstate, uistate, **opts) gui = GuiGramplet(viewpage, dbstate, uistate, **opts)
if opts.get("content", None): if opts.get("content", None):
opts["content"](gui) opts["content"](gui)
# now that we have user code, set the tooltips # now that we have user code, set the tooltips
@ -122,43 +122,43 @@ class LinkTag(gtk.TextTag):
#self.set_property('underline', pango.UNDERLINE_SINGLE) #self.set_property('underline', pango.UNDERLINE_SINGLE)
tag_table.add(self) tag_table.add(self)
class GadgetWindow(ManagedWindow.ManagedWindow): class GrampletWindow(ManagedWindow.ManagedWindow):
def __init__(self, gadget): def __init__(self, gramplet):
self.title = gadget.title + " Gadget" self.title = gramplet.title + " Gramplet"
self.gadget = gadget self.gramplet = gramplet
ManagedWindow.ManagedWindow.__init__(self, gadget.uistate, [], gadget) ManagedWindow.ManagedWindow.__init__(self, gramplet.uistate, [], gramplet)
self.set_window(gtk.Dialog("",gadget.uistate.window, self.set_window(gtk.Dialog("",gramplet.uistate.window,
gtk.DIALOG_DESTROY_WITH_PARENT, gtk.DIALOG_DESTROY_WITH_PARENT,
(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)), (gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)),
None, self.title) None, self.title)
self.window.set_size_request(400,300) self.window.set_size_request(400,300)
self.window.connect('response', self.close) self.window.connect('response', self.close)
self.gadget.mainframe.reparent(self.window.vbox) self.gramplet.mainframe.reparent(self.window.vbox)
self.window.show() self.window.show()
def build_menu_names(self, obj): def build_menu_names(self, obj):
return (self.title, 'Gadget') return (self.title, 'Gramplet')
def get_title(self): def get_title(self):
return self.title return self.title
def close(self, *args): def close(self, *args):
""" """
Closes the detached GadgetWindow. Closes the detached GrampletWindow.
""" """
self.gadget.gvclose.show() self.gramplet.gvclose.show()
self.gadget.gvstate.show() self.gramplet.gvstate.show()
self.gadget.gvproperties.show() self.gramplet.gvproperties.show()
self.gadget.viewpage.detached_gadgets.remove(self.gadget) self.gramplet.viewpage.detached_gramplets.remove(self.gramplet)
self.gadget.state = "maximized" self.gramplet.state = "maximized"
self.gadget.mainframe.reparent(self.gadget.parent) self.gramplet.mainframe.reparent(self.gramplet.parent)
expand,fill,padding,pack = self.gadget.parent.query_child_packing(self.gadget.mainframe) expand,fill,padding,pack = self.gramplet.parent.query_child_packing(self.gramplet.mainframe)
self.gadget.parent.set_child_packing(self.gadget.mainframe,self.gadget.expand,fill,padding,pack) self.gramplet.parent.set_child_packing(self.gramplet.mainframe,self.gramplet.expand,fill,padding,pack)
ManagedWindow.ManagedWindow.close(self, *args) ManagedWindow.ManagedWindow.close(self, *args)
#------------------------------------------------------------------------ #------------------------------------------------------------------------
class Gadget(object): class Gramplet(object):
def __init__(self, gui): def __init__(self, gui):
self._idle_id = 0 self._idle_id = 0
self._generator = None self._generator = None
@ -168,7 +168,7 @@ class Gadget(object):
self.link_cursor = gtk.gdk.Cursor(gtk.gdk.LEFT_PTR) self.link_cursor = gtk.gdk.Cursor(gtk.gdk.LEFT_PTR)
self.standard_cursor = gtk.gdk.Cursor(gtk.gdk.XTERM) self.standard_cursor = gtk.gdk.Cursor(gtk.gdk.XTERM)
# links to each other: # links to each other:
self.gui = gui # plugin gadget has link to gui self.gui = gui # plugin gramplet has link to gui
gui.pui = self # gui has link to plugin ui gui.pui = self # gui has link to plugin ui
self.dbstate = gui.dbstate self.dbstate = gui.dbstate
self.init() self.init()
@ -195,14 +195,14 @@ class Gadget(object):
def on_load(self): def on_load(self):
""" """
Gadgets should override this to take care of loading previously Gramplets should override this to take care of loading previously
their special data. their special data.
""" """
pass pass
def on_save(self): def on_save(self):
""" """
Gadgets should override this to take care of saving their Gramplets should override this to take care of saving their
special data. special data.
""" """
if debug: print ("on_save: '%s'" % self.gui.title) if debug: print ("on_save: '%s'" % self.gui.title)
@ -305,9 +305,9 @@ class Gadget(object):
self._idle_id = 0 self._idle_id = 0
return False return False
except Exception, e: except Exception, e:
print "Gadget gave an error" print "Gramplet gave an error"
traceback.print_exc() traceback.print_exc()
print "Continuing after gadget error..." print "Continuing after gramplet error..."
self._idle_id = 0 self._idle_id = 0
return False return False
@ -362,12 +362,12 @@ class Gadget(object):
def logical_true(value): def logical_true(value):
return value in ["True", True, 1, "1"] return value in ["True", True, 1, "1"]
class GuiGadget: class GuiGramplet:
""" """
Class that handles the plugin interfaces for the MyGrampsView. Class that handles the plugin interfaces for the GrampletView.
""" """
TARGET_TYPE_FRAME = 80 TARGET_TYPE_FRAME = 80
LOCAL_DRAG_TYPE = 'GADGET' LOCAL_DRAG_TYPE = 'GRAMPLET'
LOCAL_DRAG_TARGET = (LOCAL_DRAG_TYPE, 0, TARGET_TYPE_FRAME) LOCAL_DRAG_TARGET = (LOCAL_DRAG_TYPE, 0, TARGET_TYPE_FRAME)
def __init__(self, viewpage, dbstate, uistate, title, **kwargs): def __init__(self, viewpage, dbstate, uistate, title, **kwargs):
self.viewpage = viewpage self.viewpage = viewpage
@ -375,7 +375,7 @@ class GuiGadget:
self.uistate = uistate self.uistate = uistate
self.title = title self.title = title
########## Set defaults ########## Set defaults
self.name = kwargs.get("name", "Unnamed Gadget") self.name = kwargs.get("name", "Unnamed Gramplet")
self.expand = logical_true(kwargs.get("expand", False)) self.expand = logical_true(kwargs.get("expand", False))
self.height = int(kwargs.get("height", 200)) self.height = int(kwargs.get("height", 200))
self.column = int(kwargs.get("column", -1)) self.column = int(kwargs.get("column", -1))
@ -384,8 +384,8 @@ class GuiGadget:
self.data = kwargs.get("data", []) self.data = kwargs.get("data", [])
########## ##########
self.pui = None # user code self.pui = None # user code
self.xml = gtk.glade.XML(const.GLADE_FILE, 'gvgadget', "gramps") self.xml = gtk.glade.XML(const.GLADE_FILE, 'gvgramplet', "gramps")
self.mainframe = self.xml.get_widget('gvgadget') self.mainframe = self.xml.get_widget('gvgramplet')
self.textview = self.xml.get_widget('gvtextview') self.textview = self.xml.get_widget('gvtextview')
self.buffer = self.textview.get_buffer() self.buffer = self.textview.get_buffer()
self.scrolledwindow = self.xml.get_widget('gvscrolledwindow') self.scrolledwindow = self.xml.get_widget('gvscrolledwindow')
@ -408,14 +408,14 @@ class GuiGadget:
# source: # source:
drag = self.gvproperties drag = self.gvproperties
drag.drag_source_set(gtk.gdk.BUTTON1_MASK, drag.drag_source_set(gtk.gdk.BUTTON1_MASK,
[GuiGadget.LOCAL_DRAG_TARGET], [GuiGramplet.LOCAL_DRAG_TARGET],
gtk.gdk.ACTION_COPY) gtk.gdk.ACTION_COPY)
def close(self, *obj): def close(self, *obj):
if self.state == "windowed": if self.state == "windowed":
return return
self.state = "closed" self.state = "closed"
self.viewpage.closed_gadgets.append(self) self.viewpage.closed_gramplets.append(self)
self.mainframe.get_parent().remove(self.mainframe) self.mainframe.get_parent().remove(self.mainframe)
def detach(self): def detach(self):
@ -426,9 +426,9 @@ class GuiGadget:
self.gvproperties.hide() self.gvproperties.hide()
# keep a pointer to old parent frame: # keep a pointer to old parent frame:
self.parent = self.mainframe.get_parent() self.parent = self.mainframe.get_parent()
self.viewpage.detached_gadgets.append(self) self.viewpage.detached_gramplets.append(self)
# make a window, and attach it there # make a window, and attach it there
self.detached_window = GadgetWindow(self) self.detached_window = GrampletWindow(self)
self.state = "windowed" self.state = "windowed"
def set_state(self, state): def set_state(self, state):
@ -494,22 +494,22 @@ class MyScrolledWindow(gtk.ScrolledWindow):
# Hack to get around show_all that shows hidden items # Hack to get around show_all that shows hidden items
# do once, the first time showing # do once, the first time showing
if self.viewpage: if self.viewpage:
gadgets = [g for g in self.viewpage.gadget_map.values() if g != None] gramplets = [g for g in self.viewpage.gramplet_map.values() if g != None]
self.viewpage = None self.viewpage = None
for gadget in gadgets: for gramplet in gramplets:
if gadget.state == "minimized": if gramplet.state == "minimized":
gadget.set_state("minimized") gramplet.set_state("minimized")
class MyGrampsView(PageView.PageView): class GrampletView(PageView.PageView):
""" """
MyGrampsView interface GrampletView interface
""" """
def __init__(self, dbstate, uistate): def __init__(self, dbstate, uistate):
""" """
Creates a MyGrampsView, with the current dbstate and uistate Creates a GrampletView, with the current dbstate and uistate
""" """
PageView.PageView.__init__(self, _('My Gramps'), dbstate, uistate) PageView.PageView.__init__(self, _('Gramplets'), dbstate, uistate)
self._popup_xy = None self._popup_xy = None
def change_db(self, event): def change_db(self, event):
@ -523,11 +523,11 @@ class MyGrampsView(PageView.PageView):
Builds the container widget for the interface. Must be overridden by the Builds the container widget for the interface. Must be overridden by the
the base class. Returns a gtk container widget. the base class. Returns a gtk container widget.
""" """
# load the user's gadgets and set columns, etc # load the user's gramplets and set columns, etc
user_gadgets = self.load_gadgets() user_gramplets = self.load_gramplets()
# build the GUI: # build the GUI:
frame = MyScrolledWindow() frame = MyScrolledWindow()
msg = _("Right click to add gadgets") msg = _("Right click to add gramplets")
self.tooltips = gtk.Tooltips() self.tooltips = gtk.Tooltips()
self.tooltips.set_tip(frame, msg) self.tooltips.set_tip(frame, msg)
frame.viewpage = self frame.viewpage = self
@ -537,7 +537,7 @@ class MyGrampsView(PageView.PageView):
frame.drag_dest_set(gtk.DEST_DEFAULT_MOTION | frame.drag_dest_set(gtk.DEST_DEFAULT_MOTION |
gtk.DEST_DEFAULT_HIGHLIGHT | gtk.DEST_DEFAULT_HIGHLIGHT |
gtk.DEST_DEFAULT_DROP, gtk.DEST_DEFAULT_DROP,
[('GADGET', 0, 80)], [('GRAMPLET', 0, 80)],
gtk.gdk.ACTION_COPY) gtk.gdk.ACTION_COPY)
frame.connect('drag_drop', self.drop_widget) frame.connect('drag_drop', self.drop_widget)
frame.connect('button-press-event', self._button_press) frame.connect('button-press-event', self._button_press)
@ -548,91 +548,91 @@ class MyGrampsView(PageView.PageView):
for i in range(self.column_count): for i in range(self.column_count):
self.columns.append(gtk.VBox()) self.columns.append(gtk.VBox())
self.hbox.pack_start(self.columns[-1],expand=True) self.hbox.pack_start(self.columns[-1],expand=True)
# Load the gadgets # Load the gramplets
self.gadget_map = {} # title->gadget self.gramplet_map = {} # title->gramplet
self.frame_map = {} # frame->gadget self.frame_map = {} # frame->gramplet
self.detached_gadgets = [] # list of detached gadgets self.detached_gramplets = [] # list of detached gramplets
self.closed_gadgets = [] # list of closed gadgets self.closed_gramplets = [] # list of closed gramplets
self.closed_opts = [] # list of closed options from ini file self.closed_opts = [] # list of closed options from ini file
# get the user's gadgets from ~/.gramps/gadgets.ini # get the user's gramplets from ~/.gramps/gramplets.ini
# Load the user's gadgets: # Load the user's gramplets:
for (name, opts) in user_gadgets: for (name, opts) in user_gramplets:
all_opts = get_gadget_opts(name, opts) all_opts = get_gramplet_opts(name, opts)
if "title" not in all_opts: if "title" not in all_opts:
all_opts["title"] = "Untitled Gadget" all_opts["title"] = "Untitled Gramplet"
if "state" not in all_opts: if "state" not in all_opts:
all_opts["state"] = "maximized" all_opts["state"] = "maximized"
# uniqify titles: # uniqify titles:
unique = all_opts["title"] unique = all_opts["title"]
cnt = 1 cnt = 1
while unique in self.gadget_map: while unique in self.gramplet_map:
unique = all_opts["title"] + ("-%d" % cnt) unique = all_opts["title"] + ("-%d" % cnt)
cnt += 1 cnt += 1
all_opts["title"] = unique all_opts["title"] = unique
if all_opts["state"] == "closed": if all_opts["state"] == "closed":
self.gadget_map[all_opts["title"]] = None # save closed name self.gramplet_map[all_opts["title"]] = None # save closed name
self.closed_opts.append(all_opts) self.closed_opts.append(all_opts)
continue continue
g = make_requested_gadget(self, name, all_opts, g = make_requested_gramplet(self, name, all_opts,
self.dbstate, self.uistate) self.dbstate, self.uistate)
if g: if g:
self.gadget_map[all_opts["title"]] = g self.gramplet_map[all_opts["title"]] = g
self.frame_map[str(g.mainframe)] = g self.frame_map[str(g.mainframe)] = g
else: else:
print "Can't make gadget of type '%s'." % name print "Can't make gramplet of type '%s'." % name
self.place_gadgets() self.place_gramplets()
return frame return frame
def clear_gadgets(self): def clear_gramplets(self):
""" """
Detach all of the mainframe gadgets from the columns. Detach all of the mainframe gramplets from the columns.
""" """
gadgets = [g for g in self.gadget_map.values() if g != None] gramplets = [g for g in self.gramplet_map.values() if g != None]
for gadget in gadgets: for gramplet in gramplets:
column = gadget.mainframe.get_parent() column = gramplet.mainframe.get_parent()
if column: if column:
column.remove(gadget.mainframe) column.remove(gramplet.mainframe)
def place_gadgets(self): def place_gramplets(self):
""" """
Place the gadget mainframes in the columns. Place the gramplet mainframes in the columns.
""" """
gadgets = [g for g in self.gadget_map.values() if g != None] gramplets = [g for g in self.gramplet_map.values() if g != None]
# put the gadgets where they go: # put the gramplets where they go:
# sort by row # sort by row
gadgets.sort(lambda a, b: cmp(a.row, b.row)) gramplets.sort(lambda a, b: cmp(a.row, b.row))
cnt = 0 cnt = 0
for gadget in gadgets: for gramplet in gramplets:
# see if the user wants this in a particular location: # see if the user wants this in a particular location:
# and if there are that many columns # and if there are that many columns
if gadget.column >= 0 and gadget.column < self.column_count: if gramplet.column >= 0 and gramplet.column < self.column_count:
pos = gadget.column pos = gramplet.column
else: else:
# else, spread them out: # else, spread them out:
pos = cnt % self.column_count pos = cnt % self.column_count
self.columns[pos].pack_start(gadget.mainframe, expand=gadget.expand) self.columns[pos].pack_start(gramplet.mainframe, expand=gramplet.expand)
gadget.column = pos gramplet.column = pos
# set height on gadget.scrolledwindow here: # set height on gramplet.scrolledwindow here:
gadget.scrolledwindow.set_size_request(-1, gadget.height) gramplet.scrolledwindow.set_size_request(-1, gramplet.height)
# Can't minimize here, because GRAMPS calls show_all later: # Can't minimize here, because GRAMPS calls show_all later:
#if gadget.state == "minimized": # starts max, change to min it #if gramplet.state == "minimized": # starts max, change to min it
# gadget.set_state("minimized") # minimize it # gramplet.set_state("minimized") # minimize it
# set minimized is called in page subclass hack (above) # set minimized is called in page subclass hack (above)
if gadget.state == "windowed": if gramplet.state == "windowed":
gadget.detach() gramplet.detach()
elif gadget.state == "closed": elif gramplet.state == "closed":
gadget.close() gramplet.close()
cnt += 1 cnt += 1
def load_gadgets(self): def load_gramplets(self):
self.column_count = 2 # default for new user self.column_count = 2 # default for new user
retval = [] retval = []
filename = GADGET_FILENAME filename = GRAMPLET_FILENAME
if filename and os.path.exists(filename): if filename and os.path.exists(filename):
cp = ConfigParser.ConfigParser() cp = ConfigParser.ConfigParser()
cp.read(filename) cp.read(filename)
for sec in cp.sections(): for sec in cp.sections():
if sec == "My Gramps View Options": if sec == "Gramplet View Options":
if "column_count" in cp.options(sec): if "column_count" in cp.options(sec):
self.column_count = int(cp.get(sec, "column_count")) self.column_count = int(cp.get(sec, "column_count"))
else: else:
@ -645,44 +645,44 @@ class MyGrampsView(PageView.PageView):
else: else:
data[opt] = cp.get(sec, opt).strip() data[opt] = cp.get(sec, opt).strip()
if "name" not in data: if "name" not in data:
data["name"] = "Unnamed Gadget" data["name"] = "Unnamed Gramplet"
data["tname"]= _("Unnamed Gadget") data["tname"]= _("Unnamed Gramplet")
retval.append((data["name"], data)) # name, opts retval.append((data["name"], data)) # name, opts
else: else:
# give defaults as currently known # give defaults as currently known
for name in ["Top Surnames Gadget", "Welcome Gadget"]: for name in ["Top Surnames Gramplet", "Welcome Gramplet"]:
if name in AVAILABLE_GADGETS: if name in AVAILABLE_GRAMPLETS:
retval.append((name, AVAILABLE_GADGETS[name])) retval.append((name, AVAILABLE_GRAMPLETS[name]))
return retval return retval
def save(self, *args): def save(self, *args):
if debug: print "saving" if debug: print "saving"
if len(self.frame_map.keys() + if len(self.frame_map.keys() +
self.detached_gadgets + self.detached_gramplets +
self.closed_gadgets) == 0: self.closed_gramplets) == 0:
return # something is the matter return # something is the matter
filename = GADGET_FILENAME filename = GRAMPLET_FILENAME
try: try:
fp = open(filename, "w") fp = open(filename, "w")
except: except:
print "Failed writing '%s'; gadgets not saved" % filename print "Failed writing '%s'; gramplets not saved" % filename
return return
fp.write(";; Gramps gadgets file" + NL) fp.write(";; Gramps gramplets file" + NL)
fp.write((";; Automatically created at %s" % time.strftime("%Y/%m/%d %H:%M:%S")) + NL + NL) fp.write((";; Automatically created at %s" % time.strftime("%Y/%m/%d %H:%M:%S")) + NL + NL)
fp.write("[My Gramps View Options]" + NL) fp.write("[Gramplet View Options]" + NL)
fp.write(("column_count=%d" + NL + NL) % self.column_count) fp.write(("column_count=%d" + NL + NL) % self.column_count)
# showing gadgets: # showing gramplets:
for col in range(self.column_count): for col in range(self.column_count):
row = 0 row = 0
for gframe in self.columns[col]: for gframe in self.columns[col]:
gadget = self.frame_map[str(gframe)] gramplet = self.frame_map[str(gframe)]
opts = get_gadget_options_by_name(gadget.name) opts = get_gramplet_options_by_name(gramplet.name)
if opts != None: if opts != None:
base_opts = opts.copy() base_opts = opts.copy()
for key in base_opts: for key in base_opts:
if key in gadget.__dict__: if key in gramplet.__dict__:
base_opts[key] = gadget.__dict__[key] base_opts[key] = gramplet.__dict__[key]
fp.write(("[%s]" + NL) % gadget.title) fp.write(("[%s]" + NL) % gramplet.title)
for key in base_opts: for key in base_opts:
if key == "content": continue if key == "content": continue
elif key == "title": continue elif key == "title": continue
@ -702,14 +702,14 @@ class MyGrampsView(PageView.PageView):
fp.write(("row=%d" + NL) % row) fp.write(("row=%d" + NL) % row)
fp.write(NL) fp.write(NL)
row += 1 row += 1
for gadget in self.detached_gadgets + self.closed_gadgets: for gramplet in self.detached_gramplets + self.closed_gramplets:
opts = get_gadget_options_by_name(gadget.name) opts = get_gramplet_options_by_name(gramplet.name)
if opts != None: if opts != None:
base_opts = opts.copy() base_opts = opts.copy()
for key in base_opts: for key in base_opts:
if key in gadget.__dict__: if key in gramplet.__dict__:
base_opts[key] = gadget.__dict__[key] base_opts[key] = gramplet.__dict__[key]
fp.write(("[%s]" + NL) % gadget.title) fp.write(("[%s]" + NL) % gramplet.title)
for key in base_opts: for key in base_opts:
if key == "content": continue if key == "content": continue
elif key == "title": continue elif key == "title": continue
@ -745,7 +745,7 @@ class MyGrampsView(PageView.PageView):
def drop_widget(self, source, context, x, y, timedata): def drop_widget(self, source, context, x, y, timedata):
""" """
This is the destination method for handling drag and drop This is the destination method for handling drag and drop
of a gadget onto the main scrolled window. of a gramplet onto the main scrolled window.
""" """
button = context.get_source_widget() button = context.get_source_widget()
hbox = button.get_parent() hbox = button.get_parent()
@ -768,17 +768,17 @@ class MyGrampsView(PageView.PageView):
if y < (rect.y + 15): # starts at 0, this allows insert before if y < (rect.y + 15): # starts at 0, this allows insert before
self.columns[col].remove(gframe) self.columns[col].remove(gframe)
stack.append(gframe) stack.append(gframe)
maingadget = self.frame_map.get(str(mainframe), None) maingramplet = self.frame_map.get(str(mainframe), None)
maingadget.column = col maingramplet.column = col
if maingadget.state == "maximized": if maingramplet.state == "maximized":
expand = maingadget.expand expand = maingramplet.expand
else: else:
expand = False expand = False
self.columns[col].pack_start(mainframe, expand=expand) self.columns[col].pack_start(mainframe, expand=expand)
for gframe in stack: for gframe in stack:
gadget = self.frame_map[str(gframe)] gramplet = self.frame_map[str(gframe)]
if gadget.state == "maximized": if gramplet.state == "maximized":
expand = gadget.expand expand = gramplet.expand
else: else:
expand = False expand = False
self.columns[col].pack_start(gframe, expand=expand) self.columns[col].pack_start(gframe, expand=expand)
@ -790,10 +790,10 @@ class MyGrampsView(PageView.PageView):
View. The user typically defines self.action_list and View. The user typically defines self.action_list and
self.action_toggle_list in this function. self.action_toggle_list in this function.
""" """
self.action = gtk.ActionGroup(self.title + "/Gadgets") self.action = gtk.ActionGroup(self.title + "/Gramplets")
self.action.add_actions([('AddGadget',gtk.STOCK_ADD,_("_Add a gadget")), self.action.add_actions([('AddGramplet',gtk.STOCK_ADD,_("_Add a gramplet")),
('RestoreGadget',None,_("_Restore a gadget")), ('RestoreGramplet',None,_("_Restore a gramplet")),
('DeleteGadget',None,_("_Delete a gadget")), ('DeleteGramplet',None,_("_Delete a gramplet")),
('Columns1',None,_("Set columns to _1"), ('Columns1',None,_("Set columns to _1"),
None,None, None,None,
lambda obj:self.set_columns(1)), lambda obj:self.set_columns(1)),
@ -807,8 +807,8 @@ class MyGrampsView(PageView.PageView):
self._add_action_group(self.action) self._add_action_group(self.action)
def set_columns(self, num): def set_columns(self, num):
# clear the gadgets: # clear the gramplets:
self.clear_gadgets() self.clear_gramplets()
# clear the columns: # clear the columns:
for column in self.columns: for column in self.columns:
frame = column.get_parent() frame = column.get_parent()
@ -821,19 +821,19 @@ class MyGrampsView(PageView.PageView):
self.columns.append(gtk.VBox()) self.columns.append(gtk.VBox())
self.columns[-1].show() self.columns[-1].show()
self.hbox.pack_start(self.columns[-1],expand=True) self.hbox.pack_start(self.columns[-1],expand=True)
# place the gadgets back in the new columns # place the gramplets back in the new columns
self.place_gadgets() self.place_gramplets()
self.widget.show() self.widget.show()
def delete_gadget(self, obj): def delete_gramplet(self, obj):
name = obj.get_child().get_label() name = obj.get_child().get_label()
############### First kind: from current session ############### First kind: from current session
for gadget in self.closed_gadgets: for gramplet in self.closed_gramplets:
if gadget.title == name: if gramplet.title == name:
self.closed_gadgets.remove(gadget) self.closed_gramplets.remove(gramplet)
self.gadget_map[gadget.title] self.gramplet_map[gramplet.title]
self.frame_map[str(gadget.mainframe)] self.frame_map[str(gramplet.mainframe)]
del gadget del gramplet
return return
################ Second kind: from options ################ Second kind: from options
for opts in self.closed_opts: for opts in self.closed_opts:
@ -841,85 +841,85 @@ class MyGrampsView(PageView.PageView):
self.closed_opts.remove(opts) self.closed_opts.remove(opts)
return return
def restore_gadget(self, obj): def restore_gramplet(self, obj):
name = obj.get_child().get_label() name = obj.get_child().get_label()
############### First kind: from current session ############### First kind: from current session
for gadget in self.closed_gadgets: for gramplet in self.closed_gramplets:
if gadget.title == name: if gramplet.title == name:
gadget.state = "maximized" gramplet.state = "maximized"
self.closed_gadgets.remove(gadget) self.closed_gramplets.remove(gramplet)
if self._popup_xy != None: if self._popup_xy != None:
self.drop_widget(self.widget, gadget, self.drop_widget(self.widget, gramplet,
self._popup_xy[0], self._popup_xy[1], 0) self._popup_xy[0], self._popup_xy[1], 0)
else: else:
self.drop_widget(self.widget, gadget, 0, 0, 0) self.drop_widget(self.widget, gramplet, 0, 0, 0)
return return
################ Second kind: from options ################ Second kind: from options
for opts in self.closed_opts: for opts in self.closed_opts:
if opts["title"] == name: if opts["title"] == name:
self.closed_opts.remove(opts) self.closed_opts.remove(opts)
g = make_requested_gadget(self, opts["name"], opts, g = make_requested_gramplet(self, opts["name"], opts,
self.dbstate, self.uistate) self.dbstate, self.uistate)
if g: if g:
self.gadget_map[opts["title"]] = g self.gramplet_map[opts["title"]] = g
self.frame_map[str(g.mainframe)] = g self.frame_map[str(g.mainframe)] = g
else: else:
print "Can't make gadget of type '%s'." % name print "Can't make gramplet of type '%s'." % name
if g: if g:
gadget = g gramplet = g
gadget.state = "maximized" gramplet.state = "maximized"
if gadget.column >= 0 and gadget.column < len(self.columns): if gramplet.column >= 0 and gramplet.column < len(self.columns):
pos = gadget.column pos = gramplet.column
else: else:
pos = 0 pos = 0
self.columns[pos].pack_start(gadget.mainframe, expand=gadget.expand) self.columns[pos].pack_start(gramplet.mainframe, expand=gramplet.expand)
# set height on gadget.scrolledwindow here: # set height on gramplet.scrolledwindow here:
gadget.scrolledwindow.set_size_request(-1, gadget.height) gramplet.scrolledwindow.set_size_request(-1, gramplet.height)
## now drop it in right place ## now drop it in right place
if self._popup_xy != None: if self._popup_xy != None:
self.drop_widget(self.widget, gadget, self.drop_widget(self.widget, gramplet,
self._popup_xy[0], self._popup_xy[1], 0) self._popup_xy[0], self._popup_xy[1], 0)
else: else:
self.drop_widget(self.widget, gadget, 0, 0, 0) self.drop_widget(self.widget, gramplet, 0, 0, 0)
def add_gadget(self, obj): def add_gramplet(self, obj):
tname = obj.get_child().get_label() tname = obj.get_child().get_label()
all_opts = get_gadget_options_by_tname(tname) all_opts = get_gramplet_options_by_tname(tname)
name = all_opts["name"] name = all_opts["name"]
if all_opts == None: if all_opts == None:
print "Unknown gadget type: '%s'; bad gadgets.ini file?" % name print "Unknown gramplet type: '%s'; bad gramplets.ini file?" % name
return return
if "title" not in all_opts: if "title" not in all_opts:
all_opts["title"] = "Untitled Gadget" all_opts["title"] = "Untitled Gramplet"
# uniqify titles: # uniqify titles:
unique = all_opts["title"] unique = all_opts["title"]
cnt = 1 cnt = 1
while unique in self.gadget_map: while unique in self.gramplet_map:
unique = all_opts["title"] + ("-%d" % cnt) unique = all_opts["title"] + ("-%d" % cnt)
cnt += 1 cnt += 1
all_opts["title"] = unique all_opts["title"] = unique
if all_opts["title"] not in self.gadget_map: if all_opts["title"] not in self.gramplet_map:
g = make_requested_gadget(self, name, all_opts, g = make_requested_gramplet(self, name, all_opts,
self.dbstate, self.uistate) self.dbstate, self.uistate)
if g: if g:
self.gadget_map[all_opts["title"]] = g self.gramplet_map[all_opts["title"]] = g
self.frame_map[str(g.mainframe)] = g self.frame_map[str(g.mainframe)] = g
gadget = g gramplet = g
if gadget.column >= 0 and gadget.column < len(self.columns): if gramplet.column >= 0 and gramplet.column < len(self.columns):
pos = gadget.column pos = gramplet.column
else: else:
pos = 0 pos = 0
self.columns[pos].pack_start(gadget.mainframe, expand=gadget.expand) self.columns[pos].pack_start(gramplet.mainframe, expand=gramplet.expand)
# set height on gadget.scrolledwindow here: # set height on gramplet.scrolledwindow here:
gadget.scrolledwindow.set_size_request(-1, gadget.height) gramplet.scrolledwindow.set_size_request(-1, gramplet.height)
## now drop it in right place ## now drop it in right place
if self._popup_xy != None: if self._popup_xy != None:
self.drop_widget(self.widget, gadget, self.drop_widget(self.widget, gramplet,
self._popup_xy[0], self._popup_xy[1], 0) self._popup_xy[0], self._popup_xy[1], 0)
else: else:
self.drop_widget(self.widget, gadget, 0, 0, 0) self.drop_widget(self.widget, gramplet, 0, 0, 0)
else: else:
print "Can't make gadget of type '%s'." % name print "Can't make gramplet of type '%s'." % name
def get_stock(self): def get_stock(self):
""" """
@ -942,9 +942,9 @@ class MyGrampsView(PageView.PageView):
</menu> </menu>
</menubar> </menubar>
<popup name="Popup"> <popup name="Popup">
<menuitem action="AddGadget"/> <menuitem action="AddGramplet"/>
<menuitem action="RestoreGadget"/> <menuitem action="RestoreGramplet"/>
<menuitem action="DeleteGadget"/> <menuitem action="DeleteGramplet"/>
<separator/> <separator/>
<menuitem action="Columns1"/> <menuitem action="Columns1"/>
<menuitem action="Columns2"/> <menuitem action="Columns2"/>
@ -957,20 +957,20 @@ class MyGrampsView(PageView.PageView):
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
self._popup_xy = (event.x, event.y) self._popup_xy = (event.x, event.y)
menu = self.uistate.uimanager.get_widget('/Popup') menu = self.uistate.uimanager.get_widget('/Popup')
ag_menu = self.uistate.uimanager.get_widget('/Popup/AddGadget') ag_menu = self.uistate.uimanager.get_widget('/Popup/AddGramplet')
if ag_menu: if ag_menu:
qr_menu = ag_menu.get_submenu() qr_menu = ag_menu.get_submenu()
if qr_menu == None: if qr_menu == None:
qr_menu = gtk.Menu() qr_menu = gtk.Menu()
names = [AVAILABLE_GADGETS[key]["tname"] for key names = [AVAILABLE_GRAMPLETS[key]["tname"] for key
in AVAILABLE_GADGETS.keys()] in AVAILABLE_GRAMPLETS.keys()]
names.sort() names.sort()
for name in names: for name in names:
Utils.add_menuitem(qr_menu, name, Utils.add_menuitem(qr_menu, name,
None, self.add_gadget) None, self.add_gramplet)
self.uistate.uimanager.get_widget('/Popup/AddGadget').set_submenu(qr_menu) self.uistate.uimanager.get_widget('/Popup/AddGramplet').set_submenu(qr_menu)
rg_menu = self.uistate.uimanager.get_widget('/Popup/RestoreGadget') rg_menu = self.uistate.uimanager.get_widget('/Popup/RestoreGramplet')
dg_menu = self.uistate.uimanager.get_widget('/Popup/DeleteGadget') dg_menu = self.uistate.uimanager.get_widget('/Popup/DeleteGramplet')
if rg_menu: if rg_menu:
qr_menu = rg_menu.get_submenu() qr_menu = rg_menu.get_submenu()
if qr_menu != None: if qr_menu != None:
@ -979,8 +979,8 @@ class MyGrampsView(PageView.PageView):
if qr2_menu != None: if qr2_menu != None:
dg_menu.remove_submenu() dg_menu.remove_submenu()
names = [] names = []
for gadget in self.closed_gadgets: for gramplet in self.closed_gramplets:
names.append(gadget.title) names.append(gramplet.title)
for opts in self.closed_opts: for opts in self.closed_opts:
names.append(opts["title"]) names.append(opts["title"])
names.sort() names.sort()
@ -989,20 +989,20 @@ class MyGrampsView(PageView.PageView):
qr2_menu = gtk.Menu() qr2_menu = gtk.Menu()
for name in names: for name in names:
Utils.add_menuitem(qr_menu, name, Utils.add_menuitem(qr_menu, name,
None, self.restore_gadget) None, self.restore_gramplet)
Utils.add_menuitem(qr2_menu, name, Utils.add_menuitem(qr2_menu, name,
None, self.delete_gadget) None, self.delete_gramplet)
self.uistate.uimanager.get_widget('/Popup/RestoreGadget').set_submenu(qr_menu) self.uistate.uimanager.get_widget('/Popup/RestoreGramplet').set_submenu(qr_menu)
self.uistate.uimanager.get_widget('/Popup/DeleteGadget').set_submenu(qr2_menu) self.uistate.uimanager.get_widget('/Popup/DeleteGramplet').set_submenu(qr2_menu)
if menu: if menu:
menu.popup(None, None, None, event.button, event.time) menu.popup(None, None, None, event.button, event.time)
return True return True
return False return False
def on_delete(self): def on_delete(self):
gadgets = [g for g in self.gadget_map.values() if g != None] gramplets = [g for g in self.gramplet_map.values() if g != None]
for gadget in gadgets: for gramplet in gramplets:
# this is the only place where the gui runs user code directly # this is the only place where the gui runs user code directly
if gadget.pui: if gramplet.pui:
gadget.pui.on_save() gramplet.pui.on_save()
self.save() self.save()

View File

@ -7,7 +7,7 @@ pkgdatadir = $(datadir)/@PACKAGE@/DataViews
pkgdata_PYTHON = \ pkgdata_PYTHON = \
__init__.py\ __init__.py\
MyGrampsView.py\ GrampletView.py\
PersonView.py\ PersonView.py\
RelationView.py\ RelationView.py\
FamilyList.py\ FamilyList.py\

View File

@ -26,7 +26,7 @@ Package init for the DataView package
__author__ = "Don Allingham" __author__ = "Don Allingham"
__revision__ = "$Revision: $" __revision__ = "$Revision: $"
from MyGrampsView import MyGrampsView, register, Gadget from GrampletView import GrampletView, register, Gramplet
from PersonView import PersonView from PersonView import PersonView
from RelationView import RelationshipView from RelationView import RelationshipView
from FamilyList import FamilyListView from FamilyList import FamilyListView
@ -46,7 +46,7 @@ except:
# Fallback if bad config line, or if no Config system # Fallback if bad config line, or if no Config system
print "Ignoring malformed 'data-views' entry" print "Ignoring malformed 'data-views' entry"
DATA_VIEWS = [ DATA_VIEWS = [
#MyGrampsView, GrampletView,
PersonView, PersonView,
RelationshipView, RelationshipView,
FamilyListView, FamilyListView,

View File

@ -16219,7 +16219,7 @@ Very High</property>
<property name="urgency_hint">False</property> <property name="urgency_hint">False</property>
<child> <child>
<widget class="GtkFrame" id="gvgadget"> <widget class="GtkFrame" id="gvgramplet">
<property name="border_width">10</property> <property name="border_width">10</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="label_xalign">0</property> <property name="label_xalign">0</property>

View File

@ -26,37 +26,37 @@ import time
import urllib import urllib
import gen.lib import gen.lib
from DataViews import register, Gadget from DataViews import register, Gramplet
from BasicUtils import name_displayer from BasicUtils import name_displayer
from QuickReports import run_quick_report_by_name from QuickReports import run_quick_report_by_name
import DateHandler import DateHandler
# #
# Hello World, in Gramps Gadgets # Hello World, in Gramps Gramplets
# #
# First, you need a function or class that takes a single argument # First, you need a function or class that takes a single argument
# a GuiGadget: # a GuiGramplet:
#from DataViews import register #from DataViews import register
#def init(gui): #def init(gui):
# gui.set_text("Hello world!") # gui.set_text("Hello world!")
# In this function, you can do some things to update the gadget, # In this function, you can do some things to update the gramplet,
# like set text of the main scroll window. # like set text of the main scroll window.
# Then, you need to register the gadget: # Then, you need to register the gramplet:
#register(type="gadget", # case in-senstitive keyword "gadget" #register(type="gramplet", # case in-senstitive keyword "gramplet"
# name="Hello World Gadget", # gadget name, unique among gadgets # name="Hello World Gramplet", # gramplet name, unique among gramplets
# height = 20, # height = 20,
# content = init, # function/class; takes guigadget # content = init, # function/class; takes guigramplet
# title="Sample Gadget", # default title, user changeable # title="Sample Gramplet", # default title, user changeable
# ) # )
# There are a number of arguments that you can provide, including: # There are a number of arguments that you can provide, including:
# name, height, content, title, expand, state, data # name, height, content, title, expand, state, data
# Here is a Gadget object. It has a number of method possibilities: # Here is a Gramplet object. It has a number of method possibilities:
# init- run once, on construction # init- run once, on construction
# active_changed- run when active-changed is triggered # active_changed- run when active-changed is triggered
# db_changed- run when db-changed is triggered # db_changed- run when db-changed is triggered
@ -64,7 +64,7 @@ import DateHandler
# You should call update() to run main; don't call main directly # You should call update() to run main; don't call main directly
class CalendarGadget(Gadget): class CalendarGramplet(Gramplet):
def init(self): def init(self):
import gtk import gtk
self.tooltip = _("Double-click a day for details") self.tooltip = _("Double-click a day for details")
@ -136,7 +136,7 @@ class CalendarGadget(Gadget):
'onthisday', 'onthisday',
date) date)
class LogGadget(Gadget): class LogGramplet(Gramplet):
def init(self): def init(self):
self.tooltip = _("Click name to change active\nDouble-click name to edit") self.tooltip = _("Click name to change active\nDouble-click name to edit")
self.set_text(_("Log for this Session")) self.set_text(_("Log for this Session"))
@ -192,7 +192,7 @@ class LogGadget(Gadget):
self.link(_("Unknown"), 'Person', person_handle) self.link(_("Unknown"), 'Person', person_handle)
self.append_text("\n") self.append_text("\n")
class TopSurnamesGadget(Gadget): class TopSurnamesGramplet(Gramplet):
def init(self): def init(self):
self.tooltip = _("Double-click surname for details") self.tooltip = _("Double-click surname for details")
self.top_size = 10 # will be overwritten in load self.top_size = 10 # will be overwritten in load
@ -252,7 +252,7 @@ class TopSurnamesGadget(Gadget):
total_surnames) total_surnames)
self.append_text((_("Total people") + ": %d") % total_people) self.append_text((_("Total people") + ": %d") % total_people)
class StatsGadget(Gadget): class StatsGramplet(Gramplet):
def init(self): def init(self):
self.set_text(_("No Family Tree loaded.")) self.set_text(_("No Family Tree loaded."))
@ -352,7 +352,7 @@ class StatsGadget(Gadget):
text = text + "%s\n" % p text = text + "%s\n" % p
self.set_text(text) self.set_text(text)
class PythonGadget(Gadget): class PythonGramplet(Gramplet):
def init(self): def init(self):
self.tooltip = _("Enter Python expressions") self.tooltip = _("Enter Python expressions")
self.env = {"dbstate": self.gui.dbstate, self.env = {"dbstate": self.gui.dbstate,
@ -444,7 +444,7 @@ class PythonGadget(Gadget):
return True return True
return False return False
class TODOGadget(Gadget): class TODOGramplet(Gramplet):
def init(self): def init(self):
# GUI setup: # GUI setup:
self.tooltip = _("Enter text") self.tooltip = _("Enter text")
@ -474,19 +474,19 @@ def make_welcome_content(gui):
'"Family Trees" from the menu, pick "Manage Family Trees", press ' '"Family Trees" from the menu, pick "Manage Family Trees", press '
'"New" and name your database. For more details, please read the ' '"New" and name your database. For more details, please read the '
'User Manual, or the on-line manual at http://gramps-project.org.\n\n' 'User Manual, or the on-line manual at http://gramps-project.org.\n\n'
'You are currently reading from the "My Gramps" page, where you can' 'You are currently reading from the "Gramplets" page, where you can'
' add your own gadgets.\n\n' ' add your own gramplets.\n\n'
'You can right-click on the background of this page to add additional' 'You can right-click on the background of this page to add additional'
' gadgets and change the number of columns. You can also drag the ' ' gramplets and change the number of columns. You can also drag the '
'Properties button to reposition the gadget on this page, and detach' 'Properties button to reposition the gramplet on this page, and detach'
' the gadget to float above GRAMPS. If you close GRAMPS with a gadget' ' the gramplet to float above GRAMPS. If you close GRAMPS with a gramplet'
' detached, it will re-opened detached the next time you start ' ' detached, it will re-opened detached the next time you start '
'GRAMPS.' 'GRAMPS.'
) )
gui.set_text(text) gui.set_text(text)
class NewsGadget(Gadget): class NewsGramplet(Gramplet):
URL = "http://www.gramps-project.org/wiki/index.php?title=%s&action=raw" URL = "http://www.gramps-project.org/wiki/index.php?title=%s&action=raw"
def init(self): def init(self):
@ -559,7 +559,7 @@ class NewsGadget(Gadget):
#print " after:", text #print " after:", text
yield False, text yield False, text
class AgeOnDateGadget(Gadget): class AgeOnDateGramplet(Gramplet):
def init(self): def init(self):
import gtk import gtk
# GUI setup: # GUI setup:
@ -598,80 +598,80 @@ class AgeOnDateGadget(Gadget):
date) date)
register(type="gadget", register(type="gramplet",
name= "Top Surnames Gadget", name= "Top Surnames Gramplet",
tname=_("Top Surnames Gadget"), tname=_("Top Surnames Gramplet"),
height=230, height=230,
content = TopSurnamesGadget, content = TopSurnamesGramplet,
title=_("Top Surnames"), title=_("Top Surnames"),
) )
register(type="gadget", register(type="gramplet",
name="Statistics Gadget", name="Statistics Gramplet",
tname=_("Statistics Gadget"), tname=_("Statistics Gramplet"),
height=230, height=230,
expand=True, expand=True,
content = StatsGadget, content = StatsGramplet,
title=_("Statistics"), title=_("Statistics"),
) )
register(type="gadget", register(type="gramplet",
name="Session Log Gadget", name="Session Log Gramplet",
tname=_("Session Log Gadget"), tname=_("Session Log Gramplet"),
height=230, height=230,
data=['no'], data=['no'],
content = LogGadget, content = LogGramplet,
title=_("Session Log"), title=_("Session Log"),
) )
register(type="gadget", register(type="gramplet",
name="Python Gadget", name="Python Gramplet",
tname=_("Python Gadget"), tname=_("Python Gramplet"),
height=250, height=250,
content = PythonGadget, content = PythonGramplet,
title=_("Python Shell"), title=_("Python Shell"),
) )
register(type="gadget", register(type="gramplet",
name="TODO Gadget", name="TODO Gramplet",
tname=_("TODO Gadget"), tname=_("TODO Gramplet"),
height=300, height=300,
expand=True, expand=True,
content = TODOGadget, content = TODOGramplet,
title=_("TODO List"), title=_("TODO List"),
) )
register(type="gadget", register(type="gramplet",
name="Welcome Gadget", name="Welcome Gramplet",
tname=_("Welcome Gadget"), tname=_("Welcome Gramplet"),
height=300, height=300,
expand=True, expand=True,
content = make_welcome_content, content = make_welcome_content,
title=_("Welcome to GRAMPS!"), title=_("Welcome to GRAMPS!"),
) )
register(type="gadget", register(type="gramplet",
name="Calendar Gadget", name="Calendar Gramplet",
tname=_("Calendar Gadget"), tname=_("Calendar Gramplet"),
height=200, height=200,
content = CalendarGadget, content = CalendarGramplet,
title=_("Calendar"), title=_("Calendar"),
) )
register(type="gadget", register(type="gramplet",
name="News Gadget", name="News Gramplet",
tname=_("News Gadget"), tname=_("News Gramplet"),
height=300, height=300,
expand=True, expand=True,
content = NewsGadget, content = NewsGramplet,
title=_("News"), title=_("News"),
) )
register(type="gadget", register(type="gramplet",
name="Age on Date Gadget", name="Age on Date Gramplet",
tname=_("Age on Date Gadget"), tname=_("Age on Date Gramplet"),
height=200, height=200,
content = AgeOnDateGadget, content = AgeOnDateGramplet,
title=_("Age on Date"), title=_("Age on Date"),
) )

View File

@ -19,7 +19,7 @@ pkgdata_PYTHON = \
Checkpoint.py\ Checkpoint.py\
CountAncestors.py\ CountAncestors.py\
CustomBookText.py\ CustomBookText.py\
DefaultGadgets.py\ DefaultGramplets.py\
Desbrowser.py\ Desbrowser.py\
DescendChart.py\ DescendChart.py\
DescendReport.py\ DescendReport.py\