From ec53e627dbc84f659f99dffab4281c40c2d6eee5 Mon Sep 17 00:00:00 2001 From: chrin Date: Sun, 22 Jun 2025 14:06:24 +0200 Subject: [PATCH] v1.8.2 --- hush.sh | 2 +- hush_g1.sh | 2 +- hush_g2.sh | 2 +- hush_g3.sh | 2 +- hush_o2.sh | 2 +- hush_pif.sh | 2 +- src/gui.py | 46 +++++++++++++++++++++++++++++++++++----------- src/t.py | 24 ++++++++++++++++++++++++ 8 files changed, 65 insertions(+), 17 deletions(-) create mode 100644 src/t.py diff --git a/hush.sh b/hush.sh index 4aa69cf..23cf661 100755 --- a/hush.sh +++ b/hush.sh @@ -1,5 +1,5 @@ #!/bin/bash -cd /proscan/bd/applications/hush/hla/1.8.1 +cd /proscan/bd/applications/hush/hla/1.8.2 # For use if script is sourced rather than executed appNameDefault="hush.sh" diff --git a/hush_g1.sh b/hush_g1.sh index 6b0429f..5488f0b 100755 --- a/hush_g1.sh +++ b/hush_g1.sh @@ -1,5 +1,5 @@ #!/bin/bash -cd /proscan/bd/applications/hush/hla/1.8.1 +cd /proscan/bd/applications/hush/hla/1.8.2 # For use if script is sourced rather than executed appNameDefault="hush_g1.sh" diff --git a/hush_g2.sh b/hush_g2.sh index 3537760..5d6c433 100755 --- a/hush_g2.sh +++ b/hush_g2.sh @@ -1,5 +1,5 @@ #!/bin/bash -cd /proscan/bd/applications/hush/hla/1.8.1 +cd /proscan/bd/applications/hush/hla/1.8.2 # For use if script is sourced rather than executed appNameDefault="hush_g2.sh" diff --git a/hush_g3.sh b/hush_g3.sh index bea22e3..4ea845a 100755 --- a/hush_g3.sh +++ b/hush_g3.sh @@ -1,5 +1,5 @@ #!/bin/bash -cd /proscan/bd/applications/hush/hla/1.8.1 +cd /proscan/bd/applications/hush/hla/1.8.2 # For use if script is sourced rather than executed appNameDefault="hush_g3.sh" diff --git a/hush_o2.sh b/hush_o2.sh index adc1b58..36cdee4 100755 --- a/hush_o2.sh +++ b/hush_o2.sh @@ -1,5 +1,5 @@ #!/bin/bash -cd /proscan/bd/applications/hush/hla/1.8.1 +cd /proscan/bd/applications/hush/hla/1.8.2 # For use if script is sourced rather than executed appNameDefault="hush_o2.sh" diff --git a/hush_pif.sh b/hush_pif.sh index d1a3e4c..cd3267b 100755 --- a/hush_pif.sh +++ b/hush_pif.sh @@ -1,5 +1,5 @@ #!/bin/bash -cd /proscan/bd/applications/hush/hla/1.8.1 +cd /proscan/bd/applications/hush/hla/1.8.2 # For use if script is sourced rather than executed appNameDefault="hush_pif.sh" diff --git a/src/gui.py b/src/gui.py index a044c5d..64b11d7 100644 --- a/src/gui.py +++ b/src/gui.py @@ -419,7 +419,7 @@ class AppGui(QWidget): #for sect in self.simple_sector_list: # self.is_sector_standby(sect) - + self.timer_awake = QTimer() self.timer_awake.timeout.connect(self.update_awake_alarm_message) self.timer_awake.start(10000) @@ -428,6 +428,19 @@ class AppGui(QWidget): def update_awake_alarm_message(self): + #No alarm in day shift + def in_operation_range(): + current_time = datetime.now().time() + #given_time_start = datetime.strptime("07:00AM", "I:%M%p").time() + #given_time_stop = datetime.strptime("05:30PM", "I:%M%p").time() + given_time_start = datetime.strptime("07:00", "%H:%M").time() + given_time_stop = datetime.strptime("17:00", "%H:%M").time() + + if given_time_start <= current_time <= given_time_stop: + return True + else: + return False + def what_alarm(sect, plot_only=False): alarm_val = 0 pvdata = self.cafe.getPVCache( @@ -447,8 +460,12 @@ class AppGui(QWidget): datet = date2 if date1 < date2 else date1 self.simple_tdiff[idx] = self.time_difference(datet) + + if in_operation_range(): + self.simple_alarm[idx].setStyleSheet(self.no_alarm_sss) + alarm_val = 0 - if self.simple_tdiff[idx][0] > int( + elif self.simple_tdiff[idx][0] > int( self.input_parameters['alarmMajor']): self.simple_alarm[idx].setStyleSheet(self.alarm_major_sss) alarm_val = 2 @@ -484,18 +501,21 @@ class AppGui(QWidget): self.simple_alarm[idx].setText(' Active ') alarm_val = 0 - #elif 'SH' in sect: - # continue - + else: alarm_val = what_alarm(sect) - + + #if in_operation_range(): + # alarm_val = 0 + # self.simple_alarm[idx].setStyleSheet(self.no_alarm_sss) + pv = self.settings.data[sect]['alarm'] if not self.input_parameters["simulation"]: - stat = self.cafe.set(pv, alarm_val) - if stat != self.cyca.ECAFE_NOWTACCESS: - self.check_status(_pymodule, 'set', pv, stat, _line()) - #print(pv, sect, alarm_val) + if 'Controlroom' in self.assigned_master: + stat = self.cafe.set(pv, alarm_val) + if stat != self.cyca.ECAFE_NOWTACCESS: + self.check_status(_pymodule, 'set', pv, stat, _line()) + #print(pv, sect, alarm_val) date1 = self.simple_t0[idx] @@ -537,8 +557,12 @@ class AppGui(QWidget): self.simple_alarm[idx].setText(self.alarm_text + str( int(self.simple_tdiff[idx][0])) + ' min ') - + + alarm_val = what_alarm('SH', plot_only=True) + #if in_operation_range(): + # alarm_val = 0 + pv = self.settings.data['SH']['alarm'] if not self.input_parameters["simulation"]: stat = self.cafe.set(pv, alarm_val) diff --git a/src/t.py b/src/t.py new file mode 100644 index 0000000..80c3c6a --- /dev/null +++ b/src/t.py @@ -0,0 +1,24 @@ + +from datetime import datetime + +def in_range(): + current_time = datetime.now().time() + #given_time_start = datetime.strptime("07:00AM", "I:%M%p").time() + #given_time_stop = datetime.strptime("05:30PM", "I:%M%p").time() + given_time_start = datetime.strptime("07:00", "%H:%M").time() + given_time_stop = datetime.strptime("17:00", "%H:%M").time() + + if given_time_start <= current_time <= given_time_stop: + print("in range") + return True + else: + print(current_time) + print(given_time_stop) + + + +if in_range(): + print("in range") +else: + print("not in range") +