Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Michal Rybka
Automatic receiver for HAB on 434 MHz band
Commits
e5b6c466
Commit
e5b6c466
authored
Apr 07, 2021
by
Martin Vítek
Browse files
Add start script
parent
e09d6095
Changes
1
Hide whitespace changes
Inline
Side-by-side
start_script.py
0 → 100755
View file @
e5b6c466
#!/usr/bin/python3
# Uses examples from: https://www.python-course.eu/tkinter_entry_widgets.php
import
tkinter
as
tk
import
os
import
sys
import
subprocess
config_name
=
"config"
# Load config file
if
os
.
path
.
exists
(
config_name
):
with
open
(
config_name
,
'r'
,
encoding
=
'utf-8'
)
as
config
:
name
=
config
.
readline
()[:
-
1
]
latitude
=
config
.
readline
()[:
-
1
]
longitude
=
config
.
readline
()[:
-
1
]
else
:
name
=
"OK1RAJ"
latitude
=
"14.416667"
longitude
=
"50.083333"
print
(
"From config:"
)
print
(
"
\t
Call sign: "
,
name
);
print
(
"
\t
Latitude: "
,
latitude
);
print
(
"
\t
Longitude: "
,
longitude
);
# Save data to config and run command
def
start_button_handler
():
name
=
e1
.
get
()
latitude
=
e2
.
get
()
longitude
=
e3
.
get
()
print
(
"From user:"
)
print
(
"
\t
Call sign: "
,
name
);
print
(
"
\t
Latitude: "
,
latitude
);
print
(
"
\t
Longitude: "
,
longitude
);
with
open
(
config_name
,
'w'
,
encoding
=
'utf-8'
)
as
config
:
config
.
write
(
name
+
'
\n
'
);
config
.
write
(
latitude
+
'
\n
'
);
config
.
write
(
longitude
+
'
\n
'
);
subprocess
.
Popen
([
"./habdecWebsocketServer"
,
"--device"
,
"0"
,
"--sampling_rate"
,
"2.024e6"
,
"--rtty"
,
"300"
,
"7"
,
"2"
,
"-print"
,
"1"
,
"--freq"
,
"434.000"
,
"--gain"
,
"35"
,
"--biast"
,
"0"
,
"--afc"
,
"0"
,
"--station"
,
name
,
"--latlon"
,
latitude
,
longitude
])
sys
.
exit
()
# Create window
master
=
tk
.
Tk
()
master
.
title
(
'OK1RAJ Automatic Receiver'
)
# Fields labels
tk
.
Label
(
master
,
text
=
"Značka"
).
grid
(
row
=
0
,
column
=
0
,
pady
=
2
)
tk
.
Label
(
master
,
text
=
"Zeměpisná šířka"
).
grid
(
row
=
1
,
column
=
0
,
pady
=
2
)
tk
.
Label
(
master
,
text
=
"Zeměpisná délka"
).
grid
(
row
=
2
,
column
=
0
,
pady
=
2
)
# Input fields
e1
=
tk
.
Entry
(
master
)
e2
=
tk
.
Entry
(
master
)
e3
=
tk
.
Entry
(
master
)
e1
.
grid
(
row
=
0
,
column
=
1
)
e2
.
grid
(
row
=
1
,
column
=
1
)
e3
.
grid
(
row
=
2
,
column
=
1
)
e1
.
insert
(
10
,
name
);
e2
.
insert
(
10
,
latitude
);
e3
.
insert
(
10
,
longitude
);
# Button
tk
.
Button
(
master
,
text
=
'Start'
,
command
=
start_button_handler
).
grid
(
row
=
4
,
column
=
1
,
sticky
=
tk
.
W
,
pady
=
10
)
master
.
mainloop
()
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment