diff --git a/gramps/gui/configure.py b/gramps/gui/configure.py index bd7050b6f..b3d03cb91 100644 --- a/gramps/gui/configure.py +++ b/gramps/gui/configure.py @@ -2162,11 +2162,9 @@ class GrampsPreferences(ConfigureDialog): scrollw.set_size_request(600, 100) text = Gtk.Label() text.set_line_wrap(True) - font_description = Pango.font_description_from_string(font) - text.modify_font(font_description) self.activate_change_font() text.set_halign(Gtk.Align.START) - text.set_text(my_characters) + text.set_markup("%s" % (font, my_characters)) scrollw.add(text) scrollw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) 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) text = Gtk.Label() 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_markup("" + - my_characters + - "") + text.set_markup("%s" + "" % (font, my_characters)) self.grid.attach(text, 1, 8, 8, 1) scrollw.show_all() text.show_all() diff --git a/gramps/gui/editors/editperson.py b/gramps/gui/editors/editperson.py index 15f34ed8f..fc05f3625 100644 --- a/gramps/gui/editors/editperson.py +++ b/gramps/gui/editors/editperson.py @@ -42,6 +42,7 @@ import pickle from gi.repository import Gtk from gi.repository import Gdk 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) 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.obj.get_primary_name(), on_change=self._changed_name) @@ -550,7 +550,9 @@ class EditPerson(EditPrimary): Update the window title, and default name in name tab """ self.update_title(self.get_menu_title()) - self.preview_name.set_text(self.get_preview_name()) + self.preview_name.set_markup( + "%s" % + markup_escape_text(self.get_preview_name(), -1)) self.name_list.update_defname() def name_callback(self): diff --git a/gramps/gui/widgets/labels.py b/gramps/gui/widgets/labels.py index 3ff9be1a3..ba3f6a7dd 100644 --- a/gramps/gui/widgets/labels.py +++ b/gramps/gui/widgets/labels.py @@ -18,7 +18,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # -__all__ = ["LinkLabel", "EditLabel", "BasicLabel", "GenderLabel", +__all__ = ["LinkLabel", "EditLabel", "BasicLabel", "MarkupLabel", "DualMarkupLabel"] #------------------------------------------------------------------------- @@ -127,7 +127,7 @@ class LinkLabel(Gtk.EventBox): hbox = Gtk.Box() hbox.pack_start(self.label, False, False, 0) 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) self.add(hbox) @@ -205,20 +205,6 @@ class BasicLabel(Gtk.Label): self.set_ellipsize(ellipsize) 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) self.pack_start(label, False, False, 0) - b = GenderLabel(alt) - b.set_use_markup(True) + b = Gtk.Label(label=alt) self.pack_start(b, False, False, 4) self.show() diff --git a/gramps/gui/widgets/monitoredwidgets.py b/gramps/gui/widgets/monitoredwidgets.py index 00d970377..d66154ab7 100644 --- a/gramps/gui/widgets/monitoredwidgets.py +++ b/gramps/gui/widgets/monitoredwidgets.py @@ -183,36 +183,8 @@ class MonitoredEntryIndicator(MonitoredEntry): autolist=None, changed=None): MonitoredEntry.__init__(self, obj, set_val, get_val, read_only, autolist, changed) - self.origcolor = obj.get_style_context().get_color(Gtk.StateType.NORMAL) - 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) + self.obj.set_placeholder_text(indicator) - 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 #------------------------------------------------------------------------- # diff --git a/gramps/gui/widgets/validatedmaskedentry.py b/gramps/gui/widgets/validatedmaskedentry.py index 6df9919a1..2427e55cf 100644 --- a/gramps/gui/widgets/validatedmaskedentry.py +++ b/gramps/gui/widgets/validatedmaskedentry.py @@ -191,7 +191,7 @@ class MaskedEntry(UndoableEntry): :param mask: the mask to set """ if not mask: - self.override_font(Pango.FontDescription("sans")) + # self.override_font(Pango.FontDescription("sans")) self._mask = mask return @@ -221,7 +221,9 @@ class MaskedEntry(UndoableEntry): pos += 1 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._insert_mask(0, input_length) diff --git a/gramps/plugins/gramplet/persondetails.py b/gramps/plugins/gramplet/persondetails.py index 13f64afe7..2cec52371 100644 --- a/gramps/plugins/gramplet/persondetails.py +++ b/gramps/plugins/gramplet/persondetails.py @@ -24,7 +24,7 @@ # #------------------------------------------------------------------------- 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.show() self.name = Gtk.Label(halign=Gtk.Align.START) - self.name.override_font(Pango.FontDescription('sans bold 12')) self.name.set_selectable(True) vbox.pack_start(self.name, fill=True, expand=False, padding=7) self.grid = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL) @@ -150,7 +149,9 @@ class PersonDetails(Gramplet): Display details of the active person. """ self.load_person_image(active_person) - self.name.set_text(name_displayer.display(active_person)) + self.name.set_markup( + "%s" % + markup_escape_text(name_displayer.display(active_person), -1)) self.clear_grid() self.display_alternate_names(active_person) self.display_parents(active_person) @@ -177,8 +178,8 @@ class PersonDetails(Gramplet): """ Display an empty row to separate groupd of entries. """ - label = Gtk.Label(label='') - label.override_font(Pango.FontDescription('sans 4')) + label = Gtk.Label() + label.set_markup(" ") label.set_selectable(True) label.show() self.grid.add(label) diff --git a/gramps/plugins/gramplet/placedetails.py b/gramps/plugins/gramplet/placedetails.py index b89029c9d..9a03715ba 100644 --- a/gramps/plugins/gramplet/placedetails.py +++ b/gramps/plugins/gramplet/placedetails.py @@ -23,7 +23,7 @@ # #------------------------------------------------------------------------- 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) self.photo = Photo(self.uistate.screen_height() < 1000) self.title = Gtk.Label(halign=Gtk.Align.START) - self.title.override_font(Pango.FontDescription('sans bold 12')) self.title.set_selectable(True) vbox.pack_start(self.title, False, True, 7) self.grid = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL) @@ -119,7 +118,8 @@ class PlaceDetails(Gramplet): """ self.load_place_image(place) title = place_displayer.display(self.dbstate.db, place) - self.title.set_text(title) + self.title.set_markup("%s" % + markup_escape_text(title)) self.clear_grid() 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. """ - label = Gtk.Label(label='') - label.override_font(Pango.FontDescription('sans 4')) + label = Gtk.Label() + label.set_markup(" ") label.set_selectable(True) label.show() self.grid.add(label) diff --git a/gramps/plugins/gramplet/repositorydetails.py b/gramps/plugins/gramplet/repositorydetails.py index b23767750..61898bb0c 100644 --- a/gramps/plugins/gramplet/repositorydetails.py +++ b/gramps/plugins/gramplet/repositorydetails.py @@ -24,6 +24,7 @@ #------------------------------------------------------------------------- from gi.repository import Gtk from gi.repository import Pango +from gi.repository.GLib import markup_escape_text #------------------------------------------------------------------------- # @@ -51,7 +52,6 @@ class RepositoryDetails(Gramplet): self.top = Gtk.Box() vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.name = Gtk.Label(halign=Gtk.Align.START) - self.name.override_font(Pango.FontDescription('sans bold 12')) self.name.set_selectable(True) vbox.pack_start(self.name, fill=True, expand=False, padding=7) self.grid = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL) @@ -112,7 +112,9 @@ class RepositoryDetails(Gramplet): """ Display details of the active repository. """ - self.name.set_text(repo.get_name()) + self.name.set_markup( + "%s" % + markup_escape_text(repo.get_name(), -1)) self.clear_grid() address_list = repo.get_address_list() @@ -154,8 +156,8 @@ class RepositoryDetails(Gramplet): """ Display an empty row to separate groupd of entries. """ - label = Gtk.Label(label='') - label.override_font(Pango.FontDescription('sans 4')) + label = Gtk.Label() + label.set_markup(" ") label.set_selectable(True) label.show() self.grid.add(label)