Added 'record count' feature.

pull/61/head
Christian T. Jacobs 2017-06-27 21:13:59 +01:00
rodzic f816554816
commit 7055f4f67d
4 zmienionych plików z 33 dodań i 2 usunięć

Wyświetl plik

@ -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.

Wyświetl plik

@ -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.

Wyświetl plik

@ -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

Wyświetl plik

@ -347,6 +347,19 @@
<property name="use_stock">False</property>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="separatormenuitem7">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="mitem_record_count">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Record Count</property>
</object>
</child>
</object>
</child>
</object>