diff --git a/pyqso/awards.py b/pyqso/awards.py index 0a2f95b..2c6397b 100644 --- a/pyqso/awards.py +++ b/pyqso/awards.py @@ -81,7 +81,7 @@ class Awards: count.append([0]*len(self.bands)) for log in logbook.logs: - records = log.get_all_records() + records = log.records if(records is not None): for r in records: if(r["BAND"] is not None and r["MODE"] is not None): diff --git a/pyqso/log.py b/pyqso/log.py index 614d5dd..99f138b 100644 --- a/pyqso/log.py +++ b/pyqso/log.py @@ -53,7 +53,7 @@ class Log(Gtk.ListStore): logging.debug("Populating '%s'..." % self.name) self.add_missing_db_columns() self.clear() - records = self.get_all_records() + records = self.records if(records is not None): for r in records: liststore_entry = [r["id"]] @@ -300,7 +300,8 @@ class Log(Gtk.ListStore): logging.exception(e) return None - def get_all_records(self): + @property + def records(self): """ Return a list of all the records in the log. :returns: A list of all the records in the log. Each record is represented by a dictionary. diff --git a/pyqso/logbook.py b/pyqso/logbook.py index dcee9a8..baa28a3 100644 --- a/pyqso/logbook.py +++ b/pyqso/logbook.py @@ -636,7 +636,7 @@ class Logbook: logging.debug("No file path specified.") else: adif = ADIF() - records = log.get_all_records() + records = log.records if(records is not None): adif.write(records, path) else: @@ -693,7 +693,7 @@ class Logbook: ced.dialog.destroy() cabrillo = Cabrillo() - records = log.get_all_records() + records = log.records if(records is not None): cabrillo.write(records, path, contest=contest, mycall=mycall) else: @@ -709,7 +709,7 @@ class Logbook: return log_index = self.get_log_index() log = self.logs[log_index] - records = log.get_all_records() + records = log.records if(records is not None): printer = Printer(self.application) printer.print_records(records) diff --git a/tests/test_log.py b/tests/test_log.py index 8e4cd38..fa71cf2 100644 --- a/tests/test_log.py +++ b/tests/test_log.py @@ -130,14 +130,14 @@ class TestLog(unittest.TestCase): assert(record[field_name.upper()] == self.fields_and_data[field_name.upper()]) assert(len(record) == len(self.fields_and_data) + 1) - def test_log_get_all_records(self): + def test_log_records(self): query = "INSERT INTO test VALUES (NULL, ?, ?, ?, ?, ?, ?, ?, ?)" c = self.connection.cursor() # Add the same record twice c.execute(query, (self.fields_and_data["CALL"], self.fields_and_data["QSO_DATE"], self.fields_and_data["TIME_ON"], self.fields_and_data["FREQ"], self.fields_and_data["BAND"], self.fields_and_data["MODE"], self.fields_and_data["RST_SENT"], self.fields_and_data["RST_RCVD"])) c.execute(query, (self.fields_and_data["CALL"], self.fields_and_data["QSO_DATE"], self.fields_and_data["TIME_ON"], self.fields_and_data["FREQ"], self.fields_and_data["BAND"], self.fields_and_data["MODE"], self.fields_and_data["RST_SENT"], self.fields_and_data["RST_RCVD"])) - records = self.log.get_all_records() + records = self.log.records print("Contents of all retrieved records: ", records) assert(len(records) == 2) # There should be 2 records for field_name in self.field_names: