kopia lustrzana https://github.com/ctjacobs/pyqso
Convert to Python 3 using 2to3.
Also update Travis CI settings for Python 3, add new package dependencies and update the documentation.pull/41/head
rodzic
02d7b5446a
commit
fc94c8d511
10
.travis.yml
10
.travis.yml
|
@ -1,14 +1,17 @@
|
|||
sudo: required
|
||||
dist: trusty
|
||||
|
||||
language: python
|
||||
|
||||
python:
|
||||
- "2.7"
|
||||
|
||||
- "3.4"
|
||||
|
||||
virtualenv:
|
||||
system_site_packages: true
|
||||
|
||||
before_install:
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -y python2.7 gir1.2-gtk-3.0 python-gi-cairo python-mpltoolkits.basemap python-numpy python-matplotlib python-libhamlib2 python-sphinx
|
||||
- sudo apt-get install -yq xvfb gir1.2-gtk-3.0 python3-gi-cairo python-mpltoolkits.basemap python3-numpy python3-matplotlib python3-sphinx python-libhamlib2
|
||||
- "export DISPLAY=:99.0"
|
||||
- "sh -e /etc/init.d/xvfb start"
|
||||
|
||||
|
@ -17,6 +20,7 @@ install:
|
|||
|
||||
before_script:
|
||||
- export PYTHONPATH=`pwd`:$PYTHONPATH
|
||||
- echo $PYTHONPATH
|
||||
|
||||
script:
|
||||
- make unittest
|
||||
|
|
4
Makefile
4
Makefile
|
@ -23,7 +23,7 @@ input: clean install docs
|
|||
|
||||
install:
|
||||
@echo "*** Installing PyQSO"
|
||||
python setup.py install
|
||||
python3 setup.py install
|
||||
|
||||
docs:
|
||||
@echo "*** Building the documentation"
|
||||
|
@ -31,7 +31,7 @@ docs:
|
|||
|
||||
unittest:
|
||||
@echo "*** Running the unit tests"
|
||||
python -m unittest discover --start-directory=pyqso --pattern=*.py --verbose
|
||||
python3 -m unittest discover --start-directory=pyqso --pattern=*.py --verbose
|
||||
|
||||
clean:
|
||||
@echo "*** Cleaning docs directory"
|
||||
|
|
23
README.md
23
README.md
|
@ -57,25 +57,24 @@ Dependencies
|
|||
PyQSO depends on the following Debian packages:
|
||||
|
||||
* gir1.2-gtk-3.0
|
||||
* python2.7
|
||||
* python-gi-cairo (for log printing purposes)
|
||||
* python3
|
||||
* python3-gi-cairo (for log printing purposes)
|
||||
|
||||
The following extra packages are necessary to enable the grey line tool:
|
||||
|
||||
* python-mpltoolkits.basemap
|
||||
* python-numpy
|
||||
* python-matplotlib (version 1.3.0 or later)
|
||||
|
||||
The following extra package is necessary to enable Hamlib support:
|
||||
|
||||
* python-libhamlib2
|
||||
* python3-mpltoolkits.basemap
|
||||
* python3-numpy
|
||||
* python3-matplotlib (version 1.3.0 or later)
|
||||
* libxcb-render0-dev
|
||||
* python3-cairocffi
|
||||
|
||||
The following extra package is necessary to build the documentation:
|
||||
|
||||
* python-sphinx
|
||||
* python3-sphinx
|
||||
|
||||
There currently does not exist a Python 3-compatible Debian package for [Hamlib](http://www.hamlib.org). This library must be built manually to enable Hamlib support.
|
||||
|
||||
Contact
|
||||
-------
|
||||
|
||||
If you have any comments or questions about PyQSO, please send them via email to <c.jacobs10@imperial.ac.uk>.
|
||||
|
||||
If you have any comments or questions about PyQSO, please send them via email to Christian Jacobs (2E0ICL) at <c.jacobs10@imperial.ac.uk>.
|
||||
|
|
14
bin/pyqso
14
bin/pyqso
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (C) 2012 Christian T. Jacobs.
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
|||
|
||||
from gi.repository import Gtk, GdkPixbuf
|
||||
import argparse
|
||||
import ConfigParser
|
||||
import configparser
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
|
@ -54,7 +54,7 @@ class PyQSO(Gtk.Window):
|
|||
Gtk.Window.__init__(self, title="PyQSO")
|
||||
|
||||
# Get any application-specific preferences from the configuration file
|
||||
config = ConfigParser.ConfigParser()
|
||||
config = configparser.ConfigParser()
|
||||
# Check that the configuration file actually exists (and is readable)
|
||||
# otherwise, we will resort to the defaults.
|
||||
have_config = (config.read(os.path.expanduser("~/.pyqso.ini")) != [])
|
||||
|
@ -65,8 +65,8 @@ class PyQSO(Gtk.Window):
|
|||
for icon_path in possible_icon_paths:
|
||||
try:
|
||||
self.set_icon_from_file(icon_path)
|
||||
except Exception, error:
|
||||
print error.message
|
||||
except Exception as error:
|
||||
print(error.message)
|
||||
|
||||
# Kills the application if the close button is clicked on the main window itself.
|
||||
self.connect("delete-event", Gtk.main_quit)
|
||||
|
@ -136,8 +136,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.""")
|
|||
for icon_path in possible_icon_paths:
|
||||
try:
|
||||
about.set_logo(GdkPixbuf.Pixbuf.new_from_file_at_scale(icon_path, 64, 64, False))
|
||||
except Exception, error:
|
||||
print error.message
|
||||
except Exception as error:
|
||||
print(error.message)
|
||||
about.run()
|
||||
about.destroy()
|
||||
return
|
||||
|
|
|
@ -34,7 +34,7 @@ include:
|
|||
|
||||
- Basic support for the Hamlib library.
|
||||
|
||||
The source code for PyQSO is available for download from the `GitHub repository <https://github.com/ctjacobs/pyqso>`_.
|
||||
The source code for PyQSO, written in Python (version 3.x), is available for download from the `GitHub repository <https://github.com/ctjacobs/pyqso>`_.
|
||||
|
||||
Data storage model
|
||||
------------------
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (C) 2012 Christian T. Jacobs.
|
||||
|
||||
|
@ -22,7 +22,7 @@ import logging
|
|||
import unittest
|
||||
from datetime import datetime
|
||||
import calendar
|
||||
import ConfigParser
|
||||
import configparser
|
||||
from os.path import expanduser
|
||||
|
||||
# ADIF field names and their associated data types available in PyQSO.
|
||||
|
@ -143,7 +143,7 @@ class ADIF:
|
|||
records = []
|
||||
|
||||
# ADIF-related configuration options
|
||||
config = ConfigParser.ConfigParser()
|
||||
config = configparser.ConfigParser()
|
||||
have_config = (config.read(expanduser('~/.pyqso.ini')) != [])
|
||||
(section, option) = ("adif", "merge_comment")
|
||||
if(have_config and config.has_option(section, option) and config.get(section, option) == "True"):
|
||||
|
@ -214,7 +214,7 @@ class ADIF:
|
|||
|
||||
# Merge the COMMENT field with the NOTES field, if desired and applicable.
|
||||
if(merge_comment):
|
||||
if("NOTES" in fields_and_data_dictionary.keys() and comment):
|
||||
if("NOTES" in list(fields_and_data_dictionary.keys()) and comment):
|
||||
logging.debug("Merging COMMENT field with NOTES field...")
|
||||
fields_and_data_dictionary["NOTES"] += "\\n" + comment
|
||||
logging.debug("Merged fields.")
|
||||
|
@ -258,7 +258,7 @@ class ADIF:
|
|||
# Then write each log to the file.
|
||||
for r in records:
|
||||
for field_name in AVAILABLE_FIELD_NAMES_ORDERED:
|
||||
if(not(field_name.lower() in r.keys() or field_name.upper() in r.keys())):
|
||||
if(not(field_name.lower() in list(r.keys()) or field_name.upper() in list(r.keys()))):
|
||||
# If the field_name does not exist in the record, then skip past it.
|
||||
# Only write out the fields that exist and that have some data in them.
|
||||
continue
|
||||
|
@ -379,7 +379,7 @@ class ADIF:
|
|||
|
||||
elif(data_type == "I"):
|
||||
# IntlString
|
||||
m = re.match(ur"(.+)", data, re.UNICODE)
|
||||
m = re.match(r"(.+)", data, re.UNICODE)
|
||||
if(m is None):
|
||||
return False
|
||||
else:
|
||||
|
@ -387,7 +387,7 @@ class ADIF:
|
|||
|
||||
elif(data_type == "G"):
|
||||
# IntlMultilineString
|
||||
m = re.match(ur"(.+(\r\n)*.*)", data, re.UNICODE)
|
||||
m = re.match(r"(.+(\r\n)*.*)", data, re.UNICODE)
|
||||
if(m is None):
|
||||
return False
|
||||
else:
|
||||
|
@ -458,10 +458,10 @@ class TestADIF(unittest.TestCase):
|
|||
|
||||
records = self.adif.read("ADIF.test_read.adi")
|
||||
expected_records = [{'TIME_ON': '1955', 'BAND': '40m', 'CALL': 'TEST', 'MODE': 'CW', 'QSO_DATE': '20130322'}]
|
||||
print "Imported records: ", records
|
||||
print "Expected records: ", expected_records
|
||||
print("Imported records: ", records)
|
||||
print("Expected records: ", expected_records)
|
||||
assert(len(records) == 1)
|
||||
assert(len(records[0].keys()) == len(expected_records[0].keys()))
|
||||
assert(len(list(records[0].keys())) == len(list(expected_records[0].keys())))
|
||||
assert(records == expected_records)
|
||||
|
||||
def test_adif_read_multiple(self):
|
||||
|
@ -480,11 +480,11 @@ class TestADIF(unittest.TestCase):
|
|||
|
||||
records = self.adif.read("ADIF.test_read_multiple.adi")
|
||||
expected_records = [{'TIME_ON': '1955', 'BAND': '40m', 'CALL': 'TEST', 'MODE': 'CW', 'QSO_DATE': '20130322'}, {'TIME_ON': '0820', 'BAND': '20m', 'CALL': 'TEST2ABC', 'MODE': 'SSB', 'QSO_DATE': '20150227'}, {'TIME_ON': '0832', 'BAND': '2m', 'CALL': 'HELLO', 'MODE': 'FM', 'QSO_DATE': '20150227'}]
|
||||
print "Imported records: ", records
|
||||
print "Expected records: ", expected_records
|
||||
print("Imported records: ", records)
|
||||
print("Expected records: ", expected_records)
|
||||
assert(len(records) == 3)
|
||||
for i in range(len(expected_records)):
|
||||
assert(len(records[i].keys()) == len(expected_records[i].keys()))
|
||||
assert(len(list(records[i].keys())) == len(list(expected_records[i].keys())))
|
||||
assert(records == expected_records)
|
||||
|
||||
def test_adif_read_alphabet(self):
|
||||
|
@ -496,10 +496,10 @@ class TestADIF(unittest.TestCase):
|
|||
|
||||
records = self.adif.read("ADIF.test_read_alphabet.adi")
|
||||
expected_records = [{'CALL': 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'}]
|
||||
print "Imported records: ", records
|
||||
print "Expected records: ", expected_records
|
||||
print("Imported records: ", records)
|
||||
print("Expected records: ", expected_records)
|
||||
assert(len(records) == 1)
|
||||
assert(len(records[0].keys()) == len(expected_records[0].keys()))
|
||||
assert(len(list(records[0].keys())) == len(list(expected_records[0].keys())))
|
||||
assert(records == expected_records)
|
||||
|
||||
def test_adif_read_capitalisation(self):
|
||||
|
@ -511,10 +511,10 @@ class TestADIF(unittest.TestCase):
|
|||
|
||||
records = self.adif.read("ADIF.test_read_capitalisation.adi")
|
||||
expected_records = [{'CALL': 'TEST'}]
|
||||
print "Imported records: ", records
|
||||
print "Expected records: ", expected_records
|
||||
print("Imported records: ", records)
|
||||
print("Expected records: ", expected_records)
|
||||
assert(len(records) == 1)
|
||||
assert(len(records[0].keys()) == len(expected_records[0].keys()))
|
||||
assert(len(list(records[0].keys())) == len(list(expected_records[0].keys())))
|
||||
assert(records == expected_records)
|
||||
|
||||
def test_adif_read_header_only(self):
|
||||
|
@ -525,8 +525,8 @@ class TestADIF(unittest.TestCase):
|
|||
|
||||
records = self.adif.read("ADIF.test_read_header_only.adi")
|
||||
expected_records = []
|
||||
print "Imported records: ", records
|
||||
print "Expected records: ", expected_records
|
||||
print("Imported records: ", records)
|
||||
print("Expected records: ", expected_records)
|
||||
assert(len(records) == 0)
|
||||
assert(records == expected_records)
|
||||
|
||||
|
@ -538,10 +538,10 @@ class TestADIF(unittest.TestCase):
|
|||
|
||||
records = self.adif.read("ADIF.test_read_no_header.adi")
|
||||
expected_records = [{'TIME_ON': '1955', 'BAND': '40m', 'CALL': 'TEST', 'MODE': 'CW', 'QSO_DATE': '20130322'}]
|
||||
print "Imported records: ", records
|
||||
print "Expected records: ", expected_records
|
||||
print("Imported records: ", records)
|
||||
print("Expected records: ", expected_records)
|
||||
assert(len(records) == 1)
|
||||
assert(len(records[0].keys()) == len(expected_records[0].keys()))
|
||||
assert(len(list(records[0].keys())) == len(list(expected_records[0].keys())))
|
||||
assert(records == expected_records)
|
||||
|
||||
def test_adif_write(self):
|
||||
|
@ -552,7 +552,7 @@ class TestADIF(unittest.TestCase):
|
|||
|
||||
f = open("ADIF.test_write.adi", 'r')
|
||||
text = f.read()
|
||||
print "File 'ADIF.test_write.adi' contains the following text:", text
|
||||
print("File 'ADIF.test_write.adi' contains the following text:", text)
|
||||
assert("""
|
||||
<adif_ver:3>1.0
|
||||
<programid:5>PyQSO
|
||||
|
@ -587,13 +587,13 @@ class TestADIF(unittest.TestCase):
|
|||
c = self.connection.cursor()
|
||||
c.execute("SELECT * FROM test")
|
||||
records = c.fetchall()
|
||||
print records
|
||||
print(records)
|
||||
|
||||
self.adif.write(records, "ADIF.test_write_sqlite3_Row.adi")
|
||||
|
||||
f = open("ADIF.test_write_sqlite3_Row.adi", 'r')
|
||||
text = f.read()
|
||||
print "File 'ADIF.test_write_sqlite3_Row.adi' contains the following text:", text
|
||||
print("File 'ADIF.test_write_sqlite3_Row.adi' contains the following text:", text)
|
||||
assert("""
|
||||
<adif_ver:3>1.0
|
||||
<programid:5>PyQSO
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (C) 2013 Christian T. Jacobs.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (C) 2013 Christian T. Jacobs.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (C) 2013 Christian T. Jacobs.
|
||||
|
||||
|
@ -19,10 +19,10 @@
|
|||
|
||||
import logging
|
||||
import unittest
|
||||
import httplib
|
||||
import http.client
|
||||
from xml.dom import minidom
|
||||
|
||||
from auxiliary_dialogs import *
|
||||
from pyqso.auxiliary_dialogs import *
|
||||
|
||||
class CallsignLookupQRZ():
|
||||
""" Use qrz.com to lookup details about a particular callsign. """
|
||||
|
@ -47,7 +47,7 @@ class CallsignLookupQRZ():
|
|||
"""
|
||||
logging.debug("Connecting to the qrz.com server...")
|
||||
try:
|
||||
self.connection = httplib.HTTPConnection('xmldata.qrz.com')
|
||||
self.connection = http.client.HTTPConnection('xmldata.qrz.com')
|
||||
request = '/xml/current/?username=%s;password=%s;agent=pyqso' % (username, password)
|
||||
self.connection.request('GET', request)
|
||||
response = self.connection.getresponse()
|
||||
|
@ -172,7 +172,7 @@ class CallsignLookupHamQTH():
|
|||
|
||||
logging.debug("Connecting to the hamqth.com server...")
|
||||
try:
|
||||
self.connection = httplib.HTTPConnection('www.hamqth.com')
|
||||
self.connection = http.client.HTTPConnection('www.hamqth.com')
|
||||
request = '/xml.php?u=%s&p=%s' % (username, password)
|
||||
self.connection.request('GET', request)
|
||||
response = self.connection.getresponse()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (C) 2013 Christian T. Jacobs.
|
||||
|
||||
|
@ -158,7 +158,7 @@ class DXCluster(Gtk.VBox):
|
|||
if(self.connection):
|
||||
text = self.connection.read_very_eager()
|
||||
try:
|
||||
text = text.replace(u"\u0007", "") # Remove the BEL Unicode character from the end of the line
|
||||
text = text.replace("\u0007", "") # Remove the BEL Unicode character from the end of the line
|
||||
except UnicodeDecodeError:
|
||||
pass
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (C) 2013 Christian T. Jacobs.
|
||||
|
||||
|
|
24
pyqso/log.py
24
pyqso/log.py
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (C) 2013 Christian T. Jacobs.
|
||||
|
||||
|
@ -22,8 +22,8 @@ import logging
|
|||
import sqlite3 as sqlite
|
||||
import unittest
|
||||
|
||||
from adif import AVAILABLE_FIELD_NAMES_ORDERED
|
||||
from record_dialog import *
|
||||
from pyqso.adif import AVAILABLE_FIELD_NAMES_ORDERED
|
||||
from pyqso.record_dialog import *
|
||||
|
||||
class Log(Gtk.ListStore):
|
||||
""" A single log inside of the whole logbook. A Log object can store multiple Record objects. """
|
||||
|
@ -141,7 +141,7 @@ class Log(Gtk.ListStore):
|
|||
database_entry = []
|
||||
for t in column_names:
|
||||
column_name = str(t[1]) # 't' here is a tuple
|
||||
if( (column_name.upper() in AVAILABLE_FIELD_NAMES_ORDERED) and (column_name.upper() in fields_and_data[r].keys()) ):
|
||||
if( (column_name.upper() in AVAILABLE_FIELD_NAMES_ORDERED) and (column_name.upper() in list(fields_and_data[r].keys())) ):
|
||||
database_entry.append(fields_and_data[r][column_name.upper()])
|
||||
else:
|
||||
if(column_name != "id"): # Ignore the row index field. This is a special case since it's not in AVAILABLE_FIELD_NAMES_ORDERED.
|
||||
|
@ -152,7 +152,7 @@ class Log(Gtk.ListStore):
|
|||
liststore_entry = []
|
||||
field_names = AVAILABLE_FIELD_NAMES_ORDERED
|
||||
for i in range(0, len(field_names)):
|
||||
if(field_names[i] in fields_and_data[r].keys()):
|
||||
if(field_names[i] in list(fields_and_data[r].keys())):
|
||||
liststore_entry.append(fields_and_data[r][field_names[i]])
|
||||
else:
|
||||
liststore_entry.append("")
|
||||
|
@ -349,8 +349,8 @@ class TestLog(unittest.TestCase):
|
|||
for t in result:
|
||||
column_names_after.append(t[1].upper())
|
||||
|
||||
print "Column names before: ", column_names_before
|
||||
print "Column names after: ", column_names_after
|
||||
print("Column names before: ", column_names_before)
|
||||
print("Column names after: ", column_names_after)
|
||||
|
||||
assert(len(column_names_before) == len(self.field_names) + 1) # Added 1 here because of the "ID" column in all database tables.
|
||||
assert(len(column_names_after) == len(AVAILABLE_FIELD_NAMES_ORDERED) + 1)
|
||||
|
@ -366,7 +366,7 @@ class TestLog(unittest.TestCase):
|
|||
assert len(records) == 1
|
||||
|
||||
for field_name in self.field_names:
|
||||
print self.fields_and_data[field_name], records[0][field_name]
|
||||
print(self.fields_and_data[field_name], records[0][field_name])
|
||||
assert self.fields_and_data[field_name] == records[0][field_name]
|
||||
|
||||
def test_log_delete_record(self):
|
||||
|
@ -410,8 +410,8 @@ class TestLog(unittest.TestCase):
|
|||
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"]))
|
||||
|
||||
record = self.log.get_record_by_index(1)
|
||||
print "Contents of retrieved record: ", record
|
||||
for field_name in record.keys():
|
||||
print("Contents of retrieved record: ", record)
|
||||
for field_name in list(record.keys()):
|
||||
if(field_name.upper() == "ID"):
|
||||
continue
|
||||
else:
|
||||
|
@ -426,7 +426,7 @@ class TestLog(unittest.TestCase):
|
|||
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()
|
||||
print "Contents of all retrieved records: ", records
|
||||
print("Contents of all retrieved records: ", records)
|
||||
assert(len(records) == 2) # There should be 2 records
|
||||
for field_name in self.field_names:
|
||||
assert(records[0][field_name] == self.fields_and_data[field_name])
|
||||
|
@ -440,7 +440,7 @@ class TestLog(unittest.TestCase):
|
|||
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"]))
|
||||
|
||||
number_of_records = self.log.get_number_of_records()
|
||||
print "Number of records in the log: ", number_of_records
|
||||
print("Number of records in the log: ", number_of_records)
|
||||
assert(number_of_records == 2) # There should be 2 records
|
||||
|
||||
def test_log_get_duplicates(self):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (C) 2013 Christian T. Jacobs.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (C) 2012 Christian T. Jacobs.
|
||||
|
||||
|
@ -22,12 +22,12 @@ import logging
|
|||
import sqlite3 as sqlite
|
||||
from os.path import basename, getmtime, expanduser
|
||||
import datetime
|
||||
import ConfigParser
|
||||
import configparser
|
||||
|
||||
from adif import *
|
||||
from log import *
|
||||
from log_name_dialog import *
|
||||
from auxiliary_dialogs import *
|
||||
from pyqso.adif import *
|
||||
from pyqso.log import *
|
||||
from pyqso.log_name_dialog import *
|
||||
from pyqso.auxiliary_dialogs import *
|
||||
|
||||
class Logbook(Gtk.Notebook):
|
||||
""" A Logbook object can store multiple Log objects. """
|
||||
|
@ -498,7 +498,7 @@ class Logbook(Gtk.Notebook):
|
|||
|
||||
column.connect("clicked", self.sort_log, i+1)
|
||||
|
||||
config = ConfigParser.ConfigParser()
|
||||
config = configparser.ConfigParser()
|
||||
have_config = (config.read(expanduser('~/.pyqso.ini')) != [])
|
||||
(section, option) = ("view", AVAILABLE_FIELD_NAMES_ORDERED[i].lower())
|
||||
if(have_config and config.has_option(section, option)):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (C) 2012 Christian T. Jacobs.
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
|||
|
||||
from gi.repository import Gtk
|
||||
import logging
|
||||
import ConfigParser
|
||||
import configparser
|
||||
import os.path
|
||||
|
||||
class Menu(Gtk.MenuBar):
|
||||
|
@ -209,7 +209,7 @@ class Menu(Gtk.MenuBar):
|
|||
mitem_view.set_submenu(subm_view)
|
||||
|
||||
mitem_toolbox = Gtk.CheckMenuItem("Toolbox")
|
||||
config = ConfigParser.ConfigParser()
|
||||
config = configparser.ConfigParser()
|
||||
have_config = (config.read(os.path.expanduser('~/.pyqso.ini')) != [])
|
||||
(section, option) = ("general", "show_toolbox")
|
||||
if(have_config and config.has_option(section, option)):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (C) 2013 Christian T. Jacobs.
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
|||
|
||||
from gi.repository import Gtk
|
||||
import logging
|
||||
import ConfigParser
|
||||
import configparser
|
||||
import os.path
|
||||
import base64
|
||||
try:
|
||||
|
@ -75,31 +75,31 @@ class PreferencesDialog(Gtk.Dialog):
|
|||
records_data = self.records.get_data()
|
||||
adif_data = self.adif.get_data()
|
||||
|
||||
config = ConfigParser.ConfigParser()
|
||||
config = configparser.ConfigParser()
|
||||
|
||||
# General
|
||||
config.add_section("general")
|
||||
for key in general_data.keys():
|
||||
for key in list(general_data.keys()):
|
||||
config.set("general", key.lower(), general_data[key])
|
||||
|
||||
# View
|
||||
config.add_section("view")
|
||||
for key in view_data.keys():
|
||||
for key in list(view_data.keys()):
|
||||
config.set("view", key.lower(), view_data[key])
|
||||
|
||||
# ADIF
|
||||
config.add_section("adif")
|
||||
for key in adif_data.keys():
|
||||
for key in list(adif_data.keys()):
|
||||
config.set("adif", key.lower(), adif_data[key])
|
||||
|
||||
# Hamlib
|
||||
config.add_section("hamlib")
|
||||
for key in hamlib_data.keys():
|
||||
for key in list(hamlib_data.keys()):
|
||||
config.set("hamlib", key.lower(), hamlib_data[key])
|
||||
|
||||
# Records
|
||||
config.add_section("records")
|
||||
for key in records_data.keys():
|
||||
for key in list(records_data.keys()):
|
||||
config.set("records", key.lower(), records_data[key])
|
||||
|
||||
with open(os.path.expanduser('~/.pyqso.ini'), 'w') as f:
|
||||
|
@ -117,7 +117,7 @@ class GeneralPage(Gtk.VBox):
|
|||
|
||||
# Remember that the have_config conditional in the PyQSO class may be out-of-date the next time the user opens up the preferences dialog
|
||||
# because a configuration file may have been created after launching the application. Let's check to see if one exists again...
|
||||
config = ConfigParser.ConfigParser()
|
||||
config = configparser.ConfigParser()
|
||||
have_config = (config.read(os.path.expanduser('~/.pyqso.ini')) != [])
|
||||
|
||||
self.sources = {}
|
||||
|
@ -152,7 +152,7 @@ class ViewPage(Gtk.VBox):
|
|||
|
||||
Gtk.VBox.__init__(self, spacing=2)
|
||||
|
||||
config = ConfigParser.ConfigParser()
|
||||
config = configparser.ConfigParser()
|
||||
have_config = (config.read(os.path.expanduser('~/.pyqso.ini')) != [])
|
||||
|
||||
self.sources = {}
|
||||
|
@ -204,7 +204,7 @@ class HamlibPage(Gtk.VBox):
|
|||
|
||||
Gtk.VBox.__init__(self, spacing=2)
|
||||
|
||||
config = ConfigParser.ConfigParser()
|
||||
config = configparser.ConfigParser()
|
||||
have_config = (config.read(os.path.expanduser('~/.pyqso.ini')) != [])
|
||||
|
||||
self.sources = {}
|
||||
|
@ -288,7 +288,7 @@ class RecordsPage(Gtk.VBox):
|
|||
|
||||
# Remember that the have_config conditional in the PyQSO class may be out-of-date the next time the user opens up the preferences dialog
|
||||
# because a configuration file may have been created after launching the application. Let's check to see if one exists again...
|
||||
config = ConfigParser.ConfigParser()
|
||||
config = configparser.ConfigParser()
|
||||
have_config = (config.read(os.path.expanduser('~/.pyqso.ini')) != [])
|
||||
|
||||
self.sources = {}
|
||||
|
@ -459,7 +459,7 @@ class ADIFPage(Gtk.VBox):
|
|||
|
||||
# Remember that the have_config conditional in the PyQSO class may be out-of-date the next time the user opens up the preferences dialog
|
||||
# because a configuration file may have been created after launching the application. Let's check to see if one exists again...
|
||||
config = ConfigParser.ConfigParser()
|
||||
config = configparser.ConfigParser()
|
||||
have_config = (config.read(os.path.expanduser('~/.pyqso.ini')) != [])
|
||||
|
||||
self.sources = {}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (C) 2013 Christian T. Jacobs.
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
|||
|
||||
from gi.repository import Gtk
|
||||
import logging
|
||||
import ConfigParser
|
||||
import configparser
|
||||
from datetime import datetime
|
||||
from os.path import expanduser
|
||||
import base64
|
||||
|
@ -30,9 +30,9 @@ except ImportError:
|
|||
logging.warning("Could not import the Hamlib module!")
|
||||
have_hamlib = False
|
||||
|
||||
from adif import AVAILABLE_FIELD_NAMES_FRIENDLY, AVAILABLE_FIELD_NAMES_ORDERED, MODES, BANDS, BANDS_RANGES
|
||||
from callsign_lookup import *
|
||||
from auxiliary_dialogs import *
|
||||
from pyqso.adif import AVAILABLE_FIELD_NAMES_FRIENDLY, AVAILABLE_FIELD_NAMES_ORDERED, MODES, BANDS, BANDS_RANGES
|
||||
from pyqso.callsign_lookup import *
|
||||
from pyqso.auxiliary_dialogs import *
|
||||
|
||||
class RecordDialog(Gtk.Dialog):
|
||||
""" A dialog through which users can enter information about a QSO/record. """
|
||||
|
@ -54,7 +54,7 @@ class RecordDialog(Gtk.Dialog):
|
|||
Gtk.Dialog.__init__(self, title=title, parent=parent, flags=Gtk.DialogFlags.DESTROY_WITH_PARENT, buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OK, Gtk.ResponseType.OK))
|
||||
|
||||
# Check if a configuration file is present, since we might need it to set up the rest of the dialog.
|
||||
config = ConfigParser.ConfigParser()
|
||||
config = configparser.ConfigParser()
|
||||
have_config = (config.read(expanduser('~/.pyqso.ini')) != [])
|
||||
|
||||
## QSO DATA FRAME
|
||||
|
@ -476,7 +476,7 @@ class RecordDialog(Gtk.Dialog):
|
|||
""" Get the callsign-related data from an online database and store it in the relevant Gtk.Entry boxes, but return None. """
|
||||
|
||||
# Get the database name.
|
||||
config = ConfigParser.ConfigParser()
|
||||
config = configparser.ConfigParser()
|
||||
have_config = (config.read(expanduser('~/.pyqso.ini')) != [])
|
||||
try:
|
||||
if(have_config and config.has_option("records", "callsign_database")):
|
||||
|
@ -529,7 +529,7 @@ class RecordDialog(Gtk.Dialog):
|
|||
ignore_prefix_suffix = True
|
||||
|
||||
fields_and_data = callsign_lookup.lookup(full_callsign, ignore_prefix_suffix=ignore_prefix_suffix)
|
||||
for field_name in fields_and_data.keys():
|
||||
for field_name in list(fields_and_data.keys()):
|
||||
self.sources[field_name].set_text(fields_and_data[field_name])
|
||||
return
|
||||
|
||||
|
@ -547,7 +547,7 @@ class RecordDialog(Gtk.Dialog):
|
|||
""" Insert the current date and time. """
|
||||
|
||||
# Check if a configuration file is present.
|
||||
config = ConfigParser.ConfigParser()
|
||||
config = configparser.ConfigParser()
|
||||
have_config = (config.read(expanduser('~/.pyqso.ini')) != [])
|
||||
|
||||
# Do we want to use UTC or the computer's local time?
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (C) 2013 Christian T. Jacobs.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (C) 2013 Christian T. Jacobs.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (C) 2013 Christian T. Jacobs.
|
||||
|
||||
|
|
2
setup.py
2
setup.py
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (C) 2013 Christian T. Jacobs.
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue