From b0c82f6b6e69bb03cd665a03ff19dae4d430ca06 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Fri, 22 May 2015 19:55:15 +0100 Subject: [PATCH 1/8] Fix syntax error --- gramps/plugins/gramplet/todo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gramps/plugins/gramplet/todo.py b/gramps/plugins/gramplet/todo.py index 9cb006ba8..826099321 100644 --- a/gramps/plugins/gramplet/todo.py +++ b/gramps/plugins/gramplet/todo.py @@ -51,7 +51,7 @@ class ToDo(Gramplet): self.right.set_tooltip_text(_('Next To Do note')) self.right.set_sensitive(False) hbox.pack_start(self.right, False, False, 0) - self.edit = SimpleButton('gtk-edit' self.edit_clicked) + self.edit = SimpleButton('gtk-edit', self.edit_clicked) self.edit.set_tooltip_text(_('Edit the selected To Do note')) self.edit.set_sensitive(False) hbox.pack_start(self.edit, False, False, 0) From 9790890e025c02b174c2689560ec4fed69ec3232 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Fri, 22 May 2015 20:45:18 +0100 Subject: [PATCH 2/8] Fix popup menu --- gramps/plugins/view/relview.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gramps/plugins/view/relview.py b/gramps/plugins/view/relview.py index a3499cda8..fcfb25bbd 100644 --- a/gramps/plugins/view/relview.py +++ b/gramps/plugins/view/relview.py @@ -1262,9 +1262,9 @@ class RelationshipView(NavigationView): if button_activated(event, _LEFT_BUTTON): self.change_active(handle) elif button_activated(event, _RIGHT_BUTTON): - myMenu = Gtk.Menu() - myMenu.append(self.build_menu_item(handle)) - myMenu.popup(None, None, None, None, event.button, event.time) + self.myMenu = Gtk.Menu() + self.myMenu.append(self.build_menu_item(handle)) + self.myMenu.popup(None, None, None, None, event.button, event.time) def build_menu_item(self, handle): person = self.dbstate.db.get_person_from_handle(handle) From f2f78ef2f4f193a8cb6caeae2157d404762075af Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Fri, 22 May 2015 23:20:43 +0100 Subject: [PATCH 3/8] Convert deprecated set_alignment method --- gramps/gui/configure.py | 2 +- gramps/gui/editors/filtereditor.py | 6 ++---- gramps/gui/filters/sidebar/_sidebarfilter.py | 2 +- gramps/gui/logger/_errorreportassistant.py | 14 +++++++------- gramps/gui/plug/_guioptions.py | 8 ++++---- gramps/gui/plug/_windows.py | 2 +- gramps/gui/plug/export/_exportoptions.py | 10 +++++----- gramps/gui/plug/report/_docreportdialog.py | 4 ++-- gramps/gui/plug/report/_graphvizreportdialog.py | 2 +- gramps/gui/plug/report/_reportdialog.py | 14 +++++++------- gramps/gui/viewmanager.py | 6 +++--- gramps/gui/views/listview.py | 2 +- gramps/gui/widgets/fanchart.py | 8 ++++---- gramps/gui/widgets/grampletbar.py | 2 +- gramps/gui/widgets/grampletpane.py | 2 +- gramps/gui/widgets/labels.py | 14 +++++++------- gramps/gui/widgets/monitoredwidgets.py | 2 +- gramps/gui/widgets/statusbar.py | 2 +- gramps/plugins/gramplet/eval.py | 3 +-- gramps/plugins/gramplet/leak.py | 3 +-- gramps/plugins/gramplet/persondetails.py | 10 ++++------ gramps/plugins/gramplet/placedetails.py | 10 ++++------ gramps/plugins/gramplet/repositorydetails.py | 10 ++++------ gramps/plugins/gramplet/soundgen.py | 9 +++------ gramps/plugins/gramplet/todogramplet.py | 3 +-- gramps/plugins/sidebar/categorysidebar.py | 1 - gramps/plugins/sidebar/dropdownsidebar.py | 2 -- gramps/plugins/sidebar/expandersidebar.py | 1 - gramps/plugins/tool/mediamanager.py | 6 +++--- gramps/plugins/tool/testcasegenerator.py | 2 +- gramps/plugins/view/pedigreeview.py | 12 ++++++------ gramps/plugins/view/relview.py | 14 +++++++------- 32 files changed, 85 insertions(+), 103 deletions(-) diff --git a/gramps/gui/configure.py b/gramps/gui/configure.py index 58be41eb9..75d6b8232 100644 --- a/gramps/gui/configure.py +++ b/gramps/gui/configure.py @@ -312,7 +312,7 @@ class ConfigureDialog(ManagedWindow): config = self.__config text = Gtk.Label() text.set_line_wrap(line_wrap) - text.set_alignment(0.,0.) + text.set_halign(Gtk.Align.START) text.set_text(label) grid.attach(text, 1, index, 8, 1) diff --git a/gramps/gui/editors/filtereditor.py b/gramps/gui/editors/filtereditor.py index d7e172eb3..bb61a4e33 100644 --- a/gramps/gui/editors/filtereditor.py +++ b/gramps/gui/editors/filtereditor.py @@ -488,8 +488,7 @@ class EditRule(ManagedWindow): vallist = [] tlist = [] pos = 0 - l2 = Gtk.Label(label=class_obj.name) - l2.set_alignment(0, 0.5) + l2 = Gtk.Label(label=class_obj.name, halign=Gtk.Align.START) l2.show() c = Gtk.TreeView() #c.set_data('d', pos) @@ -501,8 +500,7 @@ class EditRule(ManagedWindow): grid.set_row_spacing(6) grid.show() for v in arglist: - l = Gtk.Label(label=v) - l.set_alignment(1, 0.5) + l = Gtk.Label(label=v, halign=Gtk.Align.END) l.show() if v == _('Place:'): t = MyPlaces([]) diff --git a/gramps/gui/filters/sidebar/_sidebarfilter.py b/gramps/gui/filters/sidebar/_sidebarfilter.py index e6ba40c70..a6d3b0ad0 100644 --- a/gramps/gui/filters/sidebar/_sidebarfilter.py +++ b/gramps/gui/filters/sidebar/_sidebarfilter.py @@ -135,7 +135,7 @@ class SidebarFilter(DbGUIElement): label = Gtk.Label() label.set_text('%s' % heading) label.set_use_markup(True) - label.set_alignment(0, 0.5) + label.set_halign(Gtk.Align.START) self.grid.attach(label, 1, self.position, 1, 1) self.position += 1 diff --git a/gramps/gui/logger/_errorreportassistant.py b/gramps/gui/logger/_errorreportassistant.py index d032e306f..668f83413 100644 --- a/gramps/gui/logger/_errorreportassistant.py +++ b/gramps/gui/logger/_errorreportassistant.py @@ -260,7 +260,7 @@ class ErrorReportAssistant(Gtk.Assistant): label = Gtk.Label(label=_("If you can see that there is any personal " "information included in the error please remove " "it.")) - label.set_alignment(0.01, 0.5) + label.set_halign(Gtk.Align.START) label.set_padding(0, 4) label.set_line_wrap(True) @@ -339,7 +339,7 @@ class ErrorReportAssistant(Gtk.Assistant): "anything that you know to be wrong or remove " "anything that you would rather not have included " "in the bug report.")) - label.set_alignment(0.01, 0.5) + label.set_halign(Gtk.Align.START) label.set_padding(0, 4) label.set_line_wrap(True) @@ -416,7 +416,7 @@ class ErrorReportAssistant(Gtk.Assistant): label = Gtk.Label(label=_("Please provide as much information as you can " "about what you were doing when the error " "occured.")) - label.set_alignment(0.01, 0.5) + label.set_halign(Gtk.Align.START) label.set_padding(0, 4) label.set_line_wrap(True) @@ -489,7 +489,7 @@ class ErrorReportAssistant(Gtk.Assistant): "of the error information. Just make sure that it " "does not contain anything that you do not want " "to be sent to the developers.")) - label.set_alignment(0.01, 0.5) + label.set_halign(Gtk.Align.START) label.set_padding(0, 4) label.set_line_wrap(True) @@ -555,7 +555,7 @@ class ErrorReportAssistant(Gtk.Assistant): (_("Use the two buttons below to first copy the bug report to the " "clipboard and then open a webbrowser to file a bug report at "), URL_BUGTRACKER)) - label.set_alignment(0.01, 0.5) + label.set_halign(Gtk.Align.START) label.set_padding(0, 4) label.set_line_wrap(True) label.set_use_markup(True) @@ -564,7 +564,7 @@ class ErrorReportAssistant(Gtk.Assistant): url_label = Gtk.Label(label=_("Use this button to start a web browser and " "file a bug report on the Gramps bug tracking " "system.")) - url_label.set_alignment(0.01, 0.5) + url_label.set_halign(Gtk.Align.START) url_label.set_padding(0, 4) url_label.set_line_wrap(True) url_label.set_size_request(200, -1) @@ -588,7 +588,7 @@ class ErrorReportAssistant(Gtk.Assistant): "Then go to the bug tracking website by using " "the button below, paste the report and click " "submit report")) - clip_label.set_alignment(0.01, 0.5) + clip_label.set_halign(Gtk.Align.START) clip_label.set_padding(0, 4) clip_label.set_line_wrap(True) clip_label.set_size_request(200, -1) diff --git a/gramps/gui/plug/_guioptions.py b/gramps/gui/plug/_guioptions.py index 155c22639..119303ed2 100644 --- a/gramps/gui/plug/_guioptions.py +++ b/gramps/gui/plug/_guioptions.py @@ -617,7 +617,7 @@ class GuiPersonOption(Gtk.Box): self.__uistate = uistate self.__track = track self.__person_label = Gtk.Label() - self.__person_label.set_alignment(0.0, 0.5) + self.__person_label.set_halign(Gtk.Align.START) pevt = Gtk.EventBox() pevt.add(self.__person_label) @@ -742,7 +742,7 @@ class GuiFamilyOption(Gtk.Box): self.__uistate = uistate self.__track = track self.__family_label = Gtk.Label() - self.__family_label.set_alignment(0.0, 0.5) + self.__family_label.set_halign(Gtk.Align.START) pevt = Gtk.EventBox() pevt.add(self.__family_label) @@ -931,7 +931,7 @@ class GuiNoteOption(Gtk.Box): self.__uistate = uistate self.__track = track self.__note_label = Gtk.Label() - self.__note_label.set_alignment(0.0, 0.5) + self.__note_label.set_halign(Gtk.Align.START) pevt = Gtk.EventBox() pevt.add(self.__note_label) @@ -1035,7 +1035,7 @@ class GuiMediaOption(Gtk.Box): self.__uistate = uistate self.__track = track self.__media_label = Gtk.Label() - self.__media_label.set_alignment(0.0, 0.5) + self.__media_label.set_halign(Gtk.Align.START) pevt = Gtk.EventBox() pevt.add(self.__media_label) diff --git a/gramps/gui/plug/_windows.py b/gramps/gui/plug/_windows.py index 9cc67e7e5..085d96b13 100644 --- a/gramps/gui/plug/_windows.py +++ b/gramps/gui/plug/_windows.py @@ -1003,7 +1003,7 @@ class ToolManagedWindowBase(ManagedWindow): widget.set_hexpand(True) if text: text_widget = Gtk.Label(label='%s:' % text) - text_widget.set_alignment(0.0, 0.5) + text_widget.set_halign(Gtk.Align.START) grid.attach(text_widget, 1, row, 1, 1) grid.attach(widget, 2, row, 1, 1) else: diff --git a/gramps/gui/plug/export/_exportoptions.py b/gramps/gui/plug/export/_exportoptions.py index f985430b2..241f7d569 100644 --- a/gramps/gui/plug/export/_exportoptions.py +++ b/gramps/gui/plug/export/_exportoptions.py @@ -263,7 +263,7 @@ class WriterOptionBox(object): # Frame Person: self.filter_obj = Gtk.ComboBox() label = Gtk.Label(label=_('_Person Filter') + ": ") - label.set_alignment(0, 0.5) + label.set_halign(Gtk.Align.START) label.set_size_request(150, -1) label.set_use_underline(True) label.set_mnemonic_widget(self.filter_obj) @@ -280,7 +280,7 @@ class WriterOptionBox(object): # Objects for choosing a Note filter: self.filter_note = Gtk.ComboBox() label_note = Gtk.Label(label=_('_Note Filter') + ": ") - label_note.set_alignment(0, 0.5) + label_note.set_halign(Gtk.Align.START) label_note.set_size_request(150, -1) label_note.set_use_underline(True) label_note.set_mnemonic_widget(self.filter_note) @@ -295,7 +295,7 @@ class WriterOptionBox(object): elif proxy_name == "privacy": # Frame 3: label = Gtk.Label(label=_("Privacy Filter") + ":") - label.set_alignment(0, 0.5) + label.set_halign(Gtk.Align.START) label.set_size_request(150, -1) box = Gtk.Box() box.pack_start(label, False, True, 0) @@ -304,7 +304,7 @@ class WriterOptionBox(object): elif proxy_name == "living": # Frame 4: label = Gtk.Label(label=_("Living Filter") + ":") - label.set_alignment(0, 0.5) + label.set_halign(Gtk.Align.START) label.set_size_request(150, -1) box = Gtk.Box() box.pack_start(label, False, True, 0) @@ -315,7 +315,7 @@ class WriterOptionBox(object): # Frame 5: self.reference_filter = Gtk.ComboBox() label = Gtk.Label(label=_('Reference Filter') + ": ") - label.set_alignment(0, 0.5) + label.set_halign(Gtk.Align.START) label.set_size_request(150, -1) box = Gtk.Box() box.pack_start(label, False, True, 0) diff --git a/gramps/gui/plug/report/_docreportdialog.py b/gramps/gui/plug/report/_docreportdialog.py index 8b85ec16e..02e3aaaad 100644 --- a/gramps/gui/plug/report/_docreportdialog.py +++ b/gramps/gui/plug/report/_docreportdialog.py @@ -168,7 +168,7 @@ class DocReportDialog(ReportDialog): self.make_doc_menu(self.options.handler.get_format_name()) self.format_menu.connect('changed', self.doc_type_changed) label = Gtk.Label(label="%s:" % _("Output Format")) - label.set_alignment(0.0, 0.5) + label.set_set_halign(Gtk.Align.START) 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) @@ -214,7 +214,7 @@ class DocReportDialog(ReportDialog): self.html_grid.set_border_width(6) label = Gtk.Label(label="%s:" % _("CSS file")) - label.set_alignment(0.0,0.5) + label.set_set_halign(Gtk.Align.START) self.html_grid.attach(label, 1, 1, 1, 1) self.css_combo = Gtk.ComboBoxText() diff --git a/gramps/gui/plug/report/_graphvizreportdialog.py b/gramps/gui/plug/report/_graphvizreportdialog.py index 8361c0647..0adbb158c 100644 --- a/gramps/gui/plug/report/_graphvizreportdialog.py +++ b/gramps/gui/plug/report/_graphvizreportdialog.py @@ -148,7 +148,7 @@ class GraphvizReportDialog(ReportDialog): self.format_menu.set(self.options.handler.get_format_name()) self.format_menu.connect('changed', self.doc_type_changed) label = Gtk.Label(label="%s:" % _("Output Format")) - label.set_alignment(0.0, 0.5) + label.set_halign(Gtk.Align.START) 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) diff --git a/gramps/gui/plug/report/_reportdialog.py b/gramps/gui/plug/report/_reportdialog.py index 1935d4c9c..143cac23b 100644 --- a/gramps/gui/plug/report/_reportdialog.py +++ b/gramps/gui/plug/report/_reportdialog.py @@ -318,7 +318,7 @@ class ReportDialog(ManagedWindow): # Styles Frame label = Gtk.Label(label="%s:" % _("Style")) - label.set_alignment(0.0, 0.5) + label.set_halign(Gtk.Align.START) self.style_menu = StyleComboBox() self.style_menu.set_hexpand(True) @@ -361,7 +361,7 @@ class ReportDialog(ManagedWindow): grid.set_row_spacing(6) label = Gtk.Label(label="%s" % _("Report Options")) - label.set_alignment(0.0, 0.5) + label.set_halign(Gtk.Align.START) label.set_use_markup(True) self.notebook.append_page(grid, label) @@ -371,7 +371,7 @@ class ReportDialog(ManagedWindow): widget.set_hexpand(True) if text: text_widget = Gtk.Label(label="%s:" % text) - text_widget.set_alignment(0.0, 0.0) + text_widget.set_halign(Gtk.Align.START) grid.attach(text_widget, 1, row, 1, 1) grid.attach(widget, 2, row, 1, 1) else: @@ -395,7 +395,7 @@ class ReportDialog(ManagedWindow): widget.set_hexpand(True) if text: text_widget = Gtk.Label(label='%s:' % text) - text_widget.set_alignment(0.0, 0.5) + text_widget.set_halign(Gtk.Align.START) grid.attach(text_widget, 1, row, 1, 1) if isinstance(widget, GuiTextOption): grid.attach(widget, 2, row, 1, 1) @@ -451,7 +451,7 @@ class ReportDialog(ManagedWindow): # need any labels at top: label = Gtk.Label(label="%s" % _('Document Options')) label.set_use_markup(1) - label.set_alignment(0.0, 0.5) + label.set_halign(Gtk.Align.START) self.grid.set_border_width(12) self.grid.attach(label, 0, self.row, 4, 1) self.row += 1 @@ -465,7 +465,7 @@ class ReportDialog(ManagedWindow): # Save Frame self.doc_label = Gtk.Label(label="%s:" % _("Filename")) - self.doc_label.set_alignment(0.0, 0.5) + self.doc_label.set_halign(Gtk.Align.START) self.grid.attach(self.doc_label, 1, self.row, 1, 1) self.target_fileentry.set_hexpand(True) @@ -613,7 +613,7 @@ class ReportDialog(ManagedWindow): self.uistate, self.track) if has_label: widget_text = Gtk.Label('%s:' % option.get_label()) - widget_text.set_alignment(0.0, 0.0) + widget_text.set_halign(Gtk.Align.START) self.grid.attach(widget_text, 1, self.row, 1, 1) self.doc_widgets.append(widget_text) self.grid.attach(widget, 2, self.row, 2, 1) diff --git a/gramps/gui/viewmanager.py b/gramps/gui/viewmanager.py index 832f03a21..721706faf 100644 --- a/gramps/gui/viewmanager.py +++ b/gramps/gui/viewmanager.py @@ -1229,7 +1229,7 @@ class ViewManager(CLIManager): label = Gtk.Label(label=_("Path:")) label.set_justify(Gtk.Justification.LEFT) label.set_size_request(90, -1) - label.set_alignment(0, .5) + label.set_halign(Gtk.Align.START) hbox.pack_start(label, False, True, 0) path_entry = Gtk.Entry() text = config.get('paths.quick-backup-directory') @@ -1249,7 +1249,7 @@ class ViewManager(CLIManager): label = Gtk.Label(label=_("File:")) label.set_justify(Gtk.Justification.LEFT) label.set_size_request(90, -1) - label.set_alignment(0, .5) + label.set_halign(Gtk.Align.START) hbox.pack_start(label, False, True, 0) struct_time = time.localtime() file_entry.set_text(config.get('paths.quick-backup-filename') % @@ -1281,7 +1281,7 @@ class ViewManager(CLIManager): label = Gtk.Label(label=_("Media:")) label.set_justify(Gtk.Justification.LEFT) label.set_size_request(90, -1) - label.set_alignment(0, .5) + label.set_halign(Gtk.Align.START) hbox.pack_start(label, False, True, 0) include = Gtk.RadioButton(None, "%s (%s %s)" % (_("Include"), mbytes, _("Megabyte|MB"))) diff --git a/gramps/gui/views/listview.py b/gramps/gui/views/listview.py index 6253b38e2..f5fc65359 100644 --- a/gramps/gui/views/listview.py +++ b/gramps/gui/views/listview.py @@ -1005,7 +1005,7 @@ class ListView(NavigationView): combobox = Gtk.ComboBoxText() label = Gtk.Label(label=_("Format:")) - label.set_alignment(1.0, 0.5) + label.set_halign(Gtk.Align.END) box = Gtk.Box() box.pack_start(label, True, True, padding=12) box.pack_start(combobox, False, False, 0) diff --git a/gramps/gui/widgets/fanchart.py b/gramps/gui/widgets/fanchart.py index 60c9a4d0c..edca4cdac 100644 --- a/gramps/gui/widgets/fanchart.py +++ b/gramps/gui/widgets/fanchart.py @@ -1715,7 +1715,7 @@ class FanChartGrampsGUI(object): sib_item.set_image(go_image) label.set_use_markup(True) label.show() - label.set_alignment(0,0) + label.set_halign(Gtk.Align.START) sib_item.add(label) linked_persons.append(sib_id) sib_item.connect("activate", self.on_childmenu_changed, sib_id) @@ -1752,7 +1752,7 @@ class FanChartGrampsGUI(object): child_item.set_image(go_image) label.set_use_markup(True) label.show() - label.set_alignment(0,0) + label.set_halign(Gtk.Align.START) child_item.add(label) linked_persons.append(child_handle) child_item.connect("activate", self.on_childmenu_changed, child_handle) @@ -1789,7 +1789,7 @@ class FanChartGrampsGUI(object): par_item.set_image(go_image) label.set_use_markup(True) label.show() - label.set_alignment(0,0) + label.set_halign(Gtk.Align.START) par_item.add(label) linked_persons.append(par_id) par_item.connect("activate", self.on_childmenu_changed, par_id) @@ -1832,7 +1832,7 @@ class FanChartGrampsGUI(object): per_item.set_image(go_image) label.set_use_markup(True) label.show() - label.set_alignment(0, 0) + label.set_halign(Gtk.Align.START) per_item.add(label) per_item.connect("activate", self.on_childmenu_changed, p_id) per_item.show() diff --git a/gramps/gui/widgets/grampletbar.py b/gramps/gui/widgets/grampletbar.py index baca56b8e..90610e2e5 100644 --- a/gramps/gui/widgets/grampletbar.py +++ b/gramps/gui/widgets/grampletbar.py @@ -341,7 +341,7 @@ class GrampletBar(Gtk.Notebook): tab_label.show() msg = _('Select the down arrow on the right corner for adding, removing or restoring gramplets.') content = Gtk.Label(label=msg) - content.set_alignment(0, 0) + content.set_halign(Gtk.Align.START) content.set_line_wrap(True) content.set_size_request(150, -1) content.show() diff --git a/gramps/gui/widgets/grampletpane.py b/gramps/gui/widgets/grampletpane.py index eedd3b7e1..6fa669937 100644 --- a/gramps/gui/widgets/grampletpane.py +++ b/gramps/gui/widgets/grampletpane.py @@ -569,7 +569,7 @@ class GuiGramplet(object): topbox.pack_start(hbox, False, False, 0) for item in self.pui.option_order: label = Gtk.Label(label=item + ":") - label.set_alignment(1.0, 0.5) + label.set_halign(Gtk.Align.END) labels.pack_start(label, True, True, 0) options.pack_start(self.pui.option_dict[item][0], True, True, 0) # widget save_button = Gtk.Button.new_with_mnemonic(_('_Save')) diff --git a/gramps/gui/widgets/labels.py b/gramps/gui/widgets/labels.py index 80553ffa6..76f9dc597 100644 --- a/gramps/gui/widgets/labels.py +++ b/gramps/gui/widgets/labels.py @@ -126,7 +126,7 @@ class LinkLabel(Gtk.EventBox): self.label = Gtk.Label(label=text) self.label.set_use_markup(True) - self.label.set_alignment(0, 0.5) + self.label.set_halign(Gtk.Align.START) hbox = Gtk.Box() hbox.pack_start(self.label, False, False, 0) @@ -205,7 +205,7 @@ class BasicLabel(Gtk.Label): def __init__(self, text, ellipsize=Pango.EllipsizeMode.NONE): GObject.GObject.__init__(self, label=text) - self.set_alignment(0, 0.5) + self.set_halign(Gtk.Align.START) self.set_ellipsize(ellipsize) self.show() @@ -218,7 +218,7 @@ class GenderLabel(Gtk.Label): def __init__(self, text): GObject.GObject.__init__(self, label=text) - self.set_alignment(0, 0.5) + self.set_halign(Gtk.Align.START) if win(): pangoFont = Pango.FontDescription('Arial') self.override_font(pangoFont) @@ -231,9 +231,9 @@ class GenderLabel(Gtk.Label): #------------------------------------------------------------------------- class MarkupLabel(Gtk.Label): - def __init__(self, text, x_align=0, y_align=0.5): + def __init__(self, text, halign=Gtk.Align.START): GObject.GObject.__init__(self, label=text) - self.set_alignment(x_align, y_align) + self.set_halign(halign) self.set_use_markup(True) self.show_all() @@ -244,10 +244,10 @@ class MarkupLabel(Gtk.Label): #------------------------------------------------------------------------- class DualMarkupLabel(Gtk.Box): - def __init__(self, text, alt, x_align=0, y_align=0.5): + def __init__(self, text, alt, halign=Gtk.Align.START): Gtk.Box.__init__(self) label = Gtk.Label(label=text) - label.set_alignment(x_align, y_align) + label.set_halign(halign) label.set_use_markup(True) self.pack_start(label, False, False, 0) diff --git a/gramps/gui/widgets/monitoredwidgets.py b/gramps/gui/widgets/monitoredwidgets.py index 95a811d4a..47d5f4514 100644 --- a/gramps/gui/widgets/monitoredwidgets.py +++ b/gramps/gui/widgets/monitoredwidgets.py @@ -833,7 +833,7 @@ class MonitoredTagList(object): self.all_tags.append((tag.get_handle(), tag.get_name())) self.label = label - self.label.set_alignment(0, 0.5) + self.label.set_halign(Gtk.Align.START) self.label.set_ellipsize(Pango.EllipsizeMode.END) image = Gtk.Image() image.set_from_icon_name('gramps-tag', Gtk.IconSize.MENU) diff --git a/gramps/gui/widgets/statusbar.py b/gramps/gui/widgets/statusbar.py index d5df55e6d..770acab69 100644 --- a/gramps/gui/widgets/statusbar.py +++ b/gramps/gui/widgets/statusbar.py @@ -64,7 +64,7 @@ class Statusbar(Gtk.Box): self.__status.show() self.__filter = Gtk.Label() - self.__filter.set_alignment(1.0, 0.5) + self.__filter.set_halign(Gtk.Align.END) self.__filter.show() self.pack_start(self.__warnbtn, False, True, 4) diff --git a/gramps/plugins/gramplet/eval.py b/gramps/plugins/gramplet/eval.py index dc3e7fab9..b9864be23 100644 --- a/gramps/plugins/gramplet/eval.py +++ b/gramps/plugins/gramplet/eval.py @@ -90,9 +90,8 @@ class PythonEvaluation(Gramplet): """ Add a text view to the interface. """ - label = Gtk.Label(name) + label = Gtk.Label(halign=Gtk.Align.START) label.set_markup('%s' % name) - label.set_alignment(0, 0.5) self.top.pack_start(label, False, False, 6) swin = Gtk.ScrolledWindow() swin.set_shadow_type(Gtk.ShadowType.IN) diff --git a/gramps/plugins/gramplet/leak.py b/gramps/plugins/gramplet/leak.py index 37079b953..81308fd7a 100644 --- a/gramps/plugins/gramplet/leak.py +++ b/gramps/plugins/gramplet/leak.py @@ -77,8 +77,7 @@ class Leak(Gramplet): self.top = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.top.set_border_width(6) - self.label = Gtk.Label() - self.label.set_alignment(0, 0.5) + self.label = Gtk.Label(halign=Gtk.Align.START) self.top.pack_start(self.label, False, False, 6) self.scroll = Gtk.ScrolledWindow() diff --git a/gramps/plugins/gramplet/persondetails.py b/gramps/plugins/gramplet/persondetails.py index 68a64dc5d..47e2d42ba 100644 --- a/gramps/plugins/gramplet/persondetails.py +++ b/gramps/plugins/gramplet/persondetails.py @@ -48,8 +48,7 @@ class PersonDetails(Gramplet): 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 = Gtk.Label(halign=Gtk.Align.START) self.name.override_font(Pango.FontDescription('sans bold 12')) vbox.pack_start(self.name, fill=True, expand=False, padding=7) self.grid = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL) @@ -64,11 +63,10 @@ class PersonDetails(Gramplet): """ Add a row to the table. """ - label = Gtk.Label(label=title + ':') - label.set_alignment(1, 0) + label = Gtk.Label(label=title + ':', halign=Gtk.Align.END, + valign=Gtk.Align.START) label.show() - value = Gtk.Label(label=value) - value.set_alignment(0, 0) + value = Gtk.Label(label=value, halign=Gtk.Align.START) value.show() self.grid.add(label) self.grid.attach_next_to(value, label, Gtk.PositionType.RIGHT, 1, 1) diff --git a/gramps/plugins/gramplet/placedetails.py b/gramps/plugins/gramplet/placedetails.py index bc9d1a42f..f79bf4581 100644 --- a/gramps/plugins/gramplet/placedetails.py +++ b/gramps/plugins/gramplet/placedetails.py @@ -43,8 +43,7 @@ class PlaceDetails(Gramplet): 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 = Gtk.Label(halign=Gtk.Align.START) self.title.override_font(Pango.FontDescription('sans bold 12')) vbox.pack_start(self.title, False, True, 7) self.grid = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL) @@ -59,11 +58,10 @@ class PlaceDetails(Gramplet): """ Add a row to the table. """ - label = Gtk.Label(label=title + ':') - label.set_alignment(1, 0) + label = Gtk.Label(label=title + ':', halign=Gtk.Align.END, + valign=Gtk.Align.START) label.show() - value = Gtk.Label(label=value) - value.set_alignment(0, 0) + value = Gtk.Label(label=value, halign=Gtk.Align.START) value.show() self.grid.add(label) self.grid.attach_next_to(value, label, Gtk.PositionType.RIGHT, 1, 1) diff --git a/gramps/plugins/gramplet/repositorydetails.py b/gramps/plugins/gramplet/repositorydetails.py index 99c843007..906ba060a 100644 --- a/gramps/plugins/gramplet/repositorydetails.py +++ b/gramps/plugins/gramplet/repositorydetails.py @@ -39,8 +39,7 @@ class RepositoryDetails(Gramplet): """ self.top = Gtk.Box() vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) - self.name = Gtk.Label() - self.name.set_alignment(0, 0) + self.name = Gtk.Label(halign=Gtk.Align.START) self.name.override_font(Pango.FontDescription('sans bold 12')) vbox.pack_start(self.name, fill=True, expand=False, padding=7) self.grid = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL) @@ -54,11 +53,10 @@ class RepositoryDetails(Gramplet): """ Add a row to the table. """ - label = Gtk.Label(label=title + ':') - label.set_alignment(1, 0) + label = Gtk.Label(label=title + ':', halign=Gtk.Align.END, + valign=Gtk.Align.START) label.show() - value = Gtk.Label(label=value) - value.set_alignment(0, 0) + value = Gtk.Label(label=value, halign=Gtk.Align.START) value.show() self.grid.add(label) self.grid.attach_next_to(value, label, Gtk.PositionType.RIGHT, 1, 1) diff --git a/gramps/plugins/gramplet/soundgen.py b/gramps/plugins/gramplet/soundgen.py index 2bbdfb5ff..14f2e1277 100644 --- a/gramps/plugins/gramplet/soundgen.py +++ b/gramps/plugins/gramplet/soundgen.py @@ -62,16 +62,13 @@ class SoundGen(Gramplet): grid.set_border_width(6) grid.set_row_spacing(6) grid.set_column_spacing(20) - label1 = Gtk.Label(_("Name:")) - label1.set_alignment(0, 0.5) + label1 = Gtk.Label(label=_("Name:"), halign=Gtk.Align.START) grid.attach(label1, 0, 0, 1, 1) - label2 = Gtk.Label(_("SoundEx code:")) - label2.set_alignment(0, 0.5) + label2 = Gtk.Label(label=_("SoundEx code:"), halign=Gtk.Align.START) grid.attach(label2, 0, 1, 1, 1) self.autocomp = Gtk.ComboBox.new_with_entry() grid.attach(self.autocomp, 1, 0, 1, 1) - self.value = Gtk.Label() - self.value.set_alignment(0, 0.5) + self.value = Gtk.Label(halign=Gtk.Align.START) grid.attach(self.value, 1, 1, 1, 1) self.name = self.autocomp.get_child() diff --git a/gramps/plugins/gramplet/todogramplet.py b/gramps/plugins/gramplet/todogramplet.py index 61fe9a4e1..f9cc5ca6b 100644 --- a/gramps/plugins/gramplet/todogramplet.py +++ b/gramps/plugins/gramplet/todogramplet.py @@ -64,8 +64,7 @@ class ToDoGramplet(Gramplet): self.page = Gtk.Label() hbox.pack_end(self.page, False, False, 10) - self.title = Gtk.Label() - self.title.set_alignment(0, 0) + self.title = Gtk.Label(halign=Gtk.Align.START) self.title.set_line_wrap(True) scrolledwindow = Gtk.ScrolledWindow() diff --git a/gramps/plugins/sidebar/categorysidebar.py b/gramps/plugins/sidebar/categorysidebar.py index 51a104d24..9841103c7 100644 --- a/gramps/plugins/sidebar/categorysidebar.py +++ b/gramps/plugins/sidebar/categorysidebar.py @@ -163,7 +163,6 @@ class CategorySidebar(BaseSidebar): # create the button button = Gtk.ToggleButton() button.set_relief(Gtk.ReliefStyle.NONE) - button.set_alignment(0, 0.5) self.buttons.append(button) # add the tooltip diff --git a/gramps/plugins/sidebar/dropdownsidebar.py b/gramps/plugins/sidebar/dropdownsidebar.py index b68015201..fa0fb17a7 100644 --- a/gramps/plugins/sidebar/dropdownsidebar.py +++ b/gramps/plugins/sidebar/dropdownsidebar.py @@ -146,14 +146,12 @@ class DropdownSidebar(BaseSidebar): # create the button button = Gtk.ToggleButton() button.set_relief(Gtk.ReliefStyle.NONE) - button.set_alignment(0, 0.5) self.buttons.append(button) # create the drop-down button to display views if len(self.views[cat_num]) > 1: dropdown = Gtk.Button() dropdown.set_relief(Gtk.ReliefStyle.NONE) - dropdown.set_alignment(0.5, 0.5) arrow = Gtk.Arrow(arrow_type=Gtk.ArrowType.DOWN, shadow_type=Gtk.ShadowType.NONE) dropdown.add(arrow) diff --git a/gramps/plugins/sidebar/expandersidebar.py b/gramps/plugins/sidebar/expandersidebar.py index d0273920d..effc8b07c 100644 --- a/gramps/plugins/sidebar/expandersidebar.py +++ b/gramps/plugins/sidebar/expandersidebar.py @@ -172,7 +172,6 @@ class ExpanderSidebar(BaseSidebar): # create the button button = Gtk.ToggleButton() button.set_relief(Gtk.ReliefStyle.NONE) - button.set_alignment(0, 0.5) self.buttons.append(button) self.lookup[(cat_num, view_num)] = len(self.buttons) - 1 diff --git a/gramps/plugins/tool/mediamanager.py b/gramps/plugins/tool/mediamanager.py index 23158fb5b..be2aa0a6e 100644 --- a/gramps/plugins/tool/mediamanager.py +++ b/gramps/plugins/tool/mediamanager.py @@ -318,9 +318,9 @@ class ConfirmationPage(Gtk.Box): self.set_border_width(12) self.confirm = Gtk.Label() + self.confirm.set_halign(Gtk.Align.START) self.confirm.set_line_wrap(True) self.confirm.set_use_markup(True) - self.confirm.set_alignment(0, 0.5) self.pack_start(self.confirm, False, True, 0) scrolled_window = Gtk.ScrolledWindow() @@ -494,8 +494,8 @@ class PathChange(BatchOp): grid.attach(self.from_entry, 1, 0, 1, 1) from_label = Gtk.Label(label=_('_Replace:')) + from_label.set_halign(Gtk.Align.START) from_label.set_use_underline(True) - from_label.set_alignment(0, 0.5) from_label.set_mnemonic_widget(self.from_entry) grid.attach(from_label, 0, 0, 1, 1) @@ -504,8 +504,8 @@ class PathChange(BatchOp): grid.attach(self.to_entry, 1, 1, 1, 1) to_label = Gtk.Label(label=_('_With:')) + to_label.set_halign(Gtk.Align.START) to_label.set_use_underline(True) - to_label.set_alignment(0, 0.5) to_label.set_mnemonic_widget(self.to_entry) grid.attach(to_label, 0, 1, 1, 1) diff --git a/gramps/plugins/tool/testcasegenerator.py b/gramps/plugins/tool/testcasegenerator.py index 1140c6a22..da401a300 100644 --- a/gramps/plugins/tool/testcasegenerator.py +++ b/gramps/plugins/tool/testcasegenerator.py @@ -233,7 +233,7 @@ class TestcaseGenerator(tool.BatchTool): self.label = Gtk.Label(label=_("Number of people to generate\n" "(Number is approximate because families " "are generated)")) - self.label.set_alignment(0.0, 0.5) + self.label.set_halign(Gtk.Align.START) self.top.vbox.pack_start(self.label,0,0,5) self.entry_count = Gtk.Entry() diff --git a/gramps/plugins/view/pedigreeview.py b/gramps/plugins/view/pedigreeview.py index 95c96c4d4..59965f561 100644 --- a/gramps/plugins/view/pedigreeview.py +++ b/gramps/plugins/view/pedigreeview.py @@ -1063,7 +1063,7 @@ class PedigreeView(NavigationView): label.set_justify(Gtk.Justification.LEFT) label.set_use_markup(True) label.set_line_wrap(True) - label.set_alignment(0.1, 0.5) + label.set_halign(Gtk.Align.START) if self.tree_style in [0, 2]: x_pos = (1 + _width) * (level + 1) + 1 y_pos = _delta // 2 + offset * _delta -1 + _height // 2 @@ -1447,7 +1447,7 @@ class PedigreeView(NavigationView): label = Gtk.Label(label=cname) label.set_use_markup(True) label.show() - label.set_alignment(0, 0) + label.set_halign(Gtk.Align.START) menuitem = Gtk.ImageMenuItem() go_image = Gtk.Image.new_from_icon_name('go-jump', Gtk.IconSize.MENU) @@ -1724,7 +1724,7 @@ class PedigreeView(NavigationView): sib_item.set_image(go_image) label.set_use_markup(True) label.show() - label.set_alignment(0, 0) + label.set_halign(Gtk.Align.START) sib_item.add(label) linked_persons.append(sib_id) sib_item.connect("activate", self.cb_childmenu_changed, sib_id) @@ -1763,7 +1763,7 @@ class PedigreeView(NavigationView): child_item.set_image(go_image) label.set_use_markup(True) label.show() - label.set_alignment(0, 0) + label.set_halign(Gtk.Align.START) child_item.add(label) linked_persons.append(child_handle) child_item.connect("activate", self.cb_childmenu_changed, @@ -1803,7 +1803,7 @@ class PedigreeView(NavigationView): par_item.set_image(go_image) label.set_use_markup(True) label.show() - label.set_alignment(0, 0) + label.set_halign(Gtk.Align.START) par_item.add(label) linked_persons.append(par_id) par_item.connect("activate", self.cb_childmenu_changed, par_id) @@ -1849,7 +1849,7 @@ class PedigreeView(NavigationView): per_item.set_image(go_image) label.set_use_markup(True) label.show() - label.set_alignment(0, 0) + label.set_halign(Gtk.Align.START) per_item.add(label) per_item.connect("activate", self.cb_childmenu_changed, p_id) per_item.show() diff --git a/gramps/plugins/view/relview.py b/gramps/plugins/view/relview.py index fcfb25bbd..5ffd301e4 100644 --- a/gramps/plugins/view/relview.py +++ b/gramps/plugins/view/relview.py @@ -560,7 +560,7 @@ class RelationshipView(NavigationView): fmt = '%s' text = fmt % escape(name) label = widgets.DualMarkupLabel(text, _GenderCode[person.gender], - x_align=1) + halign=Gtk.Align.END) if self._config.get('preferences.releditbtn'): button = widgets.IconButton(self.edit_button_press, person.handle) @@ -742,7 +742,7 @@ class RelationshipView(NavigationView): """ msg = '%s' % escape(title) hbox = Gtk.Box() - label = widgets.MarkupLabel(msg, x_align=1) + label = widgets.MarkupLabel(msg, halign=Gtk.Align.END) # Draw the collapse/expand button: if family is not None: if self.check_collapsed(person.handle, family.handle): @@ -1013,7 +1013,7 @@ class RelationshipView(NavigationView): format = "%s" label = widgets.MarkupLabel(format % escape(title), - x_align=1, y_align=0) + halign=Gtk.Align.END) if self._config.get('preferences.releditbtn'): label.set_padding(0, 5) @@ -1050,7 +1050,7 @@ class RelationshipView(NavigationView): self._set_draggable_person(eventbox, handle) else: link_label = Gtk.Label(label=_('Unknown')) - link_label.set_alignment(0, 1) + link_label.set_halign(Gtk.Align.START) link_label.show() vbox.pack_start(link_label, True, True, 0) @@ -1112,7 +1112,7 @@ class RelationshipView(NavigationView): format = "%s" lbl = widgets.MarkupLabel(format % escape(title), - x_align=1, y_align=.5) + halign=Gtk.Align.END) if self._config.get('preferences.releditbtn'): lbl.set_padding(0, 5) return lbl @@ -1174,7 +1174,7 @@ class RelationshipView(NavigationView): hbox = Gtk.Box() l = widgets.BasicLabel("%d." % index) l.set_width_chars(3) - l.set_alignment(1.0, 0.5) + l.set_halign(Gtk.Align.END) hbox.pack_start(l, False, False, 0) hbox.pack_start(widgets.LinkBox(link_label, button), False, False, 4) @@ -1275,7 +1275,7 @@ class RelationshipView(NavigationView): image.show() label = Gtk.Label(label=_("Edit %s") % name) label.show() - label.set_alignment(0, 0) + label.set_halign(Gtk.Align.START) item.set_image(image) item.add(label) From ae1af073a7d144785827df53926f6fe56af5b26a Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Fri, 22 May 2015 23:29:23 +0100 Subject: [PATCH 4/8] Use icon names for drag source --- gramps/gui/editors/editchildref.py | 2 +- gramps/gui/editors/editfamily.py | 4 ++-- gramps/gui/editors/editperson.py | 2 +- gramps/gui/editors/editpersonref.py | 2 +- gramps/gui/editors/objectentries.py | 2 +- gramps/gui/widgets/fanchart.py | 2 +- gramps/plugins/view/pedigreeview.py | 2 +- gramps/plugins/view/relview.py | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/gramps/gui/editors/editchildref.py b/gramps/gui/editors/editchildref.py index 12fbfd1fa..267ddde2c 100644 --- a/gramps/gui/editors/editchildref.py +++ b/gramps/gui/editors/editchildref.py @@ -113,7 +113,7 @@ class EditChildRef(EditSecondary): DdTargets.PERSON_LINK.target_flags, DdTargets.PERSON_LINK.app_id) self.label_event_box.drag_source_set_target_list(tglist) - self.label_event_box.drag_source_set_icon_stock('gramps-person') + self.label_event_box.drag_source_set_icon_name('gramps-person') self.label_event_box.connect('drag_data_get', self.drag_data_get) def _setup_fields(self): diff --git a/gramps/gui/editors/editfamily.py b/gramps/gui/editors/editfamily.py index 8d1dcf461..707bf0853 100644 --- a/gramps/gui/editors/editfamily.py +++ b/gramps/gui/editors/editfamily.py @@ -561,7 +561,7 @@ class EditFamily(EditPrimary): DdTargets.FAMILY_LINK.target_flags, DdTargets.FAMILY_LINK.app_id) self.contexteventbox.drag_source_set_target_list(tglist) - self.contexteventbox.drag_source_set_icon_stock('gramps-family') + self.contexteventbox.drag_source_set_icon_name('gramps-family') self.contexteventbox.connect('drag_data_get', self.on_drag_data_get_family) def on_drag_data_get_family(self,widget, context, sel_data, info, time): @@ -584,7 +584,7 @@ class EditFamily(EditPrimary): DdTargets.PERSON_LINK.target_flags, DdTargets.PERSON_LINK.app_id) event_box.drag_source_set_target_list(tglist) - event_box.drag_source_set_icon_stock('gramps-person') + event_box.drag_source_set_icon_name('gramps-person') event_box.connect('drag_data_get', on_drag_data_get) #Disallow drop: if event_box.drag_dest_get_target_list(): diff --git a/gramps/gui/editors/editperson.py b/gramps/gui/editors/editperson.py index 183f3bf3d..71177f0e5 100644 --- a/gramps/gui/editors/editperson.py +++ b/gramps/gui/editors/editperson.py @@ -263,7 +263,7 @@ class EditPerson(EditPrimary): [], Gdk.DragAction.COPY) self.contexteventbox.drag_source_set_target_list(tglist) - self.contexteventbox.drag_source_set_icon_stock('gramps-person') + self.contexteventbox.drag_source_set_icon_name('gramps-person') self.contexteventbox.connect('drag_data_get', self._top_drag_data_get) def _connect_db_signals(self): diff --git a/gramps/gui/editors/editpersonref.py b/gramps/gui/editors/editpersonref.py index 0cf47c3f9..0bdf57706 100644 --- a/gramps/gui/editors/editpersonref.py +++ b/gramps/gui/editors/editpersonref.py @@ -111,7 +111,7 @@ class EditPersonRef(EditSecondary): DdTargets.PERSON_LINK.target_flags, DdTargets.PERSON_LINK.app_id) self.label_event_box.drag_source_set_target_list(tglist) - self.label_event_box.drag_source_set_icon_stock('gramps-person') + self.label_event_box.drag_source_set_icon_name('gramps-person') self.label_event_box.connect('drag_data_get', self.drag_data_get) else: self.label_event_box.drag_source_unset() diff --git a/gramps/gui/editors/objectentries.py b/gramps/gui/editors/objectentries.py index be9985860..a703add4a 100644 --- a/gramps/gui/editors/objectentries.py +++ b/gramps/gui/editors/objectentries.py @@ -167,7 +167,7 @@ class ObjEntry(object): self._DND_TYPE.app_id) self.label_event_box.drag_source_set_target_list(tglist) if self._DND_ICON: - self.label_event_box.drag_source_set_icon_stock(self._DND_ICON) + self.label_event_box.drag_source_set_icon_name(self._DND_ICON) self.label_event_box.connect('drag_data_get', self.drag_data_get) else: if self.label.drag_source_get_target_list(): diff --git a/gramps/gui/widgets/fanchart.py b/gramps/gui/widgets/fanchart.py index edca4cdac..398ebf3fb 100644 --- a/gramps/gui/widgets/fanchart.py +++ b/gramps/gui/widgets/fanchart.py @@ -964,7 +964,7 @@ class FanChartBaseWidget(Gtk.DrawingArea): def on_drag_begin(self, widget, data): """Set up some inital conditions for drag. Set up icon.""" self.in_drag = True - self.drag_source_set_icon_stock('gramps-person') + self.drag_source_set_icon_name('gramps-person') def on_drag_end(self, widget, data): """Set up some inital conditions for drag. Set up icon.""" diff --git a/gramps/plugins/view/pedigreeview.py b/gramps/plugins/view/pedigreeview.py index 59965f561..a5018c80f 100644 --- a/gramps/plugins/view/pedigreeview.py +++ b/gramps/plugins/view/pedigreeview.py @@ -120,7 +120,7 @@ class _PersonWidgetBase(Gtk.DrawingArea): def cb_drag_begin(self, widget, data): """Set up some inital conditions for drag. Set up icon.""" self.in_drag = True - self.drag_source_set_icon_stock('gramps-person') + self.drag_source_set_icon_name('gramps-person') def cb_drag_end(self, widget, data): """Set up some inital conditions for drag. Set up icon.""" diff --git a/gramps/plugins/view/relview.py b/gramps/plugins/view/relview.py index 5ffd301e4..28bec2c1c 100644 --- a/gramps/plugins/view/relview.py +++ b/gramps/plugins/view/relview.py @@ -1091,7 +1091,7 @@ class RelationshipView(NavigationView): dnd_type.target_flags, dnd_type.app_id) eventbox.drag_source_set_target_list(tglist) - eventbox.drag_source_set_icon_stock(stock_icon) + eventbox.drag_source_set_icon_name(stock_icon) eventbox.connect('drag_data_get', self._make_drag_data_get_func(object_h, dnd_type)) From 53887d2033b2f42fe7aeec987e4722b9aaac3b87 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Fri, 22 May 2015 23:35:10 +0100 Subject: [PATCH 5/8] Specify label keyword in Button constructor --- gramps/gui/configure.py | 2 +- gramps/gui/plug/_windows.py | 24 ++++++++++---------- gramps/gui/plug/export/_exportoptions.py | 4 ++-- gramps/plugins/gramplet/ageondategramplet.py | 2 +- gramps/plugins/gramplet/eval.py | 4 ++-- gramps/plugins/gramplet/leak.py | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/gramps/gui/configure.py b/gramps/gui/configure.py index 75d6b8232..2565a037e 100644 --- a/gramps/gui/configure.py +++ b/gramps/gui/configure.py @@ -1339,7 +1339,7 @@ class GrampsPreferences(ConfigureDialog): checkbutton.connect("toggled", self.toggle_hide_previous_addons) grid.attach(checkbutton, 1, current_line, 1, 1) - button = Gtk.Button(_("Check now")) + button = Gtk.Button(label=_("Check now")) button.connect("clicked", self.check_for_updates) grid.attach(button, 3, current_line, 1, 1) diff --git a/gramps/gui/plug/_windows.py b/gramps/gui/plug/_windows.py index 085d96b13..9896589a1 100644 --- a/gramps/gui/plug/_windows.py +++ b/gramps/gui/plug/_windows.py @@ -138,18 +138,18 @@ class PluginStatus(ManagedWindow): vbox_reg.pack_start(scrolled_window_reg, True, True, 0) hbutbox = Gtk.ButtonBox() hbutbox.set_layout(Gtk.ButtonBoxStyle.SPREAD) - self.__info_btn = Gtk.Button(_("Info")) + self.__info_btn = Gtk.Button(label=_("Info")) hbutbox.add(self.__info_btn) self.__info_btn.connect('clicked', self.__info, self.list_reg, 4) # id_col - self.__hide_btn = Gtk.Button(_("Hide/Unhide")) + self.__hide_btn = Gtk.Button(label=_("Hide/Unhide")) hbutbox.add(self.__hide_btn) self.__hide_btn.connect('clicked', self.__hide, self.list_reg, 4, 1) # list, id_col, hide_col if __debug__: - self.__edit_btn = Gtk.Button(_("Edit")) + self.__edit_btn = Gtk.Button(label=_("Edit")) hbutbox.add(self.__edit_btn) self.__edit_btn.connect('clicked', self.__edit, self.list_reg, 4) # id_col - self.__load_btn = Gtk.Button(_("Load")) + self.__load_btn = Gtk.Button(label=_("Load")) hbutbox.add(self.__load_btn) self.__load_btn.connect('clicked', self.__load, self.list_reg, 4) # id_col vbox_reg.pack_start(hbutbox, False, False, 0) @@ -192,19 +192,19 @@ class PluginStatus(ManagedWindow): vbox_loaded.pack_start(scrolled_window, True, True, 0) hbutbox = Gtk.ButtonBox() hbutbox.set_layout(Gtk.ButtonBoxStyle.SPREAD) - self.__info_btn = Gtk.Button(_("Info")) + self.__info_btn = Gtk.Button(label=_("Info")) hbutbox.add(self.__info_btn) self.__info_btn.connect('clicked', self.__info, self.list, 4) # id_col - self.__hide_btn = Gtk.Button(_("Hide/Unhide")) + self.__hide_btn = Gtk.Button(label=_("Hide/Unhide")) hbutbox.add(self.__hide_btn) self.__hide_btn.connect('clicked', self.__hide, self.list, 4, 5) # list, id_col, hide_col if __debug__: - self.__edit_btn = Gtk.Button(_("Edit")) + self.__edit_btn = Gtk.Button(label=_("Edit")) hbutbox.add(self.__edit_btn) self.__edit_btn.connect('clicked', self.__edit, self.list, 4) # id_col - self.__load_btn = Gtk.Button(_("Load")) + self.__load_btn = Gtk.Button(label=_("Load")) self.__load_btn.set_sensitive(False) hbutbox.add(self.__load_btn) self.__load_btn.connect('clicked', self.__load, self.list, 4) # id_col @@ -264,13 +264,13 @@ class PluginStatus(ManagedWindow): hbutbox = Gtk.ButtonBox() hbutbox.set_layout(Gtk.ButtonBoxStyle.SPREAD) - self.__add_btn = Gtk.Button(_("Install Addon")) + self.__add_btn = Gtk.Button(label=_("Install Addon")) hbutbox.add(self.__add_btn) self.__add_btn.connect('clicked', self.__get_addon_top) - self.__add_all_btn = Gtk.Button(_("Install All Addons")) + self.__add_all_btn = Gtk.Button(label=_("Install All Addons")) hbutbox.add(self.__add_all_btn) self.__add_all_btn.connect('clicked', self.__get_all_addons) - self.__refresh_btn = Gtk.Button(_("Refresh Addon List")) + self.__refresh_btn = Gtk.Button(label=_("Refresh Addon List")) hbutbox.add(self.__refresh_btn) self.__refresh_btn.connect('clicked', self.__refresh_addon_list) install_page.pack_start(hbutbox, False, True, 5) @@ -283,7 +283,7 @@ class PluginStatus(ManagedWindow): if __debug__: # Only show the "Reload" button when in debug mode # (without -O on the command line) - self.__reload_btn = Gtk.Button(_("Reload")) + self.__reload_btn = Gtk.Button(label=_("Reload")) self.window.action_area.add(self.__reload_btn) self.__reload_btn.connect('clicked', self.__reload) diff --git a/gramps/gui/plug/export/_exportoptions.py b/gramps/gui/plug/export/_exportoptions.py index 241f7d569..a38468c34 100644 --- a/gramps/gui/plug/export/_exportoptions.py +++ b/gramps/gui/plug/export/_exportoptions.py @@ -177,12 +177,12 @@ class WriterOptionBox(object): row += 1 hbox = Gtk.Box() - self.advanced_button = Gtk.Button(_("Change order")) + self.advanced_button = Gtk.Button(label=_("Change order")) self.advanced_button.set_size_request(150, -1) self.proxy_options_showing = False self.advanced_button.connect("clicked", self.show_options) hbox.pack_end(self.advanced_button, False, True, 0) - self.preview_button = Gtk.Button(_("Calculate Previews")) + self.preview_button = Gtk.Button(label=_("Calculate Previews")) self.preview_button.connect("clicked", self.preview) hbox.pack_end(self.preview_button, False, True, 0) widget.pack_start(hbox, False, True, 0) diff --git a/gramps/plugins/gramplet/ageondategramplet.py b/gramps/plugins/gramplet/ageondategramplet.py index 72aa93125..1b03a01a2 100644 --- a/gramps/plugins/gramplet/ageondategramplet.py +++ b/gramps/plugins/gramplet/ageondategramplet.py @@ -71,7 +71,7 @@ class AgeOnDateGramplet(Gramplet): label = Gtk.Label() label.set_text(_("Date") + ":") self.entry = Gtk.Entry() - button = Gtk.Button(_("Run")) + button = Gtk.Button(label=_("Run")) button.connect("clicked", self.run) ##self.filter = hbox.pack_start(label, False, True, 0) diff --git a/gramps/plugins/gramplet/eval.py b/gramps/plugins/gramplet/eval.py index b9864be23..f52cdc9f7 100644 --- a/gramps/plugins/gramplet/eval.py +++ b/gramps/plugins/gramplet/eval.py @@ -74,10 +74,10 @@ class PythonEvaluation(Gramplet): self.error = self.__add_text_view(_("Error")) bbox = Gtk.ButtonBox() - apply_button = Gtk.Button(_("Apply")) + apply_button = Gtk.Button(label=_("Apply")) apply_button.connect('clicked', self.apply_clicked) bbox.pack_start(apply_button, False, False, 6) - clear_button = Gtk.Button(_("Clear")) + clear_button = Gtk.Button(label=_("Clear")) clear_button.connect('clicked', self.clear_clicked) bbox.pack_start(clear_button, False, False, 6) self.top.pack_start(bbox, False, False, 6) diff --git a/gramps/plugins/gramplet/leak.py b/gramps/plugins/gramplet/leak.py index 81308fd7a..2e30e7582 100644 --- a/gramps/plugins/gramplet/leak.py +++ b/gramps/plugins/gramplet/leak.py @@ -106,7 +106,7 @@ class Leak(Gramplet): self.top.pack_start(self.scroll, True, True, 6) bbox = Gtk.ButtonBox() - apply_button = Gtk.Button(_("Refresh")) + apply_button = Gtk.Button(label=_("Refresh")) apply_button.connect('clicked', self.apply_clicked) bbox.pack_start(apply_button, False, False, 6) self.top.pack_start(bbox, False, False, 6) From 0f079c432032784033f14779c7e74db817feb267 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Sat, 23 May 2015 00:01:24 +0100 Subject: [PATCH 6/8] Another escape change from cgi to html --- gramps/gui/views/treemodels/peoplemodel.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/gramps/gui/views/treemodels/peoplemodel.py b/gramps/gui/views/treemodels/peoplemodel.py index 6c8a1e090..44a906a3a 100644 --- a/gramps/gui/views/treemodels/peoplemodel.py +++ b/gramps/gui/views/treemodels/peoplemodel.py @@ -30,7 +30,7 @@ TreeModel for the GRAMPS Person tree. # Standard python modules # #------------------------------------------------------------------------- -import cgi +from html import escape #------------------------------------------------------------------------- # @@ -290,7 +290,7 @@ class PeopleBaseModel(object): else: date_str = get_date(birth) if date_str != "": - retval = cgi.escape(date_str) + retval = escape(date_str) if not get_date_valid(birth): return invalid_date_format % retval else: @@ -310,7 +310,7 @@ class PeopleBaseModel(object): if sort_mode: retval = "%09d" % event.get_date_object().get_sort_value() else: - retval = "%s" % cgi.escape(date_str) + retval = "%s" % escape(date_str) if not get_date_valid(event): return invalid_date_format % retval else: @@ -345,7 +345,7 @@ class PeopleBaseModel(object): else: date_str = get_date(event) if date_str != "": - retval = cgi.escape(date_str) + retval = escape(date_str) if not get_date_valid(event): return invalid_date_format % retval else: @@ -367,7 +367,7 @@ class PeopleBaseModel(object): if sort_mode: retval = "%09d" % event.get_date_object().get_sort_value() else: - retval = "%s" % cgi.escape(date_str) + retval = "%s" % escape(date_str) if not get_date_valid(event): return invalid_date_format % retval else: @@ -385,7 +385,7 @@ class PeopleBaseModel(object): if event: place_title = place_displayer.display_event(self.db, event) if place_title: - return cgi.escape(place_title) + return escape(place_title) except: return '' @@ -399,7 +399,7 @@ class PeopleBaseModel(object): place_title = place_displayer.display_event(self.db, event) if place_title: - return "%s" % cgi.escape(place_title) + return "%s" % escape(place_title) return "" def column_death_place(self, data): @@ -413,7 +413,7 @@ class PeopleBaseModel(object): if event: place_title = place_displayer.display_event(self.db, event) if place_title: - return cgi.escape(place_title) + return escape(place_title) except: return '' @@ -428,7 +428,7 @@ class PeopleBaseModel(object): place_title = place_displayer.display_event(self.db, event) if place_title: - return "%s" % cgi.escape(place_title) + return "%s" % escape(place_title) return "" def _get_parents_data(self, data): From 8fd1a93f97b49201c0f73ad8e9b1f4bb62354e82 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Sat, 23 May 2015 00:19:18 +0100 Subject: [PATCH 7/8] Specify label keyword in Label constructor --- gramps/gui/editors/editplacename.py | 2 +- gramps/gui/logger/_errorreportassistant.py | 58 +++++++++++----------- gramps/gui/plug/export/_exportoptions.py | 3 +- gramps/gui/plug/report/_styleeditor.py | 2 +- gramps/plugins/tool/mediamanager.py | 4 +- gramps/plugins/tool/patchnames.py | 9 ++-- 6 files changed, 41 insertions(+), 37 deletions(-) diff --git a/gramps/gui/editors/editplacename.py b/gramps/gui/editors/editplacename.py index 0573e101b..1fd28f80a 100644 --- a/gramps/gui/editors/editplacename.py +++ b/gramps/gui/editors/editplacename.py @@ -68,7 +68,7 @@ class EditPlaceName(ManagedWindow): self.set_window(window, None, _('Place Name Editor')) hbox = Gtk.Box() - label = Gtk.Label(_('Place Name:')) + label = Gtk.Label(label=_('Place Name:')) self.entry = Gtk.Entry() if index >= 0: self.entry.set_text(data[index]) diff --git a/gramps/gui/logger/_errorreportassistant.py b/gramps/gui/logger/_errorreportassistant.py index 668f83413..e5c81597a 100644 --- a/gramps/gui/logger/_errorreportassistant.py +++ b/gramps/gui/logger/_errorreportassistant.py @@ -305,7 +305,7 @@ class ErrorReportAssistant(Gtk.Assistant): error_details_frame.add(error_details_box) - side_label = Gtk.Label(_("This is the detailed Gramps error " + side_label = Gtk.Label(label=_("This is the detailed Gramps error " "information, don't worry if you do not " "understand it. You will have the opportunity " "to add further detail about the error " @@ -335,10 +335,10 @@ class ErrorReportAssistant(Gtk.Assistant): """ Build the system information page. """ - label = Gtk.Label(label=_("Please check the information below and correct " - "anything that you know to be wrong or remove " - "anything that you would rather not have included " - "in the bug report.")) + label = Gtk.Label(label=_("Please check the information below and " + "correct anything that you know to be wrong or " + "remove anything that you would rather not have " + "included in the bug report.")) label.set_halign(Gtk.Align.START) label.set_padding(0, 4) label.set_line_wrap(True) @@ -385,9 +385,9 @@ class ErrorReportAssistant(Gtk.Assistant): sys_information_frame.add(sys_information_box) - side_label = Gtk.Label(label=_("This is the information about your system " - "that will help the developers to fix the " - "bug.")) + side_label = Gtk.Label(label=_("This is the information about your " + "system that will help the developers to fix " + "the bug.")) side_label.set_line_wrap(True) @@ -413,8 +413,8 @@ class ErrorReportAssistant(Gtk.Assistant): """ Build the further information page. """ - label = Gtk.Label(label=_("Please provide as much information as you can " - "about what you were doing when the error " + label = Gtk.Label(label=_("Please provide as much information as you " + "can about what you were doing when the error " "occured.")) label.set_halign(Gtk.Align.START) label.set_padding(0, 4) @@ -457,8 +457,8 @@ class ErrorReportAssistant(Gtk.Assistant): user_information_frame.add(user_information_box) - side_label = Gtk.Label(label=_("This is your opportunity to describe what " - "you were doing when the error occured.")) + side_label = Gtk.Label(label=_("This is your opportunity to describe " + "what you were doing when the error occured.")) side_label.set_line_wrap(True) @@ -484,11 +484,11 @@ class ErrorReportAssistant(Gtk.Assistant): """ Build the bug report summary page. """ - label = Gtk.Label(_("Please check that the information is correct, " - "do not worry if you don't understand the detail " - "of the error information. Just make sure that it " - "does not contain anything that you do not want " - "to be sent to the developers.")) + label = Gtk.Label(label=_("Please check that the information is " + "correct, do not worry if you don't understand the " + "detail of the error information. Just make sure " + "that it does not contain anything that you do not " + "want to be sent to the developers.")) label.set_halign(Gtk.Align.START) label.set_padding(0, 4) label.set_line_wrap(True) @@ -521,10 +521,10 @@ class ErrorReportAssistant(Gtk.Assistant): summary_frame.add(summary_box) - side_label = Gtk.Label(label=_("This is the completed bug report. The next " - "page of the assistant will help you to file " - "a bug on the Gramps bug tracking system " - "website.")) + side_label = Gtk.Label(label=_("This is the completed bug report. " + "The next page of the assistant will help you " + "to file a bug on the Gramps bug tracking " + "system website.")) side_label.set_line_wrap(True) @@ -561,9 +561,9 @@ class ErrorReportAssistant(Gtk.Assistant): label.set_use_markup(True) - url_label = Gtk.Label(label=_("Use this button to start a web browser and " - "file a bug report on the Gramps bug tracking " - "system.")) + url_label = Gtk.Label(label=_("Use this button to start a web browser " + "and file a bug report on the Gramps bug " + "tracking system.")) url_label.set_halign(Gtk.Align.START) url_label.set_padding(0, 4) url_label.set_line_wrap(True) @@ -583,7 +583,7 @@ class ErrorReportAssistant(Gtk.Assistant): url_frame = Gtk.Frame() url_frame.add(url_box) - clip_label = Gtk.Label(_("Use this button " + clip_label = Gtk.Label(label=_("Use this button " "to copy the bug report onto the clipboard. " "Then go to the bug tracking website by using " "the button below, paste the report and click " @@ -620,10 +620,10 @@ class ErrorReportAssistant(Gtk.Assistant): outer_frame.add(inner_box) - side_label = Gtk.Label(label=_("This is the final step. Use the buttons on " - "this page to start a web browser and file a " - "bug report on the Gramps bug tracking " - "system.")) + side_label = Gtk.Label(label=_("This is the final step. Use the " + "buttons on this page to start a web browser " + "and file a bug report on the Gramps bug " + "tracking system.")) side_label.set_line_wrap(True) diff --git a/gramps/gui/plug/export/_exportoptions.py b/gramps/gui/plug/export/_exportoptions.py index a38468c34..0bcc2d2c6 100644 --- a/gramps/gui/plug/export/_exportoptions.py +++ b/gramps/gui/plug/export/_exportoptions.py @@ -144,7 +144,8 @@ class WriterOptionBox(object): widget = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) full_database_row = Gtk.Box() - full_database_row.pack_start(Gtk.Label(_("Unfiltered Family Tree:")), True, True, 0) + label = Gtk.Label(label=_("Unfiltered Family Tree:")) + full_database_row.pack_start(label, True, True, 0) people_count = len(self.dbstate.db.get_person_handles()) # translators: leave all/any {...} untranslated button = Gtk.Button(ngettext("{number_of} Person", diff --git a/gramps/gui/plug/report/_styleeditor.py b/gramps/gui/plug/report/_styleeditor.py index efdc81185..71181b88e 100644 --- a/gramps/gui/plug/report/_styleeditor.py +++ b/gramps/gui/plug/report/_styleeditor.py @@ -349,7 +349,7 @@ class StyleEditor(object): for i in range(t.get_columns()): hbox = Gtk.Box() - label = Gtk.Label(_('Column %d:') % (i + 1)) + label = Gtk.Label(label=_('Column %d:') % (i + 1)) hbox.pack_start(label, False, False, 6) spin = Gtk.SpinButton() spin.set_range(0, 100) diff --git a/gramps/plugins/tool/mediamanager.py b/gramps/plugins/tool/mediamanager.py index be2aa0a6e..58acf27c3 100644 --- a/gramps/plugins/tool/mediamanager.py +++ b/gramps/plugins/tool/mediamanager.py @@ -336,8 +336,8 @@ class ConfirmationPage(Gtk.Box): scrolled_window.add(tree) self.pack_start(scrolled_window, True, True, 0) - label3 = Gtk.Label(_('Press Apply to proceed, Cancel to abort, ' - 'or Back to revisit your options.')) + label3 = Gtk.Label(label=_('Press Apply to proceed, Cancel to abort, ' + 'or Back to revisit your options.')) self.pack_start(label3, False, True, 0) def prepare(self, index): diff --git a/gramps/plugins/tool/patchnames.py b/gramps/plugins/tool/patchnames.py index bc319cfae..d2b2b46c0 100644 --- a/gramps/plugins/tool/patchnames.py +++ b/gramps/plugins/tool/patchnames.py @@ -118,19 +118,22 @@ class PatchNames(tool.BatchTool, ManagedWindow): winprefix.vbox.set_spacing(5) hboxpref = Gtk.Box() - hboxpref.pack_start(Gtk.Label(_('Prefixes to search for:')), False, False, 5) + label = Gtk.Label(label=_('Prefixes to search for:')) + hboxpref.pack_start(label, False, False, 5) self.prefixbox = Gtk.Entry() self.prefixbox.set_text(', '.join(PREFIX_LIST)) hboxpref.pack_start(self.prefixbox, True, True, 0) winprefix.vbox.pack_start(hboxpref, True, True, 0) hboxcon = Gtk.Box() - hboxcon.pack_start(Gtk.Label(_('Connectors splitting surnames:')), False, False, 5) + label = Gtk.Label(label=_('Connectors splitting surnames:')) + hboxcon.pack_start(label, False, False, 5) self.conbox = Gtk.Entry() self.conbox.set_text(', '.join(CONNECTOR_LIST)) hboxcon.pack_start(self.conbox, True, True, 0) winprefix.vbox.pack_start(hboxcon, True, True, 0) hboxconns = Gtk.Box() - hboxconns.pack_start(Gtk.Label(_('Connectors not splitting surnames:')), False, False, 5) + label = Gtk.Label(label=_('Connectors not splitting surnames:')) + hboxconns.pack_start(label, False, False, 5) self.connsbox = Gtk.Entry() self.connsbox.set_text(', '.join(CONNECTOR_LIST_NONSPLIT)) hboxconns.pack_start(self.connsbox, True, True, 0) From 75cc4fb721d7ac2da051a00a23a5eaf62a7ba917 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Sat, 23 May 2015 07:58:28 -0400 Subject: [PATCH 8/8] Fixed GW import issue with citation handles --- gramps/plugins/importer/importgeneweb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gramps/plugins/importer/importgeneweb.py b/gramps/plugins/importer/importgeneweb.py index 01707577a..7d9192f2c 100644 --- a/gramps/plugins/importer/importgeneweb.py +++ b/gramps/plugins/importer/importgeneweb.py @@ -362,7 +362,7 @@ class GeneWebParser(object): def read_children_source_line(self,line,fields): csrc = self.get_or_create_source(self.decode(fields[1])) - self.current_child_source_handle = csrc + self.current_child_source_handle = csrc.handle return None def read_family_comment(self,line,fields):