Merge pull request #903 from prculley:deprecations
This commit is contained in:
commit
7100c51a31
@ -161,12 +161,12 @@ def image_size(source):
|
||||
:returns: a tuple consisting of the width and height
|
||||
"""
|
||||
from gi.repository import GdkPixbuf
|
||||
from gi.repository import GObject
|
||||
from gi.repository import GLib
|
||||
try:
|
||||
img = GdkPixbuf.Pixbuf.new_from_file(source)
|
||||
width = img.get_width()
|
||||
height = img.get_height()
|
||||
except GObject.GError:
|
||||
except GLib.GError:
|
||||
width = 0
|
||||
height = 0
|
||||
return (width, height)
|
||||
|
@ -36,7 +36,7 @@ from hashlib import md5
|
||||
# GTK/Gnome modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gi.repository import GObject
|
||||
from gi.repository import GLib
|
||||
from gi.repository import GdkPixbuf
|
||||
|
||||
try:
|
||||
@ -98,7 +98,7 @@ def __get_gconf_string(key):
|
||||
"""
|
||||
try:
|
||||
val = CLIENT.get_string(key)
|
||||
except GObject.GError:
|
||||
except GLib.GError:
|
||||
val = None
|
||||
return str(val)
|
||||
|
||||
@ -119,7 +119,7 @@ def __get_gconf_bool(key):
|
||||
"""
|
||||
try:
|
||||
val = CLIENT.get_bool(key)
|
||||
except GObject.GError:
|
||||
except GLib.GError:
|
||||
val = None
|
||||
return val
|
||||
|
||||
@ -318,7 +318,7 @@ def get_thumbnail_image(src_file, mtype=None, rectangle=None, size=SIZE_NORMAL):
|
||||
try:
|
||||
filename = get_thumbnail_path(src_file, mtype, rectangle, size)
|
||||
return GdkPixbuf.Pixbuf.new_from_file(filename)
|
||||
except (GObject.GError, OSError):
|
||||
except (GLib.GError, OSError):
|
||||
if mtype:
|
||||
return find_mime_type_pixbuf(mtype)
|
||||
else:
|
||||
|
@ -690,7 +690,7 @@ class GrampsPreferences(ConfigureDialog):
|
||||
hbox.pack_start(lwidget, False, False, 0)
|
||||
hbox.pack_start(self.color_scheme_box, False, False, 0)
|
||||
|
||||
restore_btn = Gtk.Button(_('Restore to defaults'))
|
||||
restore_btn = Gtk.Button(label=_('Restore to defaults'))
|
||||
restore_btn.set_tooltip_text(
|
||||
_('Restore colors for current theme to default.'))
|
||||
restore_btn.connect('clicked', self.restore_colors)
|
||||
@ -1827,12 +1827,10 @@ class GrampsPreferences(ConfigureDialog):
|
||||
Show dialog to choose media directory.
|
||||
"""
|
||||
f = Gtk.FileChooserDialog(title=_("Select media directory"),
|
||||
parent=self.window,
|
||||
action=Gtk.FileChooserAction.SELECT_FOLDER,
|
||||
buttons=(_('_Cancel'),
|
||||
Gtk.ResponseType.CANCEL,
|
||||
_('_Apply'),
|
||||
Gtk.ResponseType.OK))
|
||||
transient_for=self.window,
|
||||
action=Gtk.FileChooserAction.SELECT_FOLDER)
|
||||
f.add_buttons(_('_Cancel'), Gtk.ResponseType.CANCEL,
|
||||
_('_Apply'), Gtk.ResponseType.OK)
|
||||
mpath = media_path(self.dbstate.db)
|
||||
f.set_current_folder(os.path.dirname(mpath))
|
||||
|
||||
@ -1877,12 +1875,10 @@ class GrampsPreferences(ConfigureDialog):
|
||||
Show dialog to choose backup directory.
|
||||
"""
|
||||
f = Gtk.FileChooserDialog(title=_("Select backup directory"),
|
||||
parent=self.window,
|
||||
action=Gtk.FileChooserAction.SELECT_FOLDER,
|
||||
buttons=(_('_Cancel'),
|
||||
Gtk.ResponseType.CANCEL,
|
||||
_('_Apply'),
|
||||
Gtk.ResponseType.OK))
|
||||
transient_for=self.window,
|
||||
action=Gtk.FileChooserAction.SELECT_FOLDER)
|
||||
f.add_buttons(_('_Cancel'), Gtk.ResponseType.CANCEL,
|
||||
_('_Apply'), Gtk.ResponseType.OK)
|
||||
backup_path = config.get('database.backup-path')
|
||||
if not backup_path:
|
||||
backup_path = config.get('database.path')
|
||||
@ -2162,11 +2158,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("<span font='%s'>%s</span>" % (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 +2173,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("<big><big><big><big>" +
|
||||
my_characters +
|
||||
"</big></big></big></big>")
|
||||
text.set_markup("<big><big><big><big><span font='%s'>%s</span>"
|
||||
"</big></big></big></big>" % (font, my_characters))
|
||||
self.grid.attach(text, 1, 8, 8, 1)
|
||||
scrollw.show_all()
|
||||
text.show_all()
|
||||
|
@ -380,7 +380,7 @@ class GrampsLoginDialog(ManagedWindow):
|
||||
self.title = _("Login")
|
||||
ManagedWindow.__init__(self, uistate, [], self.__class__, modal=True)
|
||||
|
||||
dialog = Gtk.Dialog(parent=uistate.window)
|
||||
dialog = Gtk.Dialog(transient_for=uistate.window)
|
||||
grid = Gtk.Grid()
|
||||
grid.set_border_width(6)
|
||||
grid.set_row_spacing(6)
|
||||
|
@ -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(
|
||||
"<span size='x-large' weight='bold'>%s</span>" %
|
||||
markup_escape_text(self.get_preview_name(), -1))
|
||||
self.name_list.update_defname()
|
||||
|
||||
def name_callback(self):
|
||||
@ -638,7 +640,6 @@ class EditPerson(EditPrimary):
|
||||
"""
|
||||
self.imgmenu = Gtk.Menu()
|
||||
menu = self.imgmenu
|
||||
menu.set_title(_("Media Object"))
|
||||
obj = self.db.get_media_from_handle(photo.get_reference_handle())
|
||||
if obj:
|
||||
add_menuitem(menu, _("View"), photo,
|
||||
@ -1086,9 +1087,9 @@ class EditPerson(EditPrimary):
|
||||
class GenderDialog(Gtk.MessageDialog):
|
||||
def __init__(self, parent=None):
|
||||
Gtk.MessageDialog.__init__(self,
|
||||
parent,
|
||||
flags=Gtk.DialogFlags.MODAL,
|
||||
type=Gtk.MessageType.QUESTION,
|
||||
transient_for=parent,
|
||||
modal=True,
|
||||
message_type=Gtk.MessageType.QUESTION,
|
||||
)
|
||||
self.set_icon(ICON)
|
||||
self.set_title('')
|
||||
|
@ -101,7 +101,7 @@ class EditTagList(ManagedWindow):
|
||||
Create a dialog box to select tags.
|
||||
"""
|
||||
# pylint: disable-msg=E1101
|
||||
top = Gtk.Dialog(parent=self.uistate.window)
|
||||
top = Gtk.Dialog(transient_for=self.uistate.window)
|
||||
top.vbox.set_spacing(5)
|
||||
|
||||
columns = [('', -1, 300),
|
||||
|
@ -284,7 +284,8 @@ class ErrorReportAssistant(ManagedWindow, Gtk.Assistant):
|
||||
"information included in the error please remove "
|
||||
"it."))
|
||||
label.set_halign(Gtk.Align.START)
|
||||
label.set_padding(0, 4)
|
||||
label.set_margin_top(4)
|
||||
label.set_margin_bottom(4)
|
||||
label.set_line_wrap(True)
|
||||
|
||||
swin = Gtk.ScrolledWindow()
|
||||
@ -300,9 +301,9 @@ class ErrorReportAssistant(ManagedWindow, Gtk.Assistant):
|
||||
sw_frame = Gtk.Frame()
|
||||
sw_frame.add(swin)
|
||||
|
||||
reset = Gtk.Button("Reset")
|
||||
reset = Gtk.Button(label="Reset")
|
||||
reset.connect('clicked', self._reset_error_details)
|
||||
clear = Gtk.Button("Clear")
|
||||
clear = Gtk.Button(label="Clear")
|
||||
clear.connect('clicked', self._clear_error_details)
|
||||
|
||||
button_box = Gtk.ButtonBox()
|
||||
@ -364,7 +365,8 @@ class ErrorReportAssistant(ManagedWindow, Gtk.Assistant):
|
||||
"remove anything that you would rather not have "
|
||||
"included in the bug report."))
|
||||
label.set_halign(Gtk.Align.START)
|
||||
label.set_padding(0, 4)
|
||||
label.set_margin_top(4)
|
||||
label.set_margin_bottom(4)
|
||||
label.set_line_wrap(True)
|
||||
|
||||
swin = Gtk.ScrolledWindow()
|
||||
@ -380,9 +382,9 @@ class ErrorReportAssistant(ManagedWindow, Gtk.Assistant):
|
||||
sw_frame = Gtk.Frame()
|
||||
sw_frame.add(swin)
|
||||
|
||||
reset = Gtk.Button("Reset")
|
||||
reset = Gtk.Button(label="Reset")
|
||||
reset.connect('clicked', self._reset_sys_information)
|
||||
clear = Gtk.Button("Clear")
|
||||
clear = Gtk.Button(label="Clear")
|
||||
clear.connect('clicked', self._clear_sys_information)
|
||||
|
||||
|
||||
@ -441,7 +443,8 @@ class ErrorReportAssistant(ManagedWindow, Gtk.Assistant):
|
||||
"can about what you were doing when the error "
|
||||
"occurred."))
|
||||
label.set_halign(Gtk.Align.START)
|
||||
label.set_padding(0, 4)
|
||||
label.set_margin_top(4)
|
||||
label.set_margin_bottom(4)
|
||||
label.set_line_wrap(True)
|
||||
|
||||
swin = Gtk.ScrolledWindow()
|
||||
@ -456,7 +459,7 @@ class ErrorReportAssistant(ManagedWindow, Gtk.Assistant):
|
||||
sw_frame = Gtk.Frame()
|
||||
sw_frame.add(swin)
|
||||
|
||||
clear = Gtk.Button("Clear")
|
||||
clear = Gtk.Button(label="Clear")
|
||||
clear.connect('clicked', self._clear_user_information)
|
||||
|
||||
button_box = Gtk.ButtonBox()
|
||||
@ -514,7 +517,8 @@ class ErrorReportAssistant(ManagedWindow, Gtk.Assistant):
|
||||
"that it does not contain anything that you do not "
|
||||
"want to be sent to the developers."))
|
||||
label.set_halign(Gtk.Align.START)
|
||||
label.set_padding(0, 4)
|
||||
label.set_margin_top(4)
|
||||
label.set_margin_bottom(4)
|
||||
label.set_line_wrap(True)
|
||||
|
||||
swin = Gtk.ScrolledWindow()
|
||||
@ -580,7 +584,8 @@ class ErrorReportAssistant(ManagedWindow, Gtk.Assistant):
|
||||
"clipboard and then open a webbrowser to file a bug report at "),
|
||||
URL_BUGTRACKER))
|
||||
label.set_halign(Gtk.Align.START)
|
||||
label.set_padding(0, 4)
|
||||
label.set_margin_top(4)
|
||||
label.set_margin_bottom(4)
|
||||
label.set_line_wrap(True)
|
||||
label.set_use_markup(True)
|
||||
|
||||
@ -589,11 +594,12 @@ class ErrorReportAssistant(ManagedWindow, Gtk.Assistant):
|
||||
"and file a bug report on the Gramps bug "
|
||||
"tracking system."))
|
||||
url_label.set_halign(Gtk.Align.START)
|
||||
url_label.set_padding(0, 4)
|
||||
url_label.set_margin_top(4)
|
||||
url_label.set_margin_bottom(4)
|
||||
url_label.set_line_wrap(True)
|
||||
url_label.set_size_request(200, -1)
|
||||
|
||||
url_button = Gtk.Button("File bug report")
|
||||
url_button = Gtk.Button(label="File bug report")
|
||||
url_button.connect('clicked', self._start_gramps_bts_in_browser)
|
||||
url_button_vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||
url_button_vbox.pack_start(url_button, True, False, 0)
|
||||
@ -613,11 +619,12 @@ class ErrorReportAssistant(ManagedWindow, Gtk.Assistant):
|
||||
"the button below, paste the report and click "
|
||||
"submit report"))
|
||||
clip_label.set_halign(Gtk.Align.START)
|
||||
clip_label.set_padding(0, 4)
|
||||
clip_label.set_margin_top(4)
|
||||
clip_label.set_margin_bottom(4)
|
||||
clip_label.set_line_wrap(True)
|
||||
clip_label.set_size_request(200, -1)
|
||||
|
||||
clip_button = Gtk.Button("Copy to clipboard")
|
||||
clip_button = Gtk.Button(label="Copy to clipboard")
|
||||
clip_button.connect('clicked', self._copy_to_clipboard)
|
||||
clip_button_vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||
clip_button_vbox.pack_start(clip_button, True, False, 0)
|
||||
|
@ -105,7 +105,7 @@ class ErrorView(ManagedWindow):
|
||||
|
||||
def draw_window(self):
|
||||
title = "%s - Gramps" % _("Error Report")
|
||||
self.top = Gtk.Dialog(title)
|
||||
self.top = Gtk.Dialog(title=title)
|
||||
# look over the top level windows, it seems the oldest come first, so
|
||||
# the most recent still visible window appears to be a good choice for
|
||||
# a transient parent
|
||||
|
@ -75,16 +75,17 @@ class LastNameDialog(ManagedWindow):
|
||||
def __init__(self, database, uistate, track, surnames, skip_list=set()):
|
||||
|
||||
ManagedWindow.__init__(self, uistate, track, self, modal=True)
|
||||
flags = Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT
|
||||
buttons = (_('_Cancel'), Gtk.ResponseType.REJECT,
|
||||
_('_OK'), Gtk.ResponseType.ACCEPT)
|
||||
self.__dlg = Gtk.Dialog(None, uistate.window, flags, buttons)
|
||||
self.__dlg = Gtk.Dialog(
|
||||
transient_for=uistate.window, destroy_with_parent=True,
|
||||
modal=True)
|
||||
self.__dlg.add_buttons(_('_Cancel'), Gtk.ResponseType.REJECT,
|
||||
_('_OK'), Gtk.ResponseType.ACCEPT)
|
||||
self.set_window(self.__dlg, None, _('Select surname'))
|
||||
self.setup_configs('interface.lastnamedialog', 400, 400)
|
||||
|
||||
# build up a container to display all of the people of interest
|
||||
self.__model = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_INT)
|
||||
self.__tree_view = Gtk.TreeView(self.__model)
|
||||
self.__tree_view = Gtk.TreeView(model=self.__model)
|
||||
col1 = Gtk.TreeViewColumn(_('Surname'), Gtk.CellRendererText(), text=0)
|
||||
col2 = Gtk.TreeViewColumn(_('Count'), Gtk.CellRendererText(), text=1)
|
||||
col1.set_resizable(True)
|
||||
@ -1739,12 +1740,10 @@ class GuiDestinationOption(Gtk.Box):
|
||||
else:
|
||||
my_action = Gtk.FileChooserAction.SAVE
|
||||
|
||||
fcd = Gtk.FileChooserDialog(_("Save As"), action=my_action,
|
||||
parent=self.__uistate.window,
|
||||
buttons=(_('_Cancel'),
|
||||
Gtk.ResponseType.CANCEL,
|
||||
_('_Open'),
|
||||
Gtk.ResponseType.OK))
|
||||
fcd = Gtk.FileChooserDialog(title=_("Save As"), action=my_action,
|
||||
transient_for=self.__uistate.window)
|
||||
fcd.add_buttons(_('_Cancel'), Gtk.ResponseType.CANCEL,
|
||||
_('_Open'), Gtk.ResponseType.OK)
|
||||
|
||||
name = os.path.abspath(self.__option.get_value())
|
||||
if self.__option.get_directory_entry():
|
||||
|
@ -435,12 +435,10 @@ class PluginStatus(ManagedWindow):
|
||||
"""
|
||||
Select a file from the file system.
|
||||
"""
|
||||
fcd = Gtk.FileChooserDialog(_("Load Addon"),
|
||||
parent=self.__uistate.window,
|
||||
buttons=(_('_Cancel'),
|
||||
Gtk.ResponseType.CANCEL,
|
||||
_('_Open'),
|
||||
Gtk.ResponseType.OK))
|
||||
fcd = Gtk.FileChooserDialog(title=_("Load Addon"),
|
||||
transient_for=self.__uistate.window)
|
||||
fcd.add_buttons(_('_Cancel'), Gtk.ResponseType.CANCEL,
|
||||
_('_Open'), Gtk.ResponseType.OK)
|
||||
name = self.install_addon_path.get_text()
|
||||
dir = os.path.dirname(name)
|
||||
if not os.path.isdir(dir):
|
||||
@ -688,10 +686,10 @@ class PluginTrace(ManagedWindow):
|
||||
) % {'str1': _("Plugin Error"), 'str2': name}
|
||||
ManagedWindow.__init__(self, uistate, track, self)
|
||||
|
||||
self.set_window(Gtk.Dialog("", uistate.window,
|
||||
Gtk.DialogFlags.DESTROY_WITH_PARENT,
|
||||
(_('_Close'), Gtk.ResponseType.CLOSE)),
|
||||
None, title)
|
||||
dlg = Gtk.Dialog(title="", transient_for=uistate.window,
|
||||
destroy_with_parent=True)
|
||||
dlg.add_button(_('_Close'), Gtk.ResponseType.CLOSE),
|
||||
self.set_window(dlg, None, title)
|
||||
self.setup_configs('interface.plugintrace', 600, 400)
|
||||
self.window.connect('response', self.close)
|
||||
|
||||
@ -742,7 +740,7 @@ class ToolManagedWindowBase(ManagedWindow):
|
||||
self.format_menu = None
|
||||
self.style_button = None
|
||||
|
||||
window = Gtk.Dialog('Tool')
|
||||
window = Gtk.Dialog(title='Tool')
|
||||
self.set_window(window, None, self.get_title())
|
||||
|
||||
#self.window.connect('response', self.close)
|
||||
|
@ -286,7 +286,7 @@ class ExportAssistant(ManagedWindow, Gtk.Assistant):
|
||||
self.set_page_complete(vbox, True)
|
||||
|
||||
def create_page_fileselect(self):
|
||||
self.chooser = Gtk.FileChooserWidget(Gtk.FileChooserAction.SAVE)
|
||||
self.chooser = Gtk.FileChooserWidget(action=Gtk.FileChooserAction.SAVE)
|
||||
self.chooser.set_homogeneous(False) # Fix for bug #8350.
|
||||
#add border
|
||||
self.chooser.set_border_width(12)
|
||||
|
@ -164,9 +164,9 @@ class WriterOptionBox:
|
||||
full_database_row.pack_start(label, True, True, 0)
|
||||
people_count = len(self.dbstate.db.get_person_handles())
|
||||
# translators: leave all/any {...} untranslated
|
||||
button = Gtk.Button(ngettext("{number_of} Person",
|
||||
"{number_of} People", people_count
|
||||
).format(number_of=people_count) )
|
||||
button = Gtk.Button(label=ngettext("{number_of} Person",
|
||||
"{number_of} People", people_count
|
||||
).format(number_of=people_count))
|
||||
button.set_tooltip_text(_("Click to see preview of unfiltered data"))
|
||||
button.set_size_request(107, -1)
|
||||
button.connect("clicked", self.show_preview_data)
|
||||
@ -271,9 +271,9 @@ class WriterOptionBox:
|
||||
from gi.repository import Gtk
|
||||
from ...widgets import SimpleButton
|
||||
# translators: leave all/any {...} untranslated
|
||||
button = Gtk.Button(ngettext("{number_of} Person",
|
||||
"{number_of} People", 0
|
||||
).format(number_of=0) )
|
||||
button = Gtk.Button(label=ngettext("{number_of} Person",
|
||||
"{number_of} People", 0
|
||||
).format(number_of=0))
|
||||
button.set_size_request(107, -1)
|
||||
button.connect("clicked", self.show_preview_data)
|
||||
button.proxy_name = proxy_name
|
||||
@ -283,7 +283,8 @@ class WriterOptionBox:
|
||||
label = Gtk.Label(label=_('_Person Filter') + COLON)
|
||||
label.set_halign(Gtk.Align.START)
|
||||
label.set_size_request(120, -1)
|
||||
label.set_padding(5, 0)
|
||||
label.set_margin_start(5)
|
||||
label.set_margin_end(5)
|
||||
label.set_use_underline(True)
|
||||
label.set_mnemonic_widget(self.filter_obj)
|
||||
box = Gtk.Box()
|
||||
@ -301,7 +302,8 @@ class WriterOptionBox:
|
||||
label_note = Gtk.Label(label=_('_Note Filter') + COLON)
|
||||
label_note.set_halign(Gtk.Align.START)
|
||||
label_note.set_size_request(120, -1)
|
||||
label_note.set_padding(5, 0)
|
||||
label_note.set_margin_start(5)
|
||||
label_note.set_margin_end(5)
|
||||
label_note.set_use_underline(True)
|
||||
label_note.set_mnemonic_widget(self.filter_note)
|
||||
box = Gtk.Box()
|
||||
@ -317,7 +319,8 @@ class WriterOptionBox:
|
||||
label = Gtk.Label(label=_("Privacy Filter") + COLON)
|
||||
label.set_halign(Gtk.Align.START)
|
||||
label.set_size_request(120, -1)
|
||||
label.set_padding(5, 0)
|
||||
label.set_margin_start(5)
|
||||
label.set_margin_end(5)
|
||||
box = Gtk.Box()
|
||||
box.pack_start(label, False, True, 0)
|
||||
box.add(self.private_check)
|
||||
@ -327,7 +330,8 @@ class WriterOptionBox:
|
||||
label = Gtk.Label(label=_("Living Filter") + COLON)
|
||||
label.set_halign(Gtk.Align.START)
|
||||
label.set_size_request(120, -1)
|
||||
label.set_padding(5, 0)
|
||||
label.set_margin_start(5)
|
||||
label.set_margin_end(5)
|
||||
box = Gtk.Box()
|
||||
box.pack_start(label, False, True, 0)
|
||||
self.restrict_option = Gtk.ComboBox()
|
||||
@ -339,7 +343,8 @@ class WriterOptionBox:
|
||||
label = Gtk.Label(label=_('Reference Filter') + COLON)
|
||||
label.set_halign(Gtk.Align.START)
|
||||
label.set_size_request(120, -1)
|
||||
label.set_padding(5, 0)
|
||||
label.set_margin_start(5)
|
||||
label.set_margin_end(5)
|
||||
box = Gtk.Box()
|
||||
box.pack_start(label, False, True, 0)
|
||||
box.pack_start(self.reference_filter, True, True, 0)
|
||||
|
@ -58,13 +58,11 @@ class FileEntry(Gtk.Box):
|
||||
else:
|
||||
my_action = Gtk.FileChooserAction.SAVE
|
||||
|
||||
dialog = Gtk.FileChooserDialog(self.title,
|
||||
self.parent,
|
||||
action=my_action,
|
||||
buttons=(_('_Cancel'),
|
||||
Gtk.ResponseType.CANCEL,
|
||||
_('_Open'),
|
||||
Gtk.ResponseType.OK))
|
||||
dialog = Gtk.FileChooserDialog(title=self.title,
|
||||
transient_for=self.parent,
|
||||
action=my_action)
|
||||
dialog.add_buttons(_('_Cancel'), Gtk.ResponseType.CANCEL,
|
||||
_('_Open'), Gtk.ResponseType.OK)
|
||||
|
||||
name = os.path.basename(self.entry.get_text())
|
||||
if self.dir:
|
||||
|
@ -175,7 +175,8 @@ class PaperFrame(Gtk.Box):
|
||||
|
||||
self.paper_grid.show_all()
|
||||
# Shift the grid from glade toplevel window to this box
|
||||
self.paper_grid.reparent(self)
|
||||
self.paper_grid.get_parent().remove(self.paper_grid)
|
||||
self.add(self.paper_grid)
|
||||
# need to get rid of glade toplevel now that we are done with it.
|
||||
self.top.destroy()
|
||||
|
||||
|
@ -414,7 +414,7 @@ class StyleEditor(ManagedWindow):
|
||||
spin.set_value(t.get_column_width(i))
|
||||
self.column.append(spin)
|
||||
hbox.pack_start(spin, False, False, 6)
|
||||
hbox.pack_start(Gtk.Label('%'), False, False, 6)
|
||||
hbox.pack_start(Gtk.Label(label='%'), False, False, 6)
|
||||
hbox.show_all()
|
||||
self.vbox.pack_start(hbox, False, False, 3)
|
||||
|
||||
|
@ -1649,9 +1649,9 @@ class QuickBackup(ManagedWindow): # TODO move this class into its own module
|
||||
self.user = user
|
||||
|
||||
ManagedWindow.__init__(self, uistate, [], self.__class__)
|
||||
window = Gtk.Dialog('',
|
||||
self.uistate.window,
|
||||
Gtk.DialogFlags.DESTROY_WITH_PARENT, None)
|
||||
window = Gtk.Dialog(title='',
|
||||
transient_for=self.uistate.window,
|
||||
destroy_with_parent=True)
|
||||
self.set_window(window, None, _("Gramps XML Backup"))
|
||||
self.setup_configs('interface.quick-backup', 500, 150)
|
||||
close_button = window.add_button(_('_Close'),
|
||||
@ -1787,12 +1787,10 @@ class QuickBackup(ManagedWindow): # TODO move this class into its own module
|
||||
"""
|
||||
fdialog = Gtk.FileChooserDialog(
|
||||
title=_("Select backup directory"),
|
||||
parent=self.window,
|
||||
action=Gtk.FileChooserAction.SELECT_FOLDER,
|
||||
buttons=(_('_Cancel'),
|
||||
Gtk.ResponseType.CANCEL,
|
||||
_('_Apply'),
|
||||
Gtk.ResponseType.OK))
|
||||
transient_for=self.window,
|
||||
action=Gtk.FileChooserAction.SELECT_FOLDER)
|
||||
fdialog.add_buttons(_('_Cancel'), Gtk.ResponseType.CANCEL,
|
||||
_('_Apply'), Gtk.ResponseType.OK)
|
||||
mpath = path_entry.get_text()
|
||||
if not mpath:
|
||||
mpath = HOME_DIR
|
||||
|
@ -269,7 +269,7 @@ class BookmarksDialog(ManagedWindow):
|
||||
|
||||
def draw_window(self):
|
||||
"""Draw the bookmark dialog box."""
|
||||
self.top = Gtk.Dialog(parent=self.parent_window)
|
||||
self.top = Gtk.Dialog(transient_for=self.parent_window)
|
||||
self.top.vbox.set_spacing(5)
|
||||
label = Gtk.Label(label='<span size="larger" weight="bold">%s</span>'
|
||||
% _("Organize Bookmarks"))
|
||||
|
@ -1059,11 +1059,11 @@ class ListView(NavigationView):
|
||||
####################################################################
|
||||
def export(self, *obj):
|
||||
chooser = Gtk.FileChooserDialog(
|
||||
_("Export View as Spreadsheet"),
|
||||
self.uistate.window,
|
||||
Gtk.FileChooserAction.SAVE,
|
||||
(_('_Cancel'), Gtk.ResponseType.CANCEL,
|
||||
_('_Save'), Gtk.ResponseType.OK))
|
||||
title=_("Export View as Spreadsheet"),
|
||||
transient_for=self.uistate.window,
|
||||
action=Gtk.FileChooserAction.SAVE)
|
||||
chooser.add_buttons(_('_Cancel'), Gtk.ResponseType.CANCEL,
|
||||
_('_Save'), Gtk.ResponseType.OK)
|
||||
chooser.set_do_overwrite_confirmation(True)
|
||||
|
||||
combobox = Gtk.ComboBoxText()
|
||||
|
@ -331,7 +331,8 @@ class NavigationView(PageView):
|
||||
"""
|
||||
A dialog to move to a Gramps ID entered by the user.
|
||||
"""
|
||||
dialog = Gtk.Dialog(_('Jump to by Gramps ID'), self.uistate.window)
|
||||
dialog = Gtk.Dialog(title=_('Jump to by Gramps ID'),
|
||||
transient_for=self.uistate.window)
|
||||
dialog.set_border_width(12)
|
||||
label = Gtk.Label(label='<span weight="bold" size="larger">%s</span>' %
|
||||
_('Jump to by Gramps ID'))
|
||||
|
@ -459,7 +459,7 @@ class OrganizeTagsDialog(ManagedWindow):
|
||||
Create a dialog box to organize tags.
|
||||
"""
|
||||
# pylint: disable-msg=E1101
|
||||
top = Gtk.Dialog(parent=self.parent_window)
|
||||
top = Gtk.Dialog(transient_for=self.parent_window)
|
||||
top.vbox.set_spacing(5)
|
||||
label = Gtk.Label(label='<span size="larger" weight="bold">%s</span>'
|
||||
% _("Organize Tags"))
|
||||
@ -688,7 +688,7 @@ class EditTag(ManagedWindow):
|
||||
Create a dialog box to enter a new tag.
|
||||
"""
|
||||
# pylint: disable-msg=E1101
|
||||
top = Gtk.Dialog(parent=self.parent_window)
|
||||
top = Gtk.Dialog(transient_for=self.parent_window)
|
||||
top.vbox.set_spacing(5)
|
||||
|
||||
hbox = Gtk.Box()
|
||||
|
@ -630,13 +630,11 @@ class DetachedWindow(ManagedWindow):
|
||||
self.grampletbar = grampletbar
|
||||
self.gramplet = gramplet
|
||||
|
||||
ManagedWindow.__init__(self, gramplet.uistate, [],
|
||||
self.title)
|
||||
self.set_window(Gtk.Dialog("", gramplet.uistate.window,
|
||||
Gtk.DialogFlags.DESTROY_WITH_PARENT,
|
||||
(_('_Close'), Gtk.ResponseType.CLOSE)),
|
||||
None,
|
||||
self.title)
|
||||
ManagedWindow.__init__(self, gramplet.uistate, [], self.title)
|
||||
dlg = Gtk.Dialog(transient_for=gramplet.uistate.window,
|
||||
destroy_with_parent = True)
|
||||
dlg.add_button(_('_Close'), Gtk.ResponseType.CLOSE)
|
||||
self.set_window(dlg, None, self.title)
|
||||
self.window.move(x_pos, y_pos)
|
||||
self.window.set_default_size(gramplet.detached_width,
|
||||
gramplet.detached_height)
|
||||
@ -701,7 +699,8 @@ class DetachedWindow(ManagedWindow):
|
||||
self.gramplet.detached_width = size[0]
|
||||
self.gramplet.detached_height = size[1]
|
||||
self.gramplet.detached_window = None
|
||||
self.gramplet.reparent(self.grampletbar)
|
||||
self.notebook.remove(self.gramplet)
|
||||
self.grampletbar.add(self.gramplet)
|
||||
ManagedWindow.close(self, *args)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
@ -233,12 +233,11 @@ class GrampletWindow(ManagedWindow):
|
||||
self.docked_state = gramplet.gstate
|
||||
# Now detach it
|
||||
self.gramplet.set_state("detached")
|
||||
ManagedWindow.__init__(self, gramplet.uistate, [],
|
||||
self.title)
|
||||
self.set_window(Gtk.Dialog("", gramplet.uistate.window,
|
||||
Gtk.DialogFlags.DESTROY_WITH_PARENT,
|
||||
(_('_Close'), Gtk.ResponseType.CLOSE)),
|
||||
None, self.title)
|
||||
ManagedWindow.__init__(self, gramplet.uistate, [], self.title)
|
||||
dlg = Gtk.Dialog(transient_for=gramplet.uistate.window,
|
||||
destroy_with_parent=True)
|
||||
dlg.add_button(_('_Close'), Gtk.ResponseType.CLOSE)
|
||||
self.set_window(dlg, None, self.title)
|
||||
cfg_name = gramplet.gname.replace(' ', '').lower() + '-gramplet'
|
||||
self.setup_configs('interface.' + cfg_name,
|
||||
gramplet.detached_width, gramplet.detached_height)
|
||||
@ -246,7 +245,8 @@ class GrampletWindow(ManagedWindow):
|
||||
# add gramplet:
|
||||
if self.gramplet.pui:
|
||||
self.gramplet.pui.active = True
|
||||
self.gramplet.mainframe.reparent(self.window.vbox)
|
||||
self.gramplet.mainframe.get_parent().remove(self.gramplet.mainframe)
|
||||
self.window.vbox.add(self.gramplet.mainframe)
|
||||
self.window.connect('response', self.handle_response)
|
||||
self.show()
|
||||
# After we show, then we hide:
|
||||
@ -310,7 +310,8 @@ class GrampletWindow(ManagedWindow):
|
||||
expand = self.gramplet.gstate == "maximized" and self.gramplet.expand
|
||||
column = pane.columns[col]
|
||||
parent = self.gramplet.pane.get_column_frame(self.gramplet.column)
|
||||
self.gramplet.mainframe.reparent(parent)
|
||||
self.gramplet.mainframe.get_parent().remove(self.gramplet.mainframe)
|
||||
parent.add(self.gramplet.mainframe)
|
||||
if self.gramplet.pui:
|
||||
self.gramplet.pui.active = self.gramplet.pane.pageview.active
|
||||
for gframe in stack:
|
||||
|
@ -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)
|
||||
|
||||
@ -138,7 +138,10 @@ class LinkLabel(Gtk.EventBox):
|
||||
self.connect('realize', realize_cb)
|
||||
|
||||
def set_padding(self, x, y):
|
||||
self.label.set_padding(x, y)
|
||||
self.label.set_margin_start(x)
|
||||
self.label.set_margin_end(x)
|
||||
self.label.set_margin_top(x)
|
||||
self.label.set_margin_bottom(x)
|
||||
|
||||
def enter_text(self, obj, event, handle):
|
||||
if self.emph:
|
||||
@ -205,20 +208,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 +236,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()
|
||||
|
@ -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
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -84,7 +84,6 @@ class Photo(Gtk.EventBox):
|
||||
elif is_right_click(event):
|
||||
if self.handle and self.uistate:
|
||||
self.menu = Gtk.Menu()
|
||||
self.menu.set_title(_("Media Object"))
|
||||
add_menuitem(self.menu, _("Make Active Media"), widget,
|
||||
lambda obj: self.uistate.set_active(self.handle, "Media"))
|
||||
self.menu.popup(None, None, None, None, event.button, event.time)
|
||||
|
@ -26,7 +26,7 @@
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gdk
|
||||
from gi.repository import GdkPixbuf
|
||||
from gi.repository import GObject
|
||||
from gi.repository import GLib, GObject
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -305,7 +305,7 @@ class SelectionWidget(Gtk.ScrolledWindow):
|
||||
viewport_size.height)
|
||||
self._rescale()
|
||||
self.loaded = True
|
||||
except (GObject.GError, OSError):
|
||||
except (GLib.GError, OSError):
|
||||
self.show_missing()
|
||||
|
||||
def show_missing(self):
|
||||
|
@ -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)
|
||||
@ -940,6 +942,8 @@ VALIDATION_ICON_WIDTH = 16
|
||||
MANDATORY_ICON = 'dialog-information'
|
||||
ERROR_ICON = 'process-stop'
|
||||
DELAY_TIME = 2500
|
||||
READWRITE = (GObject.PARAM_READWRITE if GLib.check_version(2, 42, 0) else
|
||||
GObject.ParamFlags.READWRITE)
|
||||
|
||||
class ValidatableMaskedEntry(MaskedEntry):
|
||||
"""
|
||||
@ -969,12 +973,12 @@ class ValidatableMaskedEntry(MaskedEntry):
|
||||
'data-type': (GObject.TYPE_PYOBJECT,
|
||||
'Data Type of the widget',
|
||||
'Type object',
|
||||
GObject.PARAM_READWRITE),
|
||||
READWRITE),
|
||||
'mandatory': (GObject.TYPE_BOOLEAN,
|
||||
'Mandatory',
|
||||
'Mandatory',
|
||||
False,
|
||||
GObject.PARAM_READWRITE),
|
||||
READWRITE),
|
||||
}
|
||||
|
||||
# FIXME put the data type support back
|
||||
|
@ -139,7 +139,6 @@ class GeoEvents(Gramplet, DbGUIElement):
|
||||
"""
|
||||
self.menu = Gtk.Menu()
|
||||
menu = self.menu
|
||||
menu.set_title(_('Edit'))
|
||||
title = _('Edit the event')
|
||||
add_item = Gtk.MenuItem(label=title)
|
||||
add_item.connect("activate", self.edit_event, treeview)
|
||||
|
@ -70,7 +70,7 @@ class FanChart2WayGramplet(FanChart2WayGrampsGUI, Gramplet):
|
||||
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_with_viewport(self.fan)
|
||||
self.gui.get_container_widget().add(self.fan)
|
||||
# Make sure it is visible:
|
||||
self.fan.show()
|
||||
|
||||
|
@ -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(
|
||||
"<span size='large' weight='bold'>%s</span>" %
|
||||
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("<span font='sans 4'> </span>")
|
||||
label.set_selectable(True)
|
||||
label.show()
|
||||
self.grid.add(label)
|
||||
|
@ -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("<span size='large' weight='bold'>%s</span>" %
|
||||
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("<span font='sans 4'> </span>")
|
||||
label.set_selectable(True)
|
||||
label.show()
|
||||
self.grid.add(label)
|
||||
|
@ -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(
|
||||
"<span size='large' weight='bold'>%s</span>" %
|
||||
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("<span font='sans 4'> </span>")
|
||||
label.set_selectable(True)
|
||||
label.show()
|
||||
self.grid.add(label)
|
||||
|
@ -405,7 +405,6 @@ class GeoGraphyView(OsmGps, NavigationView):
|
||||
|
||||
self.changemap = Gtk.Menu()
|
||||
changemap = self.changemap
|
||||
changemap.set_title(title)
|
||||
changemap.show()
|
||||
add_item.set_submenu(changemap)
|
||||
# show in the map menu all available providers
|
||||
@ -885,7 +884,6 @@ class GeoGraphyView(OsmGps, NavigationView):
|
||||
menu.append(add_item)
|
||||
self.itemoption = Gtk.Menu()
|
||||
itemoption = self.itemoption
|
||||
itemoption.set_title(message)
|
||||
itemoption.show()
|
||||
add_item.set_submenu(itemoption)
|
||||
modify = Gtk.MenuItem(label=_("Edit Place"))
|
||||
@ -990,11 +988,11 @@ class GeoGraphyView(OsmGps, NavigationView):
|
||||
filtering = Gtk.FileFilter()
|
||||
filtering.add_pattern("*.kml")
|
||||
kml = Gtk.FileChooserDialog(
|
||||
_("Select a kml file used to add places"),
|
||||
title=_("Select a kml file used to add places"),
|
||||
action=Gtk.FileChooserAction.OPEN,
|
||||
parent=self.uistate.window,
|
||||
buttons=(_('_Cancel'), Gtk.ResponseType.CANCEL,
|
||||
_('_Apply'), Gtk.ResponseType.OK))
|
||||
transient_for=self.uistate.window)
|
||||
kml.add_buttons(_('_Cancel'), Gtk.ResponseType.CANCEL,
|
||||
_('_Apply'), Gtk.ResponseType.OK)
|
||||
mpath = HOME_DIR
|
||||
kml.set_current_folder(os.path.dirname(mpath))
|
||||
kml.set_filter(filtering)
|
||||
@ -1286,13 +1284,11 @@ class GeoGraphyView(OsmGps, NavigationView):
|
||||
"""
|
||||
dummy_obj = obj
|
||||
selected_dir = Gtk.FileChooserDialog(
|
||||
_("Select tile cache directory for offline mode"),
|
||||
title=_("Select tile cache directory for offline mode"),
|
||||
action=Gtk.FileChooserAction.SELECT_FOLDER,
|
||||
parent=self.uistate.window,
|
||||
buttons=(_('_Cancel'),
|
||||
Gtk.ResponseType.CANCEL,
|
||||
_('_Apply'),
|
||||
Gtk.ResponseType.OK))
|
||||
transient_for=self.uistate.window)
|
||||
selected_dir.add_buttons(_('_Cancel'), Gtk.ResponseType.CANCEL,
|
||||
_('_Apply'), Gtk.ResponseType.OK)
|
||||
mpath = config.get('geography.path')
|
||||
if not mpath:
|
||||
mpath = HOME_DIR
|
||||
|
@ -115,10 +115,10 @@ class PlaceSelection(ManagedWindow, OsmGps):
|
||||
self.selection_layer = layer
|
||||
self.layer = layer
|
||||
self.warning = False
|
||||
self.set_window(
|
||||
Gtk.Dialog(_('Place Selection in a region'), uistate.window,
|
||||
buttons=(_('_Close'), Gtk.ResponseType.CLOSE)),
|
||||
None, _('Place Selection in a region'), None)
|
||||
dlg = Gtk.Dialog(title=_('Place Selection in a region'),
|
||||
transient_for=uistate.window)
|
||||
dlg.add_button(_('_Close'), Gtk.ResponseType.CLOSE)
|
||||
self.set_window(dlg, None, _('Place Selection in a region'), None)
|
||||
mylabel = _('Choose the radius of the selection.\n'
|
||||
'On the map you should see a circle or an'
|
||||
' oval depending on the latitude.')
|
||||
@ -139,11 +139,11 @@ class PlaceSelection(ManagedWindow, OsmGps):
|
||||
slider.connect('value-changed', self.slider_change, self.lat, self.lon)
|
||||
self.window.vbox.pack_start(slider, False, True, 0)
|
||||
self.vadjust = Gtk.Adjustment(page_size=15)
|
||||
self.scroll = Gtk.ScrolledWindow(self.vadjust)
|
||||
self.scroll = Gtk.ScrolledWindow(vadjustment=self.vadjust)
|
||||
self.scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
|
||||
self.scroll.set_shadow_type(Gtk.ShadowType.IN)
|
||||
self.plist = Gtk.ListStore(str, str, str, str, str)
|
||||
self.choices = Gtk.TreeView(self.plist)
|
||||
self.choices = Gtk.TreeView(model=self.plist)
|
||||
self.scroll.add(self.choices)
|
||||
self.renderer = Gtk.CellRendererText()
|
||||
self.tvcol1 = Gtk.TreeViewColumn(_('Country'), self.renderer, markup=0)
|
||||
|
@ -775,10 +775,10 @@ class CheckIntegrity:
|
||||
'kept')
|
||||
|
||||
fs_top = Gtk.FileChooserDialog(
|
||||
"%s - Gramps" % _("Select file"),
|
||||
parent=self.parent_window,
|
||||
buttons=(_('_Cancel'), Gtk.ResponseType.CANCEL,
|
||||
_('_OK'), Gtk.ResponseType.OK))
|
||||
title="%s - Gramps" % _("Select file"),
|
||||
transient_for=self.parent_window)
|
||||
fs_top.add_buttons(_('_Cancel'), Gtk.ResponseType.CANCEL,
|
||||
_('_OK'), Gtk.ResponseType.OK)
|
||||
fs_top.set_current_folder(self.last_img_dir)
|
||||
response = fs_top.run()
|
||||
if response == Gtk.ResponseType.OK:
|
||||
|
@ -393,12 +393,10 @@ class EventComparisonResults(ManagedWindow):
|
||||
|
||||
def on_write_table(self, obj):
|
||||
f = Gtk.FileChooserDialog(_("Select filename"),
|
||||
parent=self.window,
|
||||
action=Gtk.FileChooserAction.SAVE,
|
||||
buttons=(_('_Cancel'),
|
||||
Gtk.ResponseType.CANCEL,
|
||||
_('_Save'),
|
||||
Gtk.ResponseType.OK))
|
||||
transient_for=self.window,
|
||||
action=Gtk.FileChooserAction.SAVE)
|
||||
f.add_buttons(_('_Cancel'), Gtk.ResponseType.CANCEL,
|
||||
_('_Save'), Gtk.ResponseType.OK)
|
||||
|
||||
f.set_current_folder(get_curr_dir())
|
||||
status = f.run()
|
||||
|
@ -84,15 +84,16 @@ class PopulateSources(tool.Tool, ManagedWindow):
|
||||
num_citations = self.options.handler.options_dict['citations']
|
||||
|
||||
# GUI setup:
|
||||
dialog = Gtk.Dialog("Populate sources and citations tool",
|
||||
self.uistate.window,
|
||||
Gtk.DialogFlags.MODAL|Gtk.DialogFlags.DESTROY_WITH_PARENT,
|
||||
(_('_Cancel'), Gtk.ResponseType.REJECT,
|
||||
_('_OK'), Gtk.ResponseType.ACCEPT))
|
||||
label = Gtk.Label("Enter a valid number of sources and citations."
|
||||
" This will create the requested number of sources,"
|
||||
" and for each source, will create the requested"
|
||||
" number of citations.")
|
||||
dialog = Gtk.Dialog(title="Populate sources and citations tool",
|
||||
transient_for=self.uistate.window,
|
||||
modal=True, destroy_with_parent=True)
|
||||
dialog.add_buttons(_('_Cancel'), Gtk.ResponseType.REJECT,
|
||||
_('_OK'), Gtk.ResponseType.ACCEPT)
|
||||
label = Gtk.Label(
|
||||
label="Enter a valid number of sources and citations."
|
||||
" This will create the requested number of sources,"
|
||||
" and for each source, will create the requested"
|
||||
" number of citations.")
|
||||
label.set_line_wrap(True)
|
||||
|
||||
hbox1 = Gtk.Box()
|
||||
|
@ -272,7 +272,7 @@ class TestcaseGenerator(tool.BatchTool):
|
||||
|
||||
def init_gui(self, uistate):
|
||||
title = "%s - Gramps" % _("Generate testcases")
|
||||
self.top = Gtk.Dialog(title, parent=uistate.window)
|
||||
self.top = Gtk.Dialog(title=title, transient_for=uistate.window)
|
||||
self.window = uistate.window
|
||||
self.top.set_default_size(400, 150)
|
||||
self.top.vbox.set_spacing(5)
|
||||
|
@ -135,7 +135,7 @@ class FanChart2WayView(fanchart2way.FanChart2WayGrampsGUI, NavigationView):
|
||||
self.scrolledwindow.set_policy(Gtk.PolicyType.AUTOMATIC,
|
||||
Gtk.PolicyType.AUTOMATIC)
|
||||
self.fan.show_all()
|
||||
self.scrolledwindow.add_with_viewport(self.fan)
|
||||
self.scrolledwindow.add(self.fan)
|
||||
|
||||
return self.scrolledwindow
|
||||
|
||||
@ -573,9 +573,9 @@ class CairoPrintSave():
|
||||
(typically evince not installed)!
|
||||
"""
|
||||
dummy_preview = preview
|
||||
dlg = Gtk.MessageDialog(parent,
|
||||
flags=Gtk.DialogFlags.MODAL,
|
||||
type=Gtk.MessageType.WARNING,
|
||||
dlg = Gtk.MessageDialog(transient_for=parent,
|
||||
modal=True,
|
||||
message_type=Gtk.MessageType.WARNING,
|
||||
buttons=Gtk.ButtonsType.CLOSE,
|
||||
message_format=_('No preview available'))
|
||||
self.preview = dlg
|
||||
|
@ -561,9 +561,9 @@ class CairoPrintSave:
|
||||
(typically evince not installed)!
|
||||
"""
|
||||
dummy_preview = preview
|
||||
dlg = Gtk.MessageDialog(parent,
|
||||
flags=Gtk.DialogFlags.MODAL,
|
||||
type=Gtk.MessageType.WARNING,
|
||||
dlg = Gtk.MessageDialog(transient_for=parent,
|
||||
modal=True,
|
||||
message_type=Gtk.MessageType.WARNING,
|
||||
buttons=Gtk.ButtonsType.CLOSE,
|
||||
message_format=_('No preview available'))
|
||||
self.preview = dlg
|
||||
|
@ -659,9 +659,9 @@ class CairoPrintSave:
|
||||
(typically evince not installed)!
|
||||
"""
|
||||
dummy_preview = preview
|
||||
dlg = Gtk.MessageDialog(parent,
|
||||
flags=Gtk.DialogFlags.MODAL,
|
||||
type=Gtk.MessageType.WARNING,
|
||||
dlg = Gtk.MessageDialog(transient_for=parent,
|
||||
modal=True,
|
||||
message_type=Gtk.MessageType.WARNING,
|
||||
buttons=Gtk.ButtonsType.CLOSE,
|
||||
message_format=_('No preview available'))
|
||||
self.preview = dlg
|
||||
|
@ -568,7 +568,6 @@ class GeoClose(GeoGraphyView):
|
||||
"""
|
||||
self.newmenu = Gtk.Menu()
|
||||
menu = self.newmenu
|
||||
menu.set_title("person")
|
||||
events = []
|
||||
message = ""
|
||||
oldplace = ""
|
||||
@ -613,7 +612,6 @@ class GeoClose(GeoGraphyView):
|
||||
menu.append(add_item)
|
||||
self.itemoption = Gtk.Menu()
|
||||
itemoption = self.itemoption
|
||||
itemoption.set_title(message)
|
||||
itemoption.show()
|
||||
add_item.set_submenu(itemoption)
|
||||
modify = Gtk.MenuItem(label=_("Edit Event"))
|
||||
|
@ -379,7 +379,6 @@ class GeoEvents(GeoGraphyView):
|
||||
def bubble_message(self, event, lat, lon, marks):
|
||||
self.menu = Gtk.Menu()
|
||||
menu = self.menu
|
||||
menu.set_title("events")
|
||||
message = ""
|
||||
oldplace = ""
|
||||
prevmark = None
|
||||
@ -390,7 +389,6 @@ class GeoEvents(GeoGraphyView):
|
||||
menu.append(add_item)
|
||||
self.itemoption = Gtk.Menu()
|
||||
itemoption = self.itemoption
|
||||
itemoption.set_title(message)
|
||||
itemoption.show()
|
||||
add_item.set_submenu(itemoption)
|
||||
modify = Gtk.MenuItem(label=_("Edit Event"))
|
||||
@ -424,7 +422,6 @@ class GeoEvents(GeoGraphyView):
|
||||
menu.append(add_item)
|
||||
self.itemoption = Gtk.Menu()
|
||||
itemoption = self.itemoption
|
||||
itemoption.set_title(message)
|
||||
itemoption.show()
|
||||
add_item.set_submenu(itemoption)
|
||||
modify = Gtk.MenuItem(label=_("Edit Event"))
|
||||
@ -461,7 +458,6 @@ class GeoEvents(GeoGraphyView):
|
||||
menu.append(add_item)
|
||||
self.itemoption = Gtk.Menu()
|
||||
itemoption = self.itemoption
|
||||
itemoption.set_title(_("Centering on Place"))
|
||||
itemoption.show()
|
||||
add_item.set_submenu(itemoption)
|
||||
oldplace = ""
|
||||
|
@ -758,7 +758,6 @@ class GeoFamClose(GeoGraphyView):
|
||||
"""
|
||||
self.menu = Gtk.Menu()
|
||||
menu = self.menu
|
||||
menu.set_title("family")
|
||||
events = []
|
||||
message = ""
|
||||
oldplace = ""
|
||||
@ -802,7 +801,6 @@ class GeoFamClose(GeoGraphyView):
|
||||
menu.append(add_item)
|
||||
self.itemoption = Gtk.Menu()
|
||||
itemoption = self.itemoption
|
||||
itemoption.set_title(message)
|
||||
itemoption.show()
|
||||
add_item.set_submenu(itemoption)
|
||||
modify = Gtk.MenuItem(label=_("Edit Event"))
|
||||
|
@ -494,7 +494,6 @@ class GeoFamily(GeoGraphyView):
|
||||
"""
|
||||
self.menu = Gtk.Menu()
|
||||
menu = self.menu
|
||||
menu.set_title("family")
|
||||
message = ""
|
||||
oldplace = ""
|
||||
prevmark = None
|
||||
|
@ -637,7 +637,6 @@ class GeoMoves(GeoGraphyView):
|
||||
"""
|
||||
self.menu = Gtk.Menu()
|
||||
menu = self.menu
|
||||
menu.set_title("descendance")
|
||||
events = []
|
||||
message = ""
|
||||
oldplace = ""
|
||||
@ -680,7 +679,6 @@ class GeoMoves(GeoGraphyView):
|
||||
menu.append(add_item)
|
||||
self.itemoption = Gtk.Menu()
|
||||
itemoption = self.itemoption
|
||||
itemoption.set_title(message)
|
||||
itemoption.show()
|
||||
add_item.set_submenu(itemoption)
|
||||
modify = Gtk.MenuItem(label=_("Edit Event"))
|
||||
|
@ -485,7 +485,6 @@ class GeoPerson(GeoGraphyView):
|
||||
def bubble_message(self, event, lat, lon, marks):
|
||||
self.menu = Gtk.Menu()
|
||||
menu = self.menu
|
||||
menu.set_title("person")
|
||||
message = ""
|
||||
oldplace = ""
|
||||
prevmark = None
|
||||
@ -496,7 +495,6 @@ class GeoPerson(GeoGraphyView):
|
||||
menu.append(add_item)
|
||||
self.itemoption = Gtk.Menu()
|
||||
itemoption = self.itemoption
|
||||
itemoption.set_title(message)
|
||||
itemoption.show()
|
||||
message = ""
|
||||
add_item.set_submenu(itemoption)
|
||||
@ -517,7 +515,6 @@ class GeoPerson(GeoGraphyView):
|
||||
menu.append(add_item)
|
||||
self.itemoption = Gtk.Menu()
|
||||
itemoption = self.itemoption
|
||||
itemoption.set_title(message)
|
||||
itemoption.show()
|
||||
message = ""
|
||||
add_item.set_submenu(itemoption)
|
||||
@ -559,7 +556,6 @@ class GeoPerson(GeoGraphyView):
|
||||
menu.append(add_item)
|
||||
self.itemoption = Gtk.Menu()
|
||||
itemoption = self.itemoption
|
||||
itemoption.set_title(message)
|
||||
itemoption.show()
|
||||
add_item.set_submenu(itemoption)
|
||||
modify = Gtk.MenuItem(label=_("Edit Event"))
|
||||
|
@ -480,7 +480,6 @@ class GeoPlaces(GeoGraphyView):
|
||||
def bubble_message(self, event, lat, lon, marks):
|
||||
self.menu = Gtk.Menu()
|
||||
menu = self.menu
|
||||
menu.set_title("places")
|
||||
message = ""
|
||||
prevmark = None
|
||||
for mark in marks:
|
||||
@ -490,7 +489,6 @@ class GeoPlaces(GeoGraphyView):
|
||||
menu.append(add_item)
|
||||
self.itemoption = Gtk.Menu()
|
||||
itemoption = self.itemoption
|
||||
itemoption.set_title(message)
|
||||
itemoption.show()
|
||||
add_item.set_submenu(itemoption)
|
||||
modify = Gtk.MenuItem(label=_("Edit Place"))
|
||||
@ -516,7 +514,6 @@ class GeoPlaces(GeoGraphyView):
|
||||
menu.append(add_item)
|
||||
self.itemoption = Gtk.Menu()
|
||||
itemoption = self.itemoption
|
||||
itemoption.set_title(message)
|
||||
itemoption.show()
|
||||
add_item.set_submenu(itemoption)
|
||||
modify = Gtk.MenuItem(label=_("Edit Place"))
|
||||
@ -553,7 +550,6 @@ class GeoPlaces(GeoGraphyView):
|
||||
menu.append(add_item)
|
||||
self.itemoption = Gtk.Menu()
|
||||
itemoption = self.itemoption
|
||||
itemoption.set_title(_("Centering on Place"))
|
||||
itemoption.show()
|
||||
add_item.set_submenu(itemoption)
|
||||
oldplace = ""
|
||||
|
@ -1196,7 +1196,7 @@ class RelationshipView(NavigationView):
|
||||
label = widgets.MarkupLabel(format % escape(title),
|
||||
halign=Gtk.Align.END)
|
||||
if self._config.get('preferences.releditbtn'):
|
||||
label.set_padding(0, 5)
|
||||
label.set_margin_end(5)
|
||||
|
||||
eventbox = Gtk.EventBox()
|
||||
if handle is not None:
|
||||
@ -1286,7 +1286,7 @@ class RelationshipView(NavigationView):
|
||||
lbl = widgets.MarkupLabel(format % escape(title),
|
||||
halign=Gtk.Align.END)
|
||||
if self._config.get('preferences.releditbtn'):
|
||||
lbl.set_padding(0, 5)
|
||||
lbl.set_margin_end(5)
|
||||
return lbl
|
||||
|
||||
def write_child(self, vbox, handle, index, child_should_be_linked):
|
||||
@ -1333,6 +1333,7 @@ class RelationshipView(NavigationView):
|
||||
link_label = widgets.LinkLabel(name, link_func, handle, emph,
|
||||
theme=self.theme)
|
||||
link_label.set_padding(3, 0)
|
||||
|
||||
if child_should_be_linked and self._config.get(
|
||||
'preferences.releditbtn'):
|
||||
button = widgets.IconButton(self.edit_button_press, handle)
|
||||
@ -1354,7 +1355,7 @@ class RelationshipView(NavigationView):
|
||||
value = self.info_string(handle)
|
||||
if value:
|
||||
l = widgets.MarkupLabel(value)
|
||||
l.set_padding(48, 0)
|
||||
l.set_margin_start(48)
|
||||
vbox.add(l)
|
||||
|
||||
def write_data(self, box, title, start_col=_SDATA_START,
|
||||
|
Loading…
Reference in New Issue
Block a user