Skip to content

Commit

Permalink
externalized path to icons
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusmueller committed Aug 25, 2017
1 parent f764a8f commit 94db7bf
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
18 changes: 7 additions & 11 deletions apps/DABstep
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import time
import dab.user_frontend as user_frontend
import dab.usrp_dab_rx as usrp_dab_rx
import dab.usrp_dab_tx as usrp_dab_tx
import dab.constants as constants
import math
import json
import sip
Expand All @@ -25,12 +26,7 @@ class DABstep(QtGui.QMainWindow, user_frontend.Ui_MainWindow):
self.screen_width = resolution_width
self.screen_height = resolution_height
# show logo if it exists
post_path = os.path.join('share', 'gr-dab')
if os.environ.get('PYBOMBS_PREFIX'):
path = os.path.join(os.environ.get('PYBOMBS_PREFIX'), post_path)
else:
path = os.path.join('/usr', 'local', post_path)
self.path = path
self.path = constants.icon_path
self.label_logo.setText("<img src=\"" + str(self.path) + "/DAB_logo.png\">")

# tab definitions
Expand Down Expand Up @@ -618,22 +614,22 @@ class DABstep(QtGui.QMainWindow, user_frontend.Ui_MainWindow):
# write msc status
if not self.my_receiver.get_firecode_passed():
self.label_firecode.setText(self.label_firecode.text() + "<font color=\"red\">X </font>")
self.led_msc.setText("<img src=\"led_red.png\">")
self.led_msc.setText("<img src=\""+ self.path+ "/led_red.png\">")
else:
errors = self.my_receiver.get_corrected_errors()
if errors < 10:
self.label_firecode.setText(self.label_firecode.text() + "<font color=\"green\">" + str(errors) + " < /font>")
self.led_msc.setText("<img src=\"led_green.png\">")
self.led_msc.setText("<img src=\""+ self.path+ "/led_green.png\">")
else:
self.label_firecode.setText(self.label_firecode.text() + "<font color=\"orange\">" + str(errors) + "</font>")
self.led_msc.setText("<img src=\"led_orange.png\">")
self.led_msc.setText("<img src=\""+ self.path+ "/led_orange.png\">")
# write fic status
if self.my_receiver.get_crc_passed():
self.label_fic.setText(self.label_fic.text() + "<font color=\"green\">0 </font>")
self.led_fic.setText("<img src=\"led_green.png\">")
self.led_fic.setText("<img src=\""+ self.path+ "/led_green.png\">")
else:
self.label_fic.setText(self.label_fic.text() + "<font color=\"red\">X </font>")
self.led_fic.setText("<img src=\"led_red.png\">")
self.led_fic.setText("<img src=\""+ self.path+ "/led_red.png\">")
self.label_fic.setWordWrap(True)
self.label_firecode.setWordWrap(True)
self.content_count += 1
Expand Down
15 changes: 14 additions & 1 deletion python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,19 @@
include(GrPython)
if(NOT PYTHONINTERP_FOUND)
return()
endif()
endif()


########################################################################
# Insert ICON PATH macro Insert ICON PATH macro into constants.py
########################################################################
set(GR_PKG_DAB_DATA_DIR ${GR_PKG_DATA_DIR})
set(GR_DAB_ICON_PATH ${CMAKE_INSTALL_PREFIX}/${GR_PKG_DATA_DIR})
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/constants.py.in
${CMAKE_CURRENT_BINARY_DIR}/constants.py
ESCAPE_QUOTES
@ONLY)

########################################################################
# Install python sources
Expand All @@ -41,6 +53,7 @@ GR_PYTHON_INSTALL(
fic_encode.py
msc_encode.py
transmitter_c.py
${CMAKE_CURRENT_BINARY_DIR}/constants.py
dabplus_audio_decoder_ff.py DESTINATION ${GR_PYTHON_DIR}/dab
)

Expand Down
1 change: 1 addition & 0 deletions python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@
from msc_encode import msc_encode
from transmitter_c import transmitter_c
from dabplus_audio_decoder_ff import dabplus_audio_decoder_ff
import constants
#
1 change: 1 addition & 0 deletions python/constants.py.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
image_path = "@GR_DAB_ICON_PATH@"

1 comment on commit 94db7bf

@primercuervo
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@primercuervo likes this commit!

Please sign in to comment.