kopia lustrzana https://github.com/ctjacobs/pyqso
- Added functionality to remove duplicate records in a log.
- Updated the manual.pull/17/head
rodzic
b4f5aa10a6
commit
927b41c3a7
1
TODO
1
TODO
|
@ -1,3 +1,2 @@
|
|||
- Finish manual
|
||||
- More error handling
|
||||
- Duplicate entry checking and removal
|
||||
|
|
|
@ -144,9 +144,10 @@ A DX cluster is essentially a server through which radio operators can report an
|
|||
PyQSO is able to connect to a DX cluster that operates using the Telnet protocol to provide a text-based alert service. As a result of the many different Telnet-based software products that DX clusters run, PyQSO currently outputs the raw data received from the DX cluster rather than trying to parse it in some way.
|
||||
|
||||
\section{Grey line}
|
||||
The grey line tool can be used to check which parts of the world are in darkness. The grey line window is updated every 30 minutes.
|
||||
The grey line tool can be used to check which parts of the world are in darkness. %The grey line window is updated every 30 minutes.
|
||||
|
||||
\section{Awards}
|
||||
Currently only the DXCC award is supported, but additional awards will be added if there is user demand for them.
|
||||
|
||||
\chapter{Preferences}
|
||||
PyQSO user preferences are stored in a configuration file located at \texttt{\textasciitilde/.pyqso.cfg}, where \texttt{\textasciitilde} denotes the user's home directory.
|
||||
|
|
|
@ -27,6 +27,14 @@ def error(parent, message):
|
|||
dialog.run()
|
||||
dialog.destroy()
|
||||
return
|
||||
|
||||
def info(parent, message):
|
||||
''' Displays some information. '''
|
||||
dialog = Gtk.MessageDialog(parent, Gtk.DialogFlags.DESTROY_WITH_PARENT,
|
||||
Gtk.MessageType.INFO, Gtk.ButtonsType.OK, message)
|
||||
dialog.run()
|
||||
dialog.destroy()
|
||||
return
|
||||
|
||||
def question(parent, message):
|
||||
''' Asks the user a question. The dialog comes with 'Yes' and 'No' response buttons. '''
|
||||
|
|
|
@ -789,14 +789,35 @@ class Logbook(Gtk.Notebook):
|
|||
|
||||
def remove_duplicates_callback(self, widget=None):
|
||||
logging.debug("Removing duplicate records...")
|
||||
logging.error("Duplicates cannot be removed yet.")
|
||||
|
||||
log_index = self.get_log_index()
|
||||
log = self.logs[log_index]
|
||||
|
||||
removed = 0
|
||||
duplicates = []
|
||||
# Find the duplicates in the log, based on the CALL, QSO_DATE, TIME_ON, FREQ and MODE fields.
|
||||
with self.connection:
|
||||
c = self.connection.cursor()
|
||||
c.execute(
|
||||
'''SELECT rowid FROM repeater_contacts WHERE rowid NOT IN
|
||||
(
|
||||
SELECT MIN(rowid) FROM repeater_contacts GROUP BY call, qso_date, time_on, freq, mode
|
||||
)''')
|
||||
result = c.fetchall()
|
||||
for rowid in result:
|
||||
duplicates.append(rowid[0]) # Get the integers from inside the tuples.
|
||||
|
||||
logging.debug("Removed %d duplicate records." % removed)
|
||||
removed = 0 # Count the number of records that are removed. Hopefully this will be the same as len(duplicates).
|
||||
path = Gtk.TreePath(0) # Start with the first row in the log.
|
||||
iter = log.get_iter(path)
|
||||
while iter is not None:
|
||||
row_index = log.get_value(iter, 0) # Get the index.
|
||||
if(row_index in duplicates): # Is this a duplicate row? If so, delete it.
|
||||
log.delete_record(row_index, iter)
|
||||
removed += 1
|
||||
iter = log.iter_next(iter) # Move on to the next row, until iter_next returns None.
|
||||
|
||||
info(self.parent, "Found %d duplicate(s). Successfully removed %d duplicate(s)." % (len(duplicates), removed))
|
||||
assert(len(duplicates) == removed)
|
||||
return
|
||||
|
||||
def get_number_of_logs(self):
|
||||
|
|
Ładowanie…
Reference in New Issue