diff --git a/gramps/gui/configure.py b/gramps/gui/configure.py index 4e0f5f217..97808be49 100644 --- a/gramps/gui/configure.py +++ b/gramps/gui/configure.py @@ -105,7 +105,7 @@ class DisplayNameEditor(ManagedWindow): Gtk.Dialog(_('Display Name Editor'), buttons=(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)), None, _('Display Name Editor'), None) - table = self.dialog._build_custom_name_ui() + grid = self.dialog._build_custom_name_ui() label = Gtk.Label(label=_("""The following keywords are replaced with the appropriate name parts: Given - given name (first name) Surname - surnames (with prefix and connectors) @@ -128,7 +128,7 @@ UPPERCASE keyword forces uppercase. Extra parentheses, commas are removed. Other """)) label.set_use_markup(True) self.window.vbox.pack_start(label, False, True, 0) - self.window.vbox.pack_start(table, True, True, 0) + self.window.vbox.pack_start(grid, True, True, 0) self.window.set_default_size(600, 550) self.window.connect('response', self.close) self.show() @@ -287,7 +287,7 @@ class ConfigureDialog(ManagedWindow): """ self.__config.set(constant, int(obj.get_value())) - def add_checkbox(self, table, label, index, constant, start=1, stop=9, + def add_checkbox(self, grid, label, index, constant, start=1, stop=9, config=None, extra_callback=None): if not config: config = self.__config @@ -296,10 +296,10 @@ class ConfigureDialog(ManagedWindow): checkbox.connect('toggled', self.update_checkbox, constant, config) if extra_callback: checkbox.connect('toggled', extra_callback) - table.attach(checkbox, start, stop, index, index+1, yoptions=0) + grid.attach(checkbox, start, index, stop - start, 1) return checkbox - def add_radiobox(self, table, label, index, constant, group, column, + def add_radiobox(self, grid, label, index, constant, group, column, config=None): if not config: config = self.__config @@ -307,19 +307,19 @@ class ConfigureDialog(ManagedWindow): if config.get(constant) == True: radiobox.set_active(True) radiobox.connect('toggled', self.update_radiobox, constant) - table.attach(radiobox, column, column+1, index, index+1, yoptions=0) + grid.attach(radiobox, column, index, 1, 1) return radiobox - def add_text(self, table, label, index, config=None, line_wrap=True): + def add_text(self, grid, label, index, config=None, line_wrap=True): if not config: config = self.__config text = Gtk.Label() text.set_line_wrap(line_wrap) text.set_alignment(0.,0.) text.set_text(label) - table.attach(text, 1, 9, index, index+1, yoptions=Gtk.AttachOptions.SHRINK) + grid.attach(text, 1, index, 8, 1) - def add_path_box(self, table, label, index, entry, path, callback_label, + def add_path_box(self, grid, label, index, entry, path, callback_label, callback_sel, config=None): """ Add an entry to give in path and a select button to open a dialog. @@ -341,11 +341,11 @@ class ConfigureDialog(ManagedWindow): btn.add(image) hbox.pack_start(entry, True, True, 0) hbox.pack_start(btn, False, False, 0) - table.attach(lwidget, 1, 2, index, index+1, yoptions=0, - xoptions=Gtk.AttachOptions.FILL) - table.attach(hbox, 2, 3, index, index+1, yoptions=0) + hbox.set_hexpand(True) + grid.attach(lwidget, 1, index, 1, 1) + grid.attach(hbox, 2, index, 1, 1) - def add_entry(self, table, label, index, constant, callback=None, + def add_entry(self, grid, label, index, constant, callback=None, config=None, col_attach=0): if not config: config = self.__config @@ -356,15 +356,15 @@ class ConfigureDialog(ManagedWindow): entry = Gtk.Entry() entry.set_text(config.get(constant)) entry.connect('changed', callback, constant) + entry.set_hexpand(True) if label: - table.attach(lwidget, col_attach, col_attach+1, index, index+1, yoptions=0, - xoptions=Gtk.AttachOptions.FILL) - table.attach(entry, col_attach+1, col_attach+2, index, index+1, yoptions=0) + grid.attach(lwidget, col_attach, index, 1, 1) + grid.attach(entry, col_attach+1, index, 1, 1) else: - table.attach(entry, col_attach, col_attach+1, index, index+1, yoptions=0) + grid.attach(entry, col_attach, index, 1, 1) return entry - def add_pos_int_entry(self, table, label, index, constant, callback=None, + def add_pos_int_entry(self, grid, label, index, constant, callback=None, config=None, col_attach=1, helptext=''): """ entry field for positive integers """ @@ -374,14 +374,13 @@ class ConfigureDialog(ManagedWindow): entry = Gtk.Entry() entry.set_text(str(config.get(constant))) entry.set_tooltip_markup(helptext) + entry.set_hexpand(True) if callback: entry.connect('changed', callback, constant) - table.attach(lwidget, col_attach, col_attach+1, index, index+1, - yoptions=0, xoptions=Gtk.AttachOptions.FILL) - table.attach(entry, col_attach+1, col_attach+2, index, index+1, - yoptions=0) + grid.attach(lwidget, col_attach, index, 1, 1) + grid.attach(entry, col_attach+1, index, 1, 1) - def add_color(self, table, label, index, constant, config=None, col=0): + def add_color(self, grid, label, index, constant, config=None, col=0): if not config: config = self.__config lwidget = BasicLabel("%s: " % label) @@ -389,14 +388,14 @@ class ConfigureDialog(ManagedWindow): color = Gdk.color_parse(hexval) entry = Gtk.ColorButton(color=color) color_hex_label = BasicLabel(hexval) + color_hex_label.set_hexpand(True) entry.connect('color-set', self.update_color, constant, color_hex_label) - table.attach(lwidget, col, col+1, index, index+1, yoptions=0, - xoptions=Gtk.AttachOptions.FILL) - table.attach(entry, col+1, col+2, index, index+1, yoptions=0, xoptions=0) - table.attach(color_hex_label, col+2, col+3, index, index+1, yoptions=0) + grid.attach(lwidget, col, index, 1, 1) + grid.attach(entry, col+1, index, 1, 1) + grid.attach(color_hex_label, col+2, index, 1, 1) return entry - def add_combo(self, table, label, index, constant, opts, callback=None, + def add_combo(self, grid, label, index, constant, opts, callback=None, config=None, valueactive=False, setactive=None): """ A drop-down list allowing selection from a number of fixed options. @@ -431,12 +430,12 @@ class ConfigureDialog(ManagedWindow): else: combo.set_active(setactive) combo.connect('changed', callback, constant) - table.attach(lwidget, 1, 2, index, index+1, yoptions=0, - xoptions=Gtk.AttachOptions.FILL) - table.attach(combo, 2, 3, index, index+1, yoptions=0) + combo.set_hexpand(True) + grid.attach(lwidget, 1, index, 1, 1) + grid.attach(combo, 2, index, 1, 1) return combo - def add_slider(self, table, label, index, constant, range, callback=None, + def add_slider(self, grid, label, index, constant, range, callback=None, config=None): """ A slider allowing the selection of an integer within a specified range. @@ -452,12 +451,11 @@ class ConfigureDialog(ManagedWindow): slider.set_digits(0) slider.set_value_pos(Gtk.PositionType.BOTTOM) slider.connect('value-changed', callback, constant) - table.attach(lwidget, 1, 2, index, index+1, yoptions=0, - xoptions=Gtk.AttachOptions.FILL) - table.attach(slider, 2, 3, index, index+1, yoptions=0) + grid.attach(lwidget, 1, index, 1, 1) + grid.attach(slider, 2, index, 1, 1) return slider - def add_spinner(self, table, label, index, constant, range, callback=None, + def add_spinner(self, grid, label, index, constant, range, callback=None, config=None): """ A spinner allowing the selection of an integer within a specified range. @@ -471,9 +469,9 @@ class ConfigureDialog(ManagedWindow): adj = Gtk.Adjustment(config.get(constant), range[0], range[1], 1, 0, 0) spinner = Gtk.SpinButton(adjustment=adj, climb_rate=0.0, digits=0) spinner.connect('value-changed', callback, constant) - table.attach(lwidget, 1, 2, index, index+1, yoptions=0, - xoptions=Gtk.AttachOptions.FILL) - table.attach(spinner, 2, 3, index, index+1, yoptions=0) + spinner.set_hexpand(True) + grid.attach(lwidget, 1, index, 1, 1) + grid.attach(spinner, 2, index, 1, 1) return spinner #------------------------------------------------------------------------- @@ -500,115 +498,118 @@ class GrampsPreferences(ConfigureDialog): on_close=update_constants) def add_researcher_panel(self, configdialog): - table = Gtk.Table(n_rows=3, n_columns=8) - table.set_border_width(12) - table.set_col_spacings(6) - table.set_row_spacings(6) - self.add_text(table, _('Enter your information so people can contact you when you' + grid = Gtk.Grid() + grid.set_border_width(12) + grid.set_column_spacing(6) + grid.set_row_spacing(6) + self.add_text(grid, _('Enter your information so people can contact you when you' ' distribute your Family Tree'), 0, line_wrap=False) - self.add_entry(table, _('Name'), 1, 'researcher.researcher-name') - self.add_entry(table, _('Address'), 2, 'researcher.researcher-addr') - self.add_entry(table, _('Locality'), 3, 'researcher.researcher-locality') - self.add_entry(table, _('City'), 4, 'researcher.researcher-city') - self.add_entry(table, _('State/County'), 5, 'researcher.researcher-state') - self.add_entry(table, _('Country'), 6, 'researcher.researcher-country') - self.add_entry(table, _('ZIP/Postal Code'), 7, 'researcher.researcher-postal') - self.add_entry(table, _('Phone'), 8, 'researcher.researcher-phone') - self.add_entry(table, _('Email'), 9, 'researcher.researcher-email') - return _('Researcher'), table + self.add_entry(grid, _('Name'), 1, 'researcher.researcher-name') + self.add_entry(grid, _('Address'), 2, 'researcher.researcher-addr') + self.add_entry(grid, _('Locality'), 3, 'researcher.researcher-locality') + self.add_entry(grid, _('City'), 4, 'researcher.researcher-city') + self.add_entry(grid, _('State/County'), 5, 'researcher.researcher-state') + self.add_entry(grid, _('Country'), 6, 'researcher.researcher-country') + self.add_entry(grid, _('ZIP/Postal Code'), 7, 'researcher.researcher-postal') + self.add_entry(grid, _('Phone'), 8, 'researcher.researcher-phone') + self.add_entry(grid, _('Email'), 9, 'researcher.researcher-email') + return _('Researcher'), grid def add_prefix_panel(self, configdialog): """ Add the ID prefix tab to the preferences. """ - table = Gtk.Table(n_rows=3, n_columns=8) - table.set_border_width(12) - table.set_col_spacings(6) - table.set_row_spacings(6) - self.add_entry(table, _('Person'), 0, 'preferences.iprefix', + grid = Gtk.Grid() + grid.set_border_width(12) + grid.set_column_spacing(6) + grid.set_row_spacing(6) + self.add_entry(grid, _('Person'), 0, 'preferences.iprefix', self.update_idformat_entry) - self.add_entry(table, _('Family'), 1, 'preferences.fprefix', + self.add_entry(grid, _('Family'), 1, 'preferences.fprefix', self.update_idformat_entry) - self.add_entry(table, _('Place'), 2, 'preferences.pprefix', + self.add_entry(grid, _('Place'), 2, 'preferences.pprefix', self.update_idformat_entry) - self.add_entry(table, _('Source'), 3, 'preferences.sprefix', + self.add_entry(grid, _('Source'), 3, 'preferences.sprefix', self.update_idformat_entry) - self.add_entry(table, _('Citation'), 4, 'preferences.cprefix', + self.add_entry(grid, _('Citation'), 4, 'preferences.cprefix', self.update_idformat_entry) - self.add_entry(table, _('Media Object'), 5, 'preferences.oprefix', + self.add_entry(grid, _('Media Object'), 5, 'preferences.oprefix', self.update_idformat_entry) - self.add_entry(table, _('Event'), 6, 'preferences.eprefix', + self.add_entry(grid, _('Event'), 6, 'preferences.eprefix', self.update_idformat_entry) - self.add_entry(table, _('Repository'), 7, 'preferences.rprefix', + self.add_entry(grid, _('Repository'), 7, 'preferences.rprefix', self.update_idformat_entry) - self.add_entry(table, _('Note'), 8, 'preferences.nprefix', + self.add_entry(grid, _('Note'), 8, 'preferences.nprefix', self.update_idformat_entry) - return _('ID Formats'), table + return _('ID Formats'), grid def add_color_panel(self, configdialog): """ Add the tab to set defaults colors for graph boxes """ - table = Gtk.Table(n_rows=17, n_columns=8) - self.add_text(table, _('Set the colors used for boxes in the graphical views'), + grid = Gtk.Grid() + grid.set_border_width(12) + grid.set_column_spacing(6) + grid.set_row_spacing(6) + self.add_text(grid, _('Set the colors used for boxes in the graphical views'), 0, line_wrap=False) - self.add_color(table, _('Gender Male Alive'), 1, + self.add_color(grid, _('Gender Male Alive'), 1, 'preferences.color-gender-male-alive') - self.add_color(table, _('Border Male Alive'), 2, + self.add_color(grid, _('Border Male Alive'), 2, 'preferences.bordercolor-gender-male-alive') - self.add_color(table, _('Gender Male Death'), 3, + self.add_color(grid, _('Gender Male Death'), 3, 'preferences.color-gender-male-death') - self.add_color(table, _('Border Male Death'), 4, + self.add_color(grid, _('Border Male Death'), 4, 'preferences.bordercolor-gender-male-death') - self.add_color(table, _('Gender Female Alive'), 1, + self.add_color(grid, _('Gender Female Alive'), 1, 'preferences.color-gender-female-alive', col=4) - self.add_color(table, _('Border Female Alive'), 2, + self.add_color(grid, _('Border Female Alive'), 2, 'preferences.bordercolor-gender-female-alive', col=4) - self.add_color(table, _('Gender Female Death'), 3, + self.add_color(grid, _('Gender Female Death'), 3, 'preferences.color-gender-female-death', col=4) - self.add_color(table, _('Border Female Death'), 4, + self.add_color(grid, _('Border Female Death'), 4, 'preferences.bordercolor-gender-female-death', col=4) -## self.add_color(table, _('Gender Other Alive'), 5, +## self.add_color(grid, _('Gender Other Alive'), 5, ## 'preferences.color-gender-other-alive') -## self.add_color(table, _('Border Other Alive'), 6, +## self.add_color(grid, _('Border Other Alive'), 6, ## 'preferences.bordercolor-gender-other-alive') -## self.add_color(table, _('Gender Other Death'), 7, +## self.add_color(grid, _('Gender Other Death'), 7, ## 'preferences.color-gender-other-death') -## self.add_color(table, _('Border Other Death'), 8, +## self.add_color(grid, _('Border Other Death'), 8, ## 'preferences.bordercolor-gender-other-death') - self.add_color(table, _('Gender Unknown Alive'), 5, + self.add_color(grid, _('Gender Unknown Alive'), 5, 'preferences.color-gender-unknown-alive', col=4) - self.add_color(table, _('Border Unknown Alive'), 6, + self.add_color(grid, _('Border Unknown Alive'), 6, 'preferences.bordercolor-gender-unknown-alive', col=4) - self.add_color(table, _('Gender Unknown Death'), 7, + self.add_color(grid, _('Gender Unknown Death'), 7, 'preferences.color-gender-unknown-death', col=4) - self.add_color(table, _('Border Unknown Death'), 8, + self.add_color(grid, _('Border Unknown Death'), 8, 'preferences.bordercolor-gender-unknown-death', col=4) - return _('Colors'), table + return _('Colors'), grid def add_advanced_panel(self, configdialog): - table = Gtk.Table(n_rows=4, n_columns=8) - table.set_border_width(12) - table.set_col_spacings(6) - table.set_row_spacings(6) + grid = Gtk.Grid() + grid.set_border_width(12) + grid.set_column_spacing(6) + grid.set_row_spacing(6) self.add_checkbox( - table, _('Suppress warning when adding parents to a child.'), + grid, _('Suppress warning when adding parents to a child.'), 0, 'preferences.family-warn') self.add_checkbox( - table, _('Suppress warning when canceling with changed data.'), + grid, _('Suppress warning when canceling with changed data.'), 1, 'interface.dont-ask') self.add_checkbox( - table, _('Suppress warning about missing researcher when' + grid, _('Suppress warning about missing researcher when' ' exporting to GEDCOM.'), 2, 'behavior.owner-warn') self.add_checkbox( - table, _('Show plugin status dialog on plugin load error.'), + grid, _('Show plugin status dialog on plugin load error.'), 3, 'behavior.pop-plugin-status') - return _('Warnings'), table + return _('Warnings'), grid def _build_name_format_model(self, active): """ @@ -801,10 +802,10 @@ class GrampsPreferences(ConfigureDialog): UI to manage the custom name formats """ - table = Gtk.Table(n_rows=2, n_columns=3) - table.set_border_width(6) - table.set_col_spacings(6) - table.set_row_spacings(6) + grid = Gtk.Grid() + grid.set_border_width(6) + grid.set_column_spacing(6) + grid.set_row_spacing(6) # make a treeview for listing all the name formats format_tree = Gtk.TreeView(self.fmt_model) @@ -832,7 +833,9 @@ class GrampsPreferences(ConfigureDialog): format_sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) format_sw.add(format_tree) format_sw.set_shadow_type(Gtk.ShadowType.IN) - table.attach(format_sw, 0, 3, 0, 1, yoptions=Gtk.AttachOptions.FILL|Gtk.AttachOptions.EXPAND) + format_sw.set_hexpand(True) + format_sw.set_vexpand(True) + grid.attach(format_sw, 0, 0, 3, 1) # to hold the values of the selected row of the tree and the iter self.selected_fmt = () @@ -849,12 +852,12 @@ class GrampsPreferences(ConfigureDialog): self.remove_button.connect('clicked', self.cb_del_fmt_str) self.remove_button.set_sensitive(False) - table.attach(self.insert_button, 0, 1, 1, 2, yoptions=0) - table.attach(self.remove_button, 1, 2, 1, 2, yoptions=0) - table.attach(self.edit_button, 2, 3, 1, 2, yoptions=0) + grid.attach(self.insert_button, 0, 1, 1, 1) + grid.attach(self.remove_button, 1, 1, 1, 1) + grid.attach(self.edit_button, 2, 1, 1, 1) self.format_list = format_tree self.name_column = name_column - return table + return grid def name_changed_check(self): """ @@ -926,10 +929,10 @@ class GrampsPreferences(ConfigureDialog): def add_formats_panel(self, configdialog): row = 0 - table = Gtk.Table(n_rows=4, n_columns=4) - table.set_border_width(12) - table.set_col_spacings(6) - table.set_row_spacings(6) + grid = Gtk.Grid() + grid.set_border_width(12) + grid.set_column_spacing(6) + grid.set_row_spacing(6) # Display name: self.examplename = Name() @@ -974,12 +977,12 @@ class GrampsPreferences(ConfigureDialog): btn.connect('clicked', self.cb_name_dialog) hbox.pack_start(self.fmt_obox, True, True, 0) hbox.pack_start(btn, False, False, 0) - table.attach(lwidget, 0, 1, row, row+1, yoptions=0) - table.attach(hbox, 1, 3, row, row+1, yoptions=0) + grid.attach(lwidget, 0, row, 1, 1) + grid.attach(hbox, 1, row, 2, 1) row += 1 # Pa/Matronymic surname handling - self.add_checkbox(table, + self.add_checkbox(grid, _("Consider single pa/matronymic as surname"), row, 'preferences.patronimic-surname', stop=3, extra_callback=self.cb_pa_sur_changed) @@ -995,8 +998,8 @@ class GrampsPreferences(ConfigureDialog): obox.set_active(active) obox.connect('changed', self.date_format_changed) lwidget = BasicLabel("%s: " % _('Date format')) - table.attach(lwidget, 0, 1, row, row+1, yoptions=0) - table.attach(obox, 1, 3, row, row+1, yoptions=0) + grid.attach(lwidget, 0, row, 1, 1) + grid.attach(obox, 1, row, 2, 1) row += 1 # Place format: @@ -1009,8 +1012,8 @@ class GrampsPreferences(ConfigureDialog): obox.set_active(active) obox.connect('changed', self.place_format_changed) lwidget = BasicLabel("%s: " % _('Place format')) - table.attach(lwidget, 0, 1, row, row+1, yoptions=0) - table.attach(obox, 1, 3, row, row+1, yoptions=0) + grid.attach(lwidget, 0, row, 1, 1) + grid.attach(obox, 1, row, 2, 1) row += 1 # Age precision: @@ -1031,8 +1034,8 @@ class GrampsPreferences(ConfigureDialog): obj.get_active() + 1)) lwidget = BasicLabel("%s: " % _('Age display precision (requires restart)')) - table.attach(lwidget, 0, 1, row, row+1, yoptions=0) - table.attach(obox, 1, 3, row, row+1, yoptions=0) + grid.attach(lwidget, 0, row, 1, 1) + grid.attach(obox, 1, row, 2, 1) row += 1 # Calendar format on report: @@ -1044,8 +1047,8 @@ class GrampsPreferences(ConfigureDialog): obox.set_active(active) obox.connect('changed', self.date_calendar_changed) lwidget = BasicLabel("%s: " % _('Calendar on reports')) - table.attach(lwidget, 0, 1, row, row+1, yoptions=0) - table.attach(obox, 1, 3, row, row+1, yoptions=0) + grid.attach(lwidget, 0, row, 1, 1) + grid.attach(obox, 1, row, 2, 1) row += 1 # Surname guessing: @@ -1057,8 +1060,8 @@ class GrampsPreferences(ConfigureDialog): lambda obj: config.set('behavior.surname-guessing', obj.get_active())) lwidget = BasicLabel("%s: " % _('Surname guessing')) - table.attach(lwidget, 0, 1, row, row+1, yoptions=0) - table.attach(obox, 1, 3, row, row+1, yoptions=0) + grid.attach(lwidget, 0, row, 1, 1) + grid.attach(obox, 1, row, 2, 1) row += 1 # Default Family Relationship @@ -1070,12 +1073,12 @@ class GrampsPreferences(ConfigureDialog): lambda obj: config.set('preferences.family-relation-type', obj.get_active())) lwidget = BasicLabel("%s: " % _('Default family relationship')) - table.attach(lwidget, 0, 1, row, row+1, yoptions=0) - table.attach(obox, 1, 3, row, row+1, yoptions=0) + grid.attach(lwidget, 0, row, 1, 1) + grid.attach(obox, 1, row, 2, 1) row += 1 #height multiple surname table - self.add_pos_int_entry(table, + self.add_pos_int_entry(grid, _('Height multiple surname box (pixels)'), row, 'interface.surname-box-height', self.update_surn_height, col_attach=0) @@ -1094,49 +1097,49 @@ class GrampsPreferences(ConfigureDialog): obox.connect('changed', lambda obj: config.set('interface.statusbar', 2*obj.get_active())) lwidget = BasicLabel("%s: " % _('Status bar')) - table.attach(lwidget, 0, 1, row, row+1, yoptions=0) - table.attach(obox, 1, 3, row, row+1, yoptions=0) + grid.attach(lwidget, 0, row, 1, 1) + grid.attach(obox, 1, row, 2, 1) row += 1 # Text in sidebar: - self.add_checkbox(table, + self.add_checkbox(grid, _("Show text in sidebar buttons (requires restart)"), row, 'interface.sidebar-text', stop=3) row += 1 # Gramplet bar close buttons: - self.add_checkbox(table, + self.add_checkbox(grid, _("Show close button in gramplet bar tabs"), row, 'interface.grampletbar-close', stop=3, extra_callback=self.cb_grampletbar_close) row += 1 - return _('Display'), table + return _('Display'), grid def add_text_panel(self, configdialog): row = 0 - table = Gtk.Table(n_rows=6, n_columns=8) - table.set_border_width(12) - table.set_col_spacings(6) - table.set_row_spacings(6) - self.add_entry(table, _('Missing surname'), row, + grid = Gtk.Grid() + grid.set_border_width(12) + grid.set_column_spacing(6) + grid.set_row_spacing(6) + self.add_entry(grid, _('Missing surname'), row, 'preferences.no-surname-text') row += 1 - self.add_entry(table, _('Missing given name'), row, + self.add_entry(grid, _('Missing given name'), row, 'preferences.no-given-text') row += 1 - self.add_entry(table, _('Missing record'), row, + self.add_entry(grid, _('Missing record'), row, 'preferences.no-record-text') row += 1 - self.add_entry(table, _('Private surname'), row, + self.add_entry(grid, _('Private surname'), row, 'preferences.private-surname-text') row += 1 - self.add_entry(table, _('Private given name'), row, + self.add_entry(grid, _('Private given name'), row, 'preferences.private-given-text') row += 1 - self.add_entry(table, _('Private record'), row, + self.add_entry(grid, _('Private record'), row, 'preferences.private-record-text') row += 1 - return _('Text'), table + return _('Text'), grid def cb_name_dialog(self, obj): the_list = self.fmt_obox.get_model() @@ -1183,33 +1186,33 @@ class GrampsPreferences(ConfigureDialog): config.set('preferences.calendar-format-report', obj.get_active()) def add_date_panel(self, configdialog): - table = Gtk.Table(n_rows=2, n_columns=7) - table.set_border_width(12) - table.set_col_spacings(6) - table.set_row_spacings(6) + grid = Gtk.Grid() + grid.set_border_width(12) + grid.set_column_spacing(6) + grid.set_row_spacing(6) - self.add_spinner(table, + self.add_spinner(grid, _('Date about range'), 0, 'behavior.date-about-range', (1, 9999)) - self.add_spinner(table, + self.add_spinner(grid, _('Date after range'), 1, 'behavior.date-after-range', (1, 9999)) - self.add_spinner(table, + self.add_spinner(grid, _('Date before range'), 2, 'behavior.date-before-range', (1, 9999)) - self.add_spinner(table, + self.add_spinner(grid, _('Maximum age probably alive'), 3, 'behavior.max-age-prob-alive', (80, 140)) - self.add_spinner(table, + self.add_spinner(grid, _('Maximum sibling age difference'), 4, 'behavior.max-sib-age-diff', (10, 30)) - self.add_spinner(table, + self.add_spinner(grid, _('Minimum years between generations'), 5, 'behavior.min-generation-years', (5, 20)) - self.add_spinner(table, + self.add_spinner(grid, _('Average years between generations'), 6, 'behavior.avg-generation-gap', (10, 30)) - self.add_pos_int_entry(table, + self.add_pos_int_entry(grid, _('Markup for invalid date format'), 7, 'preferences.invalid-date-format', self.update_markup_entry, @@ -1227,16 +1230,16 @@ class GrampsPreferences(ConfigureDialog): 'will display Underlined bold date.\n') ) - return _('Dates'), table + return _('Dates'), grid def add_behavior_panel(self, configdialog): - table = Gtk.Table(n_rows=2, n_columns=8) - table.set_border_width(12) - table.set_col_spacings(6) - table.set_row_spacings(6) + grid = Gtk.Grid() + grid.set_border_width(12) + grid.set_column_spacing(6) + grid.set_row_spacing(6) current_line = 0 - self.add_checkbox(table, + self.add_checkbox(grid, _('Add default source on GEDCOM import'), current_line, 'preferences.default-source') @@ -1244,14 +1247,14 @@ class GrampsPreferences(ConfigureDialog): checkbutton = Gtk.CheckButton(label=_("Add tag on import")) checkbutton.set_active(config.get('preferences.tag-on-import')) checkbutton.connect("toggled", self.toggle_tag_on_import) - table.attach(checkbutton, 1, 2, current_line, current_line+1, yoptions=0) - self.tag_format_entry = self.add_entry(table, None, current_line, + grid.attach(checkbutton, 1, current_line, 1, 1) + self.tag_format_entry = self.add_entry(grid, None, current_line, 'preferences.tag-on-import-format', col_attach=2) self.tag_format_entry.set_sensitive(config.get('preferences.tag-on-import')) current_line += 1 - obj = self.add_checkbox(table, + obj = self.add_checkbox(grid, _('Enable spelling checker'), current_line, 'behavior.spellcheck') if not HAVE_GTKSPELL: @@ -1267,23 +1270,23 @@ class GrampsPreferences(ConfigureDialog): "%(gramps_wiki_build_spell_url)s") % spell_dict ) current_line += 1 - self.add_checkbox(table, + self.add_checkbox(grid, _('Display Tip of the Day'), current_line, 'behavior.use-tips') current_line += 1 - self.add_checkbox(table, + self.add_checkbox(grid, _('Remember last view displayed'), current_line, 'preferences.use-last-view') current_line += 1 - self.add_spinner(table, + self.add_spinner(grid, _('Max generations for relationships'), current_line, 'behavior.generation-depth', (5, 50), self.update_gendepth) current_line += 1 self.path_entry = Gtk.Entry() - self.add_path_box(table, + self.add_path_box(grid, _('Base path for relative media paths'), current_line, self.path_entry, self.dbstate.db.get_mediapath(), self.set_mediapath, self.select_mediapath) @@ -1301,8 +1304,8 @@ class GrampsPreferences(ConfigureDialog): obox.set_active(active) obox.connect('changed', self.check_for_updates_changed) lwidget = BasicLabel("%s: " % _('Check for updates')) - table.attach(lwidget, 1, 2, current_line, current_line+1, yoptions=0) - table.attach(obox, 2, 3, current_line, current_line+1, yoptions=0) + grid.attach(lwidget, 1, current_line, 1, 1) + grid.attach(obox, 2, current_line, 1, 1) current_line += 1 self.whattype_box = Gtk.ComboBoxText() @@ -1319,11 +1322,11 @@ class GrampsPreferences(ConfigureDialog): self.whattype_box.set_active(0) self.whattype_box.connect('changed', self.check_for_type_changed) lwidget = BasicLabel("%s: " % _('What to check')) - table.attach(lwidget, 1, 2, current_line, current_line+1, yoptions=0) - table.attach(self.whattype_box, 2, 3, current_line, current_line+1, yoptions=0) + grid.attach(lwidget, 1, current_line, 1, 1) + grid.attach(self.whattype_box, 2, current_line, 1, 1) current_line += 1 - self.add_entry(table, _('Where to check'), current_line, 'behavior.addons-url', col_attach=1) + self.add_entry(grid, _('Where to check'), current_line, 'behavior.addons-url', col_attach=1) current_line += 1 checkbutton = Gtk.CheckButton( @@ -1331,12 +1334,12 @@ class GrampsPreferences(ConfigureDialog): checkbutton.set_active(config.get('behavior.do-not-show-previously-seen-updates')) checkbutton.connect("toggled", self.toggle_hide_previous_addons) - table.attach(checkbutton, 0, 3, current_line, current_line+1, yoptions=0) + grid.attach(checkbutton, 1, current_line, 1, 1) button = Gtk.Button(_("Check now")) button.connect("clicked", self.check_for_updates) - table.attach(button, 3, 4, current_line, current_line+1, yoptions=0) + grid.attach(button, 3, current_line, 1, 1) - return _('General'), table + return _('General'), grid def check_for_updates(self, button): try: @@ -1368,26 +1371,26 @@ class GrampsPreferences(ConfigureDialog): self.uistate.viewmanager.do_reg_plugins(self.dbstate, self.uistate) def add_famtree_panel(self, configdialog): - table = Gtk.Table(n_rows=2, n_columns=2) - table.set_border_width(12) - table.set_col_spacings(6) - table.set_row_spacings(6) + grid = Gtk.Grid() + grid.set_border_width(12) + grid.set_column_spacing(6) + grid.set_row_spacing(6) self.dbpath_entry = Gtk.Entry() - self.add_path_box(table, + self.add_path_box(grid, _('Family Tree Database path'), 0, self.dbpath_entry, config.get('behavior.database-path'), self.set_dbpath, self.select_dbpath) - #self.add_entry(table, + #self.add_entry(grid, # _('Family Tree Database path'), # 0, 'behavior.database-path') - self.add_checkbox(table, + self.add_checkbox(grid, _('Automatically load last Family Tree'), 1, 'behavior.autoload') - return _('Family Tree'), table + return _('Family Tree'), grid def set_mediapath(self, *obj): if self.path_entry.get_text().strip(): diff --git a/gramps/gui/filters/sidebar/_sidebarfilter.py b/gramps/gui/filters/sidebar/_sidebarfilter.py index 2e91b91ac..e32bea24e 100644 --- a/gramps/gui/filters/sidebar/_sidebarfilter.py +++ b/gramps/gui/filters/sidebar/_sidebarfilter.py @@ -47,13 +47,12 @@ class SidebarFilter(DbGUIElement): DbGUIElement.__init__(self, dbstate.db) self.position = 1 - self.vbox = Gtk.VBox() - self.table = Gtk.Table(n_rows=4, n_columns=11) - self.vbox.pack_start(self.table, False, False, 0) - self.table.set_border_width(6) - self.table.set_row_spacings(6) - self.table.set_col_spacing(0, 6) - self.table.set_col_spacing(1, 6) + self.vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) + self.grid = Gtk.Grid() + self.vbox.pack_start(self.grid, False, False, 0) + self.grid.set_border_width(6) + self.grid.set_row_spacing(6) + self.grid.set_column_spacing(6) self.apply_btn = Gtk.Button(stock=Gtk.STOCK_FIND) self.clear_btn = Gtk.Button() @@ -71,7 +70,7 @@ class SidebarFilter(DbGUIElement): self.apply_btn.connect('clicked', self.clicked) - hbox = Gtk.HBox() + hbox = Gtk.Box() hbox.show() image = Gtk.Image() image.set_from_stock(Gtk.STOCK_UNDO, Gtk.IconSize.BUTTON) @@ -116,7 +115,7 @@ class SidebarFilter(DbGUIElement): pass def add_regex_entry(self, widget): - hbox = Gtk.HBox() + hbox = Gtk.Box() hbox.pack_start(widget, False, False, 12) self.vbox.pack_start(hbox, False, False, 0) @@ -137,17 +136,14 @@ class SidebarFilter(DbGUIElement): label.set_text('%s' % heading) label.set_use_markup(True) label.set_alignment(0, 0.5) - self.table.attach(label, 1, 2, self.position, self.position+1, - xoptions=Gtk.AttachOptions.FILL, yoptions=0) + self.grid.attach(label, 1, self.position, 1, 1) self.position += 1 def add_entry(self, name, widget): if name: - self.table.attach(widgets.BasicLabel(name), - 1, 2, self.position, self.position+1, - xoptions=Gtk.AttachOptions.FILL, yoptions=0) - self.table.attach(widget, 2, 4, self.position, self.position+1, - xoptions=Gtk.AttachOptions.FILL|Gtk.AttachOptions.EXPAND, yoptions=0) + self.grid.attach(widgets.BasicLabel(name), 1, self.position, 1, 1) + widget.set_hexpand(True) + self.grid.attach(widget, 2, self.position, 2, 1) self.position += 1 def on_filters_changed(self, namespace): @@ -225,7 +221,7 @@ class SidebarFilter(DbGUIElement): """ Adds the text and widget to GUI, with an Edit button. """ - hbox = Gtk.HBox() + hbox = Gtk.Box() hbox.pack_start(widget, True, True, 0) hbox.pack_start(widgets.SimpleButton(Gtk.STOCK_EDIT, self.edit_filter), False, False, 0) diff --git a/gramps/gui/plug/_windows.py b/gramps/gui/plug/_windows.py index a97b0bbbf..3a05ccb8a 100644 --- a/gramps/gui/plug/_windows.py +++ b/gramps/gui/plug/_windows.py @@ -111,7 +111,7 @@ class PluginStatus(ManagedWindow): notebook = Gtk.Notebook() #first page with all registered plugins - vbox_reg = Gtk.VBox() + vbox_reg = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) scrolled_window_reg = Gtk.ScrolledWindow() self.list_reg = Gtk.TreeView() # model: plugintype, hidden, pluginname, plugindescr, pluginid @@ -162,7 +162,7 @@ class PluginStatus(ManagedWindow): tab_label=Gtk.Label(label=_('Registered Plugins'))) #second page with loaded plugins - vbox_loaded = Gtk.VBox() + vbox_loaded = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) scrolled_window = Gtk.ScrolledWindow() self.list = Gtk.TreeView() self.model = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING, @@ -218,7 +218,7 @@ class PluginStatus(ManagedWindow): tab_label=Gtk.Label(label=_('Loaded Plugins'))) #third page with method to install plugin - install_page = Gtk.VBox() + install_page = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) scrolled_window = Gtk.ScrolledWindow() self.addon_list = Gtk.TreeView() # model: help_name, name, ptype, image, desc, use, rating, contact, download, url @@ -249,7 +249,7 @@ class PluginStatus(ManagedWindow): self.addon_list.append_column(col) self.addon_list.connect('cursor-changed', self.button_press_addon) - install_row = Gtk.HBox() + install_row = Gtk.Box() install_row.pack_start(Gtk.Label(label=_("Path to Addon:")), False, True, 0) self.install_addon_path = Gtk.Entry() @@ -753,12 +753,6 @@ class ToolManagedWindowBase(ManagedWindow): self.setup_title() self.setup_header() - #self.tbl = Gtk.Table(4, 4, False) - #self.tbl.set_col_spacings(12) - #self.tbl.set_row_spacings(6) - #self.tbl.set_border_width(6) - #self.col = 0 - #self.window.vbox.add(self.tbl) # Build the list of widgets that are used to extend the Options # frame and to create other frames @@ -1006,25 +1000,23 @@ class ToolManagedWindowBase(ManagedWindow): the add_user_options task.""" for key in self.frame_names: flist = self.frames[key] - table = Gtk.Table(n_rows=3, n_columns=len(flist)) - table.set_col_spacings(12) - table.set_row_spacings(6) - table.set_border_width(6) + grid = Gtk.Grid() + grid.set_column_spacing(12) + grid.set_row_spacing(6) + grid.set_border_width(6) l = Gtk.Label(label="%s" % key) l.set_use_markup(True) - self.notebook.append_page(table, l) + self.notebook.append_page(grid, l) row = 0 for (text, widget) in flist: + widget.set_hexpand(True) if text: text_widget = Gtk.Label(label='%s:' % text) text_widget.set_alignment(0.0, 0.5) - table.attach(text_widget, 1, 2, row, row+1, - Gtk.AttachOptions.SHRINK|Gtk.AttachOptions.FILL, Gtk.AttachOptions.SHRINK) - table.attach(widget, 2, 3, row, row+1, - yoptions=Gtk.AttachOptions.SHRINK) + grid.attach(text_widget, 1, row, 1, 1) + grid.attach(widget, 2, row, 1, 1) else: - table.attach(widget, 2, 3, row, row+1, - yoptions=Gtk.AttachOptions.SHRINK) + grid.attach(widget, 2, row, 1, 1) row += 1 self.notebook.show_all() diff --git a/gramps/gui/plug/export/_exportassistant.py b/gramps/gui/plug/export/_exportassistant.py index 680f988f8..1ba085051 100644 --- a/gramps/gui/plug/export/_exportassistant.py +++ b/gramps/gui/plug/export/_exportassistant.py @@ -166,7 +166,7 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) : image = Gtk.Image() image.set_from_file(SPLASH) - box = Gtk.VBox() + box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) box.set_size_request(600, -1) # wide enough it won't have to expand box.pack_start(image, False, False, 5) box.pack_start(label, False, False, 5) @@ -183,18 +183,18 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) : """Create the export type page. A Title label. - A table of format radio buttons and their descriptions. + A grid of format radio buttons and their descriptions. """ self.format_buttons = [] - box = Gtk.VBox() + box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) box.set_border_width(12) box.set_spacing(12) - table = Gtk.Table(n_rows=2*len(self.__exporters), n_columns=2) - table.set_row_spacings(6) - table.set_col_spacings(6) + grid = Gtk.Grid() + grid.set_row_spacings(6) + grid.set_col_spacings(6) button = None recent_type = config.get('behavior.recent-export-type') @@ -209,12 +209,12 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) : button = Gtk.RadioButton.new_with_mnemonic_from_widget(button, title) button.set_tooltip_text(description) self.format_buttons.append(button) - table.attach(button, 0, 2, 2*ix, 2*ix+1) + grid.attach(button, 0, 2*ix, 2, 1) if ix == recent_type: button.set_active(True) ix += 1 - box.pack_start(table, False, False, 0) + box.pack_start(grid, False, False, 0) page = box @@ -228,7 +228,7 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) : def create_page_options(self): # as we do not know yet what to show, we create an empty page - page = Gtk.VBox() + page = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) page.set_border_width(12) page.set_spacing(12) @@ -340,7 +340,7 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) : image = Gtk.Image() image.set_from_file(SPLASH) - box = Gtk.VBox() + box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) box.set_border_width(12) box.set_spacing(6) box.pack_start(image, False, False, 5) @@ -356,7 +356,7 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) : # Construct summary page # As this is the last page needs to be of page_type # Gtk.AssistantPageType.CONFIRM or Gtk.AssistantPageType.SUMMARY - vbox = Gtk.VBox() + vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) vbox.set_border_width(12) vbox.set_spacing(6) diff --git a/gramps/gui/plug/export/_exportoptions.py b/gramps/gui/plug/export/_exportoptions.py index 864b3e4f5..1502d2b1d 100644 --- a/gramps/gui/plug/export/_exportoptions.py +++ b/gramps/gui/plug/export/_exportoptions.py @@ -137,12 +137,12 @@ class WriterOptionBox(object): self.parse_options() def get_option_box(self): - """Build up a Gtk.Table that contains the standard options.""" + """Build up a Gtk.Box that contains the standard options.""" from gi.repository import Gtk from gi.repository import Pango - widget = Gtk.VBox() + widget = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) - full_database_row = Gtk.HBox() + full_database_row = Gtk.Box() full_database_row.pack_start(Gtk.Label(_("Unfiltered Family Tree:")), True, True, 0) people_count = len(self.dbstate.db.get_person_handles()) # translators: leave all/any {...} untranslated @@ -154,7 +154,7 @@ class WriterOptionBox(object): button.connect("clicked", self.show_preview_data) button.proxy_name = "unfiltered" self.preview_proxy_button["unfiltered"] = button - self.spacer = Gtk.HBox() + self.spacer = Gtk.Box() full_database_row.pack_end(self.spacer, False, True, 0) full_database_row.pack_end(button, False, True, 0) @@ -175,7 +175,7 @@ class WriterOptionBox(object): widget.pack_start(frame, False, True, 0) row += 1 - hbox = Gtk.HBox() + hbox = Gtk.Box() self.advanced_button = Gtk.Button(_("Change order")) self.advanced_button.set_size_request(150, -1) self.proxy_options_showing = False @@ -266,7 +266,7 @@ class WriterOptionBox(object): label.set_size_request(150, -1) label.set_use_underline(True) label.set_mnemonic_widget(self.filter_obj) - box = Gtk.HBox() + box = Gtk.Box() box.pack_start(label, False, True, 0) box.pack_start(self.filter_obj, True, True, 0) box.pack_start( @@ -283,7 +283,7 @@ class WriterOptionBox(object): label_note.set_size_request(150, -1) label_note.set_use_underline(True) label_note.set_mnemonic_widget(self.filter_note) - box = Gtk.HBox() + box = Gtk.Box() box.pack_start(label_note, False, True, 0) box.pack_start(self.filter_note, True, True, 0) box.pack_start( @@ -296,7 +296,7 @@ class WriterOptionBox(object): label = Gtk.Label(label=_("Privacy Filter") + ":") label.set_alignment(0, 0.5) label.set_size_request(150, -1) - box = Gtk.HBox() + box = Gtk.Box() box.pack_start(label, False, True, 0) box.add(self.private_check) button.set_tooltip_text(_("Click to see preview after privacy filter")) @@ -305,7 +305,7 @@ class WriterOptionBox(object): label = Gtk.Label(label=_("Living Filter") + ":") label.set_alignment(0, 0.5) label.set_size_request(150, -1) - box = Gtk.HBox() + box = Gtk.Box() box.pack_start(label, False, True, 0) self.restrict_option = Gtk.ComboBox() box.add(self.restrict_option) @@ -316,7 +316,7 @@ class WriterOptionBox(object): label = Gtk.Label(label=_('Reference Filter') + ": ") label.set_alignment(0, 0.5) label.set_size_request(150, -1) - box = Gtk.HBox() + box = Gtk.Box() box.pack_start(label, False, True, 0) box.pack_start(self.reference_filter, True, True, 0) button.set_tooltip_text(_("Click to see preview after reference filter")) @@ -324,9 +324,9 @@ class WriterOptionBox(object): raise AttributeError("Unknown proxy '%s'" % proxy_name) frame = Gtk.Frame() - hbox = Gtk.HBox() + hbox = Gtk.Box() frame.add(hbox) - vbox = Gtk.HBox() + vbox = Gtk.Box() self.vbox_n.append(vbox) up = Gtk.Button() up.connect("clicked", self.swap) diff --git a/gramps/gui/plug/report/_docreportdialog.py b/gramps/gui/plug/report/_docreportdialog.py index 023fbe9c5..8b85ec16e 100644 --- a/gramps/gui/plug/report/_docreportdialog.py +++ b/gramps/gui/plug/report/_docreportdialog.py @@ -132,8 +132,8 @@ class DocReportDialog(ReportDialog): else: self.html_label = Gtk.Label(label='%s' % _("HTML Options")) self.html_label.set_use_markup(True) - self.notebook.insert_page(self.html_table, self.html_label, 0) - self.html_table.show_all() + self.notebook.insert_page(self.html_grid, self.html_label, 0) + self.html_grid.show_all() if preserve_tab: self.notebook.set_current_page(old_page) self.firstpage_added = True @@ -169,16 +169,15 @@ class DocReportDialog(ReportDialog): self.format_menu.connect('changed', self.doc_type_changed) label = Gtk.Label(label="%s:" % _("Output Format")) label.set_alignment(0.0, 0.5) - self.tbl.attach(label, 1, 2, self.row, self.row+1, Gtk.AttachOptions.SHRINK|Gtk.AttachOptions.FILL) - self.tbl.attach(self.format_menu, 2, 4, self.row, self.row+1, - yoptions=Gtk.AttachOptions.SHRINK) + self.grid.attach(label, 1, self.row, 1, 1) + self.format_menu.set_hexpand(True) + self.grid.attach(self.format_menu, 2, self.row, 2, 1) self.row += 1 self.open_with_app = Gtk.CheckButton(label=_("Open with default viewer")) self.open_with_app.set_active( config.get('interface.open-with-default-viewer')) - self.tbl.attach(self.open_with_app, 2, 4, self.row, self.row+1, - yoptions=Gtk.AttachOptions.SHRINK) + self.grid.attach(self.open_with_app, 2, self.row, 2, 1) self.row += 1 ext = self.format_menu.get_active_plugin().get_extension() @@ -209,17 +208,17 @@ class DocReportDialog(ReportDialog): this function is to grab a pointer for later use in the parse html frame function.""" - self.html_table = Gtk.Table(n_rows=3, n_columns=3) - self.html_table.set_col_spacings(12) - self.html_table.set_row_spacings(6) - self.html_table.set_border_width(0) + self.html_grid = Gtk.Grid() + self.html_grid.set_column_spacing(12) + self.html_grid.set_row_spacing(6) + self.html_grid.set_border_width(6) label = Gtk.Label(label="%s:" % _("CSS file")) label.set_alignment(0.0,0.5) - self.html_table.attach(label, 1, 2, 1, 2, Gtk.AttachOptions.SHRINK|Gtk.AttachOptions.FILL, - yoptions=Gtk.AttachOptions.SHRINK) + self.html_grid.attach(label, 1, 1, 1, 1) self.css_combo = Gtk.ComboBoxText() + self.css_combo.set_hexpand(True) css_filename = self.options.handler.get_css_filename() active_index = 0 @@ -234,7 +233,7 @@ class DocReportDialog(ReportDialog): active_index = index index += 1 - self.html_table.attach(self.css_combo,2,3,1,2, yoptions=Gtk.AttachOptions.SHRINK) + self.html_grid.attach(self.css_combo, 2, 1, 1, 1) self.css_combo.set_active(active_index) def parse_format_frame(self): diff --git a/gramps/gui/plug/report/_reportdialog.py b/gramps/gui/plug/report/_reportdialog.py index 56994e81f..6a4c3512a 100644 --- a/gramps/gui/plug/report/_reportdialog.py +++ b/gramps/gui/plug/report/_reportdialog.py @@ -173,10 +173,10 @@ class ReportDialog(ManagedWindow): self.setup_title() self.setup_header() - self.tbl = Gtk.Table(n_rows=4, n_columns=4, homogeneous=False) - self.tbl.set_col_spacings(12) - self.tbl.set_row_spacings(6) - self.tbl.set_border_width(6) + self.grid = Gtk.Grid() + self.grid.set_column_spacing(12) + self.grid.set_row_spacing(6) + self.grid.set_border_width(6) self.row = 0 # Build the list of widgets that are used to extend the Options @@ -204,10 +204,10 @@ class ReportDialog(ManagedWindow): try: #assume a vbox or hbox - self.window.vbox.pack_start(self.tbl, expand=True, fill=True, padding=0) + self.window.vbox.pack_start(self.grid, expand=True, fill=True, padding=0) except: #general container instead: - self.window.vbox.add(self.tbl) + self.window.vbox.add(self.grid) self.show() def get_title(self): @@ -321,14 +321,13 @@ class ReportDialog(ManagedWindow): label.set_alignment(0.0, 0.5) self.style_menu = StyleComboBox() + self.style_menu.set_hexpand(True) self.style_button = Gtk.Button("%s..." % _("Style Editor")) self.style_button.connect('clicked', self.on_style_edit_clicked) - self.tbl.attach(label, 1, 2, self.row, self.row+1, Gtk.AttachOptions.SHRINK|Gtk.AttachOptions.FILL) - self.tbl.attach(self.style_menu, 2, 3, self.row, self.row+1, - yoptions=Gtk.AttachOptions.SHRINK) - self.tbl.attach(self.style_button, 3, 4, self.row, self.row+1, - xoptions=Gtk.AttachOptions.SHRINK|Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.SHRINK) + self.grid.attach(label, 1, self.row, 1, 1) + self.grid.attach(self.style_menu, 2, self.row, 1, 1) + self.grid.attach(self.style_button, 3, self.row, 1, 1) self.row += 1 # Build the initial list of available styles sets. This @@ -356,60 +355,54 @@ class ReportDialog(ManagedWindow): if max_rows == 0: return - table = Gtk.Table(n_rows=3, n_columns=max_rows+1) - table.set_col_spacings(12) - table.set_row_spacings(6) + grid = Gtk.Grid() + grid.set_border_width(6) + grid.set_column_spacing(12) + grid.set_row_spacing(6) label = Gtk.Label(label="%s" % _("Report Options")) label.set_alignment(0.0, 0.5) label.set_use_markup(True) - table.set_border_width(6) - self.notebook.append_page(table, label) - row += 1 + self.notebook.append_page(grid, label) # Setup requested widgets for (text, widget) in self.widgets: + widget.set_hexpand(True) if text: text_widget = Gtk.Label(label="%s:" % text) text_widget.set_alignment(0.0, 0.0) - table.attach(text_widget, 1, 2, row, row+1, - Gtk.AttachOptions.SHRINK|Gtk.AttachOptions.FILL, Gtk.AttachOptions.SHRINK) - table.attach(widget, 2, 3, row, row+1, - yoptions=Gtk.AttachOptions.SHRINK) + grid.attach(text_widget, 1, row, 1, 1) + grid.attach(widget, 2, row, 1, 1) else: - table.attach(widget, 2, 3, row, row+1, - yoptions=Gtk.AttachOptions.SHRINK) + grid.attach(widget, 2, row, 1, 1) row += 1 def setup_other_frames(self): from gramps.gui.plug._guioptions import GuiTextOption for key in self.frame_names: flist = self.frames[key] - table = Gtk.Table(n_rows=3, n_columns=len(flist)) - table.set_col_spacings(12) - table.set_row_spacings(6) - table.set_border_width(6) + grid = Gtk.Grid() + grid.set_column_spacing(12) + grid.set_row_spacing(6) + grid.set_border_width(6) l = Gtk.Label(label="%s" % _(key)) l.set_use_markup(True) - self.notebook.append_page(table, l) + self.notebook.append_page(grid, l) row = 0 for (text, widget) in flist: + widget.set_hexpand(True) if text: text_widget = Gtk.Label(label='%s:' % text) text_widget.set_alignment(0.0, 0.5) - table.attach(text_widget, 1, 2, row, row+1, - Gtk.AttachOptions.SHRINK|Gtk.AttachOptions.FILL, Gtk.AttachOptions.SHRINK) + grid.attach(text_widget, 1, row, 1, 1) if isinstance(widget, GuiTextOption): - table.attach(widget, 2, 3, row, row+1, - yoptions=Gtk.AttachOptions.EXPAND|Gtk.AttachOptions.FILL) + grid.attach(widget, 2, row, 1, 1) else: - table.attach(widget, 2, 3, row, row+1, - yoptions=Gtk.AttachOptions.SHRINK) + grid.attach(widget, 2, row, 1, 1) else: - table.attach(widget, 2, 3, row, row+1, - yoptions=Gtk.AttachOptions.SHRINK) + grid.attach(widget, 2, row, 1, 1) row += 1 #------------------------------------------------------------------------ @@ -459,8 +452,8 @@ class ReportDialog(ManagedWindow): label = Gtk.Label(label="%s" % _('Document Options')) label.set_use_markup(1) label.set_alignment(0.0, 0.5) - self.tbl.set_border_width(12) - self.tbl.attach(label, 0, 4, self.row, self.row+1, Gtk.AttachOptions.FILL) + self.grid.set_border_width(12) + self.grid.attach(label, 0, self.row, 4, 1) self.row += 1 def setup_target_frame(self): @@ -474,10 +467,9 @@ class ReportDialog(ManagedWindow): self.doc_label = Gtk.Label(label="%s:" % _("Filename")) self.doc_label.set_alignment(0.0, 0.5) - self.tbl.attach(self.doc_label, 1, 2, self.row, self.row+1, - xoptions=Gtk.AttachOptions.SHRINK|Gtk.AttachOptions.FILL,yoptions=Gtk.AttachOptions.SHRINK) - self.tbl.attach(self.target_fileentry, 2, 4, self.row, self.row+1, - xoptions=Gtk.AttachOptions.EXPAND|Gtk.AttachOptions.FILL,yoptions=Gtk.AttachOptions.SHRINK) + self.grid.attach(self.doc_label, 1, self.row, 1, 1) + self.target_fileentry.set_hexpand(True) + self.grid.attach(self.target_fileentry, 2, self.row, 2, 1) self.row += 1 #------------------------------------------------------------------------ @@ -594,7 +586,7 @@ class ReportDialog(ManagedWindow): def setup_doc_options_frame(self): if self.doc_widgets: for option_widget in self.doc_widgets: - self.tbl.remove(option_widget) + self.grid.remove(option_widget) self.doc_widgets = [] self.doc_options = None @@ -613,11 +605,9 @@ class ReportDialog(ManagedWindow): if has_label: widget_text = Gtk.Label('%s:' % option.get_label()) widget_text.set_alignment(0.0, 0.0) - self.tbl.attach(widget_text, 1, 2, self.row, self.row+1, - Gtk.AttachOptions.SHRINK|Gtk.AttachOptions.FILL, Gtk.AttachOptions.SHRINK) + self.grid.attach(widget_text, 1, self.row, 1, 1) self.doc_widgets.append(widget_text) - self.tbl.attach(widget, 2, 4, self.row, self.row+1, - yoptions=Gtk.AttachOptions.SHRINK) + self.grid.attach(widget, 2, self.row, 2, 1) self.doc_widgets.append(widget) self.row += 1 diff --git a/gramps/gui/widgets/grampletpane.py b/gramps/gui/widgets/grampletpane.py index aa545f232..9c6351249 100644 --- a/gramps/gui/widgets/grampletpane.py +++ b/gramps/gui/widgets/grampletpane.py @@ -563,10 +563,12 @@ class GuiGramplet(object): # END WORKAROUND if len(self.pui.option_order) == 0: return frame = Gtk.Frame() - topbox = Gtk.VBox(homogeneous=False) - hbox = Gtk.HBox(homogeneous=False, spacing=5) - labels = Gtk.VBox(homogeneous=True) - options = Gtk.VBox(homogeneous=True) + topbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) + hbox = Gtk.Box(spacing=5) + labels = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, + homogeneous=True) + options = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, + homogeneous=True) hbox.pack_start(labels, False, True, 0) hbox.pack_start(options, True, True, 0) topbox.pack_start(hbox, False, False, 0) @@ -996,7 +998,7 @@ class GrampletPane(Gtk.ScrolledWindow): self.set_tooltip_text(msg) self.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) self.eventb = Gtk.EventBox() - self.hbox = Gtk.HBox(homogeneous=True) + self.hbox = Gtk.Box(homogeneous=True) self.eventb.add(self.hbox) self.add_with_viewport(self.eventb) self.set_kinetic_scrolling(True) @@ -1017,7 +1019,7 @@ class GrampletPane(Gtk.ScrolledWindow): # Create the columns: self.columns = [] for i in range(self.column_count): - self.columns.append(Gtk.VBox()) + self.columns.append(Gtk.Box(orientation=Gtk.Orientation.VERTICAL)) self.hbox.pack_start(self.columns[-1], True, True, 0) # Load the gramplets self.gramplet_map = {} # title->gramplet @@ -1334,7 +1336,7 @@ class GrampletPane(Gtk.ScrolledWindow): self.column_count = num self.columns = [] for i in range(self.column_count): - self.columns.append(Gtk.VBox()) + self.columns.append(Gtk.Box(orientation=Gtk.Orientation.VERTICAL)) self.columns[-1].show() self.hbox.pack_start(self.columns[-1], True, True, 0) # place the gramplets back in the new columns @@ -1517,23 +1519,23 @@ class GrampletPane(Gtk.ScrolledWindow): """ Function that builds the widget in the configuration dialog """ - table = Gtk.Table(n_rows=3, n_columns=2) - table.set_border_width(12) - table.set_col_spacings(6) - table.set_row_spacings(6) + grid = Gtk.Grid() + grid.set_border_width(12) + grid.set_column_spacing(6) + grid.set_row_spacing(6) self._config.register('Gramplet View Options.column_count', int, self.get_columns, # pane self.set_columns) # pane - configdialog.add_pos_int_entry(table, + configdialog.add_pos_int_entry(grid, _('Number of Columns'), 0, 'Gramplet View Options.column_count', self._config.set, config=self._config) - return _('Gramplet Layout'), table + return _('Gramplet Layout'), grid def build_panel(self, gramplet): self._config.register("%s.title" % gramplet.title, @@ -1550,39 +1552,39 @@ class GrampletPane(Gtk.ScrolledWindow): bool, gramplet.get_expand, gramplet.set_expand) def gramplet_panel(configdialog): configdialog.window.set_size_request(600, -1) - table = Gtk.Table(n_rows=3, n_columns=2) - table.set_border_width(12) - table.set_col_spacings(6) - table.set_row_spacings(6) + grid = Gtk.Grid() + grid.set_border_width(12) + grid.set_column_spacing(6) + grid.set_row_spacing(6) # Title: - configdialog.add_entry(table, + configdialog.add_entry(grid, _('Title'), 0, "%s.title" % gramplet.title, self._config.set, config=self._config) # Expand to max height - configdialog.add_checkbox(table, + configdialog.add_checkbox(grid, _("Use maximum height available"), 1, "%s.expand" % gramplet.title, config=self._config) # Height - configdialog.add_pos_int_entry(table, + configdialog.add_pos_int_entry(grid, _('Height if not maximized'), 2, "%s.height" % gramplet.title, self._config.set, config=self._config) # Detached height - configdialog.add_pos_int_entry(table, + configdialog.add_pos_int_entry(grid, _('Detached width'), 3, "%s.detached_width" % gramplet.title, self._config.set, config=self._config) # Detached width - configdialog.add_pos_int_entry(table, + configdialog.add_pos_int_entry(grid, _('Detached height'), 4, "%s.detached_height" % gramplet.title, @@ -1591,8 +1593,8 @@ class GrampletPane(Gtk.ScrolledWindow): # Options: options = gramplet.make_gui_options() if options: - table.attach(options, 1, 4, 5, 6, yoptions=0) - return gramplet.title, table + grid.attach(options, 1, 5, 3, 1) + return gramplet.title, grid return gramplet_panel class Configuration(object): diff --git a/gramps/plugins/gramplet/persondetails.py b/gramps/plugins/gramplet/persondetails.py index d1f3ddf65..1fedc6ad4 100644 --- a/gramps/plugins/gramplet/persondetails.py +++ b/gramps/plugins/gramplet/persondetails.py @@ -44,16 +44,17 @@ class PersonDetails(Gramplet): """ Build the GUI interface. """ - self.top = Gtk.HBox() - vbox = Gtk.VBox() + self.top = Gtk.Box() + vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.photo = Photo(self.uistate.screen_height() < 1000) self.photo.show() self.name = Gtk.Label() self.name.set_alignment(0, 0) self.name.modify_font(Pango.FontDescription('sans bold 12')) vbox.pack_start(self.name, fill=True, expand=False, padding=7) - self.table = Gtk.Table(n_rows=1, n_columns=2) - vbox.pack_start(self.table, fill=True, expand=False, padding=5) + self.grid = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL) + self.grid.set_column_spacing(10) + vbox.pack_start(self.grid, fill=True, expand=False, padding=5) vbox.show_all() self.top.pack_start(self.photo, fill=True, expand=False, padding=5) self.top.pack_start(vbox, fill=True, expand=True, padding=10) @@ -69,19 +70,14 @@ class PersonDetails(Gramplet): value = Gtk.Label(label=value) value.set_alignment(0, 0) value.show() - rows = self.table.get_property('n-rows') - rows += 1 - self.table.resize(rows, 2) - self.table.attach(label, 0, 1, rows, rows + 1, xoptions=Gtk.AttachOptions.FILL, - xpadding=10) - self.table.attach(value, 1, 2, rows, rows + 1) + self.grid.add(label) + self.grid.attach_next_to(value, label, Gtk.PositionType.RIGHT, 1, 1) - def clear_table(self): + def clear_grid(self): """ - Remove all the rows from the table. + Remove all the rows from the grid. """ - list(map(self.table.remove, self.table.get_children())) - self.table.resize(1, 2) + list(map(self.grid.remove, self.grid.get_children())) def db_changed(self): self.dbstate.db.connect('person-update', self.update) @@ -118,7 +114,7 @@ class PersonDetails(Gramplet): """ self.load_person_image(active_person) self.name.set_text(name_displayer.display(active_person)) - self.clear_table() + self.clear_grid() self.display_alternate_names(active_person) self.display_parents(active_person) self.display_separator() @@ -138,7 +134,7 @@ class PersonDetails(Gramplet): self.photo.set_image(None) self.photo.set_uistate(None, None) self.name.set_text(_('No active person')) - self.clear_table() + self.clear_grid() def display_separator(self): """ @@ -147,10 +143,7 @@ class PersonDetails(Gramplet): label = Gtk.Label(label='') label.modify_font(Pango.FontDescription('sans 4')) label.show() - rows = self.table.get_property('n-rows') - rows += 1 - self.table.resize(rows, 2) - self.table.attach(label, 0, 1, rows, rows + 1, xoptions=Gtk.AttachOptions.FILL) + self.grid.add(label) def display_alternate_names(self, active_person): """ diff --git a/gramps/plugins/gramplet/placedetails.py b/gramps/plugins/gramplet/placedetails.py index 876e4045b..0f00d2d78 100644 --- a/gramps/plugins/gramplet/placedetails.py +++ b/gramps/plugins/gramplet/placedetails.py @@ -40,15 +40,16 @@ class PlaceDetails(Gramplet): """ Build the GUI interface. """ - self.top = Gtk.HBox() - vbox = Gtk.VBox() + self.top = Gtk.Box() + vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.photo = Photo(self.uistate.screen_height() < 1000) self.title = Gtk.Label() self.title.set_alignment(0, 0) self.title.modify_font(Pango.FontDescription('sans bold 12')) vbox.pack_start(self.title, False, True, 7) - self.table = Gtk.Table(n_rows=1, n_columns=2) - vbox.pack_start(self.table, False, True, 0) + self.grid = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL) + self.grid.set_column_spacing(10) + vbox.pack_start(self.grid, False, True, 0) self.top.pack_start(self.photo, False, True, 5) self.top.pack_start(vbox, False, True, 10) self.top.show_all() @@ -64,19 +65,14 @@ class PlaceDetails(Gramplet): value = Gtk.Label(label=value) value.set_alignment(0, 0) value.show() - rows = self.table.get_property('n-rows') - rows += 1 - self.table.resize(rows, 2) - self.table.attach(label, 0, 1, rows, rows + 1, xoptions=Gtk.AttachOptions.FILL, - xpadding=10) - self.table.attach(value, 1, 2, rows, rows + 1) + self.grid.add(label) + self.grid.attach_next_to(value, label, Gtk.PositionType.RIGHT, 1, 1) - def clear_table(self): + def clear_grid(self): """ - Remove all the rows from the table. + Remove all the rows from the grid. """ - list(map(self.table.remove, self.table.get_children())) - self.table.resize(1, 2) + list(map(self.grid.remove, self.grid.get_children())) def db_changed(self): self.dbstate.db.connect('place-update', self.update) @@ -113,7 +109,7 @@ class PlaceDetails(Gramplet): title = place_displayer.display(self.dbstate.db, place) self.title.set_text(title) - self.clear_table() + self.clear_grid() self.add_row(_('Name'), place.get_name()) self.add_row(_('Type'), place.get_type()) self.display_separator() @@ -142,7 +138,7 @@ class PlaceDetails(Gramplet): self.photo.set_image(None) self.photo.set_uistate(None, None) self.title.set_text('') - self.clear_table() + self.clear_grid() def display_separator(self): """ @@ -151,10 +147,7 @@ class PlaceDetails(Gramplet): label = Gtk.Label(label='') label.modify_font(Pango.FontDescription('sans 4')) label.show() - rows = self.table.get_property('n-rows') - rows += 1 - self.table.resize(rows, 2) - self.table.attach(label, 0, 1, rows, rows + 1, xoptions=Gtk.AttachOptions.FILL) + self.grid.add(label) def load_place_image(self, place): """ diff --git a/gramps/plugins/gramplet/repositorydetails.py b/gramps/plugins/gramplet/repositorydetails.py index 15a27f942..0ff8679d6 100644 --- a/gramps/plugins/gramplet/repositorydetails.py +++ b/gramps/plugins/gramplet/repositorydetails.py @@ -37,14 +37,15 @@ class RepositoryDetails(Gramplet): """ Build the GUI interface. """ - self.top = Gtk.HBox() - vbox = Gtk.VBox() + self.top = Gtk.Box() + vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.name = Gtk.Label() self.name.set_alignment(0, 0) self.name.modify_font(Pango.FontDescription('sans bold 12')) vbox.pack_start(self.name, fill=True, expand=False, padding=7) - self.table = Gtk.Table(n_rows=1, n_columns=2) - vbox.pack_start(self.table, fill=True, expand=False, padding=0) + self.grid = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL) + self.grid.set_column_spacing(10) + vbox.pack_start(self.grid, fill=True, expand=False, padding=0) self.top.pack_start(vbox, fill=True, expand=False, padding=10) self.top.show_all() return self.top @@ -59,19 +60,14 @@ class RepositoryDetails(Gramplet): value = Gtk.Label(label=value) value.set_alignment(0, 0) value.show() - rows = self.table.get_property('n-rows') - rows += 1 - self.table.resize(rows, 2) - self.table.attach(label, 0, 1, rows, rows + 1, - xoptions=Gtk.AttachOptions.FILL, xpadding=10) - self.table.attach(value, 1, 2, rows, rows + 1) + self.grid.add(label) + self.grid.attach_next_to(value, label, Gtk.PositionType.RIGHT, 1, 1) - def clear_table(self): + def clear_grid(self): """ - Remove all the rows from the table. + Remove all the rows from the grid. """ - list(map(self.table.remove, self.table.get_children())) - self.table.resize(1, 2) + list(map(self.grid.remove, self.grid.get_children())) def db_changed(self): self.dbstate.db.connect('repository-update', self.update) @@ -106,7 +102,7 @@ class RepositoryDetails(Gramplet): """ self.name.set_text(repo.get_name()) - self.clear_table() + self.clear_grid() address_list = repo.get_address_list() if len(address_list) > 0: self.display_address(address_list[0]) @@ -140,7 +136,7 @@ class RepositoryDetails(Gramplet): Display empty details when no repository is selected. """ self.name.set_text('') - self.clear_table() + self.clear_grid() def display_separator(self): """ @@ -149,8 +145,4 @@ class RepositoryDetails(Gramplet): label = Gtk.Label(label='') label.modify_font(Pango.FontDescription('sans 4')) label.show() - rows = self.table.get_property('n-rows') - rows += 1 - self.table.resize(rows, 2) - self.table.attach(label, 0, 1, rows, rows + 1, - xoptions=Gtk.AttachOptions.FILL) + self.grid.add(label) diff --git a/gramps/plugins/lib/maps/geography.py b/gramps/plugins/lib/maps/geography.py index c1d16ccfb..028690b9b 100644 --- a/gramps/plugins/lib/maps/geography.py +++ b/gramps/plugins/lib/maps/geography.py @@ -1040,12 +1040,12 @@ class GeoGraphyView(OsmGps, NavigationView): Add specific entry to the preference menu. Must be done in the associated view. """ - table = Gtk.Table(n_rows=2, n_columns=2) - table.set_border_width(12) - table.set_col_spacings(6) - table.set_row_spacings(6) - configdialog.add_text(table, _('Nothing for this view.'), 0) - return _('Specific parameters'), table + grid = Gtk.Grid() + grid.set_border_width(12) + grid.set_column_spacing(6) + grid.set_row_spacing(6) + configdialog.add_text(grid, _('Nothing for this view.'), 0) + return _('Specific parameters'), grid def map_options(self, configdialog): """ @@ -1057,26 +1057,26 @@ class GeoGraphyView(OsmGps, NavigationView): config.get('geography.zoom_when_center')) self._config.set('geography.max_places', self._config.get('geography.max_places')) - table = Gtk.Table(n_rows=1, n_columns=1) - table.set_border_width(12) - table.set_col_spacings(6) - table.set_row_spacings(6) - configdialog.add_text(table, + grid = Gtk.Grid() + grid.set_border_width(12) + grid.set_column_spacing(6) + grid.set_row_spacing(6) + configdialog.add_text(grid, _('Where to save the tiles for offline mode.'), 0, line_wrap=False) - configdialog.add_entry(table, '', + configdialog.add_entry(grid, '', 1, 'geography.path') - configdialog.add_text(table, + configdialog.add_text(grid, _('If you have no more space in your file system. ' 'You can remove all tiles placed in the above path.\n' 'Be careful! If you have no internet, you\'ll get no map.'), 2, line_wrap=False) - configdialog.add_slider(table, + configdialog.add_slider(grid, _('Zoom used when centering'), 3, 'geography.zoom_when_center', (2, 16)) - configdialog.add_slider(table, + configdialog.add_slider(grid, _('The maximum number of places to show'), 4, 'geography.max_places', (1000, 10000)) - return _('The map'), table + return _('The map'), grid diff --git a/gramps/plugins/tool/mediamanager.py b/gramps/plugins/tool/mediamanager.py index 684629287..2af74c838 100644 --- a/gramps/plugins/tool/mediamanager.py +++ b/gramps/plugins/tool/mediamanager.py @@ -196,12 +196,12 @@ class MediaMan(tool.Tool): # Assistant pages # #------------------------------------------------------------------------ -class IntroductionPage(Gtk.VBox): +class IntroductionPage(Gtk.Box): """ A page containing introductory text. """ def __init__(self): - GObject.GObject.__init__(self) + Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) # Using set_page_side_image causes window sizing problems, so put the # image in the main page instead. @@ -243,20 +243,20 @@ class IntroductionPage(Gtk.VBox): ) % { 'bold_start' : '' , 'bold_end' : '' } -class SelectionPage(Gtk.VBox): +class SelectionPage(Gtk.Box): """ A page with the radio buttons for every available batch op. """ def __init__(self, batch_ops): - GObject.GObject.__init__(self) + Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.batch_op_buttons = [] self.set_spacing(12) - table = Gtk.Table(n_rows=2 * len(batch_ops), n_columns=2) - table.set_row_spacings(6) - table.set_col_spacings(6) + grid = Gtk.Grid() + grid.set_row_spacing(6) + grid.set_column_spacing(6) button = None for index in range(len(batch_ops)): @@ -266,9 +266,9 @@ class SelectionPage(Gtk.VBox): button = Gtk.RadioButton.new_with_mnemonic_from_widget(button, title) button.set_tooltip_text(description) self.batch_op_buttons.append(button) - table.attach(button, 0, 2, 2 * index, 2 * index + 1, yoptions=0) + grid.attach(button, 0, 2 * index, 2, 1) - self.add(table) + self.add(grid) def get_index(self): """ @@ -282,12 +282,12 @@ class SelectionPage(Gtk.VBox): else: return 0 -class SettingsPage(Gtk.VBox): +class SettingsPage(Gtk.Box): """ An extra page with the settings specific for the chosen batch-op. """ def __init__(self, batch_ops, assistant): - GObject.GObject.__init__(self) + Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.assistant = assistant self.batch_ops = batch_ops @@ -307,13 +307,13 @@ class SettingsPage(Gtk.VBox): self.assistant.set_page_title(self, '') return False -class ConfirmationPage(Gtk.VBox): +class ConfirmationPage(Gtk.Box): """ A page to display the summary of the proposed action, as well as the list of affected paths. """ def __init__(self, batch_ops): - GObject.GObject.__init__(self) + Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.batch_ops = batch_ops @@ -356,13 +356,13 @@ class ConfirmationPage(Gtk.VBox): for path in path_list: self.path_model.append(row=[path]) -class ConclusionPage(Gtk.VBox): +class ConclusionPage(Gtk.Box): """ A page to display the summary of the proposed action, as well as the list of affected paths. """ def __init__(self, assistant): - GObject.GObject.__init__(self) + Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.assistant = assistant @@ -485,32 +485,34 @@ class PathChange(BatchOp): def build_config(self): title = _("Replace substring settings") - box = Gtk.VBox() + box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) box.set_spacing(12) - table = Gtk.Table(n_rows=2, n_columns=2) - table.set_row_spacings(6) - table.set_col_spacings(6) + grid = Gtk.Grid() + grid.set_row_spacing(6) + grid.set_column_spacing(6) self.from_entry = Gtk.Entry() - table.attach(self.from_entry, 1, 2, 0, 1, yoptions=0) + self.from_entry.set_hexpand(True) + grid.attach(self.from_entry, 1, 0, 1, 1) from_label = Gtk.Label(label=_('_Replace:')) from_label.set_use_underline(True) from_label.set_alignment(0, 0.5) from_label.set_mnemonic_widget(self.from_entry) - table.attach(from_label, 0, 1, 0, 1, xoptions=0, yoptions=0) + grid.attach(from_label, 0, 0, 1, 1) self.to_entry = Gtk.Entry() - table.attach(self.to_entry, 1, 2, 1, 2, yoptions=0) + self.to_entry.set_hexpand(True) + grid.attach(self.to_entry, 1, 1, 1, 1) to_label = Gtk.Label(label=_('_With:')) to_label.set_use_underline(True) to_label.set_alignment(0, 0.5) to_label.set_mnemonic_widget(self.to_entry) - table.attach(to_label, 0, 1, 1, 2, xoptions=0, yoptions=0) + grid.attach(to_label, 0, 1, 1, 1) - box.add(table) + box.add(grid) return (title, box) diff --git a/gramps/plugins/view/fanchartdescview.py b/gramps/plugins/view/fanchartdescview.py index b4ff6ebb4..1e1836ec9 100644 --- a/gramps/plugins/view/fanchartdescview.py +++ b/gramps/plugins/view/fanchartdescview.py @@ -266,15 +266,15 @@ class FanChartDescView(fanchartdesc.FanChartDescGrampsGUI, NavigationView): Function that builds the widget in the configuration dialog """ nrentry = 8 - table = Gtk.Table(n_rows=6, n_columns=3) - table.set_border_width(12) - table.set_col_spacings(6) - table.set_row_spacings(6) + grid = Gtk.Grid() + grid.set_border_width(12) + grid.set_column_spacing(6) + grid.set_row_spacing(6) - configdialog.add_spinner(table, _("Max generations"), 0, + configdialog.add_spinner(grid, _("Max generations"), 0, 'interface.fanview-maxgen', (1, 11), callback=self.cb_update_maxgen) - configdialog.add_combo(table, + configdialog.add_combo(grid, _('Text Font'), 1, 'interface.fanview-font', self.allfonts, callback=self.cb_update_font, valueactive=True) @@ -295,7 +295,7 @@ class FanChartDescView(fanchartdesc.FanChartDescGrampsGUI, NavigationView): if curval == nr: break nrval += 1 - configdialog.add_combo(table, + configdialog.add_combo(grid, _('Background'), 2, 'interface.fanview-background', backgrvals, @@ -303,21 +303,21 @@ class FanChartDescView(fanchartdesc.FanChartDescGrampsGUI, NavigationView): setactive=nrval ) #colors, stored as hex values - configdialog.add_color(table, _('Start gradient/Main color'), 3, + configdialog.add_color(grid, _('Start gradient/Main color'), 3, 'interface.color-start-grad', col=1) - configdialog.add_color(table, _('End gradient/2nd color'), 4, + configdialog.add_color(grid, _('End gradient/2nd color'), 4, 'interface.color-end-grad', col=1) - configdialog.add_color(table, _('Color for duplicates'), 5, + configdialog.add_color(grid, _('Color for duplicates'), 5, 'interface.duplicate-color', col=1) # form of the fan - configdialog.add_combo(table, _('Fan chart type'), 6, + configdialog.add_combo(grid, _('Fan chart type'), 6, 'interface.fanview-form', ((fanchart.FORM_CIRCLE, _('Full Circle')), (fanchart.FORM_HALFCIRCLE, _('Half Circle')), (fanchart.FORM_QUADRANT, _('Quadrant'))), callback=self.cb_update_form) # algo for the fan angle distribution - configdialog.add_combo(table, _('Fan chart distribution'), 7, + configdialog.add_combo(grid, _('Fan chart distribution'), 7, 'interface.angle-algorithm', ((fanchartdesc.ANGLE_CHEQUI, _('Homogeneous children distribution')), @@ -326,7 +326,7 @@ class FanChartDescView(fanchartdesc.FanChartDescGrampsGUI, NavigationView): ), callback=self.cb_update_anglealgo) - return _('Layout'), table + return _('Layout'), grid def config_connect(self): """ diff --git a/gramps/plugins/view/fanchartview.py b/gramps/plugins/view/fanchartview.py index edf95119d..de57aac0f 100644 --- a/gramps/plugins/view/fanchartview.py +++ b/gramps/plugins/view/fanchartview.py @@ -264,15 +264,15 @@ class FanChartView(fanchart.FanChartGrampsGUI, NavigationView): Function that builds the widget in the configuration dialog """ nrentry = 7 - table = Gtk.Table(n_rows=6, n_columns=3) - table.set_border_width(12) - table.set_col_spacings(6) - table.set_row_spacings(6) + grid = Gtk.Grid() + grid.set_border_width(12) + grid.set_column_spacing(6) + grid.set_row_spacing(6) - configdialog.add_spinner(table, _("Max generations"), 0, + configdialog.add_spinner(grid, _("Max generations"), 0, 'interface.fanview-maxgen', (1, 11), callback=self.cb_update_maxgen) - configdialog.add_combo(table, + configdialog.add_combo(grid, _('Text Font'), 1, 'interface.fanview-font', self.allfonts, callback=self.cb_update_font, valueactive=True) @@ -293,26 +293,26 @@ class FanChartView(fanchart.FanChartGrampsGUI, NavigationView): if curval == nr: break nrval += 1 - configdialog.add_combo(table, + configdialog.add_combo(grid, _('Background'), 2, 'interface.fanview-background', backgrvals, callback=self.cb_update_background, valueactive=False, setactive=nrval ) #colors, stored as hex values - configdialog.add_color(table, _('Start gradient/Main color'), 3, + configdialog.add_color(grid, _('Start gradient/Main color'), 3, 'interface.color-start-grad', col=1) - configdialog.add_color(table, _('End gradient/2nd color'), 4, + configdialog.add_color(grid, _('End gradient/2nd color'), 4, 'interface.color-end-grad', col=1) # form of the fan - configdialog.add_combo(table, _('Fan chart type'), 5, + configdialog.add_combo(grid, _('Fan chart type'), 5, 'interface.fanview-form', ((0, _('Full Circle')), (1,_('Half Circle')), (2, _('Quadrant'))), callback=self.cb_update_form) # options users should not change: - configdialog.add_checkbox(table, + configdialog.add_checkbox(grid, _('Show children ring'), nrentry-1, 'interface.fanview-childrenring') # options we don't show on the dialog @@ -320,7 +320,7 @@ class FanChartView(fanchart.FanChartGrampsGUI, NavigationView): ## _('Allow radial text'), ## ??, 'interface.fanview-radialtext') - return _('Layout'), table + return _('Layout'), grid def config_connect(self): """ diff --git a/gramps/plugins/view/geoclose.py b/gramps/plugins/view/geoclose.py index 41ec3cdc0..bc7800330 100644 --- a/gramps/plugins/view/geoclose.py +++ b/gramps/plugins/view/geoclose.py @@ -565,11 +565,11 @@ class GeoClose(GeoGraphyView): Add specific entry to the preference menu. Must be done in the associated view. """ - table = Gtk.Table(n_rows=2, n_columns=2) - table.set_border_width(12) - table.set_col_spacings(6) - table.set_row_spacings(6) - configdialog.add_text(table, + grid = Gtk.Grid() + grid.set_border_width(12) + grid.set_column_spacing(6) + grid.set_row_spacing(6) + configdialog.add_text(grid, _('The meeting zone probability radius.\n' 'The colored zone is approximative.\n' 'The meeting zone is only shown for the reference person.\n' @@ -577,11 +577,11 @@ class GeoClose(GeoGraphyView): 'The value 1 means about 4.6 miles or 7.5 kms.\n' 'The value is in tenth of degree.'), 1, line_wrap=False) - self.config_meeting_slider = configdialog.add_slider(table, + self.config_meeting_slider = configdialog.add_slider(grid, "", 2, 'geography.maximum_meeting_zone', (1, 9)) - return _('The selection parameters'), table + return _('The selection parameters'), grid def config_connect(self): """ diff --git a/gramps/plugins/view/geofamclose.py b/gramps/plugins/view/geofamclose.py index 87628852a..e182bb7ca 100644 --- a/gramps/plugins/view/geofamclose.py +++ b/gramps/plugins/view/geofamclose.py @@ -708,11 +708,11 @@ class GeoFamClose(GeoGraphyView): Add specific entry to the preference menu. Must be done in the associated view. """ - table = Gtk.Table(n_rows=2, n_columns=2) - table.set_border_width(12) - table.set_col_spacings(6) - table.set_row_spacings(6) - configdialog.add_text(table, + grid = Gtk.Grid() + grid.set_border_width(12) + grid.set_column_spacing(6) + grid.set_row_spacing(6) + configdialog.add_text(grid, _('The meeting zone probability radius.\n' 'The colored zone is approximative.\n' 'The meeting zone is only shown for the reference family.\n' @@ -720,11 +720,11 @@ class GeoFamClose(GeoGraphyView): 'The value 1 means about 4.6 miles or 7.5 kms.\n' 'The value is in tenth of degree.'), 1, line_wrap=False) - self.config_meeting_slider = configdialog.add_slider(table, + self.config_meeting_slider = configdialog.add_slider(grid, "", 2, 'geography.maximum_meeting_zone', (1, 9)) - return _('The selection parameters'), table + return _('The selection parameters'), grid def config_connect(self): """ diff --git a/gramps/plugins/view/geomoves.py b/gramps/plugins/view/geomoves.py index 23a6e5639..995e11b19 100644 --- a/gramps/plugins/view/geomoves.py +++ b/gramps/plugins/view/geomoves.py @@ -633,25 +633,25 @@ class GeoMoves(GeoGraphyView): Add specific entry to the preference menu. Must be done in the associated view. """ - table = Gtk.Table(n_rows=2, n_columns=2) - table.set_border_width(12) - table.set_col_spacings(6) - table.set_row_spacings(6) - configdialog.add_text(table, + grid = Gtk.Grid() + grid.set_border_width(12) + grid.set_column_spacing(6) + grid.set_row_spacing(6) + configdialog.add_text(grid, _('The maximum number of generations.\n'), 1, line_wrap=False) - configdialog.add_slider(table, + configdialog.add_slider(grid, "", 2, 'geography.maximum_generations', (1, 20)) - configdialog.add_text(table, + configdialog.add_text(grid, _('Time in milliseconds between drawing two generations.\n'), 3, line_wrap=False) - configdialog.add_slider(table, + configdialog.add_slider(grid, "", 4, 'geography.generation_interval', (500, 3000)) - return _('The parameters for moves'), table + return _('The parameters for moves'), grid def config_connect(self): """ diff --git a/gramps/plugins/view/geoperson.py b/gramps/plugins/view/geoperson.py index d87a1d14b..ae53a5243 100644 --- a/gramps/plugins/view/geoperson.py +++ b/gramps/plugins/view/geoperson.py @@ -514,30 +514,30 @@ class GeoPerson(GeoGraphyView): Add specific entry to the preference menu. Must be done in the associated view. """ - table = Gtk.Table(n_rows=2, n_columns=2) - table.set_border_width(12) - table.set_col_spacings(6) - table.set_row_spacings(6) - configdialog.add_text(table, + grid = Gtk.Grid() + grid.set_border_width(12) + grid.set_column_spacing(6) + grid.set_row_spacing(6) + configdialog.add_text(grid, _('Animation speed in milliseconds (big value means slower)'), 1, line_wrap=False) - configdialog.add_slider(table, + configdialog.add_slider(grid, "", 2, 'geography.speed', (100, 1000)) - configdialog.add_text(table, + configdialog.add_text(grid, _('How many steps between two markers when we are on large move ?'), 3, line_wrap=False) - configdialog.add_slider(table, + configdialog.add_slider(grid, "", 4, 'geography.steps', (10, 100)) - configdialog.add_text(table, + configdialog.add_text(grid, _('The minimum latitude/longitude to select large move.\n' 'The value is in tenth of degree.'), 5, line_wrap=False) - configdialog.add_slider(table, + configdialog.add_slider(grid, "", 6, 'geography.maximum_lon_lat', (5, 50)) - return _('The animation parameters'), table + return _('The animation parameters'), grid diff --git a/gramps/plugins/view/htmlrenderer.py b/gramps/plugins/view/htmlrenderer.py index b24466cf0..9bab0996f 100644 --- a/gramps/plugins/view/htmlrenderer.py +++ b/gramps/plugins/view/htmlrenderer.py @@ -329,7 +329,7 @@ class HtmlView(NavigationView): self.renderer = None self.urlfield = "" self.htmlfile = "" - self.filter = Gtk.HBox() + self.filter = Gtk.Box() self.table = "" self.browser = NOWEB #self.bootstrap_handler = None @@ -344,16 +344,14 @@ class HtmlView(NavigationView): contains the interface. This containter will be inserted into a Gtk.Notebook page. """ - self.box = Gtk.VBox(homogeneous=False, spacing=4) + self.box = Gtk.VBox(spacing=4) #top widget at the top self.box.pack_start(self.top_widget(), False, False, 0 ) #web page under it in a scrolled window - #self.table = Gtk.Table(1, 1, False) self.toolkit = TOOLKIT = get_toolkits() self.renderer = RendererWebkit() - self.frames = Gtk.HBox(homogeneous=False, spacing=4) - frame = Gtk.ScrolledWindow(hadjustment=None, - vadjustment=None) + self.frames = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=4) + frame = Gtk.ScrolledWindow(hadjustment=None, vadjustment=None) frame.set_shadow_type(Gtk.ShadowType.NONE) frame.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) frame.add(self.renderer.get_window()) @@ -375,7 +373,7 @@ class HtmlView(NavigationView): """ The default class gives a widget where user can type an url """ - hbox = Gtk.HBox(homogeneous=False, spacing=4) + hbox = Gtk.Box(spacing=4) self.urlfield = Gtk.Entry() self.urlfield.set_text(config.get("htmlview.start-url")) self.urlfield.connect('activate', self._on_activate) diff --git a/gramps/plugins/view/pedigreeview.py b/gramps/plugins/view/pedigreeview.py index 6fedbb582..e9d6e646e 100644 --- a/gramps/plugins/view/pedigreeview.py +++ b/gramps/plugins/view/pedigreeview.py @@ -1994,37 +1994,37 @@ class PedigreeView(NavigationView): """ Function that builds the widget in the configuration dialog """ - table = Gtk.Table(n_rows=7, n_columns=2) - table.set_border_width(12) - table.set_col_spacings(6) - table.set_row_spacings(6) + grid = Gtk.Grid() + grid.set_border_width(12) + grid.set_column_spacing(6) + grid.set_row_spacing(6) - configdialog.add_checkbox(table, + configdialog.add_checkbox(grid, _('Show images'), 0, 'interface.pedview-show-images') - configdialog.add_checkbox(table, + configdialog.add_checkbox(grid, _('Show marriage data'), 1, 'interface.pedview-show-marriage') - configdialog.add_checkbox(table, + configdialog.add_checkbox(grid, _('Show unknown people'), 2, 'interface.pedview-show-unknown-people') - configdialog.add_combo(table, + configdialog.add_combo(grid, _('Tree style'), 4, 'interface.pedview-layout', ((0, _('Standard')), (1, _('Compact')), (2, _('Expanded'))), callback=self.cb_update_layout) - configdialog.add_combo(table, + configdialog.add_combo(grid, _('Tree direction'), 5, 'interface.pedview-tree-direction', ((0, _('Vertical (↓)')), (1, _('Vertical (↑)')), (2, _('Horizontal (→)')), (3, _('Horizontal (←)')))) - self.config_size_slider = configdialog.add_slider(table, + self.config_size_slider = configdialog.add_slider(grid, _('Tree size'), 6, 'interface.pedview-tree-size', (2, 9)) - return _('Layout'), table + return _('Layout'), grid diff --git a/gramps/plugins/view/relview.py b/gramps/plugins/view/relview.py index a094ad2c9..164a939f5 100644 --- a/gramps/plugins/view/relview.py +++ b/gramps/plugins/view/relview.py @@ -123,21 +123,6 @@ _SPACE = Gdk.keyval_from_name("space") _LEFT_BUTTON = 1 _RIGHT_BUTTON = 3 -class AttachList(object): - - def __init__(self): - self.list = [] - self.max_x = 0 - self.max_y = 0 - - def attach(self, widget, x0, x1, y0, y1, xoptions=Gtk.AttachOptions.EXPAND|Gtk.AttachOptions.FILL, - yoptions=Gtk.AttachOptions.EXPAND|Gtk.AttachOptions.FILL): - assert(widget) - assert(x1>x0) - self.list.append((widget, x0, x1, y0, y1, xoptions, yoptions)) - self.max_x = max(self.max_x, x1) - self.max_y = max(self.max_y, y1) - class RelationshipView(NavigationView): """ View showing a textual representation of the relationships of the @@ -314,13 +299,13 @@ class RelationshipView(NavigationView): Build the widget that contains the view, see :class:`~gui.views.pageview.PageView """ - container = Gtk.VBox() + container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) container.set_border_width(12) - self.vbox = Gtk.VBox() + self.vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.vbox.show() - self.header = Gtk.VBox() + self.header = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.header.show() self.child = None @@ -335,7 +320,8 @@ class RelationshipView(NavigationView): self.color = Gdk.RGBA() self.color.parse("White") - self.scroll.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) + self.scroll.set_policy(Gtk.PolicyType.AUTOMATIC, + Gtk.PolicyType.AUTOMATIC) self.scroll.show() vp = Gtk.Viewport() @@ -347,8 +333,8 @@ class RelationshipView(NavigationView): container.set_spacing(6) container.pack_start(self.header, False, False, 0) - container.pack_start(Gtk.HSeparator(), False, False, 0) - container.add(self.scroll) + container.pack_start(Gtk.Separator(), False, False, 0) + container.pack_start(self.scroll, True, True, 0) container.show_all() return container @@ -526,7 +512,10 @@ class RelationshipView(NavigationView): self.write_title(person) - self.attach = AttachList() + self.child = Gtk.Grid() + self.child.set_border_width(12) + self.child.set_column_spacing(12) + self.child.set_row_spacing(0) self.row = 0 family_handle_list = person.get_parent_family_handle_list() @@ -551,39 +540,6 @@ class RelationshipView(NavigationView): if family_handle: self.write_family(family_handle, person) - self.row = 0 - - # Here it is necessary to beat GTK into submission. For some - # bizzare reason, if you have an empty column that is spanned, - # you lose the appropriate FILL handling. So, we need to see if - # column 3 is unused (usually if there is no siblings or children. - # If so, we need to subtract one index of each x coord > 3. - - found = False - for d in self.attach.list: - if d[1] == 4 or d[2] == 4: - found = True - - if found: - cols = self.attach.max_x - else: - cols = self.attach.max_x-1 - - self.child = Gtk.Table(n_rows=self.attach.max_y, n_columns=cols) - self.child.set_border_width(12) - self.child.set_col_spacings(12) - self.child.set_row_spacings(0) - - for d in self.attach.list: - x0 = d[1] - x1 = d[2] - if not found: - if x0 > 4: - x0 -= 1 - if x1 > 4: - x1 -= 1 - self.child.attach(d[0], x0, x1, d[3], d[4], d[5], d[6]) - self.child.show_all() self.vbox.pack_start(self.child, False, True, 0) @@ -600,9 +556,9 @@ class RelationshipView(NavigationView): def write_title(self, person): list(map(self.header.remove, self.header.get_children())) - table = Gtk.Table(n_rows=2, n_columns=3) - table.set_col_spacings(12) - table.set_row_spacings(0) + grid = Gtk.Grid() + grid.set_column_spacing(12) + grid.set_row_spacing(0) # name and edit button name = name_displayer.display(person) @@ -622,23 +578,23 @@ class RelationshipView(NavigationView): hbox = widgets.LinkBox(label, button) eventbox.add(hbox) - table.attach(eventbox, 0, 2, 0, 1) + grid.attach(eventbox, 0, 0, 2, 1) eventbox = Gtk.EventBox() if self.use_shade: eventbox.override_background_color(Gtk.StateType.NORMAL, self.color) - table.attach(eventbox, 1, 2, 1, 2) - subtbl = Gtk.Table(n_rows=3, n_columns=3) - subtbl.set_col_spacings(12) - subtbl.set_row_spacings(0) - eventbox.add(subtbl) + grid.attach(eventbox, 1, 1, 1, 1) + subgrid = Gtk.Grid() + subgrid.set_column_spacing(12) + subgrid.set_row_spacing(0) + eventbox.add(subgrid) self._set_draggable_person(eventbox, person.get_handle()) # GRAMPS ID - subtbl.attach(widgets.BasicLabel("%s:" % _('ID')), - 1, 2, 0, 1, xoptions=Gtk.AttachOptions.FILL, yoptions=0) - subtbl.attach(widgets.BasicLabel(person.gramps_id), - 2, 3, 0, 1, yoptions=0) + subgrid.attach(widgets.BasicLabel("%s:" % _('ID')), 1, 0, 1, 1) + label = widgets.BasicLabel(person.gramps_id) + label.set_hexpand(True) + subgrid.attach(label, 2, 0, 1, 1) # Birth event. birth = get_birth_or_fallback(self.dbstate.db, person) @@ -647,10 +603,8 @@ class RelationshipView(NavigationView): else: birth_title = _("Birth") - subtbl.attach(widgets.BasicLabel("%s:" % birth_title), - 1, 2, 1, 2, xoptions=Gtk.AttachOptions.FILL, yoptions=0) - subtbl.attach(widgets.BasicLabel(self.format_event(birth)), - 2, 3, 1, 2, yoptions=0) + subgrid.attach(widgets.BasicLabel("%s:" % birth_title), 1, 1, 1, 1) + subgrid.attach(widgets.BasicLabel(self.format_event(birth)), 2, 1, 1, 1) death = get_death_or_fallback(self.dbstate.db, person) if death: @@ -666,36 +620,35 @@ class RelationshipView(NavigationView): death_date = death.get_date_object() if (death_date and death_date.get_valid()): age = death_date - birth_date - subtbl.attach(widgets.BasicLabel("%s:" % death_title), - 1, 2, 2, 3, xoptions=Gtk.AttachOptions.FILL, yoptions=0) - subtbl.attach(widgets.BasicLabel("%s (%s)" % + subgrid.attach(widgets.BasicLabel("%s:" % death_title), + 1, 2, 1, 1) + subgrid.attach(widgets.BasicLabel("%s (%s)" % (self.format_event(death), age), Pango.EllipsizeMode.END), - 2, 3, 2, 3, yoptions=0) + 2, 2, 1, 1) showed_death = True if not showed_death: age = Today() - birth_date if probably_alive(person, self.dbstate.db): - subtbl.attach(widgets.BasicLabel("%s:" % _("Alive")), - 1, 2, 2, 3, xoptions=Gtk.AttachOptions.FILL, yoptions=0) - subtbl.attach(widgets.BasicLabel("(%s)" % age, Pango.EllipsizeMode.END), - 2, 3, 2, 3, yoptions=0) - else: - subtbl.attach(widgets.BasicLabel("%s:" % _("Death")), - 1, 2, 2, 3, xoptions=Gtk.AttachOptions.FILL, yoptions=0) - subtbl.attach(widgets.BasicLabel("%s (%s)" % (_("unknown"), age), + subgrid.attach(widgets.BasicLabel("%s:" % _("Alive")), + 1, 2, 1, 1) + subgrid.attach(widgets.BasicLabel("(%s)" % age, Pango.EllipsizeMode.END), + 2, 2, 1, 1) + subgrid.attach(widgets.BasicLabel("%s:" % _("Death")), + 1, 2, 1, 1) + subgrid.attach(widgets.BasicLabel("%s (%s)" % (_("unknown"), age), Pango.EllipsizeMode.END), - 2, 3, 2, 3, yoptions=0) + 2, 2, 1, 1) showed_death = True if not showed_death: - subtbl.attach(widgets.BasicLabel("%s:" % death_title), - 1, 2, 2, 3, xoptions=Gtk.AttachOptions.FILL, yoptions=0) - subtbl.attach(widgets.BasicLabel(self.format_event(death)), - 2, 3, 2, 3, yoptions=0) + subgrid.attach(widgets.BasicLabel("%s:" % death_title), + 1, 2, 1, 1) + subgrid.attach(widgets.BasicLabel(self.format_event(death)), + 2, 2, 1, 1) - mbox = Gtk.HBox() - mbox.add(table) + mbox = Gtk.Box() + mbox.add(grid) # image image_list = person.get_media_list() @@ -779,12 +732,10 @@ class RelationshipView(NavigationView): return '' def write_person_data(self, title, data): - self.attach.attach(widgets.BasicLabel(title), _ALABEL_START, - _ALABEL_STOP, self.row, self.row+1, - xoptions=Gtk.AttachOptions.FILL|Gtk.AttachOptions.SHRINK) - self.attach.attach(widgets.BasicLabel(data), - _ADATA_START, _ADATA_STOP, - self.row, self.row+1) + self.child.attach(widgets.BasicLabel(title), _ALABEL_START, self.row, + _ALABEL_STOP-_ALABEL_START, 1) + self.child.attach(widgets.BasicLabel(data), _ADATA_START, self.row, + _ADATA_STOP-_ADATA_START, 1) self.row += 1 def write_label(self, title, family, is_parent, person = None): @@ -794,7 +745,7 @@ class RelationshipView(NavigationView): (collapse/expand arrow, Parents/Family title label, Family gramps_id, and add-choose-edit-delete buttons) """ msg = '%s' % cgi.escape(title) - hbox = Gtk.HBox() + hbox = Gtk.Box() label = widgets.MarkupLabel(msg, x_align=1) # Draw the collapse/expand button: if family is not None: @@ -816,9 +767,8 @@ class RelationshipView(NavigationView): if family is not None: self._set_draggable_family(eventbox, family.handle) eventbox.add(hbox) - self.attach.attach(eventbox, - _LABEL_START, _LABEL_STOP, - self.row, self.row+1, Gtk.AttachOptions.SHRINK|Gtk.AttachOptions.FILL) + self.child.attach(eventbox, _LABEL_START, self.row, + _LABEL_STOP-_LABEL_START, 1) if family: value = family.gramps_id @@ -828,16 +778,16 @@ class RelationshipView(NavigationView): if family is not None: self._set_draggable_family(eventbox, family.handle) eventbox.add(widgets.BasicLabel(value)) - self.attach.attach(eventbox, - _DATA_START, _DATA_STOP, - self.row, self.row+1, Gtk.AttachOptions.SHRINK|Gtk.AttachOptions.FILL) + self.child.attach(eventbox, _DATA_START, self.row, + _DATA_STOP-_DATA_START, 1) if family and self.check_collapsed(person.handle, family.handle): # show family names later pass else: - hbox = Gtk.HBox() + hbox = Gtk.Box() hbox.set_spacing(12) + hbox.set_hexpand(True) if is_parent: call_fcn = self.add_parent_family del_fcn = self.delete_parent_family @@ -888,7 +838,8 @@ class RelationshipView(NavigationView): if family is not None: self._set_draggable_family(eventbox, family.handle) eventbox.add(hbox) - self.attach.attach(eventbox, _BTN_START, _BTN_STOP, self.row, self.row+1) + self.child.attach(eventbox, _BTN_START, self.row, + _BTN_STOP-_BTN_START, 1) self.row += 1 ###################################################################### @@ -931,9 +882,8 @@ class RelationshipView(NavigationView): if self.use_shade: eventbox.override_background_color(Gtk.StateType.NORMAL, self.color) eventbox.add(box) - self.attach.attach( - eventbox, _PDATA_START, _PDATA_STOP, - self.row, self.row+1) + self.child.attach(eventbox, _PDATA_START, self.row, + _PDATA_STOP-_PDATA_START, 1) self.row += 1 # now advance it else: self.write_label("%s:" % _('Parents'), family, True, person) @@ -942,7 +892,7 @@ class RelationshipView(NavigationView): if self.show_siblings: active = self.get_active() - hbox = Gtk.HBox() + hbox = Gtk.Box() if self.check_collapsed(person.handle, "SIBLINGS"): arrow = widgets.ExpandCollapseArrow(True, self.expand_collapse_press, @@ -954,13 +904,11 @@ class RelationshipView(NavigationView): hbox.pack_start(arrow, False, True, 0) label_cell = self.build_label_cell(_('Siblings')) hbox.pack_start(label_cell, True, True, 0) - self.attach.attach( - hbox, _CLABEL_START-1, _CLABEL_STOP-1, self.row, - self.row+1, xoptions=Gtk.AttachOptions.FILL|Gtk.AttachOptions.SHRINK, - yoptions=Gtk.AttachOptions.FILL) + self.child.attach(hbox, _CLABEL_START-1, self.row, + _CLABEL_STOP-_CLABEL_START, 1) if self.check_collapsed(person.handle, "SIBLINGS"): - hbox = Gtk.HBox() + hbox = Gtk.Box() child_list = [ref.ref for ref in family.get_child_ref_list() if ref.ref != active] if child_list: @@ -988,12 +936,11 @@ class RelationshipView(NavigationView): if self.use_shade: eventbox.override_background_color(Gtk.StateType.NORMAL, self.color) eventbox.add(box) - self.attach.attach( - eventbox, _PDATA_START, _PDATA_STOP, - self.row, self.row+1) + self.child.attach(eventbox, _PDATA_START, self.row, + _PDATA_STOP-_PDATA_START, 1) self.row += 1 # now advance it else: - hbox = Gtk.HBox() + hbox = Gtk.Box() addchild = widgets.IconButton(self.add_child_to_fam, family.handle, Gtk.STOCK_ADD) @@ -1005,13 +952,10 @@ class RelationshipView(NavigationView): hbox.pack_start(addchild, False, True, 0) hbox.pack_start(selchild, False, True, 0) - self.attach.attach( - hbox, _CLABEL_START, _CLABEL_STOP, self.row, - self.row+1, xoptions=Gtk.AttachOptions.FILL|Gtk.AttachOptions.SHRINK, - yoptions=Gtk.AttachOptions.FILL) - + self.child.attach(hbox, _CLABEL_START, self.row, + _CLABEL_STOP-_CLABEL_START, 1) self.row += 1 - vbox = Gtk.VBox() + vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) i = 1 child_list = [ref.ref for ref in family.get_child_ref_list()] for child_handle in child_list: @@ -1022,44 +966,44 @@ class RelationshipView(NavigationView): if self.use_shade: eventbox.override_background_color(Gtk.StateType.NORMAL, self.color) eventbox.add(vbox) - self.attach.attach( - eventbox, _CDATA_START-1, _CDATA_STOP, self.row, - self.row+1) + self.child.attach(eventbox, _CDATA_START-1, self.row, + _CDATA_STOP-_CDATA_START+1, 1) self.row += 1 def get_people_box(self, *handles, **kwargs): - vbox = Gtk.HBox() + hbox = Gtk.Box() initial_name = True for handle in handles: if not initial_name: link_label = Gtk.Label(label=" %s " % _('and')) link_label.show() - vbox.pack_start(link_label, False, True, 0) + hbox.pack_start(link_label, False, True, 0) initial_name = False if handle: name = self.get_name(handle, True) link_label = widgets.LinkLabel(name, self._button_press, handle, theme=self.theme) if self.use_shade: - link_label.override_background_color(Gtk.StateType.NORMAL, self.color) + link_label.override_background_color(Gtk.StateType.NORMAL, + self.color) if self._config.get('preferences.releditbtn'): button = widgets.IconButton(self.edit_button_press, handle) button.set_tooltip_text(_('Edit %s') % name[0]) else: button = None - vbox.pack_start(widgets.LinkBox(link_label, button), + hbox.pack_start(widgets.LinkBox(link_label, button), False, True, 0) else: link_label = Gtk.Label(label=_('Unknown')) link_label.show() - vbox.pack_start(link_label, False, True, 0) + hbox.pack_start(link_label, False, True, 0) if "post_msg" in kwargs and kwargs["post_msg"]: link_label = Gtk.Label(label=kwargs["post_msg"]) link_label.show() - vbox.pack_start(link_label, False, True, 0) - return vbox + hbox.pack_start(link_label, False, True, 0) + return hbox def write_person(self, title, handle): """ @@ -1081,11 +1025,10 @@ class RelationshipView(NavigationView): if handle is not None: self._set_draggable_person(eventbox, handle) eventbox.add(label) - self.attach.attach(eventbox, _PLABEL_START, _PLABEL_STOP, self.row, - self.row+1, xoptions=Gtk.AttachOptions.FILL|Gtk.AttachOptions.SHRINK, - yoptions=Gtk.AttachOptions.FILL|Gtk.AttachOptions.SHRINK) + self.child.attach(eventbox, _PLABEL_START, self.row, + _PLABEL_STOP-_PLABEL_START, 1) - vbox = Gtk.VBox() + vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) eventbox = Gtk.EventBox() if handle: name = self.get_name(handle, True) @@ -1124,8 +1067,8 @@ class RelationshipView(NavigationView): eventbox.override_background_color(Gtk.StateType.NORMAL, self.color) eventbox.add(vbox) - self.attach.attach(eventbox, _PDATA_START, _PDATA_STOP, - self.row, self.row+1) + self.child.attach(eventbox, _PDATA_START, self.row, + _PDATA_STOP-_PDATA_START, 1) self.row += 1 return vbox @@ -1188,7 +1131,7 @@ class RelationshipView(NavigationView): ev.set_visible_window(False) if handle: self._set_draggable_person(ev, handle) - vbox = Gtk.VBox() + vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) ev.add(vbox) if not child_should_be_linked: @@ -1232,7 +1175,7 @@ class RelationshipView(NavigationView): else: button = None - hbox = Gtk.HBox() + hbox = Gtk.Box() l = widgets.BasicLabel("%d." % index) l.set_width_chars(3) l.set_alignment(1.0, 0.5) @@ -1447,9 +1390,8 @@ class RelationshipView(NavigationView): if self.use_shade: eventbox.override_background_color(Gtk.StateType.NORMAL, self.color) eventbox.add(box) - self.attach.attach( - eventbox, _PDATA_START, _PDATA_STOP, - self.row, self.row+1) + self.child.attach(eventbox, _PDATA_START, self.row, + _PDATA_STOP-_PDATA_START, 1) self.row += 1 # now advance it else: # show "V Family: ..." and the rest @@ -1461,7 +1403,7 @@ class RelationshipView(NavigationView): if not self.write_relationship_events(box, family): self.write_relationship(box, family) - hbox = Gtk.HBox() + hbox = Gtk.Box() if self.check_collapsed(family.handle, "CHILDREN"): arrow = widgets.ExpandCollapseArrow(True, self.expand_collapse_press, @@ -1473,13 +1415,11 @@ class RelationshipView(NavigationView): hbox.pack_start(arrow, False, True, 0) label_cell = self.build_label_cell(_('Children')) hbox.pack_start(label_cell, True, True, 0) - self.attach.attach( - hbox, _CLABEL_START-1, _CLABEL_STOP-1, self.row, - self.row+1, xoptions=Gtk.AttachOptions.FILL|Gtk.AttachOptions.SHRINK, - yoptions=Gtk.AttachOptions.FILL) + self.child.attach(hbox, _CLABEL_START-1, self.row, + _CLABEL_STOP-_CLABEL_START, 1) if self.check_collapsed(family.handle, "CHILDREN"): - hbox = Gtk.HBox() + hbox = Gtk.Box() child_list = family.get_child_ref_list() if child_list: count = len(child_list) @@ -1497,12 +1437,11 @@ class RelationshipView(NavigationView): if self.use_shade: eventbox.override_background_color(Gtk.StateType.NORMAL, self.color) eventbox.add(box) - self.attach.attach( - eventbox, _PDATA_START, _PDATA_STOP, - self.row, self.row+1) + self.child.attach(eventbox, _PDATA_START, self.row, + _PDATA_STOP-_PDATA_START, 1) self.row += 1 # now advance it else: - hbox = Gtk.HBox() + hbox = Gtk.Box() addchild = widgets.IconButton(self.add_child_to_fam, family.handle, Gtk.STOCK_ADD) @@ -1513,12 +1452,10 @@ class RelationshipView(NavigationView): selchild.set_tooltip_text(_('Add existing child to family')) hbox.pack_start(addchild, False, True, 0) hbox.pack_start(selchild, False, True, 0) - self.attach.attach( - hbox, _CLABEL_START, _CLABEL_STOP, self.row, - self.row+1, xoptions=Gtk.AttachOptions.FILL|Gtk.AttachOptions.SHRINK, - yoptions=Gtk.AttachOptions.FILL) + self.child.attach(hbox, _CLABEL_START, self.row, + _CLABEL_STOP-_CLABEL_START, 1) - vbox = Gtk.VBox() + vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) i = 1 child_list = family.get_child_ref_list() for child_ref in child_list: @@ -1530,9 +1467,8 @@ class RelationshipView(NavigationView): if self.use_shade: eventbox.override_background_color(Gtk.StateType.NORMAL, self.color) eventbox.add(vbox) - self.attach.attach( - eventbox, _CDATA_START-1, _CDATA_STOP, self.row, - self.row+1) + self.child.attach(eventbox, _CDATA_START-1, self.row, + _CDATA_STOP-_CDATA_START+1, 1) self.row += 1 def edit_button_press(self, obj, event, handle): @@ -1749,41 +1685,41 @@ class RelationshipView(NavigationView): """ Function that builds the widget in the configuration dialog """ - table = Gtk.Table(n_rows=3, n_columns=2) - table.set_border_width(12) - table.set_col_spacings(6) - table.set_row_spacings(6) + grid = Gtk.Grid() + grid.set_border_width(12) + grid.set_column_spacing(6) + grid.set_row_spacing(6) - configdialog.add_checkbox(table, + configdialog.add_checkbox(grid, _('Use shading'), 0, 'preferences.relation-shade') - configdialog.add_checkbox(table, + configdialog.add_checkbox(grid, _('Display edit buttons'), 1, 'preferences.releditbtn') checkbox = Gtk.CheckButton(label=_('View links as website links')) theme = self._config.get('preferences.relation-display-theme') checkbox.set_active(theme == 'WEBPAGE') checkbox.connect('toggled', self._config_update_theme) - table.attach(checkbox, 1, 9, 2, 3, yoptions=0) + grid.attach(checkbox, 1, 2, 8, 1) - return _('Layout'), table + return _('Layout'), grid def content_panel(self, configdialog): """ Function that builds the widget in the configuration dialog """ - table = Gtk.Table(n_rows=2, n_columns=2) - table.set_border_width(12) - table.set_col_spacings(6) - table.set_row_spacings(6) - configdialog.add_checkbox(table, + grid = Gtk.Grid() + grid.set_border_width(12) + grid.set_column_spacing(6) + grid.set_row_spacing(6) + configdialog.add_checkbox(grid, _('Show Details'), 0, 'preferences.family-details') - configdialog.add_checkbox(table, + configdialog.add_checkbox(grid, _('Show Siblings'), 1, 'preferences.family-siblings') - return _('Content'), table + return _('Content'), grid def _config_update_theme(self, obj): """