Hop Over detector to change beam line
This commit is contained in:
parent
09dc1104c1
commit
180af57c91
46
dashboard.py
46
dashboard.py
|
@ -33,8 +33,8 @@ class Tandem():
|
||||||
self.tandem2 = canvas.create_rectangle(self.ULC[0], self.ULC[1] + Size[0]/2 , self.ULC[0] + Size[0], self.ULC[1] + Size[1] - Size[0]/2 , fill = Color, outline = Color)
|
self.tandem2 = canvas.create_rectangle(self.ULC[0], self.ULC[1] + Size[0]/2 , self.ULC[0] + Size[0], self.ULC[1] + Size[1] - Size[0]/2 , fill = Color, outline = Color)
|
||||||
self.tandem3 = canvas.create_arc (self.ULC[0], self.ULC[1] + Size[1] - Size[0], self.ULC[0] + Size[0], self.ULC[1] + Size[1] , start = 0, extent = -180, fill = Color, outline = Color)
|
self.tandem3 = canvas.create_arc (self.ULC[0], self.ULC[1] + Size[1] - Size[0], self.ULC[0] + Size[0], self.ULC[1] + Size[1] , start = 0, extent = -180, fill = Color, outline = Color)
|
||||||
def GetExitPos(self, downstream = 0):
|
def GetExitPos(self, downstream = 0):
|
||||||
return self.ExistPos + np.array([0, - downstream])
|
return self.ExistPos + np.array([0, - downstream])
|
||||||
|
|
||||||
class BeamRectElement():
|
class BeamRectElement():
|
||||||
def __init__(self, EntryPos, Size, Angle, Color):
|
def __init__(self, EntryPos, Size, Angle, Color):
|
||||||
self.Active = False
|
self.Active = False
|
||||||
|
@ -94,12 +94,15 @@ class DetectorStation():
|
||||||
self.Name = Name
|
self.Name = Name
|
||||||
self.ULC = [Center[0] - Size/2, Center[1] - Size/2]
|
self.ULC = [Center[0] - Size/2, Center[1] - Size/2]
|
||||||
self.Detector = canvas.create_oval(self.ULC[0], self.ULC[1], self.ULC[0] + Size, self.ULC[1]+Size, fill = Color, outline = Color)
|
self.Detector = canvas.create_oval(self.ULC[0], self.ULC[1], self.ULC[0] + Size, self.ULC[1]+Size, fill = Color, outline = Color)
|
||||||
self.label = Label(canvas, text = Name, bg = Color)
|
self.label = Label(canvas, text = Name, bg = Color, cursor = "hand1")
|
||||||
self.label.place(x=Center[0], y=Center[1], anchor = "center")
|
self.label.place(x=Center[0], y=Center[1], anchor = "center")
|
||||||
|
|
||||||
canvas.tag_bind(self.Detector, '<1>', self.onClick)
|
canvas.tag_bind(self.Detector, '<1>', self.onClick)
|
||||||
self.label.bind('<1>', self.onClick)
|
self.label.bind('<1>', self.onClick)
|
||||||
|
|
||||||
|
canvas.tag_bind(self.Detector, '<Enter>', self.HopOver)
|
||||||
|
canvas.tag_bind(self.Detector, '<Leave>', self.Leave)
|
||||||
|
|
||||||
def SetColor(Color):
|
def SetColor(Color):
|
||||||
canvas.itemconfig(self.Detector, fill = Color)
|
canvas.itemconfig(self.Detector, fill = Color)
|
||||||
self.label.config(bg = Color)
|
self.label.config(bg = Color)
|
||||||
|
@ -108,13 +111,31 @@ class DetectorStation():
|
||||||
global ActiveBeamLine
|
global ActiveBeamLine
|
||||||
ActiveBeamLine = self.Name
|
ActiveBeamLine = self.Name
|
||||||
print("========== ", ActiveBeamLine)
|
print("========== ", ActiveBeamLine)
|
||||||
return self.Name
|
bl0.Deactivate()
|
||||||
|
bl1.Deactivate()
|
||||||
|
bl1a.Deactivate(); bl1a_1.Deactivate()
|
||||||
|
bl1b.Deactivate()
|
||||||
|
bl1c.Deactivate()
|
||||||
|
bl0a.Deactivate(); bl3.Deactivate()
|
||||||
|
bl2a.Deactivate(); bl2a_1.Deactivate()
|
||||||
|
bl2b.Deactivate()
|
||||||
|
bl2c.Deactivate()
|
||||||
|
bl2c_1.Deactivate()
|
||||||
|
bl2c_2.Deactivate()
|
||||||
|
return self.Name
|
||||||
|
|
||||||
|
def HopOver(self, event):
|
||||||
|
canvas.config(cursor="hand1")
|
||||||
|
|
||||||
|
def Leave(self, event):
|
||||||
|
canvas.config(cursor="")
|
||||||
|
|
||||||
def GetName(self):
|
def GetName(self):
|
||||||
return self.Name
|
return self.Name
|
||||||
|
|
||||||
|
|
||||||
def SetActiveBeamLine( ):
|
def SetActiveBeamLine( ):
|
||||||
|
|
||||||
global ActiveBeamLine
|
global ActiveBeamLine
|
||||||
if ActiveBeamLine == "Gamma\nStation":
|
if ActiveBeamLine == "Gamma\nStation":
|
||||||
bl0.Activate()
|
bl0.Activate()
|
||||||
|
@ -135,7 +156,7 @@ def SetActiveBeamLine( ):
|
||||||
bl2c_1.Deactivate()
|
bl2c_1.Deactivate()
|
||||||
bl2c_2.Deactivate()
|
bl2c_2.Deactivate()
|
||||||
|
|
||||||
if ActiveBeamLine == "CATRiNA" :
|
elif ActiveBeamLine == "CATRiNA" :
|
||||||
bl0.Activate()
|
bl0.Activate()
|
||||||
|
|
||||||
bl1.Activate()
|
bl1.Activate()
|
||||||
|
@ -155,7 +176,7 @@ def SetActiveBeamLine( ):
|
||||||
bl2c_1.Deactivate()
|
bl2c_1.Deactivate()
|
||||||
bl2c_2.Deactivate()
|
bl2c_2.Deactivate()
|
||||||
|
|
||||||
if ActiveBeamLine == "RESOLUT" :
|
elif ActiveBeamLine == "RESOLUT" :
|
||||||
bl0.Activate()
|
bl0.Activate()
|
||||||
|
|
||||||
bl1.Deactivate()
|
bl1.Deactivate()
|
||||||
|
@ -175,7 +196,7 @@ def SetActiveBeamLine( ):
|
||||||
bl2c_1.Deactivate()
|
bl2c_1.Deactivate()
|
||||||
bl2c_2.Deactivate()
|
bl2c_2.Deactivate()
|
||||||
|
|
||||||
if ActiveBeamLine == "ANASEN" :
|
elif ActiveBeamLine == "ANASEN" :
|
||||||
bl0.Activate()
|
bl0.Activate()
|
||||||
|
|
||||||
bl1.Deactivate()
|
bl1.Deactivate()
|
||||||
|
@ -195,7 +216,7 @@ def SetActiveBeamLine( ):
|
||||||
bl2c_1.Deactivate()
|
bl2c_1.Deactivate()
|
||||||
bl2c_2.Deactivate()
|
bl2c_2.Deactivate()
|
||||||
|
|
||||||
if ActiveBeamLine == "SPS" :
|
elif ActiveBeamLine == "SPS" :
|
||||||
bl0.Activate()
|
bl0.Activate()
|
||||||
|
|
||||||
bl1.Deactivate()
|
bl1.Deactivate()
|
||||||
|
@ -215,7 +236,7 @@ def SetActiveBeamLine( ):
|
||||||
bl2c_1.Activate()
|
bl2c_1.Activate()
|
||||||
bl2c_2.Deactivate()
|
bl2c_2.Deactivate()
|
||||||
|
|
||||||
if ActiveBeamLine == "CLARION-2" :
|
elif ActiveBeamLine == "CLARION-2" :
|
||||||
bl0.Activate()
|
bl0.Activate()
|
||||||
|
|
||||||
bl1.Deactivate()
|
bl1.Deactivate()
|
||||||
|
@ -235,14 +256,15 @@ def SetActiveBeamLine( ):
|
||||||
bl2c_1.Deactivate()
|
bl2c_1.Deactivate()
|
||||||
bl2c_2.Activate()
|
bl2c_2.Activate()
|
||||||
|
|
||||||
|
|
||||||
############################## Start GUI
|
############################## Start GUI
|
||||||
windowSize = [3840, 1500]# 4K width
|
#windowSize = [3840, 1500]# 4K width
|
||||||
#windowSize = [3840, 2160]# 4K
|
windowSize = [3840, 2160]# 4K
|
||||||
|
|
||||||
window = Tk(className = 'FSU Fox\'s Lab Experimental Hall')
|
window = Tk(className = 'FSU Fox\'s Lab Experimental Hall')
|
||||||
window.geometry(str(windowSize[0]) + "x" + str(windowSize[1]))
|
window.geometry(str(windowSize[0]) + "x" + str(windowSize[1]))
|
||||||
window.configure(bg='black')
|
window.configure(bg='black')
|
||||||
#window.attributes('-fullscreen', True)
|
window.attributes('-fullscreen', True)
|
||||||
|
|
||||||
canvas = Canvas(window)
|
canvas = Canvas(window)
|
||||||
canvas.configure(bg='black', bd = 0, highlightthickness=0, relief='ridge')
|
canvas.configure(bg='black', bd = 0, highlightthickness=0, relief='ridge')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user