-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgui_utils.py
70 lines (50 loc) · 2.16 KB
/
gui_utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import *
from PyQt5.QtWidgets import QApplication, QDialog, QTableWidget, QTableWidgetItem
import time
#dni tygodnia
wdays = ['Poniedziałek','Wtorek','Środa','Czwartek','Piątek','Sobota','Niedziela']
class Gui_utils:
def __init__(self,ui_object):
self.ui = ui_object
#data
def set_date(self,wd,d):
self.ui.current_date.setText(time.strftime("%d %B",d))
self.ui.current_wd.setText(wdays[wd])
#zegary
#uniwersalny dezaktywator
def disable_clock(self,obj):
obj.setText("- -:- -:- - ")
#uniwersalny updater
def update_clock(self,obj,t):
obj.setText(time.strftime("%H:%M:%S ",t))
def update_clock_from_timestamp(self,obj,ts,negative_time=False):
if ts < 0:
if negative_time:
obj.setText(time.strftime("-%H:%M:%S ",time.gmtime(abs(ts))))
return True
else:
#nic nie rób
pass
else:
obj.setText(time.strftime("%H:%M:%S ",time.gmtime(ts)))
return False
def update_break_downtime(self,t):
self.ui.current_break_downtime.setText(time.strftime("-%M:%S ",t))
def update_time(self,tstr):
self.update_clock(self.ui.current_time,tstr)
def studio_status_connected(self):
self.ui.studio_label.setStyleSheet("background-color: rgb(0, 233, 0);")
self.ui.studio_label.setText("POŁĄCZONY")
def studio_status_disconnecting(self):
self.ui.studio_label.setStyleSheet("background-color: rgb(255, 100, 100);")
self.ui.studio_label.setText("Rozłączanie")
def studio_status_reconnecting(self):
self.ui.studio_label.setStyleSheet("background-color: rgb(255, 100, 100);")
self.ui.studio_label.setText("Ponowne łączenie...")
def studio_status_disconnected(self):
self.ui.studio_label.setStyleSheet("background-color: rgb(255, 0, 0);")
self.ui.studio_label.setText("ROZŁĄCZONY")
def studio_status_wait(self):
self.ui.studio_label.setStyleSheet("background-color: rgb(255, 255, 255);")
self.ui.studio_label.setText("...")