Fix deprecation on Gtk.Widget.override_font and modify_font
This commit is contained in:
@@ -2162,11 +2162,9 @@ class GrampsPreferences(ConfigureDialog):
|
|||||||
scrollw.set_size_request(600, 100)
|
scrollw.set_size_request(600, 100)
|
||||||
text = Gtk.Label()
|
text = Gtk.Label()
|
||||||
text.set_line_wrap(True)
|
text.set_line_wrap(True)
|
||||||
font_description = Pango.font_description_from_string(font)
|
|
||||||
text.modify_font(font_description)
|
|
||||||
self.activate_change_font()
|
self.activate_change_font()
|
||||||
text.set_halign(Gtk.Align.START)
|
text.set_halign(Gtk.Align.START)
|
||||||
text.set_text(my_characters)
|
text.set_markup("<span font='%s'>%s</span>" % (font, my_characters))
|
||||||
scrollw.add(text)
|
scrollw.add(text)
|
||||||
scrollw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
|
scrollw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
|
||||||
self.grid.attach(scrollw, 1, 7, 8, 1)
|
self.grid.attach(scrollw, 1, 7, 8, 1)
|
||||||
@@ -2179,12 +2177,9 @@ class GrampsPreferences(ConfigureDialog):
|
|||||||
my_characters += symbols.get_death_symbol_for_char(death_symbl)
|
my_characters += symbols.get_death_symbol_for_char(death_symbl)
|
||||||
text = Gtk.Label()
|
text = Gtk.Label()
|
||||||
text.set_line_wrap(True)
|
text.set_line_wrap(True)
|
||||||
font_description = Pango.font_description_from_string(font)
|
|
||||||
text.modify_font(font_description)
|
|
||||||
text.set_halign(Gtk.Align.START)
|
text.set_halign(Gtk.Align.START)
|
||||||
text.set_markup("<big><big><big><big>" +
|
text.set_markup("<big><big><big><big><span font='%s'>%s</span>"
|
||||||
my_characters +
|
"</big></big></big></big>" % (font, my_characters))
|
||||||
"</big></big></big></big>")
|
|
||||||
self.grid.attach(text, 1, 8, 8, 1)
|
self.grid.attach(text, 1, 8, 8, 1)
|
||||||
scrollw.show_all()
|
scrollw.show_all()
|
||||||
text.show_all()
|
text.show_all()
|
||||||
|
@@ -42,6 +42,7 @@ import pickle
|
|||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
from gi.repository import Gdk
|
from gi.repository import Gdk
|
||||||
from gi.repository import Pango
|
from gi.repository import Pango
|
||||||
|
from gi.repository.GLib import markup_escape_text
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -435,7 +436,6 @@ class EditPerson(EditPrimary):
|
|||||||
obj.connect('changed', self._changed_name)
|
obj.connect('changed', self._changed_name)
|
||||||
|
|
||||||
self.preview_name = self.top.get_object("full_name")
|
self.preview_name = self.top.get_object("full_name")
|
||||||
self.preview_name.override_font(Pango.FontDescription('sans bold 12'))
|
|
||||||
self.surntab = SurnameTab(self.dbstate, self.uistate, self.track,
|
self.surntab = SurnameTab(self.dbstate, self.uistate, self.track,
|
||||||
self.obj.get_primary_name(),
|
self.obj.get_primary_name(),
|
||||||
on_change=self._changed_name)
|
on_change=self._changed_name)
|
||||||
@@ -550,7 +550,9 @@ class EditPerson(EditPrimary):
|
|||||||
Update the window title, and default name in name tab
|
Update the window title, and default name in name tab
|
||||||
"""
|
"""
|
||||||
self.update_title(self.get_menu_title())
|
self.update_title(self.get_menu_title())
|
||||||
self.preview_name.set_text(self.get_preview_name())
|
self.preview_name.set_markup(
|
||||||
|
"<span size='x-large' weight='bold'>%s</span>" %
|
||||||
|
markup_escape_text(self.get_preview_name(), -1))
|
||||||
self.name_list.update_defname()
|
self.name_list.update_defname()
|
||||||
|
|
||||||
def name_callback(self):
|
def name_callback(self):
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
#
|
#
|
||||||
|
|
||||||
__all__ = ["LinkLabel", "EditLabel", "BasicLabel", "GenderLabel",
|
__all__ = ["LinkLabel", "EditLabel", "BasicLabel",
|
||||||
"MarkupLabel", "DualMarkupLabel"]
|
"MarkupLabel", "DualMarkupLabel"]
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@@ -127,7 +127,7 @@ class LinkLabel(Gtk.EventBox):
|
|||||||
hbox = Gtk.Box()
|
hbox = Gtk.Box()
|
||||||
hbox.pack_start(self.label, False, False, 0)
|
hbox.pack_start(self.label, False, False, 0)
|
||||||
if label[1]:
|
if label[1]:
|
||||||
hbox.pack_start(GenderLabel(label[1]), False, False, 0)
|
hbox.pack_start(Gtk.Label(label=label[1]), False, False, 0)
|
||||||
hbox.set_spacing(4)
|
hbox.set_spacing(4)
|
||||||
self.add(hbox)
|
self.add(hbox)
|
||||||
|
|
||||||
@@ -205,20 +205,6 @@ class BasicLabel(Gtk.Label):
|
|||||||
self.set_ellipsize(ellipsize)
|
self.set_ellipsize(ellipsize)
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# GenderLabel class
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
class GenderLabel(Gtk.Label):
|
|
||||||
|
|
||||||
def __init__(self, text):
|
|
||||||
Gtk.Label.__init__(self, label=text)
|
|
||||||
self.set_halign(Gtk.Align.START)
|
|
||||||
if win():
|
|
||||||
pangoFont = Pango.FontDescription('Arial')
|
|
||||||
self.override_font(pangoFont)
|
|
||||||
self.show()
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -247,7 +233,6 @@ class DualMarkupLabel(Gtk.Box):
|
|||||||
label.set_use_markup(True)
|
label.set_use_markup(True)
|
||||||
|
|
||||||
self.pack_start(label, False, False, 0)
|
self.pack_start(label, False, False, 0)
|
||||||
b = GenderLabel(alt)
|
b = Gtk.Label(label=alt)
|
||||||
b.set_use_markup(True)
|
|
||||||
self.pack_start(b, False, False, 4)
|
self.pack_start(b, False, False, 4)
|
||||||
self.show()
|
self.show()
|
||||||
|
@@ -183,36 +183,8 @@ class MonitoredEntryIndicator(MonitoredEntry):
|
|||||||
autolist=None, changed=None):
|
autolist=None, changed=None):
|
||||||
MonitoredEntry.__init__(self, obj, set_val, get_val, read_only,
|
MonitoredEntry.__init__(self, obj, set_val, get_val, read_only,
|
||||||
autolist, changed)
|
autolist, changed)
|
||||||
self.origcolor = obj.get_style_context().get_color(Gtk.StateType.NORMAL)
|
self.obj.set_placeholder_text(indicator)
|
||||||
if get_val():
|
|
||||||
self.indicatorshown = False
|
|
||||||
else:
|
|
||||||
self.indicatorshown = True
|
|
||||||
self.indicator = indicator
|
|
||||||
self.obj.set_text(indicator)
|
|
||||||
rgba = Gdk.RGBA()
|
|
||||||
Gdk.RGBA.parse(rgba, 'grey')
|
|
||||||
self.obj.override_color(Gtk.StateType.NORMAL, rgba)
|
|
||||||
self.obj.override_font(Pango.FontDescription('sans italic'))
|
|
||||||
self.fockey = self.obj.connect('focus-in-event',
|
|
||||||
self._obj_focus)
|
|
||||||
|
|
||||||
def _on_change(self, obj):
|
|
||||||
if not self.indicatorshown:
|
|
||||||
self.set_val(str(obj.get_text()))
|
|
||||||
if self.changed:
|
|
||||||
self.changed(obj)
|
|
||||||
|
|
||||||
def _obj_focus(self, widg, eve):
|
|
||||||
"""
|
|
||||||
callback for when prefix obtains focus
|
|
||||||
"""
|
|
||||||
self.set_text('')
|
|
||||||
self.obj.override_color(Gtk.StateType.NORMAL, self.origcolor)
|
|
||||||
self.obj.override_font(Pango.FontDescription('normal'))
|
|
||||||
self.obj.disconnect(self.fockey)
|
|
||||||
self.indicatorshown = False
|
|
||||||
return False
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
@@ -191,7 +191,7 @@ class MaskedEntry(UndoableEntry):
|
|||||||
:param mask: the mask to set
|
:param mask: the mask to set
|
||||||
"""
|
"""
|
||||||
if not mask:
|
if not mask:
|
||||||
self.override_font(Pango.FontDescription("sans"))
|
# self.override_font(Pango.FontDescription("sans"))
|
||||||
self._mask = mask
|
self._mask = mask
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -221,7 +221,9 @@ class MaskedEntry(UndoableEntry):
|
|||||||
pos += 1
|
pos += 1
|
||||||
|
|
||||||
self._mask_fields.append((field_begin, field_end))
|
self._mask_fields.append((field_begin, field_end))
|
||||||
self.override_font(Pango.FontDescription("monospace"))
|
# The set_mask function doesn't seem to be used, except for the test
|
||||||
|
# so removing the monospace doesn't change visible functionality
|
||||||
|
# self.override_font(Pango.FontDescription("monospace"))
|
||||||
|
|
||||||
self._really_delete_text(0, -1)
|
self._really_delete_text(0, -1)
|
||||||
self._insert_mask(0, input_length)
|
self._insert_mask(0, input_length)
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
from gi.repository import Pango
|
from gi.repository.GLib import markup_escape_text
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -61,7 +61,6 @@ class PersonDetails(Gramplet):
|
|||||||
self.photo = Photo(self.uistate.screen_height() < 1000)
|
self.photo = Photo(self.uistate.screen_height() < 1000)
|
||||||
self.photo.show()
|
self.photo.show()
|
||||||
self.name = Gtk.Label(halign=Gtk.Align.START)
|
self.name = Gtk.Label(halign=Gtk.Align.START)
|
||||||
self.name.override_font(Pango.FontDescription('sans bold 12'))
|
|
||||||
self.name.set_selectable(True)
|
self.name.set_selectable(True)
|
||||||
vbox.pack_start(self.name, fill=True, expand=False, padding=7)
|
vbox.pack_start(self.name, fill=True, expand=False, padding=7)
|
||||||
self.grid = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL)
|
self.grid = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL)
|
||||||
@@ -150,7 +149,9 @@ class PersonDetails(Gramplet):
|
|||||||
Display details of the active person.
|
Display details of the active person.
|
||||||
"""
|
"""
|
||||||
self.load_person_image(active_person)
|
self.load_person_image(active_person)
|
||||||
self.name.set_text(name_displayer.display(active_person))
|
self.name.set_markup(
|
||||||
|
"<span size='large' weight='bold'>%s</span>" %
|
||||||
|
markup_escape_text(name_displayer.display(active_person), -1))
|
||||||
self.clear_grid()
|
self.clear_grid()
|
||||||
self.display_alternate_names(active_person)
|
self.display_alternate_names(active_person)
|
||||||
self.display_parents(active_person)
|
self.display_parents(active_person)
|
||||||
@@ -177,8 +178,8 @@ class PersonDetails(Gramplet):
|
|||||||
"""
|
"""
|
||||||
Display an empty row to separate groupd of entries.
|
Display an empty row to separate groupd of entries.
|
||||||
"""
|
"""
|
||||||
label = Gtk.Label(label='')
|
label = Gtk.Label()
|
||||||
label.override_font(Pango.FontDescription('sans 4'))
|
label.set_markup("<span font='sans 4'> </span>")
|
||||||
label.set_selectable(True)
|
label.set_selectable(True)
|
||||||
label.show()
|
label.show()
|
||||||
self.grid.add(label)
|
self.grid.add(label)
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
from gi.repository import Pango
|
from gi.repository.GLib import markup_escape_text
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -55,7 +55,6 @@ class PlaceDetails(Gramplet):
|
|||||||
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||||
self.photo = Photo(self.uistate.screen_height() < 1000)
|
self.photo = Photo(self.uistate.screen_height() < 1000)
|
||||||
self.title = Gtk.Label(halign=Gtk.Align.START)
|
self.title = Gtk.Label(halign=Gtk.Align.START)
|
||||||
self.title.override_font(Pango.FontDescription('sans bold 12'))
|
|
||||||
self.title.set_selectable(True)
|
self.title.set_selectable(True)
|
||||||
vbox.pack_start(self.title, False, True, 7)
|
vbox.pack_start(self.title, False, True, 7)
|
||||||
self.grid = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL)
|
self.grid = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL)
|
||||||
@@ -119,7 +118,8 @@ class PlaceDetails(Gramplet):
|
|||||||
"""
|
"""
|
||||||
self.load_place_image(place)
|
self.load_place_image(place)
|
||||||
title = place_displayer.display(self.dbstate.db, place)
|
title = place_displayer.display(self.dbstate.db, place)
|
||||||
self.title.set_text(title)
|
self.title.set_markup("<span size='large' weight='bold'>%s</span>" %
|
||||||
|
markup_escape_text(title))
|
||||||
|
|
||||||
self.clear_grid()
|
self.clear_grid()
|
||||||
self.add_row(_('Name'), place.get_name().get_value())
|
self.add_row(_('Name'), place.get_name().get_value())
|
||||||
@@ -158,8 +158,8 @@ class PlaceDetails(Gramplet):
|
|||||||
"""
|
"""
|
||||||
Display an empty row to separate groupd of entries.
|
Display an empty row to separate groupd of entries.
|
||||||
"""
|
"""
|
||||||
label = Gtk.Label(label='')
|
label = Gtk.Label()
|
||||||
label.override_font(Pango.FontDescription('sans 4'))
|
label.set_markup("<span font='sans 4'> </span>")
|
||||||
label.set_selectable(True)
|
label.set_selectable(True)
|
||||||
label.show()
|
label.show()
|
||||||
self.grid.add(label)
|
self.grid.add(label)
|
||||||
|
@@ -24,6 +24,7 @@
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
from gi.repository import Pango
|
from gi.repository import Pango
|
||||||
|
from gi.repository.GLib import markup_escape_text
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -51,7 +52,6 @@ class RepositoryDetails(Gramplet):
|
|||||||
self.top = Gtk.Box()
|
self.top = Gtk.Box()
|
||||||
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||||
self.name = Gtk.Label(halign=Gtk.Align.START)
|
self.name = Gtk.Label(halign=Gtk.Align.START)
|
||||||
self.name.override_font(Pango.FontDescription('sans bold 12'))
|
|
||||||
self.name.set_selectable(True)
|
self.name.set_selectable(True)
|
||||||
vbox.pack_start(self.name, fill=True, expand=False, padding=7)
|
vbox.pack_start(self.name, fill=True, expand=False, padding=7)
|
||||||
self.grid = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL)
|
self.grid = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL)
|
||||||
@@ -112,7 +112,9 @@ class RepositoryDetails(Gramplet):
|
|||||||
"""
|
"""
|
||||||
Display details of the active repository.
|
Display details of the active repository.
|
||||||
"""
|
"""
|
||||||
self.name.set_text(repo.get_name())
|
self.name.set_markup(
|
||||||
|
"<span size='large' weight='bold'>%s</span>" %
|
||||||
|
markup_escape_text(repo.get_name(), -1))
|
||||||
|
|
||||||
self.clear_grid()
|
self.clear_grid()
|
||||||
address_list = repo.get_address_list()
|
address_list = repo.get_address_list()
|
||||||
@@ -154,8 +156,8 @@ class RepositoryDetails(Gramplet):
|
|||||||
"""
|
"""
|
||||||
Display an empty row to separate groupd of entries.
|
Display an empty row to separate groupd of entries.
|
||||||
"""
|
"""
|
||||||
label = Gtk.Label(label='')
|
label = Gtk.Label()
|
||||||
label.override_font(Pango.FontDescription('sans 4'))
|
label.set_markup("<span font='sans 4'> </span>")
|
||||||
label.set_selectable(True)
|
label.set_selectable(True)
|
||||||
label.show()
|
label.show()
|
||||||
self.grid.add(label)
|
self.grid.add(label)
|
||||||
|
Reference in New Issue
Block a user