diff --git a/src/metroEmuUI/MetroEmuRun.py b/src/metroEmuUI/MetroEmuRun.py index 6730932..7998216 100644 --- a/src/metroEmuUI/MetroEmuRun.py +++ b/src/metroEmuUI/MetroEmuRun.py @@ -24,7 +24,7 @@ import railwayPanelMap as pnlMap import dataMgr as dm -FRAME_SIZE = (1800, 1000) +FRAME_SIZE = (1800, 1030) #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- @@ -46,9 +46,11 @@ def __init__(self, parent, id, title): # Build UI sizer self.SetSizer(self._buidUISizer()) + + self.statusbar = self.CreateStatusBar(1) + self.statusbar.SetStatusText('Test mode: %s' %str(gv.gTestMD)) # Set the periodic call back self.updateLock = False - # Define the data manager parallel thread. gv.iDataMgr = dm.DataManager(self) gv.iDataMgr.start() @@ -57,7 +59,6 @@ def __init__(self, parent, id, title): self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.periodic) self.timer.Start(gv.PERIODIC) - self.Bind(wx.EVT_CLOSE, self.onClose) gv.gDebugPrint("Metro-System real world main frame inited.", logType=gv.LOG_INFO) @@ -197,7 +198,7 @@ def onLoadScenario(self, event): #----------------------------------------------------------------------------- def onHelp(self, event): """ Pop-up the Help information window. """ - wx.MessageBox(' If there is any bug, please contect: \n\n \ + wx.MessageBox(' If there is any bug, please contact: \n\n \ Author: Yuancheng Liu \n \ Email: liu_yuan_cheng@hotmail.com \n \ Created: 2023/05/02 \n \ diff --git a/src/metroEmuUI/railwayPanelMap.py b/src/metroEmuUI/railwayPanelMap.py index 7416b0c..1598542 100644 --- a/src/metroEmuUI/railwayPanelMap.py +++ b/src/metroEmuUI/railwayPanelMap.py @@ -2,21 +2,20 @@ #----------------------------------------------------------------------------- # Name: railWayPanelMap.py # -# Purpose: This module is used to display the top view of the main railway -# system current state. +# Purpose: This module is used to display the state animation of the railway +# system, such as trains movement, sensors detection state, station +# docking state and singal changes ... # # Author: Yuancheng Liu # -# Version: v0.1 +# Version: v0.1.2 # Created: 2023/06/01 -# Copyright: -# License: +# Copyright: Copyright (c) 2023 LiuYuancheng +# License: MIT License #----------------------------------------------------------------------------- import os import wx -import math - import metroEmuGobal as gv DEF_PNL_SIZE = (1600, 900) @@ -24,7 +23,7 @@ #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- class PanelMap(wx.Panel): - """ RailWay top view map""" + """ RailWay system map panel.""" def __init__(self, parent, panelSize=DEF_PNL_SIZE): wx.Panel.__init__(self, parent, size=panelSize) self.bgColor = wx.Colour(30, 40, 62) @@ -35,18 +34,22 @@ def __init__(self, parent, panelSize=DEF_PNL_SIZE): # Paint the map self.Bind(wx.EVT_PAINT, self.onPaint) # self.Bind(wx.EVT_LEFT_DOWN, self.onLeftClick) - self.SetDoubleBuffered(True) # Set the panel double buffer to void the panel flash during update. + # Set the panel double buffer to void the panel flash during update. + self.SetDoubleBuffered(True) #----------------------------------------------------------------------------- def _loadBitMaps(self): - """ load the internal usage bitmaps.""" + """ Load the internal usage pictures as bitmaps.""" imgDict = {} - img = os.path.join(gv.IMG_FD, 'Alert.png') - png = wx.Image(img, wx.BITMAP_TYPE_ANY).ConvertToBitmap() - imgDict['alert'] = png + imgPath = os.path.join(gv.IMG_FD, 'Alert.png') + if os.path.exists(imgPath): + png = wx.Image(imgPath, wx.BITMAP_TYPE_ANY).ConvertToBitmap() + imgDict['alert'] = png return imgDict #----------------------------------------------------------------------------- +# Define all the _draw() map components paint functions. + def _drawEnvItems(self, dc): """ Draw the environment items.""" dc.SetPen(self.dcDefPen) diff --git a/src/scadaEmuUI/hmiEmuRun.py b/src/scadaEmuUI/hmiEmuRun.py index 16870d7..528c3c3 100644 --- a/src/scadaEmuUI/hmiEmuRun.py +++ b/src/scadaEmuUI/hmiEmuRun.py @@ -25,7 +25,7 @@ import scadaDataMgr as dataMgr PERIODIC = 500 # update in every 500ms -FRAME_SIZE = (1800, 1020) +FRAME_SIZE = (1800, 1030) #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- @@ -42,6 +42,10 @@ def __init__(self, parent, id, title): self._buildMenuBar() # Build UI sizer self.SetSizer(self._buidUISizer()) + + self.statusbar = self.CreateStatusBar(1) + self.statusbar.SetStatusText('Test mode: %s' %str(gv.TEST_MD)) + self.updateLock = False if not gv.TEST_MD: gv.idataMgr = dataMgr.DataManager(self, gv.gPlcInfo) @@ -214,7 +218,7 @@ def periodic(self, event): #----------------------------------------------------------------------------- def onHelp(self, event): """ Pop-up the Help information window. """ - wx.MessageBox(' If there is any bug, please contect: \n\n \ + wx.MessageBox(' If there is any bug, please contact: \n\n \ Author: Yuancheng Liu \n \ Email: liu_yuan_cheng@hotmail.com \n \ Created: 2023/05/02 \n \ diff --git a/src/trainCtrlUI/trainCtrlRun.py b/src/trainCtrlUI/trainCtrlRun.py index e45b2e5..57b3db1 100644 --- a/src/trainCtrlUI/trainCtrlRun.py +++ b/src/trainCtrlUI/trainCtrlRun.py @@ -42,7 +42,6 @@ def __init__(self, parent, id, title): if not gv.TEST_MD: gv.idataMgr = dataMgr.DataManager(self, gv.gPlcInfo) - self.statusbar = self.CreateStatusBar(1) self.statusbar.SetStatusText('Test mode: %s' %str(gv.TEST_MD)) # Set the periodic call back @@ -51,7 +50,6 @@ def __init__(self, parent, id, title): self.updateLock = False self.Bind(wx.EVT_TIMER, self.periodic) self.timer.Start(PERIODIC) # every 500 ms - self.trainPwrState = [True]*10 TrainTgtPlcID = 'PLC-06' @@ -59,8 +57,6 @@ def __init__(self, parent, id, title): for idx in range(csIdx, ceIdx): gv.idataMgr.setPlcCoilsData(TrainTgtPlcID, idx, self.trainPwrState[idx]) - - #--UIFrame--------------------------------------------------------------------- def _initGlobals(self): # Init the global parameters used only by this module