Prep for pip packaging

- Moved files into project folder named "NanoVNASaver"
 - Added requirements
pull/8/head
Psynosaur 2019-09-04 18:12:38 +02:00
rodzic cdfab82a44
commit 396a4c9816
13 zmienionych plików z 102 dodań i 23 usunięć

Wyświetl plik

@ -13,6 +13,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import collections
from PyQt5 import QtWidgets
from typing import List
@ -25,7 +26,7 @@ class CalibrationWindow(QtWidgets.QWidget):
def __init__(self, app):
super().__init__()
from NanoVNASaver import NanoVNASaver
from .NanoVNASaver import NanoVNASaver
self.app: NanoVNASaver = app

Wyświetl plik

@ -18,7 +18,7 @@ from typing import List
from PyQt5 import QtWidgets, QtGui, QtCore
from Marker import Marker
from .Marker import Marker
Datapoint = collections.namedtuple('Datapoint', 'freq re im')

Wyświetl plik

@ -32,8 +32,8 @@ from typing import List
from PyQt5 import QtWidgets, QtGui, QtCore
from Chart import Chart
from Marker import Marker
from .Chart import Chart
from .Marker import Marker
Datapoint = collections.namedtuple('Datapoint', 'freq re im')

Wyświetl plik

@ -50,7 +50,7 @@ class Marker(QtCore.QObject):
self.layout.addWidget(self.btnColorPicker)
def setFrequency(self, frequency):
from NanoVNASaver import NanoVNASaver
from .NanoVNASaver import NanoVNASaver
f = NanoVNASaver.parseFrequency(frequency)
if f > 0:
self.frequency = f

Wyświetl plik

@ -24,13 +24,13 @@ import serial
from PyQt5 import QtWidgets, QtCore, QtGui
from serial.tools import list_ports
import Chart
from Calibration import CalibrationWindow, Calibration
from Marker import Marker
from SmithChart import SmithChart
from SweepWorker import SweepWorker
from LogMagChart import LogMagChart
from Touchstone import Touchstone
from .Chart import Chart
from .Calibration import CalibrationWindow, Calibration
from .Marker import Marker
from .SmithChart import SmithChart
from .SweepWorker import SweepWorker
from .LogMagChart import LogMagChart
from .Touchstone import Touchstone
Datapoint = collections.namedtuple('Datapoint', 'freq re im')

Wyświetl plik

@ -18,8 +18,8 @@ from typing import List
from PyQt5 import QtWidgets, QtGui, QtCore
from Chart import Chart
from Marker import Marker
from .Chart import Chart
from .Marker import Marker
Datapoint = collections.namedtuple('Datapoint', 'freq re im')

Wyświetl plik

@ -43,6 +43,7 @@ class SweepWorker(QtCore.QRunnable):
@pyqtSlot()
def run(self):
global obj
self.percentage = 0
if not self.app.serial.is_open:
return
@ -55,9 +56,9 @@ class SweepWorker(QtCore.QRunnable):
sweepFrom = 1000000
sweepTo = 800000000
else:
from NanoVNASaver import NanoVNASaver
sweepFrom = NanoVNASaver.parseFrequency(self.app.sweepStartInput.text())
sweepTo = NanoVNASaver.parseFrequency(self.app.sweepEndInput.text())
from NanoVNASaver import NanoVNASaver as obj
sweepFrom = obj.NanoVNASaver.parseFrequency(self.app.sweepStartInput.text())
sweepTo = obj.NanoVNASaver.parseFrequency(self.app.sweepEndInput.text())
if sweepFrom < 0 or sweepTo < 0:
print("Can't sweep from " + self.app.sweepStartInput.text() + " to " + self.app.sweepEndInput.text())
self.signals.finished.emit()
@ -85,7 +86,7 @@ class SweepWorker(QtCore.QRunnable):
self.saveData(frequencies, values, values12)
# Reset the device to show the full range
self.app.setSweep(NanoVNASaver.parseFrequency(self.app.sweepStartInput.text()), NanoVNASaver.parseFrequency(self.app.sweepEndInput.text()))
self.app.setSweep(obj.NanoVNASaver.parseFrequency(self.app.sweepStartInput.text()), obj.NanoVNASaver.parseFrequency(self.app.sweepEndInput.text()))
else:
self.app.setSweep(sweepFrom, sweepTo)
sleep(0.8)

Wyświetl plik

@ -15,12 +15,13 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import collections
from typing import List
Datapoint = collections.namedtuple('Datapoint', 'freq re im')
class Touchstone:
s11data : List[Datapoint] = []
s21data : List[Datapoint] = []
s11data: List[Datapoint] = []
s21data: List[Datapoint] = []
filename = ""
@ -79,4 +80,4 @@ class Touchstone:
return
def setFilename(self, filename):
self.filename = filename
self.filename = filename

Wyświetl plik

Wyświetl plik

@ -18,11 +18,12 @@
from PyQt5 import QtWidgets
from NanoVNASaver import NanoVNASaver
from .NanoVNASaver import NanoVNASaver
version = "0.0.4"
if __name__ == '__main__':
def main():
print("NanoVNASaver " + version)
print("Copyright (C) 2019 Rune B. Broberg")
print("This program comes with ABSOLUTELY NO WARRANTY")
@ -34,3 +35,7 @@ if __name__ == '__main__':
window = NanoVNASaver()
window.show()
app.exec_()
if __name__ == '__main__':
main()

Wyświetl plik

@ -45,6 +45,20 @@ In order to run this app in Linux environment, you'll need the following package
python3 nanovna-saver.py
```
### Installation and Use with pip
1. Clone repo and cd into the directory
- `git clone https://github.com/mihtjel/nanovna-saver`
- `cd nanovna-saver`
2. Run the pip installation
`pip install .`
2. Once completed run with the following command
`NanoVNASaver`
### Using the software
Connect your NanoVNA to a serial port, and enter this serial port in the serial port box. Click "Open serial" to connect.

2
setup.cfg 100644
Wyświetl plik

@ -0,0 +1,2 @@
[metadata]
description-file = README.md

55
setup.py 100644
Wyświetl plik

@ -0,0 +1,55 @@
# NanoVNASaver - a python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019. Rune B. Broberg
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import sys
if sys.version_info < (3, 7):
print("You need at least Python 3.7 for this application!")
if sys.version_info[0] < 3:
print("try running with python3 {}".format(" ".join(sys.argv)))
sys.exit(1)
try:
from setuptools import setup, find_packages
except ImportError:
print("Could not find setuptools")
print("Try installing them with pip install setuptools")
sys.exit(1)
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name='NanoVNASaver',
url='https://github.com/mihtjel/nanovna-saver',
version='0.0.4',
author='Rune B. Broberg',
author_email='',
packages=find_packages(),
long_description=long_description,
long_description_content_type="text/markdown",
license='LICENSE.txt',
entry_points={
'console_scripts': [
'NanoVNASaver = NanoVNASaver.__main__:main'
],
},
install_requires=[
'pyserial',
'PyQt5',
'numpy',
],
)