From a9a1b7b57e3c397177da974d0fee494e3938cdb9 Mon Sep 17 00:00:00 2001 From: Baizley Date: Sat, 1 Feb 2020 00:18:59 +0100 Subject: [PATCH] Small code improvements. --- gramps/cli/argparser.py | 7 ++++--- gramps/gen/recentfiles.py | 4 ++-- gramps/gui/editors/displaytabs/surnametab.py | 8 -------- gramps/gui/editors/editperson.py | 1 - gramps/plugins/drawreport/statisticschart.py | 4 ++-- 5 files changed, 8 insertions(+), 16 deletions(-) diff --git a/gramps/cli/argparser.py b/gramps/cli/argparser.py index 6a66d5ff7..a2f934d64 100644 --- a/gramps/cli/argparser.py +++ b/gramps/cli/argparser.py @@ -343,8 +343,8 @@ class ArgParser: print(_("Gramps config settings from %s:" ) % config.filename) for sect, settings in config.data.items(): - for setting, value in settings.items(): - print("%s.%s=%s" % (sect, setting, repr(value))) + for settings_index, setting in settings.items(): + print("%s.%s=%s" % (sect, settings_index, repr(value))) print() sys.exit(0) elif option in ['-c', '--config']: @@ -434,7 +434,8 @@ class ArgParser: sys.exit(0) # Done with Default #clean options list - for ind in reversed(cleandbg): + cleandbg.reverse() + for ind in cleandbg: del options[ind] if (len(options) > 0 diff --git a/gramps/gen/recentfiles.py b/gramps/gen/recentfiles.py index 25a436881..900b4b0d9 100644 --- a/gramps/gen/recentfiles.py +++ b/gramps/gen/recentfiles.py @@ -154,7 +154,7 @@ class RecentFiles: for recent_file in self.gramps_recent_files: if recent_file.get_name() == filename: recent_file.set_name(new_filename) - break + return def remove_filename(self, filename): """ @@ -163,7 +163,7 @@ class RecentFiles: for index, recent_file in enumerate(self.gramps_recent_files): if recent_file.get_name() == filename: self.gramps_recent_files.pop(index) - break + return def check_if_recent(self, filename): """ diff --git a/gramps/gui/editors/displaytabs/surnametab.py b/gramps/gui/editors/displaytabs/surnametab.py index 2153e731d..f4b902625 100644 --- a/gramps/gui/editors/displaytabs/surnametab.py +++ b/gramps/gui/editors/displaytabs/surnametab.py @@ -148,14 +148,6 @@ class SurnameTab(EmbeddedList): self.columns.append(column) self.tree.append_column(column) -## def by_value(self, first, second): -## """ -## Method for sorting keys based on the values. -## """ -## fvalue = self.cmborigmap[first] -## svalue = self.cmborigmap[second] -## return glocale.strcoll(fvalue, svalue) - def setup_editable_col(self): """ inherit this and set the variables needed for editable columns diff --git a/gramps/gui/editors/editperson.py b/gramps/gui/editors/editperson.py index d2967cebe..f1c996d3c 100644 --- a/gramps/gui/editors/editperson.py +++ b/gramps/gui/editors/editperson.py @@ -41,7 +41,6 @@ import pickle #------------------------------------------------------------------------- from gi.repository import Gtk from gi.repository import Gdk -from gi.repository import Pango from gi.repository.GLib import markup_escape_text #------------------------------------------------------------------------- diff --git a/gramps/plugins/drawreport/statisticschart.py b/gramps/plugins/drawreport/statisticschart.py index 7beb4f786..794314d6a 100644 --- a/gramps/plugins/drawreport/statisticschart.py +++ b/gramps/plugins/drawreport/statisticschart.py @@ -1050,8 +1050,8 @@ class StatisticsChartOptions(MenuReportOptions): gender = EnumeratedListOption(_('Genders included'), Person.UNKNOWN) - for item in enumerate(_options.opt_genders): - gender.add_item(item[0], item[2]) + for first, second, third in _options.opt_genders: + gender.add_item(first, third) gender.set_help(_("Select which genders are included into " "statistics.")) add_option("gender", gender)