kopia lustrzana https://github.com/NanoVNA-Saver/nanovna-saver
option --auto-connect, connect automatically if one device detected (#645)
* option --auto-connect, connect automatically to the 1st detected device * autoconnect only if there is exactly one device Signed-off-by: Martin <Ho-Ro@users.noreply.github.com>pull/653/head
rodzic
a8ffbc3aee
commit
1f233819d2
|
@ -473,6 +473,10 @@ class NanoVNASaver(QWidget):
|
|||
|
||||
logger.debug("Finished building interface")
|
||||
|
||||
def auto_connect( self ): # connect if there is exactly one detected serial device
|
||||
if self.serial_control.inp_port.count() == 1:
|
||||
self.serial_control.connect_device()
|
||||
|
||||
def _sweep_control(self, start: bool = True) -> None:
|
||||
self.sweep_control.progress_bar.setValue(0 if start else 100)
|
||||
self.sweep_control.btn_start.setDisabled(start)
|
||||
|
|
|
@ -46,6 +46,9 @@ def main():
|
|||
parser.add_argument(
|
||||
"-D", "--debug-file", help="File to write debug logging output to"
|
||||
)
|
||||
parser.add_argument(
|
||||
"-a", "--auto-connect", action="store_true", help="Auto connect if one device detected"
|
||||
)
|
||||
parser.add_argument(
|
||||
"-f",
|
||||
"--file",
|
||||
|
@ -92,6 +95,8 @@ def main():
|
|||
window = NanoVNASaver()
|
||||
window.show()
|
||||
|
||||
if args.auto_connect:
|
||||
window.auto_connect()
|
||||
if args.file:
|
||||
t = Touchstone(args.file)
|
||||
t.load()
|
||||
|
|
Ładowanie…
Reference in New Issue