-
Notifications
You must be signed in to change notification settings - Fork 1
/
g2coreGui.py
executable file
·44 lines (38 loc) · 1.34 KB
/
g2coreGui.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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
scriptPath = os.path.dirname(os.path.realpath(__file__))
sys.path.append(scriptPath+"/backend")
sys.path.append(scriptPath+"/frontend")
import wx
import gettext
import MainFrame
import g2coreProtocol
import g2coreGuiBackend
class G2coreGui(wx.App):
def OnInit(self):
self.mainFrame = MainFrame.MainFrame(None, wx.ID_ANY, "")
self.SetTopWindow(self.mainFrame)
self.mainFrame.Show()
self.backend = g2coreGuiBackend.g2coreGuiBackend(self)
self.protocol = g2coreProtocol.g2coreProtocol() #should be done as a UI event
self.backend.setProtocol(self.protocol)
self.timer = myTimer(self.backend)
return True
class myTimer(wx.Timer):
def __init__(self, backend):
wx.Timer.__init__(self)
self.backend = backend
def Notify(self):
self.backend.animate()
application = wx.App.Get()
if self.backend.logHistory.hasChanges():
application.mainFrame.updateLog(self.backend.logHistory)
if self.backend.digitalReadOut.hasChanges():
application.mainFrame.updateDRO(self.backend.digitalReadOut)
if __name__ == "__main__":
gettext.install("app") # replace with the appropriate catalog name
app = G2coreGui(0)
app.timer.Start(100)
app.MainLoop()