mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Merge pull request #647 from DJ2LS/rigctld-win
Internal rigctld tweaks for windows users
This commit is contained in:
commit
f437b2a01b
3 changed files with 11 additions and 3 deletions
|
@ -21,7 +21,7 @@ ip = 127.0.0.1
|
||||||
port = 4532
|
port = 4532
|
||||||
path =
|
path =
|
||||||
command =
|
command =
|
||||||
arguments = --cenas
|
arguments =
|
||||||
|
|
||||||
[RADIO]
|
[RADIO]
|
||||||
control = disabled
|
control = disabled
|
||||||
|
|
|
@ -18,6 +18,7 @@ from pathlib import Path
|
||||||
import platform
|
import platform
|
||||||
import subprocess
|
import subprocess
|
||||||
import psutil
|
import psutil
|
||||||
|
import glob
|
||||||
|
|
||||||
|
|
||||||
log = structlog.get_logger("helpers")
|
log = structlog.get_logger("helpers")
|
||||||
|
@ -738,8 +739,9 @@ def find_binary_path(binary_name="rigctld", search_system_wide=False):
|
||||||
if platform.system() != 'Windows':
|
if platform.system() != 'Windows':
|
||||||
system_paths.extend(['/usr/bin', '/usr/local/bin', '/bin'])
|
system_paths.extend(['/usr/bin', '/usr/local/bin', '/bin'])
|
||||||
else:
|
else:
|
||||||
system_paths.extend(['C:\\Windows\\System32', 'C:\\Windows'])
|
system_paths.extend(glob.glob("C:\\Program Files\\Hamlib*\\bin"))
|
||||||
|
system_paths.extend(glob.glob("C:\\Program Files (x86)\\Hamlib*\\bin"))
|
||||||
|
|
||||||
for path in system_paths:
|
for path in system_paths:
|
||||||
potential_path = os.path.join(path, binary_name)
|
potential_path = os.path.join(path, binary_name)
|
||||||
if os.path.isfile(potential_path):
|
if os.path.isfile(potential_path):
|
||||||
|
|
|
@ -221,6 +221,7 @@ class radio:
|
||||||
|
|
||||||
def format_rigctld_args(self):
|
def format_rigctld_args(self):
|
||||||
config = self.config['RADIO'] # Accessing the 'RADIO' section of the INI file
|
config = self.config['RADIO'] # Accessing the 'RADIO' section of the INI file
|
||||||
|
config_rigctld = self.config['RIGCTLD'] # Accessing the 'RIGCTLD' section of the INI file for custom args
|
||||||
args = []
|
args = []
|
||||||
|
|
||||||
# Helper function to check if the value should be ignored
|
# Helper function to check if the value should be ignored
|
||||||
|
@ -251,5 +252,10 @@ class radio:
|
||||||
if not should_ignore(config.get('stop_bits', "0")):
|
if not should_ignore(config.get('stop_bits', "0")):
|
||||||
args += ['--set-conf', f'stop_bits={config["stop_bits"]}']
|
args += ['--set-conf', f'stop_bits={config["stop_bits"]}']
|
||||||
|
|
||||||
|
# Handle custom arguments for rigctld
|
||||||
|
# Custom args are split via ' ' so python doesn't add extranaeous quotes on windows
|
||||||
|
args += config_rigctld["arguments"].split(" ")
|
||||||
|
#print("Hamlib args ==>" + str(args))
|
||||||
|
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue