Perform an initial count for the awards table.

pull/61/head
Christian T. Jacobs 2017-04-01 18:10:24 +01:00
rodzic c10abde42a
commit 531749270c
4 zmienionych plików z 19 dodań i 13 usunięć

Wyświetl plik

@ -26,15 +26,16 @@ class Awards:
""" A tool for tracking progress towards an award. Currently this only supports the DXCC award.
For more information visit http://www.arrl.org/dxcc """
def __init__(self, builder):
def __init__(self, application):
""" Set up a table for progress tracking purposes.
:arg builder: The Gtk builder.
:arg application: The PyQSO application containing the main Gtk window, etc.
"""
# TODO: This only considers the DXCC award for now.
logging.debug("Setting up awards table...")
self.builder = builder
self.application = application
self.builder = self.application.builder
self.bands = ["70cm", "2m", "6m", "10m", "12m", "15m", "17m", "20m", "30m", "40m", "80m", "160m"]
self.modes = ["Phone", "CW", "Digital", "Mixed"]
@ -64,6 +65,8 @@ class Awards:
logging.debug("Awards table set up successfully.")
self.count(self.application.logbook)
return
def count(self, logbook):
@ -95,8 +98,10 @@ class Awards:
count[3][band] += 1 # Keep the total of each column in the "Mixed" mode.
else:
logging.error("Could not update the awards table for '%s' because of a database error." % log.name)
# Insert the rows containing the totals
for i in range(0, len(self.modes)):
self.awards.append([self.modes[i]] + count[i])
logging.debug("Awards table updated.")
return

Wyświetl plik

@ -38,16 +38,17 @@ class DXCluster:
""" A tool for connecting to a DX cluster (specifically Telnet-based DX clusters). """
def __init__(self, builder):
def __init__(self, application):
""" Set up the DX cluster, and set up a timer so that PyQSO can retrieve new data from the Telnet server every few seconds.
:arg builder: The Gtk builder.
:arg application: The PyQSO application containing the main Gtk window, etc.
"""
logging.debug("Setting up the DX cluster...")
self.application = application
self.builder = self.application.builder
self.connection = None
self.builder = builder
# Connect signals.
self.builder.get_object("mitem_new").connect("activate", self.new_server)

Wyświetl plik

@ -44,14 +44,15 @@ class GreyLine:
""" A tool for visualising the grey line. """
def __init__(self, builder):
def __init__(self, application):
""" Set up the drawing canvas and the timer which will re-plot the grey line every 30 minutes.
:arg builder: The Gtk builder.
:arg application: The PyQSO application containing the main Gtk window, etc.
"""
logging.debug("Setting up the grey line...")
self.builder = builder
self.application = application
self.builder = self.application.builder
# Get the QTH coordinates, if available.
config = configparser.ConfigParser()

Wyświetl plik

@ -32,7 +32,6 @@ class Toolbox:
""" Instantiate and insert the various tools into the toolbox.
:arg application: The PyQSO application containing the main Gtk window, etc.
:arg builder: The Gtk builder.
"""
logging.debug("Setting up the toolbox...")
@ -42,9 +41,9 @@ class Toolbox:
self.tools = self.builder.get_object("tools")
self.dx_cluster = DXCluster(self.builder)
self.grey_line = GreyLine(self.builder)
self.awards = Awards(self.builder)
self.dx_cluster = DXCluster(self.application)
self.grey_line = GreyLine(self.application)
self.awards = Awards(self.application)
self.tools.connect_after("switch-page", self._on_switch_page)