More pylint improvements
This commit is contained in:
parent
5f1b719810
commit
32ff947a87
@ -21,22 +21,16 @@ AgeOnDateGramplet computes the age for everyone thought to be alive
|
||||
on a particular date.
|
||||
"""
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Python modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
from gramps.gen.datehandler import parser
|
||||
from gramps.gui.plug.quick import run_quick_report_by_name
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -28,7 +28,6 @@ This Gramplet shows textual distributions of age breakdowns of various types.
|
||||
# Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
from collections import defaultdict
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -36,11 +35,10 @@ from collections import defaultdict
|
||||
# Gramps modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gen.lib import ChildRefType
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gramps.gen.lib import ChildRefType
|
||||
|
||||
class AgeStatsGramplet(Gramplet):
|
||||
|
||||
@ -150,7 +148,7 @@ class AgeStatsGramplet(Gramplet):
|
||||
bref = f.get_birth_ref()
|
||||
if bref:
|
||||
bevent = self.dbstate.db.get_event_from_handle(bref.ref)
|
||||
bdate = bevent.get_date_object()
|
||||
bdate = bevent.get_date_object()
|
||||
if bdate and birth_date and birth_date.get_year() != 0:
|
||||
diff = birth_date.get_year() - bdate.get_year()
|
||||
if diff >= 0 and diff < self.max_father_diff:
|
||||
@ -165,7 +163,7 @@ class AgeStatsGramplet(Gramplet):
|
||||
bref = m.get_birth_ref()
|
||||
if bref:
|
||||
bevent = self.dbstate.db.get_event_from_handle(bref.ref)
|
||||
bdate = bevent.get_date_object()
|
||||
bdate = bevent.get_date_object()
|
||||
if bdate and birth_date and birth_date.get_year() != 0:
|
||||
diff = birth_date.get_year() - bdate.get_year()
|
||||
if diff >= 0 and diff < self.max_mother_diff:
|
||||
@ -185,7 +183,7 @@ class AgeStatsGramplet(Gramplet):
|
||||
self.gui.buffer.apply_tag_by_name("fixed", start, end)
|
||||
self.append_text("", scroll_to="begin")
|
||||
|
||||
def ticks(self, width, start = 0, stop = 100, fill = " "):
|
||||
def ticks(self, width, start=0, stop=100, fill=" "):
|
||||
""" Returns the tickmark numbers for a graph axis """
|
||||
count = int(width / 10.0)
|
||||
retval = "%-3d" % start
|
||||
@ -205,7 +203,7 @@ class AgeStatsGramplet(Gramplet):
|
||||
retval += "%3d" % int(stop)
|
||||
return retval
|
||||
|
||||
def format(self, text, width, align = "left", borders = "||", fill = " "):
|
||||
def format(self, text, width, align="left", borders="||", fill=" "):
|
||||
""" Returns a formatted string for nice, fixed-font display """
|
||||
if align == "center":
|
||||
text = text.center(width, fill)
|
||||
@ -269,34 +267,39 @@ class AgeStatsGramplet(Gramplet):
|
||||
max_bin = float(max(bin))
|
||||
if max_bin != 0:
|
||||
i = 0
|
||||
self.append_text("--------" +
|
||||
self.format("", graph_width-4, fill = "-", borders="++") +
|
||||
self.append_text(
|
||||
"--------" +
|
||||
self.format("", graph_width-4, fill="-", borders="++") +
|
||||
"-----\n")
|
||||
self.append_text(column.center(8) +
|
||||
self.append_text(
|
||||
column.center(8) +
|
||||
self.format(title, graph_width-4, align="center") +
|
||||
" % " + "\n")
|
||||
self.append_text("--------" +
|
||||
self.format("", graph_width-4, fill = "-", borders="++") +
|
||||
self.append_text(
|
||||
"--------" +
|
||||
self.format("", graph_width-4, fill="-", borders="++") +
|
||||
"-----\n")
|
||||
for bin in bin:
|
||||
self.append_text((" %3d-%3d" % (i * 5, (i+1)* 5,)))
|
||||
selected = self.make_handles_set(i * 5, (i+1) *5, handles)
|
||||
self.link(self.format("X" * int(bin/max_bin * (graph_width-4)),
|
||||
graph_width-4),
|
||||
graph_width-4),
|
||||
'PersonList',
|
||||
selected,
|
||||
tooltip=_("Double-click to see %d people") %
|
||||
len(selected))
|
||||
len(selected))
|
||||
procent = (float(len(selected)) /
|
||||
(float(sum(hash.values())))*100)
|
||||
(float(sum(hash.values())))*100)
|
||||
self.append_text(glocale.format("%#5.2f", procent))
|
||||
self.append_text("\n")
|
||||
i += 1
|
||||
self.append_text("--------" +
|
||||
self.format("", graph_width-4, fill = "-", borders="++") +
|
||||
self.append_text(
|
||||
"--------" +
|
||||
self.format("", graph_width-4, fill="-", borders="++") +
|
||||
"-----\n")
|
||||
self.append_text(" % " +
|
||||
self.ticks(graph_width-4, start = 0,
|
||||
stop = int(max_bin/(float(sum(hash.values())))*100)) +
|
||||
self.append_text(
|
||||
" % " +
|
||||
self.ticks(graph_width-4, start=0,
|
||||
stop=int(max_bin/(float(sum(hash.values())))*100)) +
|
||||
"\n\n")
|
||||
self.append_text(self.compute_stats(hash))
|
||||
|
@ -45,7 +45,9 @@ from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
class Ancestor(Gramplet):
|
||||
|
||||
"""
|
||||
Gramplet to display ancestors of the active person.
|
||||
"""
|
||||
def init(self):
|
||||
self.gui.WIDGET = self.build_gui()
|
||||
self.gui.get_container_widget().remove(self.gui.textview)
|
||||
@ -120,6 +122,9 @@ class Ancestor(Gramplet):
|
||||
self.set_has_data(False)
|
||||
|
||||
def add_to_tree(self, depth, parent_id, person_handle):
|
||||
"""
|
||||
Add a person to the tree.
|
||||
"""
|
||||
if depth > config.get('behavior.generation-depth'):
|
||||
return
|
||||
|
||||
|
@ -17,12 +17,23 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
from gramps.gui.listmodel import ListModel, NOSORT
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gtk modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gi.repository import Gtk
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gui.listmodel import ListModel
|
||||
from gramps.gui.plug.quick import run_quick_report_by_name
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gi.repository import Gtk
|
||||
|
||||
class Attributes(Gramplet):
|
||||
"""
|
||||
|
@ -18,13 +18,24 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
from gramps.gui.listmodel import ListModel, NOSORT
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gtk modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gi.repository import Gtk
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gui.listmodel import ListModel
|
||||
from gramps.gen.utils.db import navigation_label
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gui.utils import edit_object
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gi.repository import Gtk
|
||||
|
||||
class Backlinks(Gramplet):
|
||||
"""
|
||||
|
@ -16,16 +16,24 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Gtk modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gi.repository import Gtk
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
from gramps.gui.plug.quick import run_quick_report_by_name
|
||||
from gramps.gen.lib import Date
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -33,25 +41,29 @@ from gramps.gen.lib import Date
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class CalendarGramplet(Gramplet):
|
||||
"""
|
||||
Gramplet showing a calendar of events.
|
||||
"""
|
||||
def init(self):
|
||||
from gi.repository import Gtk
|
||||
self.set_tooltip(_("Double-click a day for details"))
|
||||
self.gui.calendar = Gtk.Calendar()
|
||||
self.gui.calendar.connect('day-selected-double-click', self.double_click)
|
||||
self.gui.calendar.connect('day-selected-double-click',
|
||||
self.double_click)
|
||||
self.gui.calendar.set_display_options(
|
||||
Gtk.CalendarDisplayOptions.SHOW_HEADING)
|
||||
Gtk.CalendarDisplayOptions.SHOW_HEADING)
|
||||
self.gui.get_container_widget().remove(self.gui.textview)
|
||||
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||
vbox.pack_start(self.gui.calendar, False, False, 0)
|
||||
self.gui.get_container_widget().add(vbox)
|
||||
vbox.show_all()
|
||||
#self.gui.calendar.show()
|
||||
|
||||
def post_init(self):
|
||||
self.disconnect("active-changed")
|
||||
|
||||
def double_click(self, obj):
|
||||
# bring up events on this day
|
||||
"""
|
||||
Bring up events on this day.
|
||||
"""
|
||||
year, month, day = self.gui.calendar.get_date()
|
||||
date = Date()
|
||||
date.set_yr_mon_day(year, month + 1, day)
|
||||
|
@ -17,18 +17,29 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gtk modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gi.repository import Gtk
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gui.editors import EditPerson
|
||||
from gramps.gui.listmodel import ListModel, NOSORT
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gen.plug.report.utils import find_spouse
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gramps.gen.display.name import displayer as name_displayer
|
||||
from gramps.gen.utils.db import get_birth_or_fallback, get_death_or_fallback
|
||||
from gramps.gen.datehandler import get_date
|
||||
from gramps.gen.display.place import displayer as place_displayer
|
||||
from gramps.gen.errors import WindowActiveError
|
||||
from gi.repository import Gtk
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
class Children(Gramplet):
|
||||
"""
|
||||
|
@ -18,14 +18,25 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gtk modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gi.repository import Gtk
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gui.editors import EditSource, EditCitation
|
||||
from gramps.gui.listmodel import ListModel, NOSORT
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gui.dbguielement import DbGUIElement
|
||||
from gramps.gen.errors import WindowActiveError
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gramps.gen.errors import WindowActiveError
|
||||
from gi.repository import Gtk
|
||||
|
||||
class Citations(Gramplet, DbGUIElement):
|
||||
|
||||
|
@ -20,21 +20,12 @@
|
||||
|
||||
"""Descendant Gramplet"""
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Python modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GTK modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gdk
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -49,9 +40,13 @@ from gramps.gen.display.name import displayer as name_displayer
|
||||
from gramps.gen.datehandler import get_date
|
||||
from gramps.gen.utils.db import get_birth_or_fallback, get_death_or_fallback
|
||||
from gramps.gui.utils import model_to_text, text_to_clipboard
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
class Descendant(Gramplet):
|
||||
|
||||
"""
|
||||
Gramplet to display descendants of the active person.
|
||||
"""
|
||||
def init(self):
|
||||
self.gui.WIDGET = self.build_gui()
|
||||
self.gui.get_container_widget().remove(self.gui.textview)
|
||||
@ -112,7 +107,8 @@ class Descendant(Gramplet):
|
||||
menu = Gtk.Menu()
|
||||
menu.set_title(_('Descendent Menu'))
|
||||
entries = [
|
||||
(_("Edit"), lambda obj: self.cb_double_click(treeview), sensitivity),
|
||||
(_("Edit"), lambda obj: self.cb_double_click(treeview),
|
||||
sensitivity),
|
||||
(None, None, 0),
|
||||
(_("Copy all"), lambda obj: self.on_copy_all(treeview), 1),
|
||||
]
|
||||
@ -127,6 +123,9 @@ class Descendant(Gramplet):
|
||||
self.menu.popup(None, None, None, None, event.button, event.time)
|
||||
|
||||
def on_copy_all(self, treeview):
|
||||
"""
|
||||
Copy tree to clipboard.
|
||||
"""
|
||||
model = treeview.get_model()
|
||||
text = model_to_text(model, [0, 1], level=1)
|
||||
text_to_clipboard(text)
|
||||
@ -155,6 +154,9 @@ class Descendant(Gramplet):
|
||||
self.set_has_data(False)
|
||||
|
||||
def add_to_tree(self, parent_id, person_handle):
|
||||
"""
|
||||
Add a person to the tree.
|
||||
"""
|
||||
person = self.dbstate.db.get_person_from_handle(person_handle)
|
||||
name = name_displayer.display(person)
|
||||
|
||||
|
@ -30,8 +30,6 @@ Provide a python evaluation window
|
||||
#------------------------------------------------------------------------
|
||||
import sys
|
||||
from io import StringIO
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
import traceback
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -47,6 +45,8 @@ from gi.repository import Gtk
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -102,7 +102,7 @@ class PythonEvaluation(Gramplet):
|
||||
|
||||
def apply_clicked(self, obj):
|
||||
text = str(self.ebuf.get_text(self.ebuf.get_start_iter(),
|
||||
self.ebuf.get_end_iter(),False))
|
||||
self.ebuf.get_end_iter(), False))
|
||||
|
||||
outtext = StringIO()
|
||||
errtext = StringIO()
|
||||
|
@ -17,23 +17,32 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gtk modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gi.repository import Gtk
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gui.editors import EditEvent
|
||||
from gramps.gen.lib import EventRoleType
|
||||
from gramps.gui.listmodel import ListModel, NOSORT
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gen.plug.report.utils import find_spouse
|
||||
from gramps.gui.dbguielement import DbGUIElement
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gramps.gen.display.name import displayer as name_displayer
|
||||
from gramps.gen.display.place import displayer as place_displayer
|
||||
from gramps.gen.datehandler import get_date
|
||||
from gramps.gen.utils.db import (get_participant_from_event,
|
||||
get_birth_or_fallback,
|
||||
get_marriage_or_fallback)
|
||||
from gramps.gen.errors import WindowActiveError
|
||||
from gi.repository import Gtk
|
||||
from gramps.gen.config import config
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
age_precision = config.get('preferences.age-display-precision')
|
||||
|
||||
|
@ -19,35 +19,18 @@
|
||||
|
||||
## Based on the normal fanchart
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gi
|
||||
gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Pango
|
||||
from gi.repository import Gtk
|
||||
import math
|
||||
from gi.repository import Gdk
|
||||
try:
|
||||
import cairo
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gui.widgets.fanchartdesc import (FanChartDescWidget,
|
||||
FanChartDescGrampsGUI,
|
||||
ANGLE_WEIGHT)
|
||||
from gramps.gui.widgets.fanchart import FORM_HALFCIRCLE, BACKGROUND_SCHEME1
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gen.errors import WindowActiveError
|
||||
from gramps.gui.editors import EditPerson
|
||||
from gramps.gui.widgets.fanchartdesc import (FanChartDescWidget, FanChartDescGrampsGUI,
|
||||
ANGLE_WEIGHT)
|
||||
from gramps.gui.widgets.fanchart import FORM_HALFCIRCLE, BACKGROUND_SCHEME1
|
||||
|
||||
class FanChartDescGramplet(FanChartDescGrampsGUI, Gramplet):
|
||||
"""
|
||||
@ -67,7 +50,8 @@ class FanChartDescGramplet(FanChartDescGrampsGUI, Gramplet):
|
||||
self.alpha_filter = 0.2
|
||||
self.form = FORM_HALFCIRCLE
|
||||
self.angle_algo = ANGLE_WEIGHT
|
||||
self.set_fan(FanChartDescWidget(self.dbstate, self.uistate, self.on_popup))
|
||||
self.set_fan(FanChartDescWidget(self.dbstate, self.uistate,
|
||||
self.on_popup))
|
||||
# Replace the standard textview with the fan chart widget:
|
||||
self.gui.get_container_widget().remove(self.gui.textview)
|
||||
self.gui.get_container_widget().add(self.fan)
|
||||
@ -75,7 +59,9 @@ class FanChartDescGramplet(FanChartDescGrampsGUI, Gramplet):
|
||||
self.fan.show()
|
||||
|
||||
def init(self):
|
||||
self.set_tooltip(_("Click to expand/contract person\nRight-click for options\nClick and drag in open area to rotate"))
|
||||
self.set_tooltip(_("Click to expand/contract person\n"
|
||||
"Right-click for options\n"
|
||||
"Click and drag in open area to rotate"))
|
||||
|
||||
def active_changed(self, handle):
|
||||
"""
|
||||
|
@ -25,34 +25,16 @@
|
||||
## Found by redwood:
|
||||
## http://www.gramps-project.org/bugs/view.php?id=2611
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gi
|
||||
gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Pango
|
||||
from gi.repository import Gtk
|
||||
import math
|
||||
from gi.repository import Gdk
|
||||
try:
|
||||
import cairo
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gui.widgets.fanchart import (FanChartWidget, FanChartGrampsGUI,
|
||||
FORM_HALFCIRCLE, BACKGROUND_SCHEME1)
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gen.errors import WindowActiveError
|
||||
from gramps.gui.editors import EditPerson
|
||||
from gramps.gui.widgets.fanchart import (FanChartWidget, FanChartGrampsGUI,
|
||||
FORM_HALFCIRCLE, BACKGROUND_SCHEME1)
|
||||
|
||||
class FanChartGramplet(FanChartGrampsGUI, Gramplet):
|
||||
"""
|
||||
@ -80,7 +62,8 @@ class FanChartGramplet(FanChartGrampsGUI, Gramplet):
|
||||
self.fan.show()
|
||||
|
||||
def init(self):
|
||||
self.set_tooltip(_("Click to expand/contract person\nRight-click for options\nClick and drag in open area to rotate"))
|
||||
self.set_tooltip(_("Click to expand/contract person\nRight-click for "
|
||||
"options\nClick and drag in open area to rotate"))
|
||||
|
||||
def active_changed(self, handle):
|
||||
"""
|
||||
|
@ -28,9 +28,9 @@
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gen.const import URL_MANUAL_PAGE
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
from gramps.gen.const import URL_MANUAL_PAGE
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -48,132 +48,132 @@ class FAQGramplet(Gramplet):
|
||||
calls gui/display.py's display_url method. So no URL_WIKISTRING
|
||||
is needed in this code.
|
||||
"""
|
||||
faq_dict = { 'bold_start' : '<b>' ,
|
||||
'bold_end' : '</b>' ,
|
||||
'gramps_wiki_html_start' : "<a wiki='" ,
|
||||
'gramps_manual_html_start' :
|
||||
"<a wiki='" + URL_MANUAL_PAGE + "_-_" ,
|
||||
'gramps_FAQ_html_start' :
|
||||
"<a wiki='" + URL_MANUAL_PAGE + "_-_FAQ" ,
|
||||
'html_middle' : "'>" ,
|
||||
'html_end' : '</a>' }
|
||||
faq_dict = {'bold_start': '<b>',
|
||||
'bold_end': '</b>',
|
||||
'gramps_wiki_html_start': "<a wiki='",
|
||||
'gramps_manual_html_start':
|
||||
"<a wiki='" + URL_MANUAL_PAGE + "_-_",
|
||||
'gramps_FAQ_html_start':
|
||||
"<a wiki='" + URL_MANUAL_PAGE + "_-_FAQ",
|
||||
'html_middle': "'>",
|
||||
'html_end': '</a>'}
|
||||
self.render_text(
|
||||
_("%(bold_start)s%(gramps_FAQ_html_start)s%(html_middle)s"
|
||||
"Frequently Asked Questions"
|
||||
"%(html_end)s%(bold_end)s"
|
||||
"\n(needs a connection to the internet)\n") % faq_dict )
|
||||
"\n(needs a connection to the internet)\n") % faq_dict)
|
||||
|
||||
self.render_text("\n<b>%s</b>\n\n" % _("Editing Spouses"))
|
||||
|
||||
faq_dict.update(
|
||||
{ 'faq_section' : "#How_do_I_change_the_order_of_spouses.3F'>" })
|
||||
{'faq_section': "#How_do_I_change_the_order_of_spouses.3F'>"})
|
||||
self.render_text(
|
||||
_(" 1. %(gramps_FAQ_html_start)s%(faq_section)s"
|
||||
"How do I change the order of spouses?"
|
||||
"%(html_end)s\n") % faq_dict )
|
||||
"%(html_end)s\n") % faq_dict)
|
||||
faq_dict.update(
|
||||
{ 'faq_section' : "#How_do_I_add_an_additional_spouse.3F'>" })
|
||||
{'faq_section': "#How_do_I_add_an_additional_spouse.3F'>"})
|
||||
self.render_text(
|
||||
_(" 2. %(gramps_FAQ_html_start)s%(faq_section)s"
|
||||
"How do I add an additional spouse?"
|
||||
"%(html_end)s\n") % faq_dict )
|
||||
"%(html_end)s\n") % faq_dict)
|
||||
faq_dict.update(
|
||||
{ 'faq_section' : "#How_do_I_remove_a_spouse.3F'>" })
|
||||
{'faq_section': "#How_do_I_remove_a_spouse.3F'>"})
|
||||
self.render_text(
|
||||
_(" 3. %(gramps_FAQ_html_start)s%(faq_section)s"
|
||||
"How do I remove a spouse?"
|
||||
"%(html_end)s\n") % faq_dict )
|
||||
"%(html_end)s\n") % faq_dict)
|
||||
|
||||
self.render_text("\n<b>%s</b>\n\n" % _("Backups and Updates"))
|
||||
|
||||
faq_dict.update(
|
||||
{ 'faq_section' : "#How_do_I_keep_backups.3F'>" })
|
||||
{'faq_section': "#How_do_I_keep_backups.3F'>"})
|
||||
self.render_text(
|
||||
_(" 4. %(gramps_FAQ_html_start)s%(faq_section)s"
|
||||
"How do I make backups safely?"
|
||||
"%(html_end)s\n") % faq_dict )
|
||||
"%(html_end)s\n") % faq_dict)
|
||||
faq_dict.update(
|
||||
{ 'faq_section' : "#How_do_I_upgrade_GRAMPS.3F'>" })
|
||||
{'faq_section': "#How_do_I_upgrade_GRAMPS.3F'>"})
|
||||
self.render_text(
|
||||
_(" 5. %(gramps_FAQ_html_start)s%(faq_section)s"
|
||||
"Is it necessary to update Gramps "
|
||||
"every time an update is released?"
|
||||
"%(html_end)s\n") % faq_dict )
|
||||
"every time an update is released?"
|
||||
"%(html_end)s\n") % faq_dict)
|
||||
|
||||
self.render_text("\n<b>%s</b>\n\n" % _("Data Entry"))
|
||||
|
||||
faq_dict.update( { 'section' :
|
||||
"Entering_and_Editing_Data:_Detailed_-_part_1"
|
||||
"#Editing_Information_About_Relationships'>" })
|
||||
faq_dict.update({'section':
|
||||
"Entering_and_Editing_Data:_Detailed_-_part_1"
|
||||
"#Editing_Information_About_Relationships'>"})
|
||||
self.render_text(
|
||||
_(" 6. %(gramps_manual_html_start)s%(section)s"
|
||||
"How should information about marriages be entered?"
|
||||
"%(html_end)s\n") % faq_dict )
|
||||
faq_dict.update( { 'faq_section' :
|
||||
"#What_is_the_difference_"
|
||||
"between_a_residence_and_an_address.3F'>" })
|
||||
"%(html_end)s\n") % faq_dict)
|
||||
faq_dict.update({'faq_section':
|
||||
"#What_is_the_difference_"
|
||||
"between_a_residence_and_an_address.3F'>"})
|
||||
self.render_text(
|
||||
_(" 7. %(gramps_FAQ_html_start)s%(faq_section)s"
|
||||
"What's the difference between a residence and an address?"
|
||||
"%(html_end)s\n") % faq_dict )
|
||||
"%(html_end)s\n") % faq_dict)
|
||||
|
||||
self.render_text("\n<b>%s</b>\n\n" % _("Media Files"))
|
||||
|
||||
faq_dict.update(
|
||||
{ 'faq_section' : "#How_do_you_add_photos_to_an_item.3F'>" })
|
||||
{'faq_section': "#How_do_you_add_photos_to_an_item.3F'>"})
|
||||
self.render_text(
|
||||
_(" 8. %(gramps_FAQ_html_start)s%(faq_section)s"
|
||||
"How do you add a photo of a person/source/event?"
|
||||
"%(html_end)s\n") % faq_dict )
|
||||
"%(html_end)s\n") % faq_dict)
|
||||
faq_dict.update(
|
||||
{ 'faq_section' : "#How_do_you_find_unused_media.3F'>" })
|
||||
{'faq_section': "#How_do_you_find_unused_media.3F'>"})
|
||||
self.render_text(
|
||||
_(" 9. %(gramps_FAQ_html_start)s%(faq_section)s"
|
||||
"How do you find unused media objects?"
|
||||
"%(html_end)s\n") % faq_dict )
|
||||
"%(html_end)s\n") % faq_dict)
|
||||
|
||||
self.render_text("\n<b>%s</b>\n\n" % _("Miscellaneous"))
|
||||
|
||||
faq_dict.update( { 'faq_section' :
|
||||
"#How_can_I_publish_web_sites_"
|
||||
"generated_by_GRAMPS.3F'>" })
|
||||
faq_dict.update({'faq_section':
|
||||
"#How_can_I_publish_web_sites_"
|
||||
"generated_by_GRAMPS.3F'>"})
|
||||
self.render_text(
|
||||
_(" 10. %(gramps_FAQ_html_start)s%(faq_section)s"
|
||||
"How can I make a website with Gramps and my tree?"
|
||||
"%(html_end)s\n") % faq_dict )
|
||||
faq_dict.update( { 'web_html_start' :
|
||||
"<a href='http://sourceforge.net/mailarchive"
|
||||
"/message.php?msg_id=21487967'>" })
|
||||
"%(html_end)s\n") % faq_dict)
|
||||
faq_dict.update({'web_html_start':
|
||||
"<a href='http://sourceforge.net/mailarchive"
|
||||
"/message.php?msg_id=21487967'>"})
|
||||
self.render_text(
|
||||
_(" 11. %(web_html_start)s"
|
||||
"How do I record one's occupation?"
|
||||
"%(html_end)s\n") % faq_dict )
|
||||
"%(html_end)s\n") % faq_dict)
|
||||
faq_dict.update(
|
||||
{ 'faq_section' : "#What_do_I_do_if_I_have_found_a_bug.3F'>" })
|
||||
{'faq_section': "#What_do_I_do_if_I_have_found_a_bug.3F'>"})
|
||||
self.render_text(
|
||||
_(" 12. %(gramps_FAQ_html_start)s%(faq_section)s"
|
||||
"What do I do if I have found a bug?"
|
||||
"%(html_end)s\n") % faq_dict )
|
||||
faq_dict.update( { 'section' : "Portal:Using_GRAMPS'>" })
|
||||
"%(html_end)s\n") % faq_dict)
|
||||
faq_dict.update({'section': "Portal:Using_GRAMPS'>"})
|
||||
self.render_text(
|
||||
_(" 13. %(gramps_wiki_html_start)s%(section)s"
|
||||
"Is there a manual for Gramps?"
|
||||
"%(html_end)s\n") % faq_dict )
|
||||
faq_dict.update( { 'section' : "Category:Tutorials'>" })
|
||||
"%(html_end)s\n") % faq_dict)
|
||||
faq_dict.update({'section': "Category:Tutorials'>"})
|
||||
self.render_text(
|
||||
_(" 14. %(gramps_wiki_html_start)s%(section)s"
|
||||
"Are there tutorials available?"
|
||||
"%(html_end)s\n") % faq_dict )
|
||||
faq_dict.update( { 'section' : "Category:How_do_I...'>" })
|
||||
"%(html_end)s\n") % faq_dict)
|
||||
faq_dict.update({'section': "Category:How_do_I...'>"})
|
||||
self.render_text(
|
||||
_(" 15. %(gramps_wiki_html_start)s%(section)s"
|
||||
"How do I ...?"
|
||||
"%(html_end)s\n") % faq_dict )
|
||||
faq_dict.update( { 'section' : "How_you_can_help'>" })
|
||||
"%(html_end)s\n") % faq_dict)
|
||||
faq_dict.update({'section': "How_you_can_help'>"})
|
||||
self.render_text(
|
||||
_(" 16. %(gramps_wiki_html_start)s%(section)s"
|
||||
"How can I help with Gramps?"
|
||||
"%(html_end)s\n") % faq_dict )
|
||||
"%(html_end)s\n") % faq_dict)
|
||||
self.append_text("", scroll_to='begin')
|
||||
|
||||
def post_init(self):
|
||||
|
@ -19,17 +19,20 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
"""
|
||||
Module providing a gramplet interface to the sidebar filters.
|
||||
"""
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gui.filters.sidebar import (PersonSidebarFilter, FamilySidebarFilter,
|
||||
EventSidebarFilter, SourceSidebarFilter,
|
||||
CitationSidebarFilter,
|
||||
PlaceSidebarFilter, MediaSidebarFilter,
|
||||
RepoSidebarFilter, NoteSidebarFilter)
|
||||
from gramps.gui.filters.sidebar import (
|
||||
PersonSidebarFilter, FamilySidebarFilter, EventSidebarFilter,
|
||||
SourceSidebarFilter, CitationSidebarFilter, PlaceSidebarFilter,
|
||||
MediaSidebarFilter, RepoSidebarFilter, NoteSidebarFilter)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -18,11 +18,22 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Gtk
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gi.repository import Gtk
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gui.widgets import Photo
|
||||
from gramps.gen.utils.thumbnails import get_thumbnail_image
|
||||
from gramps.gen.utils.file import media_path_full
|
||||
from gi.repository import Gtk
|
||||
|
||||
class Gallery(Gramplet):
|
||||
"""
|
||||
@ -67,9 +78,8 @@ class Gallery(Gramplet):
|
||||
else:
|
||||
photo = Photo(self.uistate.screen_height() < 1000)
|
||||
photo.set_pixbuf(full_path,
|
||||
get_thumbnail_image(full_path,
|
||||
mime_type,
|
||||
media_ref.get_rectangle()))
|
||||
get_thumbnail_image(full_path, mime_type,
|
||||
media_ref.get_rectangle()))
|
||||
self.image_list.append(photo)
|
||||
self.top.pack_start(photo, False, False, 0)
|
||||
count += 1
|
||||
|
@ -18,12 +18,23 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
#
|
||||
from collections import defaultdict
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from collections import defaultdict
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gen.config import config
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
_YIELD_INTERVAL = 350
|
||||
|
||||
@ -66,12 +77,12 @@ class GivenNameCloudGramplet(Gramplet):
|
||||
allnames = [person.get_primary_name()] + person.get_alternate_names()
|
||||
allnames = set(name.get_first_name().strip() for name in allnames)
|
||||
for givenname in allnames:
|
||||
anyNBSP = givenname.split('\u00A0')
|
||||
if len(anyNBSP) > 1: # there was an NBSP, a non-breaking space
|
||||
first_two = anyNBSP[0] + '\u00A0' + anyNBSP[1].split()[0]
|
||||
nbsp = givenname.split('\u00A0')
|
||||
if len(nbsp) > 1: # there was an NBSP, a non-breaking space
|
||||
first_two = nbsp[0] + '\u00A0' + nbsp[1].split()[0]
|
||||
givensubnames[first_two] += 1
|
||||
representative_handle[first_two] = person.handle
|
||||
givenname = ' '.join(anyNBSP[1].split()[1:])
|
||||
givenname = ' '.join(nbsp[1].split()[1:])
|
||||
for givensubname in givenname.split():
|
||||
givensubnames[givensubname] += 1
|
||||
representative_handle[givensubname] = person.handle
|
||||
@ -84,7 +95,8 @@ class GivenNameCloudGramplet(Gramplet):
|
||||
|
||||
total = cnt = 0
|
||||
for givensubname in givensubnames:
|
||||
givensubname_sort.append( (givensubnames[givensubname], givensubname) )
|
||||
givensubname_sort.append((givensubnames[givensubname],
|
||||
givensubname))
|
||||
total += givensubnames[givensubname]
|
||||
cnt += 1
|
||||
if not cnt % _YIELD_INTERVAL:
|
||||
@ -96,8 +108,8 @@ class GivenNameCloudGramplet(Gramplet):
|
||||
cloud_values = []
|
||||
|
||||
for count, givensubname in givensubname_sort:
|
||||
cloud_names.append( (count, givensubname) )
|
||||
cloud_values.append( count )
|
||||
cloud_names.append((count, givensubname))
|
||||
cloud_values.append(count)
|
||||
|
||||
cloud_names.sort(key=lambda k: k[1])
|
||||
counts = sorted(set(cloud_values), reverse=True)
|
||||
|
@ -24,14 +24,6 @@
|
||||
Show uncollected objects in a window.
|
||||
"""
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# standard python modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GNOME/GTK modules
|
||||
@ -49,6 +41,8 @@ import gc
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gui.dialog import InfoDialog
|
||||
from gramps.gui.utils import is_right_click
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -108,7 +102,7 @@ class Leak(Gramplet):
|
||||
apply_button = Gtk.Button(label=_("Refresh"))
|
||||
apply_button.connect('clicked', self.apply_clicked)
|
||||
bbox.pack_start(apply_button, False, False, 6)
|
||||
self.top.pack_start(bbox, False, False, 6)
|
||||
self.top.pack_start(bbox, False, False, 6)
|
||||
|
||||
self.top.show_all()
|
||||
|
||||
@ -137,7 +131,7 @@ class Leak(Gramplet):
|
||||
except ReferenceError:
|
||||
pass
|
||||
InfoDialog(_('Referrers of %d') % count, text,
|
||||
parent=self.uistate.window)
|
||||
parent=self.uistate.window)
|
||||
|
||||
def refers_to(self):
|
||||
model, iter = self.selection.get_selected()
|
||||
@ -151,7 +145,7 @@ class Leak(Gramplet):
|
||||
except ReferenceError:
|
||||
pass
|
||||
InfoDialog(_('%d refers to') % count, text,
|
||||
parent=self.uistate.window)
|
||||
parent=self.uistate.window)
|
||||
|
||||
def display(self):
|
||||
try:
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Python modules
|
||||
# Gtk modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gi.repository import Gtk
|
||||
@ -162,7 +162,9 @@ class Locations(Gramplet, DbGUIElement):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class EnclosedBy(Locations):
|
||||
|
||||
"""
|
||||
Gramplet showing the locations enclosed by the active place.
|
||||
"""
|
||||
def display_place(self, place, node, visited):
|
||||
"""
|
||||
Display the location hierarchy for the active place.
|
||||
@ -194,7 +196,9 @@ class EnclosedBy(Locations):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Encloses(Locations):
|
||||
|
||||
"""
|
||||
Gramplet showing the locations which the active place encloses.
|
||||
"""
|
||||
def display_place(self, place, node, visited):
|
||||
"""
|
||||
Display the location hierarchy for the active place.
|
||||
|
@ -17,10 +17,21 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gtk modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gi.repository import Gtk
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gui.widgets import Photo
|
||||
from gramps.gen.utils.file import media_path_full
|
||||
from gi.repository import Gtk
|
||||
|
||||
class MediaPreview(Gramplet):
|
||||
"""
|
||||
@ -72,7 +83,6 @@ class MediaPreview(Gramplet):
|
||||
"""
|
||||
Load the primary image if it exists.
|
||||
"""
|
||||
self.full_path = media_path_full(self.dbstate.db,
|
||||
media.get_path())
|
||||
self.full_path = media_path_full(self.dbstate.db, media.get_path())
|
||||
mime_type = media.get_mime_type()
|
||||
self.photo.set_image(self.full_path, mime_type)
|
||||
|
@ -18,13 +18,24 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Gtk
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gi.repository import Gtk
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gui.widgets.styledtexteditor import StyledTextEditor
|
||||
from gramps.gui.widgets import SimpleButton
|
||||
from gramps.gen.lib import StyledText
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gi.repository import Gtk
|
||||
|
||||
class Notes(Gramplet):
|
||||
"""
|
||||
@ -53,7 +64,8 @@ class Notes(Gramplet):
|
||||
hbox.pack_end(self.page, False, False, 10)
|
||||
|
||||
scrolledwindow = Gtk.ScrolledWindow()
|
||||
scrolledwindow.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
|
||||
scrolledwindow.set_policy(Gtk.PolicyType.AUTOMATIC,
|
||||
Gtk.PolicyType.AUTOMATIC)
|
||||
self.texteditor = StyledTextEditor()
|
||||
self.texteditor.set_editable(False)
|
||||
self.texteditor.set_wrap_mode(Gtk.WrapMode.WORD)
|
||||
@ -96,8 +108,9 @@ class Notes(Gramplet):
|
||||
note_handle = self.note_list[self.current]
|
||||
note = self.dbstate.db.get_note_from_handle(note_handle)
|
||||
self.texteditor.set_text(note.get_styledtext())
|
||||
self.page.set_text(_('%(current)d of %(total)d') % {'current': self.current + 1,
|
||||
'total': len(self.note_list)})
|
||||
self.page.set_text(_('%(current)d of %(total)d') %
|
||||
{'current': self.current + 1,
|
||||
'total': len(self.note_list)})
|
||||
|
||||
def left_clicked(self, button):
|
||||
"""
|
||||
|
@ -29,14 +29,16 @@ from html import escape
|
||||
# Gramps modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
ngettext = glocale.translation.ngettext # else "nearby" comments are ignored
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gen.display.name import displayer as name_displayer
|
||||
from gramps.gen.datehandler import get_date
|
||||
from gramps.gen.lib import EventType
|
||||
from gramps.gen.utils.db import get_birth_or_fallback, get_death_or_fallback
|
||||
from gramps.gen.plug.menu import (NumberOption, BooleanOption,
|
||||
EnumeratedListOption)
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
ngettext = glocale.translation.ngettext # else "nearby" comments are ignored
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -53,7 +55,6 @@ class PedigreeGramplet(Gramplet):
|
||||
self.box_mode = "UTF"
|
||||
|
||||
def build_options(self):
|
||||
from gramps.gen.plug.menu import NumberOption, BooleanOption, EnumeratedListOption
|
||||
self.add_option(NumberOption(_("Max generations"),
|
||||
self.max_generations, 1, 100))
|
||||
self.add_option(BooleanOption(_("Show dates"), bool(self.show_dates)))
|
||||
@ -117,9 +118,9 @@ class PedigreeGramplet(Gramplet):
|
||||
if self.box_mode == "UTF":
|
||||
retval += "-"
|
||||
retval = retval.replace("\\", "\u2514")
|
||||
retval = retval.replace("-", "\u2500")
|
||||
retval = retval.replace("|", "\u2502")
|
||||
retval = retval.replace("/", "\u250c")
|
||||
retval = retval.replace("-", "\u2500")
|
||||
retval = retval.replace("|", "\u2502")
|
||||
retval = retval.replace("/", "\u250c")
|
||||
elif self.box_mode == "ASCII":
|
||||
retval += "--"
|
||||
return retval
|
||||
@ -259,7 +260,7 @@ class PedigreeGramplet(Gramplet):
|
||||
if g == 0:
|
||||
self.link(_("Generation 1"), 'PersonList', handles,
|
||||
tooltip=_("Double-click to see people in generation"))
|
||||
percent = glocale.format( '%.2f', 100) + percent_sign
|
||||
percent = glocale.format('%.2f', 100) + percent_sign
|
||||
self.append_text(_(" has 1 of 1 individual (%(percent)s complete)\n") % {'percent': percent})
|
||||
else:
|
||||
all.extend(handles)
|
||||
@ -269,19 +270,19 @@ class PedigreeGramplet(Gramplet):
|
||||
self.append_text(
|
||||
# translators: leave all/any {...} untranslated
|
||||
ngettext(" has {count_person} of {max_count_person} "
|
||||
"individuals ({percent} complete)\n",
|
||||
"individuals ({percent} complete)\n",
|
||||
" has {count_person} of {max_count_person} "
|
||||
"individuals ({percent} complete)\n", 2**(g-1)
|
||||
"individuals ({percent} complete)\n", 2**(g-1)
|
||||
).format(count_person=count,
|
||||
max_count_person=2**(g-1),
|
||||
percent=percent) )
|
||||
percent=percent))
|
||||
self.link(_("All generations"), 'PersonList', all,
|
||||
tooltip=_("Double-click to see all generations"))
|
||||
self.append_text(
|
||||
# translators: leave all/any {...} untranslated
|
||||
ngettext(" have {number_of} individual\n",
|
||||
" have {number_of} individuals\n", len(all)
|
||||
).format(number_of=len(all)) )
|
||||
).format(number_of=len(all)))
|
||||
# Set to a fixed font
|
||||
if self.box_mode == "UTF":
|
||||
start, end = self.gui.buffer.get_bounds()
|
||||
|
@ -18,17 +18,28 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gtk modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Pango
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.lib import EventType, EventRoleType
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gui.widgets import Photo
|
||||
from gramps.gen.display.name import displayer as name_displayer
|
||||
from gramps.gen.display.place import displayer as place_displayer
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gramps.gen.datehandler import get_date
|
||||
from gramps.gen.utils.file import media_path_full
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Pango
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
class PersonDetails(Gramplet):
|
||||
"""
|
||||
@ -175,7 +186,7 @@ class PersonDetails(Gramplet):
|
||||
nlist = active_person.get_alternate_names()
|
||||
if len(nlist) > 0:
|
||||
for altname in nlist:
|
||||
name_type = str( altname.get_type() )
|
||||
name_type = str(altname.get_type())
|
||||
text = name_displayer.display_name(altname)
|
||||
self.add_row(name_type, text)
|
||||
self.display_separator()
|
||||
@ -249,7 +260,7 @@ class PersonDetails(Gramplet):
|
||||
retval = _('%(date)s - %(place)s.') % {'date' : date,
|
||||
'place' : place}
|
||||
else:
|
||||
retval = _('%(date)s.') % dict(date = date)
|
||||
retval = _('%(date)s.') % dict(date=date)
|
||||
return retval
|
||||
|
||||
def load_person_image(self, person):
|
||||
|
@ -17,16 +17,27 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gtk modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gi.repository import Gtk
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.lib import EventType, EventRoleType
|
||||
from gramps.gui.editors import EditEvent
|
||||
from gramps.gui.listmodel import ListModel, NOSORT
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gramps.gen.datehandler import get_date
|
||||
from gramps.gen.display.place import displayer as place_displayer
|
||||
from gramps.gen.errors import WindowActiveError
|
||||
from gi.repository import Gtk
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
class PersonResidence(Gramplet):
|
||||
"""
|
||||
|
@ -17,15 +17,26 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gtk modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Pango
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gui.widgets import Photo
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gramps.gen.utils.place import conv_lat_lon
|
||||
from gramps.gen.utils.file import media_path_full
|
||||
from gramps.gen.display.place import displayer as place_displayer
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Pango
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
class PlaceDetails(Gramplet):
|
||||
"""
|
||||
|
@ -30,14 +30,15 @@
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gui.plug.quick import (run_quick_report_by_name,
|
||||
get_quick_report_list)
|
||||
from gramps.gen.plug import (
|
||||
CATEGORY_QR_PERSON, CATEGORY_QR_FAMILY, CATEGORY_QR_EVENT,
|
||||
CATEGORY_QR_SOURCE, CATEGORY_QR_NOTE, CATEGORY_QR_PLACE,
|
||||
CATEGORY_QR_MEDIA, CATEGORY_QR_REPOSITORY, CATEGORY_QR_CITATION,
|
||||
CATEGORY_QR_SOURCE_OR_CITATION)
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
from gramps.gui.plug.quick import run_quick_report_by_name, get_quick_report_list
|
||||
from gramps.gen.plug import (CATEGORY_QR_PERSON, CATEGORY_QR_FAMILY,
|
||||
CATEGORY_QR_EVENT, CATEGORY_QR_SOURCE, CATEGORY_QR_NOTE,
|
||||
CATEGORY_QR_MISC, CATEGORY_QR_PLACE, CATEGORY_QR_MEDIA,
|
||||
CATEGORY_QR_REPOSITORY, CATEGORY_QR_CITATION,
|
||||
CATEGORY_QR_SOURCE_OR_CITATION)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -112,7 +113,7 @@ class QuickViewGramplet(Gramplet):
|
||||
("Repository", _("Repository")),
|
||||
("Source", _("Source")),
|
||||
("Citation", _("Citation")),
|
||||
]:
|
||||
]:
|
||||
type_list.add_item(item[0], item[1])
|
||||
# Add particular lists:
|
||||
qv_list = get_quick_report_list(CATEGORY_QR_PERSON)
|
||||
|
@ -20,14 +20,6 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Standard Python modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
@ -35,10 +27,12 @@ _ = glocale.translation.sgettext
|
||||
#------------------------------------------------------------------------
|
||||
from gramps.plugins.lib.librecords import find_records, CALLNAME_DONTUSE
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# The Gramplet
|
||||
# RecordsGramplet
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class RecordsGramplet(Gramplet):
|
||||
|
@ -22,9 +22,9 @@
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gen.display.name import displayer as name_displayer
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
from gramps.gen.display.name import displayer as name_displayer
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -17,12 +17,23 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gtk
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Pango
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.lib import UrlType
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Pango
|
||||
|
||||
class RepositoryDetails(Gramplet):
|
||||
"""
|
||||
|
@ -32,10 +32,10 @@ import time
|
||||
from gramps.gen.lib import Person, Family
|
||||
from gramps.gen.db import PERSON_KEY, FAMILY_KEY, TXNDEL
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
from gramps.gen.display.name import displayer as name_displayer
|
||||
from gramps.gen.utils.db import family_name
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -80,7 +80,7 @@ class LogGramplet(Gramplet):
|
||||
continue
|
||||
self.last_log = (ltype, action, handle)
|
||||
self.timestamp()
|
||||
self.append_text("%s: " % _(action) )
|
||||
self.append_text("%s: " % _(action))
|
||||
if action == 'Deleted':
|
||||
transaction = self.dbstate.db.transaction
|
||||
if ltype == 'Person':
|
||||
@ -105,7 +105,7 @@ class LogGramplet(Gramplet):
|
||||
and hndl == handle):
|
||||
family = Family()
|
||||
family.unserialize(old_data)
|
||||
name = family_name(family, self.dbstate.db,name)
|
||||
name = family_name(family, self.dbstate.db, name)
|
||||
break
|
||||
self.append_text(name)
|
||||
else:
|
||||
|
@ -29,11 +29,11 @@ import posixpath
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
from gramps.gen.utils.file import media_path_full
|
||||
from gramps.gen.datehandler import get_date
|
||||
from gramps.gen.lib import Person
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -90,9 +90,9 @@ class StatsGramplet(Gramplet):
|
||||
except OSError:
|
||||
notfound.append(media.get_path())
|
||||
|
||||
males = sum([v[0] for v in database.genderStats.stats.values()]) # male, female, unknown
|
||||
females = sum([v[1] for v in database.genderStats.stats.values()]) # male, female, unknown
|
||||
unknown = sum([v[2] for v in database.genderStats.stats.values()]) # male, female, unknown
|
||||
males = sum([v[0] for v in database.genderStats.stats.values()])
|
||||
females = sum([v[1] for v in database.genderStats.stats.values()])
|
||||
unknown = sum([v[2] for v in database.genderStats.stats.values()])
|
||||
|
||||
self.clear_text()
|
||||
self.append_text(_("Individuals") + "\n")
|
||||
|
@ -16,6 +16,11 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Python modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from collections import defaultdict
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -24,9 +29,9 @@ from collections import defaultdict
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gen.config import config
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
from gramps.gen.config import config
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -91,7 +96,7 @@ class SurnameCloudGramplet(Gramplet):
|
||||
representative_handle = {}
|
||||
|
||||
cnt = 0
|
||||
namelist =[]
|
||||
namelist = []
|
||||
for person in self.dbstate.db.iter_people():
|
||||
allnames = [person.get_primary_name()] + person.get_alternate_names()
|
||||
allnames = set([name.get_group_name().strip() for name in allnames])
|
||||
@ -111,7 +116,7 @@ class SurnameCloudGramplet(Gramplet):
|
||||
surname_sort = []
|
||||
total = cnt = 0
|
||||
for surname in surnames:
|
||||
surname_sort.append( (surnames[surname], surname) )
|
||||
surname_sort.append((surnames[surname], surname))
|
||||
total += surnames[surname]
|
||||
cnt += 1
|
||||
if not cnt % _YIELD_INTERVAL:
|
||||
@ -121,10 +126,10 @@ class SurnameCloudGramplet(Gramplet):
|
||||
cloud_names = []
|
||||
cloud_values = []
|
||||
for (count, surname) in surname_sort:
|
||||
cloud_names.append( (count, surname) )
|
||||
cloud_values.append( count )
|
||||
cloud_names.append((count, surname))
|
||||
cloud_values.append(count)
|
||||
|
||||
cloud_names.sort(key=lambda k:k[1])
|
||||
cloud_names.sort(key=lambda k: k[1])
|
||||
line = 0
|
||||
### All done!
|
||||
# Now, find out how many we can display without going over top_size:
|
||||
|
@ -17,6 +17,18 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gtk modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gi.repository import Gtk
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gui.widgets.styledtexteditor import StyledTextEditor
|
||||
from gramps.gui.widgets import SimpleButton
|
||||
@ -24,7 +36,6 @@ from gramps.gen.lib import StyledText, Note, NoteType
|
||||
from gramps.gen.db import DbTxn
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gi.repository import Gtk
|
||||
|
||||
class ToDo(Gramplet):
|
||||
"""
|
||||
@ -122,8 +133,8 @@ class ToDo(Gramplet):
|
||||
note = self.dbstate.db.get_note_from_handle(note_handle)
|
||||
self.texteditor.set_text(note.get_styledtext())
|
||||
self.page.set_text(_('%(current)d of %(total)d') %
|
||||
{'current': self.current + 1,
|
||||
'total': len(self.note_list)})
|
||||
{'current': self.current + 1,
|
||||
'total': len(self.note_list)})
|
||||
|
||||
def left_clicked(self, button):
|
||||
"""
|
||||
|
@ -18,14 +18,24 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gtk modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gi.repository import Gtk
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gui.widgets.styledtexteditor import StyledTextEditor
|
||||
from gramps.gui.widgets import SimpleButton
|
||||
from gramps.gen.lib import StyledText, Note, NoteType
|
||||
from gramps.gen.filters import GenericFilterFactory, rules
|
||||
from gramps.gen.utils.db import navigation_label
|
||||
from gramps.gen.db import DbTxn
|
||||
from gi.repository import Gtk
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
@ -139,8 +149,8 @@ class ToDoGramplet(Gramplet):
|
||||
self.title.set_text(_("Unattached"))
|
||||
self.texteditor.set_text(note.get_styledtext())
|
||||
self.page.set_text(_('%(current)d of %(total)d') %
|
||||
{'current': self.current + 1,
|
||||
'total': len(self.note_list)})
|
||||
{'current': self.current + 1,
|
||||
'total': len(self.note_list)})
|
||||
|
||||
def left_clicked(self, button):
|
||||
"""
|
||||
|
@ -21,7 +21,6 @@
|
||||
# Python modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
from collections import defaultdict
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -30,16 +29,15 @@ from collections import defaultdict
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gen.config import config
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
from gramps.gen.config import config
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Constants
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
_YIELD_INTERVAL = 350
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -89,7 +87,7 @@ class TopSurnamesGramplet(Gramplet):
|
||||
|
||||
cnt = 0
|
||||
for surname in surnames:
|
||||
surname_sort.append( (surnames[surname], surname) )
|
||||
surname_sort.append((surnames[surname], surname))
|
||||
total += surnames[surname]
|
||||
cnt += 1
|
||||
if not cnt % _YIELD_INTERVAL:
|
||||
|
@ -18,10 +18,9 @@
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# modules
|
||||
# Gtk modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
from gi.repository import Gtk
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -32,17 +31,15 @@ from gi.repository import Gtk
|
||||
from gramps.gen.const import URL_WIKISTRING, URL_MANUAL_PAGE, URL_HOMEPAGE
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gui.widgets.styledtexteditor import StyledTextEditor
|
||||
from gramps.gui.widgets import SimpleButton
|
||||
from gramps.gen.lib import StyledText, StyledTextTag, StyledTextTagType
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# functions
|
||||
# Functions
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
def st(text):
|
||||
""" Return text as styled text
|
||||
"""
|
||||
@ -51,15 +48,13 @@ def st(text):
|
||||
def boldst(text):
|
||||
""" Return text as bold styled text
|
||||
"""
|
||||
tags = [StyledTextTag(StyledTextTagType.BOLD, True,
|
||||
[(0, len(text))])]
|
||||
tags = [StyledTextTag(StyledTextTagType.BOLD, True, [(0, len(text))])]
|
||||
return StyledText(text, tags)
|
||||
|
||||
def linkst(text, url):
|
||||
""" Return text as link styled text
|
||||
"""
|
||||
tags = [StyledTextTag(StyledTextTagType.LINK, url,
|
||||
[(0, len(text))])]
|
||||
tags = [StyledTextTag(StyledTextTagType.LINK, url, [(0, len(text))])]
|
||||
return StyledText(text, tags)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -85,60 +80,63 @@ class WelcomeGramplet(Gramplet):
|
||||
top = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||
|
||||
scrolledwindow = Gtk.ScrolledWindow()
|
||||
scrolledwindow.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
|
||||
scrolledwindow.set_policy(Gtk.PolicyType.AUTOMATIC,
|
||||
Gtk.PolicyType.AUTOMATIC)
|
||||
self.texteditor = StyledTextEditor()
|
||||
self.texteditor.set_editable(False)
|
||||
self.texteditor.set_wrap_mode(Gtk.WrapMode.WORD)
|
||||
scrolledwindow.add(self.texteditor)
|
||||
|
||||
self.set_text()
|
||||
self.display_text()
|
||||
|
||||
top.pack_start(scrolledwindow, True, True, 0)
|
||||
top.show_all()
|
||||
return top
|
||||
|
||||
def set_text(self):
|
||||
def display_text(self):
|
||||
"""
|
||||
Display the welcome text.
|
||||
"""
|
||||
welcome = boldst(_('Intro')) + '\n\n'
|
||||
welcome += _(
|
||||
'Gramps is a software package designed for genealogical research.'
|
||||
' Although similar to other genealogical programs, Gramps offers '
|
||||
'some unique and powerful features.\n\n')
|
||||
'Gramps is a software package designed for genealogical research.'
|
||||
' Although similar to other genealogical programs, Gramps offers '
|
||||
'some unique and powerful features.\n\n')
|
||||
welcome += boldst(_('Links')) + '\n\n'
|
||||
welcome += linkst(_('Home Page'), URL_HOMEPAGE) + '\n'
|
||||
welcome += linkst(_('Start with Genealogy and Gramps'),
|
||||
'%(gramps_wiki_url)sStart_with_Genealogy' %
|
||||
{'gramps_wiki_url': URL_WIKISTRING} ) + '\n'
|
||||
{'gramps_wiki_url': URL_WIKISTRING}) + '\n'
|
||||
welcome += linkst(_('Gramps online manual'),
|
||||
URL_WIKISTRING + URL_MANUAL_PAGE + _('locale_suffix|')) + '\n'
|
||||
URL_WIKISTRING + URL_MANUAL_PAGE +
|
||||
_('locale_suffix|')) + '\n'
|
||||
welcome += linkst(_('Ask questions on gramps-users mailing list'),
|
||||
'%(gramps_home_url)scontact/' %
|
||||
{'gramps_home_url': URL_HOMEPAGE} ) + '\n\n'
|
||||
{'gramps_home_url': URL_HOMEPAGE}) + '\n\n'
|
||||
|
||||
welcome += boldst(_('Who makes Gramps?')) + '\n\n' + _(
|
||||
'Gramps is created by genealogists for genealogists, organized in the'
|
||||
' Gramps Project.'
|
||||
' Gramps is an Open Source Software package, which means you are '
|
||||
'free to make copies and distribute it to anyone you like. It\'s '
|
||||
'developed and maintained by a worldwide team of volunteers whose'
|
||||
' goal is to make Gramps powerful, yet easy to use.\n\n')
|
||||
'Gramps is created by genealogists for genealogists, organized in'
|
||||
' the Gramps Project.'
|
||||
' Gramps is an Open Source Software package, which means you are '
|
||||
'free to make copies and distribute it to anyone you like. It\'s '
|
||||
'developed and maintained by a worldwide team of volunteers whose'
|
||||
' goal is to make Gramps powerful, yet easy to use.\n\n')
|
||||
welcome += boldst(_('Getting Started')) + '\n\n' + _(
|
||||
'The first thing you must do is to create a new Family Tree. To '
|
||||
'create a new Family Tree (sometimes called \'database\') select '
|
||||
'"Family Trees" from the menu, pick "Manage Family Trees", press '
|
||||
'"New" and name your Family Tree. For more details, please read the '
|
||||
'information at the links above\n\n')
|
||||
'The first thing you must do is to create a new Family Tree. To '
|
||||
'create a new Family Tree (sometimes called \'database\') select '
|
||||
'"Family Trees" from the menu, pick "Manage Family Trees", press '
|
||||
'"New" and name your Family Tree. For more details, please read '
|
||||
'the information at the links above\n\n')
|
||||
welcome += boldst(_('Dashboard View')) + '\n\n' + _(
|
||||
'You are currently reading from the "Dashboard" view, where you can'
|
||||
' add your own gramplets. You can also add gramplets to any view by'
|
||||
' adding a sidebar and/or bottombar, and right-clicking to the right'
|
||||
' of the tab.\n\n'
|
||||
'You can click the configuration icon in the toolbar to add additional'
|
||||
' columns, while right-click on the background allows to add gramplets.'
|
||||
' You can also drag the Properties button to reposition the gramplet '
|
||||
' on this page, and detach the gramplet to float above Gramps.'
|
||||
'You are currently reading from the "Dashboard" view, where you can'
|
||||
' add your own gramplets. You can also add gramplets to any view by'
|
||||
' adding a sidebar and/or bottombar, and right-clicking to the'
|
||||
' right of the tab.\n\n'
|
||||
'You can click the configuration icon in the toolbar to add'
|
||||
' additional columns, while right-click on the background allows to'
|
||||
' add gramplets. You can also drag the Properties button to'
|
||||
' reposition the gramplet on this page, and detach the gramplet to'
|
||||
' float above Gramps.'
|
||||
)
|
||||
|
||||
self.texteditor.set_text(welcome)
|
||||
|
@ -227,7 +227,7 @@ class WhatNextGramplet(Gramplet):
|
||||
spouses = []
|
||||
spouses_queue = []
|
||||
|
||||
while (ancestors or families):
|
||||
while ancestors or families:
|
||||
# (Other) families of parents
|
||||
for ancestor_group in ancestors_queue.pop(0):
|
||||
new_family_group = []
|
||||
@ -416,9 +416,7 @@ class WhatNextGramplet(Gramplet):
|
||||
if not name2:
|
||||
name2 = _("(person with unknown name)")
|
||||
|
||||
name = _("%(name1)s and %(name2)s") % {
|
||||
'name1': name1,
|
||||
'name2': name2}
|
||||
name = _("%(name1)s and %(name2)s") % {'name1': name1, 'name2': name2}
|
||||
|
||||
has_marriage = False
|
||||
|
||||
@ -463,9 +461,7 @@ class WhatNextGramplet(Gramplet):
|
||||
if not name2:
|
||||
name2 = _("(person with unknown name)")
|
||||
|
||||
name = _("%(name1)s and %(name2)s") % {
|
||||
'name1': name1,
|
||||
'name2': name2}
|
||||
name = _("%(name1)s and %(name2)s") % {'name1': name1, 'name2': name2}
|
||||
|
||||
if self.__family_complete_handle is not None and \
|
||||
self.__family_complete_handle not in family.get_tag_list():
|
||||
@ -494,8 +490,8 @@ class WhatNextGramplet(Gramplet):
|
||||
|
||||
if missingbits:
|
||||
return [_("%(type)s: %(list)s") % {
|
||||
'type': event.get_type(),
|
||||
'list': _(", ").join(missingbits)}]
|
||||
'type': event.get_type(),
|
||||
'list': _(", ").join(missingbits)}]
|
||||
else:
|
||||
return []
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user