Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1957,7 +1957,7 @@ def setChoices(self,block):
self._choices = collections.OrderedDict([(_('New peek'),self.OnPeek), (_('New all peek'),self.OnAllPeek),
(_('New poke'),self.OnPoke), (_('New hold in state'),self.OnInsertHoldInState), (_('New passivate in state'),self.OnInsertPassivateInState),
(_('New passivate state'),self.OnInsertPassivateState), (_('New Phase test'),self.OnInsertPhaseIs), (_('New debugger stdout'),self.OnInsertDebug),
(_('Get state'),self.OnInsertGetState), (_('Get sigma'),self.OnInsertGetSigma), (_('Get message value'),self.OnInsertGetMsgValue)])
(_('Get state'),self.OnInsertGetState), (_('Get sigma'),self.OnInsertGetSigma), (_('Get message value'),self.OnInsertGetMsgValue), (_('Get message time'),self.OnInsertGetMsgTime)])
else:
if 'PyPDEVS' in builtins.__dict__['DEFAULT_DEVS_DIRNAME']:
self._choices = collections.OrderedDict([(_("New add sub model"),self.OnAddModel),(_("New remove sub model"),self.OnRemoveModel),(_("New port connection"),self.OnDisConnectPorts),(_("New port connection"),self.OnConnectPorts),(_('New debugger stdout'),self.OnInsertDebug)])
Expand Down
39 changes: 10 additions & 29 deletions SimulationGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ def OnOk(self, event):
if self.thread.end_flag:
self.OnTimer(event)
else:
self.timer.Start(100)
self.timer.Start()

### timer for real time
if self.real_time_flag:
Expand Down Expand Up @@ -536,24 +536,6 @@ def OnStop(self, event):
if self.thread:
self.thread.terminate(False)

#import signal
#import platform

# get the current PID for safe terminate server if needed:
#PID = os.getpid()
# if platform.system() != 'Windows':
# PGID = os.getgid(PID)

# if platform.system() != 'Windows':
# os.killpg(PGID, signal.SIGKILL)
# else:
# os.kill(PID, signal.SIGTERM)

#main_thread = threading.currentThread()
#for t in threading.enumerate():
# if t is not main_thread:
# pass

self.timer.Stop()

wx.Bell()
Expand Down Expand Up @@ -594,10 +576,9 @@ def OnTimer(self, event):
if self.ntl:
self._gauge.Pulse()
else:
if not isinstance(self.thread.model.timeLast, tuple):
timeLast = self.thread.model.timeLast
else:
timeLast = self.thread.model.timeLast[0]
timeLast = self.thread.model.timeLast
if isinstance(self.thread.model.timeLast, tuple):
timeLast = timeLast[0]

self.count = (timeLast/self.thread.model.FINAL_TIME)*100

Expand Down Expand Up @@ -630,20 +611,21 @@ def OnTimer(self, event):
### stop the timer
self.timer.Stop()

### if the simulation is suspended
### if the simulation is not suspended
elif not self.thread.thread_suspend:

### udpate the status bar
self.statusbar.SetBackgroundColour('GREY')
printOnStatusBar(self.statusbar, {0:_("Processing..."), 1:self.GetClock()})
if self.statusbar.GetBackgroundColour() != 'GREY':
self.statusbar.SetBackgroundColour('GREY')
wx.CallAfter(printOnStatusBar,self.statusbar, {0:_("Processing..."), 1:self.GetClock()})

### is no time limit, add some information in status bar
if not self.ntl:
if self.statusbar.GetFieldsCount() > 2:
printOnStatusBar(self.statusbar, {2:str(self.count)[:4]+"%"})
wx.CallAfter(printOnStatusBar,self.statusbar, {2:str(self.count)[:4]+"%"})

#wx.Yield()
wx.YieldIfNeeded()
#wx.YieldIfNeeded()

def GetClock(self):
if self.real_time_flag:
Expand Down Expand Up @@ -836,7 +818,6 @@ def __set_properties(self):
icon = wx.EmptyIcon() if wx.VERSION_STRING < '4.0' else wx.Icon()
icon.CopyFromBitmap(wx.Bitmap(os.path.join(ICON_PATH_16_16, "simulation.png"), wx.BITMAP_TYPE_ANY))
self.SetIcon(icon)

self.Center()

def SetMaster(self, master):
Expand Down