diff --git a/AttributeEditor.py b/AttributeEditor.py index 6628c719..8b0ab058 100644 --- a/AttributeEditor.py +++ b/AttributeEditor.py @@ -2,12 +2,12 @@ ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # AttributeEditor.py --- +# -------------------------------- +# Copyright (c) 2020 +# L. CAPOCCHI (capocchi@univ-corse.fr) +# SPE Lab - SISU Group - University of Corsica # -------------------------------- -# Copyright (c) 2018 -# Laurent CAPOCCHI -# University of Corsica -# -------------------------------- -# Version 1.0 last modified: 16/03/18 +# Version 2.0 last modified: 03/15/20 ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # # GENERAL NOTES AND REMARKS: diff --git a/CheckerGUI.py b/CheckerGUI.py index 52759673..b37fbf9a 100644 --- a/CheckerGUI.py +++ b/CheckerGUI.py @@ -1,15 +1,24 @@ # -*- coding: utf-8 -*- -""" -Name: CheckerGUI.py -Brief descritpion: -Author(s): L. Capocchi -Version: 1.0 -Last modified: 2016.03.04 -GENERAL NOTES AND REMARKS: - -GLOBAL VARIABLES AND FUNCTIONS: -""" +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +# CheckerGUI.py --- +# -------------------------------- +# Copyright (c) 2020 +# L. CAPOCCHI (capocchi@univ-corse.fr) +# SPE Lab - SISU Group - University of Corsica +# -------------------------------- +# Version 2.0 last modified: 03/15/20 +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +# +# GENERAL NOTES AND REMARKS: +# +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## + +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +# +# GLOBAL VARIABLES AND FUNCTIONS +# +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## import wx import os diff --git a/Complexity.py b/Complexity.py index c6f60a13..991dac22 100644 --- a/Complexity.py +++ b/Complexity.py @@ -1,15 +1,24 @@ # -*- coding: utf-8 -*- -""" -Name: Complexity.py -Brief descritpion: -Author(s): L. Capocchi -Version: 1.0 -Last modified: 2019.29.10 -GENERAL NOTES AND REMARKS: - -GLOBAL VARIABLES AND FUNCTIONS: -""" +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +# Complexity.py --- +# -------------------------------- +# Copyright (c) 2020 +# L. CAPOCCHI (capocchi@univ-corse.fr) +# SPE Lab - SISU Group - University of Corsica +# -------------------------------- +# Version 2.0 last modified: 03/15/20 +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +# +# GENERAL NOTES AND REMARKS: +# +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## + +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +# +# GLOBAL VARIABLES AND FUNCTIONS +# +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## import os, sys ABS_HOME_PATH = os.path.abspath(os.path.dirname(sys.argv[0])) diff --git a/Components.py b/Components.py index 8d149cbc..f5ee7169 100644 --- a/Components.py +++ b/Components.py @@ -1,15 +1,24 @@ # -*- coding: utf-8 -*- -""" -Name: Components.py -Brief descritpion: All classes for components -Author(s): L. Capocchi -Version: 1.0 -Last modified: 2013.07.04 -GENERAL NOTES AND REMARKS: - -GLOBAL VARIABLES AND FUNCTIONS: -""" +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +# Components.py --- +# -------------------------------- +# Copyright (c) 2020 +# L. CAPOCCHI (capocchi@univ-corse.fr) +# SPE Lab - SISU Group - University of Corsica +# -------------------------------- +# Version 2.0 last modified: 03/15/20 +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +# +# GENERAL NOTES AND REMARKS: +# +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## + +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +# +# GLOBAL VARIABLES AND FUNCTIONS +# +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## import builtins diff --git a/ConnectDialog.py b/ConnectDialog.py index 8b7f4046..32201112 100644 --- a/ConnectDialog.py +++ b/ConnectDialog.py @@ -3,11 +3,11 @@ ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # ConnectDialog.py --- # -------------------------------- -# Copyright (c) 2009 +# Copyright (c) 2020 # Laurent CAPOCCHI # University of Corsica # -------------------------------- -# Version 1.0 last modified: +# Version 1.0 last modified: 03/15/2020 ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # # GENERAL NOTES AND REMARKS: diff --git a/ConnectionThread.py b/ConnectionThread.py index 5c135e3a..30d20f86 100644 --- a/ConnectionThread.py +++ b/ConnectionThread.py @@ -3,11 +3,11 @@ ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # ConnectionThread.py --- # -------------------------------- -# Copyright (c) 2010 -# Laurent CAPOCCHI -# University of Corsica +# Copyright (c) 2020 +# L. CAPOCCHI (capocchi@univ-corse.fr) +# SPE Lab - SISU Group - University of Corsica # -------------------------------- -# Version 2.0 last modified: 22/04/10 +# Version 2.0 last modified: 03/15/20 ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # # GENERAL NOTES AND REMARKS: diff --git a/Container.py b/Container.py index 4c4a9d8c..9bd0bc35 100644 --- a/Container.py +++ b/Container.py @@ -2,12 +2,12 @@ ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # Container.py --- +# -------------------------------- +# Copyright (c) 2020 +# L. CAPOCCHI (capocchi@univ-corse.fr) +# SPE Lab - SISU Group - University of Corsica # -------------------------------- -# Copyright (c) 2009 -# Laurent CAPOCCHI -# University of Corsica -# -------------------------------- -# Version 2.0 last modified: 04/14/16 +# Version 2.0 last modified: 03/15/20 ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # # GENERAL NOTES AND REMARKS: @@ -847,13 +847,15 @@ def OnSimulation(self, event): ## obj = event.GetEventObject() # si invocation à partir du bouton dans la toolBar (apparition de la frame de simulation dans une fenetre) if isinstance(obj, wx.ToolBar) or 'Diagram' in obj.GetTitle(): - frame = SimulationGUI.SimulationDialog(win, wx.NewIdRef(), _(" %s Simulator"%diagram.label), master) + frame = SimulationGUI.SimulationDialog(win, wx.NewIdRef(), _(" %s Simulator"%diagram.label)) + frame.SetMaster(master) frame.Show() ## si invocation par le menu (apparition de la frame de simulation dans le panel) elif isinstance(obj, (wx.Menu, wx.Frame)): sizer3 = wx.BoxSizer(wx.VERTICAL) win.panel3.Show() - win.SimDiag = SimulationGUI.SimulationDialog(win.panel3, wx.NewIdRef(), _("Simulation Manager"), master) + win.SimDiag = SimulationGUI.SimulationDialog(win.panel3, wx.NewIdRef(), _("Simulation Manager")) + win.SimDiag.SetMaster(master) sizer3.Add(win.SimDiag, 0, wx.EXPAND) win.panel3.SetSizer(sizer3) win.panel3.SetAutoLayout(True) diff --git a/Decorators.py b/Decorators.py index daf2a7eb..02caa80e 100644 --- a/Decorators.py +++ b/Decorators.py @@ -1,5 +1,25 @@ # -*- coding: utf-8 -*- +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +# Decorators.py --- +# -------------------------------- +# Copyright (c) 2020 +# L. CAPOCCHI (capocchi@univ-corse.fr) +# SPE Lab - SISU Group - University of Corsica +# -------------------------------- +# Version 2.0 last modified: 03/15/20 +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +# +# GENERAL NOTES AND REMARKS: +# +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## + +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +# +# GLOBAL VARIABLES AND FUNCTIONS +# +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## + import builtins import os diff --git a/DiagramNotebook.py b/DiagramNotebook.py index 5e97cbf3..02a4dcd1 100644 --- a/DiagramNotebook.py +++ b/DiagramNotebook.py @@ -3,11 +3,11 @@ ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # DiagramNoteBook.py --- # -------------------------------- -# Copyright (c) 2013 -# Laurent CAPOCCHI -# University of Corsica +# Copyright (c) 2020 +# L. CAPOCCHI (capocchi@univ-corse.fr) +# SPE Lab - SISU Group - University of Corsica # -------------------------------- -# Version 1.0 last modified: 21/01/2018 +# Version 1.0 last modified: 03/15/2020 ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # # GENERAL NOTES AND REMARKS: @@ -53,7 +53,7 @@ def __init__(self, *args, **kwargs): # for splash screen pub.sendMessage('object.added', message='Loading notebook diagram...\n') - + Printable.__init__(self) # local copy diff --git a/Editor.py b/Editor.py index 51c3cd0b..4ad9f5c8 100644 --- a/Editor.py +++ b/Editor.py @@ -3,12 +3,11 @@ ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # Editor.py --- # -------------------------------- -# Copyright (c) 2013 -# T. ville -# Laurent CAPOCCHI -# University of Corsica +# Copyright (c) 2020 +# L. CAPOCCHI (capocchi@univ-corse.fr) & T. Ville +# SPE Lab - SISU Group - University of Corsica # -------------------------------- -# Version 1.0 last modified: 28/02/2014 +# Version 1.0 last modified: 03/15/2020 ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # # GENERAL NOTES AND REMARKS: diff --git a/ImportLibrary.py b/ImportLibrary.py index e1c3bd02..caf08f51 100644 --- a/ImportLibrary.py +++ b/ImportLibrary.py @@ -3,11 +3,11 @@ ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # ImportLibrary.py --- Importing library dialog # -------------------------------- -# Copyright (c) 2009 -# Laurent CAPOCCHI -# University of Corsica +# Copyright (c) 2020 +# L. CAPOCCHI (capocchi@univ-corse.fr) +# SPE Lab - SISU Group - University of Corsica # -------------------------------- -# Version 1.0 last modified: 15/04/09 +# Version 1.0 last modified: 15/03/20 ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # # GENERAL NOTES AND REMARKS: diff --git a/Menu.py b/Menu.py index d2efd39d..379b87f3 100644 --- a/Menu.py +++ b/Menu.py @@ -2,12 +2,12 @@ ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # Menu.py --- +# -------------------------------- +# Copyright (c) 2020 +# L. CAPOCCHI (capocchi@univ-corse.fr) +# SPE Lab - SISU Group - University of Corsica # -------------------------------- -# Copyright (c) 2010 -# Laurent CAPOCCHI -# University of Corsica -# -------------------------------- -# Version 2.0 last modified: 13/05/10 +# Version 2.0 last modified: 03/15/20 ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # # GENERAL NOTES AND REMARKS: diff --git a/Patterns/Memoize.py b/Patterns/Memoize.py index cdddfcba..e12fbca5 100644 --- a/Patterns/Memoize.py +++ b/Patterns/Memoize.py @@ -1,4 +1,25 @@ # -*- coding: utf-8 -*- + +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +# Memoize.py --- +# -------------------------------- +# Copyright (c) 2020 +# L. CAPOCCHI (capocchi@univ-corse.fr) +# SPE Lab - SISU Group - University of Corsica +# -------------------------------- +# Version 2.0 last modified: 03/15/20 +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +# +# GENERAL NOTES AND REMARKS: +# +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## + +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +# +# GLOBAL VARIABLES AND FUNCTIONS +# +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## + class memoized(object): """Decorator that caches a function's return value each time it is called. If called later with the same arguments, the cached value is returned, and diff --git a/Patterns/Observer.py b/Patterns/Observer.py index 8f26a6ab..0f4c26b3 100644 --- a/Patterns/Observer.py +++ b/Patterns/Observer.py @@ -1,18 +1,17 @@ # -*- coding: utf-8 -*- ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## -# Observer.py --- Observer Pattern +# Observer.py --- +# -------------------------------- +# Copyright (c) 2020 +# L. CAPOCCHI (capocchi@univ-corse.fr) +# SPE Lab - SISU Group - University of Corsica # -------------------------------- -# Copyright (c) 2010 -# Laurent CAPOCCHI -# University of Corsica -# -------------------------------- -# Version 1.0 last modified: 15/06/10 +# Version 2.0 last modified: 03/15/20 ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # # GENERAL NOTES AND REMARKS: # -# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## diff --git a/Patterns/Singleton.py b/Patterns/Singleton.py index 7870f674..7da7965e 100644 --- a/Patterns/Singleton.py +++ b/Patterns/Singleton.py @@ -1,5 +1,25 @@ # -*- coding: utf-8 -*- +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +# Singleton.py --- +# -------------------------------- +# Copyright (c) 2020 +# L. CAPOCCHI (capocchi@univ-corse.fr) +# SPE Lab - SISU Group - University of Corsica +# -------------------------------- +# Version 2.0 last modified: 03/15/20 +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +# +# GENERAL NOTES AND REMARKS: +# +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## + +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +# +# GLOBAL VARIABLES AND FUNCTIONS +# +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## + class Singleton(type): def __init__(cls, name, bases, dict): super(Singleton, cls).__init__(name, bases, dict) diff --git a/Patterns/Strategy.py b/Patterns/Strategy.py index 840c84bb..c7745915 100644 --- a/Patterns/Strategy.py +++ b/Patterns/Strategy.py @@ -3,11 +3,11 @@ ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # Strategy.py --- Strategy Pattern # -------------------------------- -# Copyright (c) 2012 -# Laurent CAPOCCHI -# University of Corsica +# Copyright (c) 2020 +# L. CAPOCCHI (capocchi@univ-corse.fr) +# SPE Lab - SISU Group - University of Corsica # -------------------------------- -# Version 1.0 last modified: 23/03/12 +# Version 1.0 last modified: 03/15/20 ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # # GENERAL NOTES AND REMARKS: @@ -37,15 +37,14 @@ import os ### import the DEVS module depending on the selected DEVS package in DEVSKernel directory -for pydevs_dir in builtins.__dict__['DEVS_DIR_PATH_DICT']: - path = builtins.__dict__['DEVS_DIR_PATH_DICT'][pydevs_dir] +for pydevs_dir, path in builtins.__dict__['DEVS_DIR_PATH_DICT'].items(): ### split from DEVSKernel string and replace separator with point d = re.split("DEVSKernel", path)[-1].replace(os.sep, '.') ### for py 3.X import importlib exec("%s = importlib.import_module('DEVSKernel%s.DEVS')"%(pydevs_dir,d)) - + #exec("import DEVSKernel%s.DEVS as %s"%(d,pydevs_dir)) #import DEVSKernel.PyDEVS.DEVS as PyDEVS diff --git a/PreferencesGUI.py b/PreferencesGUI.py index 2bfb1c17..a2ee3c8b 100644 --- a/PreferencesGUI.py +++ b/PreferencesGUI.py @@ -1,5 +1,25 @@ # -*- coding: utf-8 -*- +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +# PreferencesGUI.py --- +# -------------------------------- +# Copyright (c) 2020 +# L. CAPOCCHI (capocchi@univ-corse.fr) +# SPE Lab - SISU Group - University of Corsica +# -------------------------------- +# Version 2.0 last modified: 03/15/20 +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +# +# GENERAL NOTES AND REMARKS: +# +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## + +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +# +# GLOBAL VARIABLES AND FUNCTIONS +# +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## + import wx import os import builtins diff --git a/SimulationGUI.py b/SimulationGUI.py index c027e60d..5d14b903 100644 --- a/SimulationGUI.py +++ b/SimulationGUI.py @@ -2,12 +2,12 @@ ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # SimulationGUI.py --- +# -------------------------------- +# Copyright (c) 2020 +# L. CAPOCCHI (capocchi@univ-corse.fr) +# SPE Lab - SISU Group - University of Corsica # -------------------------------- -# Copyright (c) 2010 -# Laurent CAPOCCHI -# University of Corsica -# -------------------------------- -# Version 2.0 last modified: 16/11/13 +# Version 2.0 last modified: 03/15/20 ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # # GENERAL NOTES AND REMARKS: @@ -43,12 +43,13 @@ ### just for individual test if __name__ == '__main__': builtins.__dict__['GUI_FLAG'] = True + builtins.__dict__['HOME_PATH'] = os.path.abspath(os.path.dirname(sys.argv[0])) builtins.__dict__['DEFAULT_DEVS_DIRNAME'] = "PyDEVS" builtins.__dict__['DEVS_DIR_PATH_DICT'] = {\ 'PyDEVS':os.path.join(os.pardir,'DEVSKernel','PyDEVS'),\ - 'PyPDEVS':os.path.join(os.pardir,'DEVSKernel','PyPDEVS')} + 'PyPDEVS':os.path.join(os.pardir,'DEVSKernel','PyPDEVS', 'old')} -from Utilities import IsAllDigits, playSound, printOnStatusBar +from Utilities import IsAllDigits, playSound, printOnStatusBar, NotificationMessage from pluginmanager import trigger_event, is_enable from Patterns.Strategy import * from Decorators import BuzyCursorNotification, hotshotit @@ -73,13 +74,14 @@ def timer(): wx.PyValidator = wx.Validator class MyBad(Exception):pass + ### class TextObjectValidator(wx.PyValidator): """ TextObjectValidator() """ - def __init__(self): - wx.PyValidator.__init__(self) + def __init__(self, *args, **kwargs): + super(TextObjectValidator, self).__init__(*args, **kwargs) def Clone(self): return TextObjectValidator() @@ -108,9 +110,10 @@ def TransferFromWindow(self): class CollapsiblePanel(wx.Panel): def __init__(self, parent, simdia): - wx.Panel.__init__(self, parent, -1) + wx.Panel.__init__(self, parent) self.parent = parent + ### frame or panel !!! self.simdia = simdia @@ -157,10 +160,10 @@ def MakePaneContent(self, pane): text2 = wx.StaticText(pane, wx.NewIdRef(), _("%s algorithm:")%DEFAULT_DEVS_DIRNAME) ### list of possible strategy depending on the PyDEVS version - if DEFAULT_DEVS_DIRNAME == 'PyDEVS': - c = list(PYDEVS_SIM_STRATEGY_DICT.keys()) - else: - c = list(PYPDEVS_SIM_STRATEGY_DICT.keys()) + #if DEFAULT_DEVS_DIRNAME == 'PyDEVS': + c = list(eval("%s_SIM_STRATEGY_DICT.keys()"%DEFAULT_DEVS_DIRNAME.upper())) + #else: + # c = list(PYPDEVS_SIM_STRATEGY_DICT.keys()) ### choice of strategy ch1 = wx.Choice(pane, wx.NewIdRef(), choices=c) @@ -191,10 +194,10 @@ def MakePaneContent(self, pane): cb5.SetValue(builtins.__dict__['REAL_TIME'] and not builtins.__dict__['NTL']) ### default strategy - if DEFAULT_DEVS_DIRNAME == 'PyDEVS': - ch1.SetSelection(list(PYDEVS_SIM_STRATEGY_DICT.keys()).index(DEFAULT_SIM_STRATEGY)) - else: - ch1.SetSelection(list(PYPDEVS_SIM_STRATEGY_DICT.keys()).index(DEFAULT_SIM_STRATEGY)) + #if DEFAULT_DEVS_DIRNAME == 'PyDEVS': + ch1.SetSelection(list(eval("%s_SIM_STRATEGY_DICT.keys()"%DEFAULT_DEVS_DIRNAME.upper())).index(DEFAULT_SIM_STRATEGY)) + #else: + # ch1.SetSelection(list(PYPDEVS_SIM_STRATEGY_DICT.keys()).index(DEFAULT_SIM_STRATEGY)) if wx.VERSION_STRING >= '4.0': ch1.SetToolTipString=ch1.SetToolTip @@ -273,41 +276,13 @@ class Base(object): Frame or Panel with progress bar """ - def __init__(self, parent, id, title, master): + def __init__(self, parent, id, title): """ Constructor """ -# if isinstance(parent, wx.Panel): -# wx.Panel.__init__(self, parent, id) -# self.SetBackgroundColour(wx.NullColour) -# self.panel = self -# -# ### panel inherit of the left splitter size -# self.panel.SetSize(parent.GetParent().GetSize()) -# -# # status bar of main application -# self.statusbar = parent.GetTopLevelParent().statusbar -# else: -# wx.Frame.__init__(self, parent, id, title, style= wx.DEFAULT_FRAME_STYLE) -# -# ### adapt size of frame depending on the plate-form -# if '__WXMSW__' in wx.PlatformInfo: -# self.SetSize((320,280)) -# else: -# self.SetSize((280,160)) -# -# # disable the roll out of the frame -# self.SetMinSize(self.GetSize()) -# -# self.panel = wx.Panel(self, -1) -# -# wx.CallAfter(self.CreateBar) -# -# self.__set_properties() - # local copy self.parent = parent - self.master = master + #self.master = master self.title = title ### current master for multi-simulation without simulationDialog reloading (show OnOk) @@ -349,7 +324,7 @@ def CreateBar(self): def __widgets(self): self._text1 = wx.StaticText(self.panel, wx.NewIdRef(), _('Final time:')) - self._value = wx.TextCtrl(self.panel, wx.NewIdRef(), str(float(self.master.FINAL_TIME)), validator=TextObjectValidator()) + self._value = wx.TextCtrl(self.panel, wx.NewIdRef(), validator=TextObjectValidator()) self._btn1 = wx.Button(self.panel, wx.NewIdRef(), _('Run')) self._btn2 = wx.Button(self.panel, wx.NewIdRef(), _('Stop')) self._btn3 = wx.Button(self.panel, wx.NewIdRef(), _('Suspend')) @@ -379,9 +354,15 @@ def SetNTL(self, ntl): def SetTime(self, time): self._value.SetValue(time) + def SetMaster(self, master): + self.master = master + self._value.SetValue(str(float(self.master.FINAL_TIME))) + + def GetMaster(self): + self.master + def __do_layout(self): - #vbox_top = wx.BoxSizer(wx.VERTICAL) vbox_body = wx.BoxSizer(wx.VERTICAL) #panel 1 @@ -396,25 +377,15 @@ def __do_layout(self): grid2.Add(self._btn2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_CENTER_HORIZONTAL|wx.EXPAND) grid2.Add(self._btn4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_CENTER_HORIZONTAL|wx.EXPAND) - # panel4 - #hbox1 = wx.BoxSizer(wx.HORIZONTAL) - #hbox1.Add(self._gauge, 1, wx.EXPAND, 9) - - ## panel5 - #hbox2 = wx.BoxSizer(wx.HORIZONTAL) - #hbox2.Add(self._cp, 1, wx.EXPAND, 9) - - vbox_body.Add(grid1, 0, wx.EXPAND, 9) + vbox_body.Add(grid1, 0, wx.EXPAND|wx.TOP, 9) + vbox_body.Add((-1, 10)) vbox_body.Add(grid2, 0, wx.EXPAND, 9) vbox_body.Add(self._gauge, 0, wx.EXPAND, 9) vbox_body.Add(self._cp, 0, wx.EXPAND, 9) # fin panel - #vbox_top.Add(vbox_body, 0, wx.EXPAND|wx.ALL, 9) self.panel.SetSizer(vbox_body) -# vbox_body.Fit(self) - self._text1.SetFocus() self._btn1.SetDefault() self._btn2.Disable() @@ -794,7 +765,7 @@ def ErrorManager(self, msg): class SimulationDialogPanel(Base, wx.Panel): """ Simulation Dialog Panel """ - def __init__(self, parent, id, title, master): + def __init__(self, parent, id, title): """ Constructor """ @@ -810,7 +781,14 @@ def __init__(self, parent, id, title, master): # status bar of main application self.statusbar = parent.GetTopLevelParent().statusbar - Base.__init__(self, parent, id, title, master) + Base.__init__(self, parent, id, title) + #self.SetMaster(master) + + def SetMaster(self, master): + Base.SetMaster(self, master) + + def GetMaster(self): + return Base.GetMaster(self) class SimulationDialogFrame(Base, wx.Frame): """ SimulationDialog(parent, id, title, master) @@ -818,7 +796,7 @@ class SimulationDialogFrame(Base, wx.Frame): Frame or Panel with progress bar """ - def __init__(self, parent, id, title, master): + def __init__(self, parent, id, title): """ Constructor """ @@ -826,21 +804,15 @@ def __init__(self, parent, id, title, master): wx.Frame.__init__(self, parent, id, title, style= wx.DEFAULT_FRAME_STYLE) - ### adapt size of frame depending on the plate-form - #if '__WXMSW__' in wx.PlatformInfo: - # self.SetSize((320,280)) - #else: - # self.SetSize((280,160)) - # disable the roll out of the frame self.SetMinSize(self.GetSize()) - self.panel = wx.Panel(self, -1) + self.panel = wx.Panel(self) wx.CallAfter(self.CreateBar) - Base.__init__(self, parent, id, title, master) - + Base.__init__(self, parent, id, title) + self.__set_properties() def __set_properties(self): @@ -849,6 +821,12 @@ def __set_properties(self): self.SetIcon(icon) self.Center() + + def SetMaster(self, master): + Base.SetMaster(self, master) + + def GetMaster(self): + return Base.GetMaster(self) def SimulationDialog(*args): parent = args[0] @@ -900,7 +878,7 @@ class SimulationThread(threading.Thread, Simulator): Thread for DEVS simulation task """ - def __init__(self, model = None, strategy = '', prof = False, ntl = False, verbose=False, dynamic_structure_flag=False, real_time_flag=False): + def __init__(self, model=None, strategy='', prof=False, ntl=False, verbose=False, dynamic_structure_flag=False, real_time_flag=False): """ Constructor. """ threading.Thread.__init__(self) @@ -988,7 +966,11 @@ def terminate(self, error = False, msg = None): m.finish(None) ### resionly for displayed application (-nogui) - if wx.GetApp() : wx.CallAfter(playSound, SIMULATION_SUCCESS_SOUND_PATH) + if wx.GetApp(): + if self.prof: + NotificationMessage(_("Information"), _("Profiling report is available on Options->Profile"), None, timeout=5) + + wx.CallAfter(playSound, SIMULATION_SUCCESS_SOUND_PATH) self.end_flag = True @@ -1018,19 +1000,20 @@ def OnInit(self): builtins.__dict__['PYDEVS_SIM_STRATEGY_DICT'] = {'original':'SimStrategy1', 'bag-based':'SimStrategy2', 'direct-coupling':'SimStrategy3'} builtins.__dict__['PYPDEVS_SIM_STRATEGY_DICT'] = {'classic':'SimStrategy4', 'distribued':'SimStrategy5', 'parallel':'SimStrategy6'} - builtins.__dict__['DEFAULT_DEVS_DIRNAME'] = 'PyPDEVS' - builtins.__dict__['DEVS_DIR_PATH_DICT'] = {'PyDEVS':os.path.join(os.pardir,'DEVSKernel','PyDEVS'),'PyPDEVS':os.path.join(os.pardir,'DEVSKernel','PyPDEVS')} - + import gettext - import DomainInterface.MasterModel + #import DomainInterface.MasterModel builtins.__dict__['ICON_PATH_16_16']=os.path.join('icons','16x16') builtins.__dict__['DEFAULT_SIM_STRATEGY'] = 'original' + builtins.__dict__['DYNAMIC_STRUCTURE'] = False + builtins.__dict__['REAL_TIME'] = False + builtins.__dict__['VERBOSE'] = False builtins.__dict__['NTL'] = False builtins.__dict__['_'] = gettext.gettext - - self.frame = SimulationDialog(None, wx.NewIdRef(), 'Simulator', DomainInterface.MasterModel.Master()) + self.frame = SimulationDialog(wx.Frame(), wx.NewIdRef(), 'Simulator') + #self.frame.SetMaster(DomainInterface.MasterModel.Master()) self.frame.Show() return True @@ -1038,6 +1021,5 @@ def OnQuit(self, event): self.Close() if __name__ == '__main__': - app = TestApp(0) app.MainLoop() \ No newline at end of file diff --git a/Utilities.py b/Utilities.py index c7eeff45..089b4196 100644 --- a/Utilities.py +++ b/Utilities.py @@ -1,5 +1,25 @@ # -*- coding: utf-8 -*- +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +# Utilities.py --- +# -------------------------------- +# Copyright (c) 2020 +# L. CAPOCCHI (capocchi@univ-corse.fr) +# SPE Lab - SISU Group - University of Corsica +# -------------------------------- +# Version 2.0 last modified: 03/15/20 +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +# +# GENERAL NOTES AND REMARKS: +# +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## + +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +# +# GLOBAL VARIABLES AND FUNCTIONS +# +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## + import builtins import os import sys diff --git a/devsimpy.py b/devsimpy.py index 80d3183b..c36dcee8 100644 --- a/devsimpy.py +++ b/devsimpy.py @@ -4,11 +4,11 @@ ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # devsimpy.py --- DEVSimPy - The Python DEVS GUI modeling and simulation software # -------------------------------- -# Copyright (c) 2019 +# Copyright (c) 2020 # L. CAPOCCHI (capocchi@univ-corse.fr) # SPE Lab - SISU Group - University of Corsica # -------------------------------- -# Version 4.0 last modified: 09/09/19 +# Version 4.0 last modified: 03/14/20 ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # # GENERAL NOTES AND REMARKS: @@ -151,6 +151,7 @@ 'REAL_TIME': False, ### PyPDEVS threaded real time simulation 'VERBOSE':False, 'TRANSPARENCY' : True, # Transparancy for DetachedFrame + 'NOTIFICATION': True, 'DEFAULT_PLOT_DYN_FREQ' : 100, # frequence of dynamic plot of QuickScope (to avoid overhead), 'DEFAULT_DEVS_DIRNAME':'PyDEVS', # default DEVS Kernel directory 'DEVS_DIR_PATH_DICT':{'PyDEVS':os.path.join(ABS_HOME_PATH,'DEVSKernel','PyDEVS'), @@ -772,8 +773,10 @@ def EnableAbstractionButton(self): level = self.spin.GetValue() ### update doward and upward button - self.tb.EnableTool(self.toggle_list[4], level != 0) - self.tb.EnableTool(self.toggle_list[5], level != 0) + tb = self.GetToolBar() + flag = level != 0 + tb.EnableTool(self.toggle_list[4], flag) + tb.EnableTool(self.toggle_list[5], flag) def OnDeleteRecentFiles(self, event): """ Delete the recent files list @@ -1286,7 +1289,8 @@ def OnSaveFile(self, event): currentPage.Refresh() ### enable save button on status bar - self.tb.EnableTool(Menu.ID_SAVE, diagram.modify) + tb = self.GetToolBar() + tb.EnableTool(Menu.ID_SAVE, diagram.modify) #self.statusbar.SetStatusText(_('%s saved')%diagram.last_name_saved) else: @@ -1363,7 +1367,8 @@ def OnSaveAsFile(self, event): self.nb2.AddEditPage(label, diagram) ### enable save button on status bar - self.tb.EnableTool(Menu.ID_SAVE, diagram.modify) + tb = self.GetToolBar() + tb.EnableTool(Menu.ID_SAVE, diagram.modify) else: wx.MessageBox(_('Error saving file.'), _('Error'), wx.OK | wx.ICON_ERROR) @@ -1647,7 +1652,8 @@ def StartSimulationGUIWin(self, arg, diagrams): ## make DEVS instance from diagram master = Container.Diagram.makeDEVSInstance(diagram) if not isinstance(master, tuple): - simFrame = SimulationGUI.SimulationDialog(self, wx.NewIdRef(), _(" %s Simulator"%diagram.label), master) + simFrame = SimulationGUI.SimulationDialog(self, wx.NewIdRef(), _(" %s Simulator"%diagram.label)) + simFrame.SetMaster(master) ### center and shit to avoid superposition if simFrame: