Add 'clicked' status to url_button

This commit is contained in:
alessandro90
2018-10-06 15:18:41 +02:00
parent 85b9446086
commit d543a8d9e4

View File

@@ -44,6 +44,8 @@ class MyApp(QMainWindow, Ui_MainWindow):
self.undefined_freq = False self.undefined_freq = False
self.undefined_band = False self.undefined_band = False
self.signal_names = [] self.signal_names = []
UrlColors = namedtuple("UrlColors", ["inactive", "active", "clicked"])
self.url_button.colors = UrlColors("#898989", "#4c75ff", "#942ccc")
self.category_labels = [self.cat_mil, self.category_labels = [self.cat_mil,
self.cat_rad, self.cat_rad,
self.cat_active, self.cat_active,
@@ -169,7 +171,10 @@ class MyApp(QMainWindow, Ui_MainWindow):
self.name_lab.setText(words) self.name_lab.setText(words)
current_signal = self.db.loc[self.current_signal_name] current_signal = self.db.loc[self.current_signal_name]
self.url_button.setEnabled(True) self.url_button.setEnabled(True)
self.url_button.setStyleSheet("color: #4c75ff;") if not current_signal.at["url_clicked"]:
self.url_button.setStyleSheet(f"color: {self.url_button.colors.active};")
else:
self.url_button.setStyleSheet(f"color: {self.url_button.colors.clicked};")
category_code = current_signal.at["category_code"] category_code = current_signal.at["category_code"]
self.find_if_undefined(current_signal) self.find_if_undefined(current_signal)
if not self.undefined_freq: if not self.undefined_freq:
@@ -201,7 +206,7 @@ class MyApp(QMainWindow, Ui_MainWindow):
self.audio_widget.set_audio_player(self.current_signal_name) self.audio_widget.set_audio_player(self.current_signal_name)
else: else:
self.url_button.setEnabled(False) self.url_button.setEnabled(False)
self.url_button.setStyleSheet("color: #898989;") self.url_button.setStyleSheet(f"color: {self.url_button.colors.clicked};")
self.current_signal_name = '' self.current_signal_name = ''
for lab in self.property_labels: for lab in self.property_labels:
lab.setText("N/A") lab.setText("N/A")