diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9266d4b..8b592cf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@
- More unit tests.
- More tooltips.
- The option to enter the frequency in Hz, kHz, MHz, or GHz in the Add/Edit Record dialog. Frequencies are still displayed in MHz in the logbook.
+- Record/QSO count feature.
### Changed
- Using username and port information (in addition to hostname) when creating an identifier for a DX cluster bookmark.
diff --git a/pyqso/logbook.py b/pyqso/logbook.py
index 7c1a9f6..47d942d 100644
--- a/pyqso/logbook.py
+++ b/pyqso/logbook.py
@@ -740,7 +740,7 @@ class Logbook:
printer = Printer(self.application)
printer.print_records(records)
else:
- error(self.application.window, "Could not retrieve the records from the SQL database. No records have been printed.")
+ error(parent=self.application.window, message="Could not retrieve the records from the SQL database. No records have been printed.")
return
def add_record_callback(self, widget):
@@ -929,6 +929,19 @@ class Logbook:
return
+ def record_count_callback(self, widget=None):
+ """ Show the record count for the selected log. """
+ page_index = self.notebook.get_current_page() # Get the index of the selected tab in the logbook.
+ if(page_index == 0): # If we are on the Summary page...
+ logging.debug("No log currently selected!")
+ return
+ log_index = self.get_log_index()
+ log = self.logs[log_index]
+ record_count = log.record_count
+ if(record_count is not None):
+ info(parent=self.application.window, message="Log '%s' contains %d records." % (log.name, record_count))
+ return
+
@property
def log_count(self):
""" Return the total number of logs in the logbook.
diff --git a/pyqso/menu.py b/pyqso/menu.py
index ff68c12..e3f08f7 100644
--- a/pyqso/menu.py
+++ b/pyqso/menu.py
@@ -108,6 +108,10 @@ class Menu:
self.items["REMOVE_DUPLICATES"] = self.builder.get_object("mitem_remove_duplicates")
self.items["REMOVE_DUPLICATES"].connect("activate", self.application.logbook.remove_duplicates_callback)
+ # Record count
+ self.items["RECORD_COUNT"] = self.builder.get_object("mitem_record_count")
+ self.items["RECORD_COUNT"].connect("activate", self.application.logbook.record_count_callback)
+
# View toolbox
self.items["TOOLBOX"] = self.builder.get_object("mitem_toolbox")
config = configparser.ConfigParser()
@@ -160,7 +164,7 @@ class Menu:
:arg bool sensitive: If True, enable all the record-related menu items. If False, disable them all.
"""
logging.debug("Setting record-related menu item sensitivity to: %s..." % sensitive)
- for item_name in ["ADD_RECORD", "EDIT_RECORD", "DELETE_RECORD", "REMOVE_DUPLICATES"]:
+ for item_name in ["ADD_RECORD", "EDIT_RECORD", "DELETE_RECORD", "REMOVE_DUPLICATES", "RECORD_COUNT"]:
self.items[item_name].set_sensitive(sensitive)
logging.debug("Set record-related menu item sensitivity to: %s." % sensitive)
return
diff --git a/res/pyqso.glade b/res/pyqso.glade
index c1b11bb..66a00c4 100644
--- a/res/pyqso.glade
+++ b/res/pyqso.glade
@@ -347,6 +347,19 @@
False
+
+
+
+
+
+