-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathframe.py
88 lines (69 loc) · 2.75 KB
/
frame.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import wx
from config import Config
class Frame(wx.Frame):
def makeFrame(self):
p = wx.Panel(self)
p.SetBackgroundColour("white")
numero_righe = 6
numero_colonne = 4
sizer = wx.FlexGridSizer(numero_righe, numero_colonne, 40, 20)
#sizer.AddGrowableCol(2)
#sizer.AddGrowableCol(1, 2)
#sizer.AddGrowableCol(2, 3)
#sizer.AddGrowableCol(3, 4)
fontTemperature = wx.Font(24, wx.DEFAULT, wx.NORMAL, wx.BOLD)
fontLabel = wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL)
for d in data:
td = 't' + d
# textId = wx.StaticText(p, -1, d)
textName = wx.StaticText(p, -1, data[d])
textTemperature = wx.StaticText(p, -1, label="----- C",name=d)
textTime = wx.StaticText(p, -1, label = "" ,name=td)
#textId.SetFont(fontLabel)
textName.SetFont(fontLabel)
textTime.SetFont(fontLabel)
textTemperature.SetFont(fontTemperature)
# textTime.SetSize(1,1)
#sizer.Add(textId, 0, wx.ALIGN_CENTER_VERTICAL)
sizer.Add(textTime, 0, wx.ALIGN_CENTER_VERTICAL, 0)
sizer.Add(textName, 0, wx.EXPAND,0)
sizer.AddStretchSpacer(prop=7)
sizer.Add(textTemperature, 0, wx.ALIGN_RIGHT,0)
textTime.Show(False)
boxsizer = wx.BoxSizer()
boxsizer.Add(sizer, 0, wx.EXPAND|wx.ALL, 10) # un bordo di cornice
p.SetSizer(boxsizer)
# sizer.Fit(self)
#boxsizer.Fit(self)
def UpdateLabel(self, value,name, time):
tname = 't' + name
w = wx.FindWindowByName(name)
wt = wx.FindWindowByName(tname)
w.SetLabel(value)
wt.SetLabel(time)
def getLabelTime(self, name):
tname = 't' + name
r = wx.FindWindowByName(tname)
return r.GetLabel()
def getLabelTemperature(self, name):
r = wx.FindWindowByName(name)
return r.GetLabel()
def errorLabel(self, name):
w = wx.FindWindowByName(name)
w.SetLabel('ERROR')
def redLabel(self, name):
w = wx.FindWindowByName(name)
w.SetForegroundColour((220,34,34))
def normalLabel(self, name):
w = wx.FindWindowByName(name)
w.SetForegroundColour((0,0,0))
def __init__(self, *a, **k):
#wx.Frame.__init__(self, *a, **k)
default = wx.MINIMIZE_BOX | wx.MAXIMIZE_BOX | wx.RESIZE_BORDER | wx.CAPTION | wx.CLIP_CHILDREN | wx.NO_BORDER ^ wx.SYSTEM_MENU
wx.Frame.__init__(self,None,style=default)
global data
con = Config()
data = con.getConfigDevice()
self.makeFrame()
self.SetBackgroundColour('white')
# self.ShowFullScreen(True)