Skip to content

Commit

Permalink
the path was fully changed, now every icon is properly working and shown
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscoSoler committed Jan 11, 2018
1 parent 9dac223 commit 669d5e3
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init_ui(self):
self.__rem_clutter.clicked.connect(self.__remove_clutter)

external_clutter = QtWidgets.QPushButton('', self)
self._add_icon_to_button(external_clutter, 'gui/icons/browse.png')
self._add_icon_to_button(external_clutter, os.path.join(self._icons_path, common_gui.Icons.BROWSE.value))
external_clutter.setCheckable(True)
external_clutter.setMaximumWidth(55)
external_clutter.clicked.connect(partial(self.__select_external_clutter, ext_clutter_label, ext_clutter_text))
Expand Down
15 changes: 15 additions & 0 deletions radarSignalAnalyzer/radarSignalAnalyzer/gui/common_gui.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from PyQt5 import QtWidgets
from PyQt5 import QtGui
from PyQt5 import QtCore
import os

import enum


def HLine():
Expand All @@ -17,6 +20,17 @@ def VLine():
return toto


class Icons(enum.Enum):
PLAY = 'play.png'
PAUSE = 'pause.png'
STOP = 'stop.png'
REWIND = 'rewind.png'
AREWIND = 'autoRewind.png'
BROWSE = 'browse.png'
INCVOL = 'increaseVolume.png'
DECVOL = 'decreaseVolume.png'


class CommonGUI():

def __init__(self):
Expand All @@ -25,6 +39,7 @@ def __init__(self):
self.__freq_max = 800
self._controller = None
self._running = False
self._icons_path = os.path.join(os.path.dirname(__file__), 'icons')

def _add_icon_to_button(self, button, icon_path):
button.setIcon(QtGui.QIcon(icon_path))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@ def __init_ui(self):
real_time.clicked.connect(self.__select_real_time_mode)

self.__browse_or_stop = QtWidgets.QPushButton('', self)
self._add_icon_to_button(self.__browse_or_stop, 'gui/icons/browse.png')
self._add_icon_to_button(self.__browse_or_stop, os.path.join(self._icons_path, common_gui.Icons.BROWSE.value))
self.__browse_or_stop.setCheckable(True)
self.__browse_or_stop.clicked.connect(self.__browse_or_stop_signal)

rewind_audio = QtWidgets.QPushButton('', self)
self._add_icon_to_button(rewind_audio, 'gui/icons/rewind.png')
self._add_icon_to_button(rewind_audio, os.path.join(self._icons_path, common_gui.Icons.REWIND.value))
rewind_audio.clicked.connect(self._controller.rewind_audio)

self.__play = QtWidgets.QPushButton('', self)
self._add_icon_to_button(self.__play, 'gui/icons/play.png')
self._add_icon_to_button(self.__play, os.path.join(self._icons_path, common_gui.Icons.PLAY.value))
self.__play.setCheckable(True)
self.__play.clicked.connect(self.__play_audio)

auto_rewind = QtWidgets.QPushButton('', self)
self._add_icon_to_button(auto_rewind, 'gui/icons/autoRewind.png')
self._add_icon_to_button(auto_rewind, os.path.join(self._icons_path, common_gui.Icons.AREWIND.value))
auto_rewind.setCheckable(True)
auto_rewind.clicked[bool].connect(self.__loop)

Expand Down Expand Up @@ -77,10 +77,10 @@ def __play_audio(self, pressed):
return

if pressed:
self._add_icon_to_button(source, 'gui/icons/pause.png')
self._add_icon_to_button(source, os.path.join(self._icons_path, common_gui.Icons.PAUSE.value))
self.pause_execution.emit(False)
else:
self._add_icon_to_button(source, 'gui/icons/play.png')
self._add_icon_to_button(source, os.path.join(self._icons_path, common_gui.Icons.PLAY.value))
self.pause_execution.emit(True)

def __loop(self, pressed):
Expand All @@ -92,22 +92,22 @@ def __browse_or_stop_signal(self, pressed):
if not file_name:
self.__browse_or_stop.setChecked(False)
else:
self._add_icon_to_button(self.__browse_or_stop, 'gui/icons/stop.png')
self._add_icon_to_button(self.__browse_or_stop, os.path.join(self._icons_path, common_gui.Icons.STOP.value))
self._controller.use_external_signal(file_name)
self.__audio_label.setText(self.__audio_label_text + os.path.basename(file_name))
self.start_running.emit()
self.pause_execution.emit(False)

self._add_icon_to_button(self.__play, 'gui/icons/pause.png')
self._add_icon_to_button(self.__play, os.path.join(self._icons_path, common_gui.Icons.PAUSE.value))
self.__play.setChecked(True)

else:
self._add_icon_to_button(self.__browse_or_stop, 'gui/icons/browse.png')
self._add_icon_to_button(self.__browse_or_stop, os.path.join(self._icons_path, common_gui.Icons.BROWSE.value))
self.__audio_label.setText(self.__audio_label_text)
self.stop_running.emit()
self.pause_execution.emit(False)

self._add_icon_to_button(self.__play, 'gui/icons/play.png')
self._add_icon_to_button(self.__play, os.path.join(self._icons_path, common_gui.Icons.PLAY.value))
self.__play.setChecked(False)

def __select_real_time_mode(self, pressed):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from PyQt5 import QtWidgets
from PyQt5 import QtGui
from functools import partial
import os

import radarSignalAnalyzer.gui.common_gui as common_gui

Expand Down Expand Up @@ -28,11 +29,11 @@ def __init_ui(self):
reset_volume.clicked.connect(partial(self.__reset_volume, volume_textbox))

increase_volume = QtWidgets.QPushButton('', self)
self._add_icon_to_button(increase_volume, 'gui/icons/increaseVolume.png')
self._add_icon_to_button(increase_volume, os.path.join(self._icons_path, common_gui.Icons.INCVOL.value))
increase_volume.clicked.connect(self.__increase_volume)

decrease_volume = QtWidgets.QPushButton('', self)
self._add_icon_to_button(decrease_volume, 'gui/icons/decreaseVolume.png')
self._add_icon_to_button(decrease_volume, os.path.join(self._icons_path, common_gui.Icons.DECVOL.value))
decrease_volume.clicked.connect(self.__decrease_volume)

intermediate_layout = QtWidgets.QHBoxLayout()
Expand Down

0 comments on commit 669d5e3

Please sign in to comment.