Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
su
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dmeiss2s
su
Commits
ebc2ceef
Commit
ebc2ceef
authored
9 years ago
by
Daniel Meißner
Committed by
Daniel Meißner
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
gui: added logic to extract hardware device selection
parent
aa05233e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/gui/gui.py
+48
-7
48 additions, 7 deletions
lib/gui/gui.py
with
48 additions
and
7 deletions
lib/gui/gui.py
+
48
−
7
View file @
ebc2ceef
...
...
@@ -4,6 +4,7 @@ import sys
import
os
import
logging
import
datetime
import
re
from
PyQt5
import
QtCore
,
QtGui
,
QtWidgets
,
uic
...
...
@@ -35,11 +36,8 @@ class SuGui(QtWidgets.QMainWindow):
"""
Start button action in main window.
"""
if
len
(
self
.
lineEdit_dump_file
.
text
())
==
0
:
QtWidgets
.
QMessageBox
.
about
(
self
,
"
Dumpfile path missing…
"
,
\
"
Please insert dump file path.
"
)
else
:
pass
if
self
.
_check_dependencies_before_start_capture
():
print
self
.
_extract_selected_hardware_device
()
def
stop_button
(
self
):
"""
...
...
@@ -60,8 +58,8 @@ class SuGui(QtWidgets.QMainWindow):
"""
self
.
comboBox_hardware
.
clear
()
for
device
in
Hardware
().
get_connected_supported_devices
():
text
=
device
[
'
id
'
]
+
"
:
"
+
device
[
'
name
'
]
self
.
comboBox_hardware
.
insert
Item
(
0
,
self
.
tr
(
text
))
text
=
device
[
'
name
'
]
+
"
(
"
+
device
[
'
id
'
]
+
"
)
"
self
.
comboBox_hardware
.
add
Item
(
self
.
tr
(
text
))
def
_get_default_dump_file_path
(
self
):
"""
...
...
@@ -75,3 +73,46 @@ class SuGui(QtWidgets.QMainWindow):
path
=
os
.
path
.
expanduser
(
"
~
"
)
+
"
/su/dump_file-
"
+
dt
+
"
.iq
"
return
path
def
_extract_selected_hardware_device
(
self
):
"""
Extract device key from combo box.
"""
device_id
=
re
.
search
(
r
"
\w{4}:\w{4}
"
,
self
.
comboBox_hardware
.
\
currentText
()).
group
()
device_key
=
''
for
key
,
value
in
Hardware
().
SUPPORTED_HARDWARE
.
items
():
if
value
==
device_id
:
device_key
=
key
return
device_key
def
_check_dependencies_before_start_capture
(
self
):
"""
Private method to check needed dependencies before starting capturing
data. The following states needs to be passed:
1. A dump file path need to be befined
2. Supported RF hardware need to be connected
3. RF hardware need to be selected
It returns True or False.
"""
if
len
(
self
.
lineEdit_dump_file
.
text
())
==
0
:
QtWidgets
.
QMessageBox
.
about
(
self
,
"
Dumpfile path missing…
"
,
\
"
Please add dump file path.
"
)
return
False
elif
len
(
Hardware
().
get_connected_supported_devices
())
==
0
:
QtWidgets
.
QMessageBox
.
about
(
self
,
"
No supported RF hardware
"
\
"
connected…
"
,
\
"
Please connect RF hardware.
"
)
self
.
refresh_hw_button
()
return
False
elif
len
(
self
.
comboBox_hardware
.
currentText
())
==
0
:
QtWidgets
.
QMessageBox
.
about
(
self
,
"
No supported RF hardware
"
\
"
selected…
"
,
\
"
Select RF hardware.
"
)
self
.
refresh_hw_button
()
return
False
else
:
return
True
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment