diff --git a/AttributeEditor.py b/AttributeEditor.py index 8b0ab058..7ec7da83 100644 --- a/AttributeEditor.py +++ b/AttributeEditor.py @@ -150,6 +150,7 @@ def MakeIcon(self, img): def OnClose(self, event): self.canvas.UpdateShapes() self.Destroy() + event.Skip() def AttributeEditor(*args,**kwargs): """ Factory function @@ -273,6 +274,7 @@ def Undo(self): ### def OnClose(self, event): self.Destroy() + event.Skip() def main(): pass diff --git a/Container.py b/Container.py index dcb39f57..f590025c 100644 --- a/Container.py +++ b/Container.py @@ -684,6 +684,8 @@ def OnClosePriorityGUI(self, event): ### we can update the devs priority list during the simulation ;-) self.updateDEVSPriorityList() + event.Skip() + def OnAddConstants(self, event): """ Method that add constant parameters in order to simplify the modling codeBlock model """ @@ -1204,14 +1206,16 @@ def OnConnect(self,event): class Shape(ShapeEvtHandler): """ Shape class """ - + + FILL = ['#add8e6'] + def __init__(self, x=[], y=[]): """ Constructor """ self.x = array.array('d',x) # list of x coord self.y = array.array('d',y) # list of y coords - self.fill= ['#add8e6'] # fill color + self.fill= Shape.FILL # fill color self.pen = [self.fill[0] , 1, wx.SOLID] # pen color and size self.font = [FONT_SIZE, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_ITALIC, wx.FONTWEIGHT_BOLD, u'Arial'] @@ -1976,11 +1980,13 @@ def OnCloseConnectionDialog(self, event): self.deselect() self.Refresh() - ### destruction du dialogue + ### Destroy the dialog try: self.dlgConnection.Destroy() except: pass + + event.Skip() def OnMiddleDown(self, event): """ @@ -3850,6 +3856,8 @@ class ContainerBlock(Block, Diagram): """ ContainerBlock(label, inputs, outputs) """ + FILL = ['#90ee90'] + ### def __init__(self, label = 'ContainerBlock', nb_inputs = 1, nb_outputs = 1): """ Constructor @@ -3857,7 +3865,7 @@ def __init__(self, label = 'ContainerBlock', nb_inputs = 1, nb_outputs = 1): Block.__init__(self, label, nb_inputs, nb_outputs) Diagram.__init__(self) #Structurable.__init__(self) - self.fill = ['#90ee90'] + self.fill = Container.FILL ### def __setstate__(self, state): diff --git a/DetachedFrame.py b/DetachedFrame.py index 9cebf3cd..6f39236d 100644 --- a/DetachedFrame.py +++ b/DetachedFrame.py @@ -272,6 +272,8 @@ def OnClose(self, event): ### Destroy the windows self.Destroy() + event.Skip() + ### ------------------------------------------------------------ class TestApp(wx.App): """ Testing application diff --git a/FindGUI.py b/FindGUI.py index 104762a9..2b06f866 100644 --- a/FindGUI.py +++ b/FindGUI.py @@ -1,23 +1,53 @@ -#!/usr/bin/python # -*- coding: utf-8 -*- -# Find/Replace Dialog +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +# FindGUI.py --- +# -------------------------------- +# Copyright (c) 2020 +# L. CAPOCCHI (capocchi@univ-corse.fr) +# SPE Lab - SISU Group - University of Corsica +# -------------------------------- +# Version 1.0 last modified: 03/22/20 +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +# +# GENERAL NOTES AND REMARKS: +# +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## + +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +# +# GLOBAL VARIABLES AND FUNCTIONS +# +## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## import wx import re +### just for individual test +if __name__ == '__main__': + import builtins + import os, sys + + 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', 'old')} + class FindReplace(wx.Dialog): def __init__(self, parent, id, title): + wx.Dialog.__init__(self, parent, id, title, size=(255, 365)) - vbox_top = wx.BoxSizer(wx.VERTICAL) - panel = wx.Panel(self, -1) + panel = wx.Panel(self) + vbox_top = wx.BoxSizer(wx.VERTICAL) vbox = wx.BoxSizer(wx.VERTICAL) # panel1 - panel1 = wx.Panel(panel, -1) - grid1 = wx.GridSizer(2, 2) + panel1 = wx.Panel(panel) + grid1 = wx.GridSizer(2, 2, 0, 0) self.input_find = wx.ComboBox(panel1, -1, size=(120, -1)) self.input_replace = wx.ComboBox(panel1, -1, size=(120, -1)) grid1.Add(wx.StaticText(panel1, -1, _('Find: '),(5, 5)), 0, wx.ALIGN_CENTER_VERTICAL) @@ -29,7 +59,7 @@ def __init__(self, parent, id, title): vbox.Add(panel1, 0, wx.BOTTOM | wx.TOP, 9) # panel2 - panel2 = wx.Panel(panel, -1) + panel2 = wx.Panel(panel) hbox2 = wx.BoxSizer(wx.HORIZONTAL) sizer21 = wx.StaticBoxSizer(wx.StaticBox(panel2, -1, _('Direction')), orient=wx.VERTICAL) sizer21.Add(wx.RadioButton(panel2, -1, _('Forward'), style=wx.RB_GROUP)) @@ -63,7 +93,7 @@ def __init__(self, parent, id, title): # panel4 - panel4 = wx.Panel(panel, -1) + panel4 = wx.Panel(panel) sizer4 = wx.GridSizer(2, 2, 2, 2) find_btn = wx.Button(panel4, -1,_('Find'), size=(120, -1)) replace_find_btn = wx.Button(panel4, -1, _('Replace/Find'), size=(120, -1)) @@ -79,8 +109,7 @@ def __init__(self, parent, id, title): vbox.Add(panel4, 0, wx.BOTTOM, 9) # panel5 - - panel5 = wx.Panel(panel, -1) + panel5 = wx.Panel(panel) sizer5 = wx.BoxSizer(wx.HORIZONTAL) sizer5.Add((191, -1), 1, wx.EXPAND | wx.ALIGN_RIGHT) close_btn = wx.Button(panel5, -1, _('Close'), size=(50, -1)) diff --git a/ImportLibrary.py b/ImportLibrary.py index caf08f51..d0b22ecc 100644 --- a/ImportLibrary.py +++ b/ImportLibrary.py @@ -535,6 +535,7 @@ def OnAdd(self, evt): def OnCloseWindow(self, event): self.Destroy() + event.Skip() ### ------------------------------------------------------------ class TestApp(wx.App): diff --git a/LabelGUI.py b/LabelGUI.py index d87e8004..5670a636 100644 --- a/LabelGUI.py +++ b/LabelGUI.py @@ -2,12 +2,12 @@ ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # LabelGUI.py --- +# -------------------------------- +# Copyright (c) 2020 +# L. CAPOCCHI (capocchi@univ-corse.fr) +# SPE Lab - SISU Group - University of Corsica # -------------------------------- -# Copyright (c) 2013 -# Laurent CAPOCCHI -# University of Corsica -# -------------------------------- -# Version 1.0 last modified: 16/04/13 +# Version 1.0 last modified: 03/22/20 ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # # GENERAL NOTES AND REMARKS: diff --git a/Menu.py b/Menu.py index 0efe865d..59ffd1dd 100644 --- a/Menu.py +++ b/Menu.py @@ -257,7 +257,7 @@ def __init__(self, parent): AppendItem(wx.MenuItem(self, ID_DELETE_PROFILES, _("Delete all"))) self.Enable(ID_DELETE_PROFILES, self.GetMenuItemCount() > 2) - parent.Bind(wx.EVT_MENU, parent.OnDeleteProfiles, id = ID_DELETE_PROFILES) + parent.Bind(wx.EVT_MENU, parent.OnDeleteProfiles, id=ID_DELETE_PROFILES) class RecentFileMenu(wx.Menu): """ @@ -349,6 +349,9 @@ def __init__(self, parent): self.Append(ID, name) parent.Bind(wx.EVT_MENU, parent.OnRestorePerspective, id=ID) + ### Enable the delete function if the list of perspectives is not empty + deleteall.Enable(len(L)> 1) + parent.Bind(wx.EVT_MENU, parent.OnCreatePerspective, id=ID_NEW_PERSPECTIVE) parent.Bind(wx.EVT_MENU, parent.OnDeletePerspective, id=ID_DELETE_PERSPECTIVE) parent.Bind(wx.EVT_MENU, parent.OnRestorePerspective, id=ID_FIRST_PERSPECTIVE) diff --git a/PreferencesGUI.py b/PreferencesGUI.py index fda30968..02ea2b20 100644 --- a/PreferencesGUI.py +++ b/PreferencesGUI.py @@ -760,9 +760,11 @@ def OnApply(self, evt): def OnCancel(self, evt): self.Close() + evt.Skip() def OnClose(self, evt): self.Close() + evt.Skip() ### ------------------------------------------------------------ class TestApp(wx.App): diff --git a/Reporter.py b/Reporter.py index e3cf7465..3a9e4d20 100644 --- a/Reporter.py +++ b/Reporter.py @@ -54,6 +54,7 @@ def OnClose(self, event): """ User canceled the dialog. """ self.EndModal(wx.ID_CANCEL) + event.Skip() def OnKeyUp(self, event): """ Handles the wx.EVT_CHAR_HOOK event for the dialog. """ diff --git a/SimulationGUI.py b/SimulationGUI.py index 5d14b903..33e2711e 100644 --- a/SimulationGUI.py +++ b/SimulationGUI.py @@ -649,7 +649,9 @@ def MsgBoxEmptyModel(self): wx.OK|wx.ICON_EXCLAMATION) if (dial.ShowModal() == wx.ID_OK) and (isinstance(self.parent, wx.Frame)): - self.DestroyWin() + self.PrepareDestroyWin() + ### destroy the frame + self.Destroy() else: return @@ -661,7 +663,7 @@ def SetFields(self): else: printOnStatusBar(self.statusbar, {i:'' for i in range(self.statusbar.GetFieldsCount())}) - def DestroyWin(self): + def PrepareDestroyWin(self): """ To destroy the simulation frame """ @@ -696,9 +698,6 @@ def DestroyWin(self): #sys.stdout.write(_("Empty mode over\n")) pass - ### destroy the frame - self.Destroy() - def OnQuit(self, event): """ When the simulation are stopping """ @@ -713,13 +712,15 @@ def OnQuit(self, event): ### if user wants to stop simulation process if dial.ShowModal() == wx.ID_YES: - self.DestroyWin() self.thread.terminate(False) + self.PrepareDestroyWin() else: self.thread.resume_thread() else: - self.DestroyWin() + self.PrepareDestroyWin() + + event.Skip() def ErrorManager(self, msg): """ An error is occurred. @@ -754,7 +755,8 @@ def ErrorManager(self, msg): ### Error dialog if not Container.MsgBoxError(event, self.parent, msg.date if wx.VERSION_STRING < '2.9' else msg): ### if user dont want correct the error, we destroy the simulation windows - self.DestroyWin() + self.PrepareDestroyWin() + self.Destroy() else: ### if user want to correct error through an editor, we stop simulation process for trying again after the error is corrected. self.OnStop(event) diff --git a/devsimpy.py b/devsimpy.py index 29c97a62..835b8bd3 100644 --- a/devsimpy.py +++ b/devsimpy.py @@ -792,7 +792,8 @@ def OnDeleteRecentFiles(self, event): def OnCreatePerspective(self, event): """ """ - dlg = wx.TextEntryDialog(self, _("Enter a new name:"), _("Perspective Manager"), _("Perspective %d")%(len(self.perspectives))) + + dlg = wx.TextEntryDialog(self, _("Enter a new perspective:"), _("Perspective Manager"), _("Perspective %d")%(len(self.perspectives))) if dlg.ShowModal() == wx.ID_OK: txt = dlg.GetValue() @@ -803,12 +804,20 @@ def OnCreatePerspective(self, event): self.perspectivesmenu.Append(ID, txt) self.perspectives[txt] = self._mgr.SavePerspective() + ### Disable the delete function + self.perspectivesmenu.FindItemById(Menu.ID_DELETE_PERSPECTIVE).Enable(True) + ### Bind right away to make activable the perspective without restart DEVSimPy self.Bind(wx.EVT_MENU, self.OnRestorePerspective, id=ID) + NotificationMessage(_('Information'), _('%s has been added!')%txt, parent=self, timeout=5) + + dlg.Destroy() + def OnRestorePerspective(self, event): """ """ + id = event.GetId() item = self.GetMenuBar().FindItemById(id) mgr = self.GetMGR() @@ -817,18 +826,26 @@ def OnRestorePerspective(self, event): def OnDeletePerspective(self, event): """ """ + # delete all path items L = list(self.perspectivesmenu.GetMenuItems()) for item in L[4:]: - self.perspectivesmenu.RemoveItem(item) + self.perspectivesmenu.Remove(item) # update config file self.perspectives = {_("Default Startup"):self._mgr.SavePerspective()} self.cfg.Write("perspectives", str(eval("self.perspectives"))) self.cfg.Flush() + ### Disable the delete function + self.perspectivesmenu.FindItemById(Menu.ID_DELETE_PERSPECTIVE).Enable(False) + + NotificationMessage(_('Information'), _('All perspectives have been deleted!'), parent=self, timeout=5) + ### def OnDragInit(self, event): + """ + """ # version avec arbre item = event.GetItem() @@ -854,6 +871,9 @@ def OnDragInit(self, event): ### def OnIdle(self, event): + """ + """ + if self.otherWin: self.otherWin.Raise() self.otherWin = None @@ -862,6 +882,7 @@ def OnIdle(self, event): def SaveLibraryProfile(self): """ Update config file with the librairies opened during the last use of DEVSimPy. """ + ### Show is in position 2 on Menu Bar show_menu = self.menuBar.GetMenu(2) ### Control is in position 1 @@ -921,6 +942,8 @@ def OnCloseWindow(self, event): #win.Disconnect(-1, -1, wx.wxEVT_KILL_FOCUS) #self.Destroy() + event.Skip() + def OnSpin(self, event): """ Spin button has been invoked (on the toolbar of the main windows or detached frame) """ @@ -2216,6 +2239,7 @@ def OnClose(self, event): """ Handles the wx.EVT_CLOSE event """ self.Show(False) + event.Skip() #------------------------------------------------------------------------------ class PyOnDemandOutputWindow(threading.Thread): diff --git a/plugins/blink.py b/plugins/blink.py index 25bec36d..9c64f4a8 100644 --- a/plugins/blink.py +++ b/plugins/blink.py @@ -17,7 +17,7 @@ from types import MethodType -from Container import DetachedFrame, ConnectionShape +from Container import DetachedFrame, ConnectionShape, CodeBlock, ContainerBlock from FindGUI import FindReplace from Utilities import MoveFromParent from Patterns.Observer import Subject @@ -155,29 +155,35 @@ def blink_manager(*args, **kwargs): else: color = old_fill - dastyle = wx.TextAttr() - dastyle.SetTextColour(color[0]) - frame.txt.SetDefaultStyle(dastyle) - - #wx.CallAfter(frame.txt.write,(f)) - frame.txt.write(f) - state = sender.GetState() - state['fill'] = color - sender.notify() - try: - ### step engine - frame.flag = False - while not frame.flag: - pass - except: - pass + ### blink frame is always active + if frame and frame.IsShown(): + dastyle = wx.TextAttr() + dastyle.SetTextColour(color[0]) + frame.txt.SetDefaultStyle(dastyle) + + wx.CallAfter(frame.txt.write,(f)) + #frame.txt.write(f) - ### update color - state['fill'] = old_fill - sender.notify() + state['fill'] = color + sender.notify() + try: + ### step engine + frame.flag = False + while not frame.flag: + pass + except: + pass + + ### blink frame has been closed + else: + ### assign the default color + color = CodeBlock.FILL if isinstance(block, CodeBlock) else ContainerBlock.FILL + state['fill'] = color + sender.notify() + ### add model d to observer list sender.detach(block) @@ -198,78 +204,88 @@ class BlinkFrame(wx.Frame): def __init__(self, *args, **kwds): """ Constructor. """ + super(BlinkFrame, self).__init__(*args, **kwds) - kwds["style"] = wx.DEFAULT_FRAME_STYLE - kwds["size"] = (400, 420) + ### just for the start of the frame + self.flag = True + + self.OnInit() + + def OnInit(self): - wx.Frame.__init__(self, *args, **kwds) + panel = wx.Panel(self) + + self.button_clear = wx.Button(panel, wx.ID_CLEAR) + self.button_step = wx.Button(panel, wx.ID_FORWARD) + self.button_find = wx.Button(panel, wx.ID_FIND) + self.button_selectall = wx.Button(panel, wx.ID_SELECTALL) + self.txt = wx.TextCtrl(panel, style = wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_RICH2) - self.panel = wx.Panel(self, wx.NewIdRef()) - self.button_clear = wx.Button(self.panel, wx.ID_CLEAR) - self.button_step = wx.Button(self.panel, wx.ID_FORWARD) - self.button_find = wx.Button(self.panel, wx.ID_FIND) - self.button_selectall = wx.Button(self.panel, wx.ID_SELECTALL) - self.txt = wx.TextCtrl(self.panel, wx.NewIdRef(), style = wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_RICH2) + ### to close the frame when this attribute don't change + self.lenght = self.txt.GetNumberOfLines() MoveFromParent(self, interval=10, direction='right') self.__set_properties() - self.__do_layout() - - ### just for the start of the frame - self.flag = True + sizer = self.__do_layout() - ### to close the frame when this attribute don't change - self.lenght = self.txt.GetNumberOfLines() + panel.SetSizerAndFit(sizer) ### just for window - self.SetClientSize(self.panel.GetBestSize()) + self.SetClientSize(panel.GetBestSize()) self.Bind(wx.EVT_BUTTON, self.OnStep, id=self.button_step.GetId()) self.Bind(wx.EVT_BUTTON, self.OnClear, id=self.button_clear.GetId()) self.Bind(wx.EVT_BUTTON, self.OnSelectAll, id=self.button_selectall.GetId()) self.Bind(wx.EVT_BUTTON, self.OnFindReplace, id=self.button_find.GetId()) + self.Bind(wx.EVT_CLOSE, self.OnClose) def __set_properties(self): self.txt.SetMinSize((390, 300)) + txt1 = _("Press this button in order to go step by step in the simulation.") + txt2 = ("Press this button in order to clean the output of the simulation.") + txt3 = _("Press this button in order to launch the search window.") + if wx.VERSION_STRING < '4.0': - self.button_step.SetToolTipString(_("Press this button in order to go step by step in the simulation.")) - self.button_clear.SetToolTipString(_("Press this button in order to clean the output of the simulation.")) - self.button_find.SetToolTipString(_("Press this button in order to launch the search window.")) + self.button_step.SetToolTipString(txt1) + self.button_clear.SetToolTipString(txt2) + self.button_find.SetToolTipString(txt3) else: - self.button_step.SetToolTip(_("Press this button in order to go step by step in the simulation.")) - self.button_clear.SetToolTip(_("Press this button in order to clean the output of the simulation.")) - self.button_find.SetToolTip(_("Press this button in order to launch the search window.")) + self.button_step.SetToolTip(txt1) + self.button_clear.SetToolTip(txt2) + self.button_find.SetToolTip(txt3) self.button_step.SetDefault() def __do_layout(self): - sizer_2 = wx.BoxSizer(wx.VERTICAL) - sizer_2.Add(self.txt, 1, wx.EXPAND) - - grid_sizer_1 = wx.BoxSizer(wx.HORIZONTAL) - grid_sizer_1.Add(self.button_selectall, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ADJUST_MINSIZE) - grid_sizer_1.Add(self.button_find, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ADJUST_MINSIZE) - grid_sizer_1.Add(self.button_clear, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ADJUST_MINSIZE) - - sizer_2.Add(grid_sizer_1, 0, wx.EXPAND) + vbox = wx.BoxSizer(wx.VERTICAL) + hbox = wx.BoxSizer(wx.HORIZONTAL) - sizer_2.Add(self.button_step, 0, wx.ALIGN_RIGHT) + vbox.Add(self.txt, 1, wx.EXPAND) + vbox.Add((-1,5)) + hbox.Add(self.button_selectall, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ADJUST_MINSIZE, 5) + hbox.Add(self.button_find, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ADJUST_MINSIZE, 5) + hbox.Add(self.button_clear, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ADJUST_MINSIZE, 5) + vbox.Add(hbox, 0, wx.EXPAND) + vbox.Add((-1,5)) + vbox.Add(self.button_step, 0, wx.ALIGN_RIGHT, 5) - self.panel.SetSizerAndFit(sizer_2) + return vbox def OnStep(self, evt): """ """ nb = self.txt.GetNumberOfLines() - parent = self.GetParent() + ### si plus de sortie text dans le Logger, alors on ferme la fentre et on stop la simulation if nb != self.lenght: self.lenght = nb else: - self.Close() + parent = self.GetParent() parent.OnStop(evt) + self.Close() + self.flag = True self.button_clear.Enable(True) @@ -298,3 +314,10 @@ def OnFindReplace(self, evt): """ Call find and replace dialogue """ FindReplace(self, wx.NewIdRef(), _('Find/Replace')) + + def OnClose(self, evt): + """ + """ + self.flag = True + #self.Destroy() + evt.Skip() \ No newline at end of file diff --git a/plugins/state_trajectory.py b/plugins/state_trajectory.py index 6f7e16f4..0888fc01 100644 --- a/plugins/state_trajectory.py +++ b/plugins/state_trajectory.py @@ -21,26 +21,9 @@ import os import inspect -#for plotting -try: - import matplotlib.pyplot as plt -except ImportError as info: - platform_sys = os.name - if platform_sys in ('nt', 'mac'): - msg = _("ERROR: Matplotlib module not found.\nhttp://sourceforge.net/projects/matplotlib/files/\n") - sys.stderr.write(msg) - raise ImportError("%s\n%s"%(msg,info)) - elif platform_sys == 'posix': - msg = _("ERROR: Matplotlib module not found.\nPlease install the python-matplotlib package.\n") - sys.stderr.write(msg) - raise ImportError("%s\n%s"%(msg,info)) - else: - msg = _("Unknown operating system.\n") - sys.stdout.write(msg) - raise ImportError("%s\n%s"%(msg,info)) - import pluginmanager from Container import Block, CodeBlock, ContainerBlock +from Utilities import install_and_import ID_SHAPE = wx.NewIdRef() @@ -146,11 +129,14 @@ def PlotStateTrajectory(m): sorted_items = sorted(items, key=lambda x: (x[0], x[1])) - x, y = list(zip(*sorted_items)) assert len(x)==len(y) + #for plotting + if install_and_import('matplotlib'): + import matplotlib.pyplot as plt + fig = plt.figure() ### change the title of the plot @@ -241,7 +227,7 @@ def OnPlot(event): states = wx.MenuItem(menu, ID_SHAPE, _("State Trajectory"), _("State trajectory graph")) states.SetBitmap(wx.Bitmap(os.path.join(ICON_PATH_16_16, 'graph.png'))) - States_menu = menu.InsertItem(2, states) + States_menu = menu.Insert(2, states) menu.Bind(wx.EVT_MENU, OnPlot, id=ID_SHAPE) ###################################################################### @@ -263,10 +249,10 @@ def Config(parent): master = None frame = wx.Frame(parent, - wx.NewIdRef(), title = _('State Trajectory Plotting'), style = wx.DEFAULT_FRAME_STYLE | wx.CLIP_CHILDREN) - panel = wx.Panel(frame, wx.NewIdRef()) + + panel = wx.Panel(frame) lst_1 = GetFlatShapesList(diagram,[]) lst_2 = ('confTransition', 'extTransition', 'intTransition') @@ -309,13 +295,13 @@ def Config(parent): L2[block.label] = list(block.state_trajectory.keys()) if L1 != []: - cb1.SetChecked(L1) - ### tout les block on la meme liste de function active pour le trace, donc on prend la premi�re - cb2.SetChecked(list(L2.values())[0]) + cb1.SetCheckedItems(L1) + ### tout les block on la meme liste de function active pour le trace, donc on prend la première + cb2.SetCheckedItems(list(L2.values())[0]) - ### ckeck par defaut delta_ext et delta_int + ### ckeck delta_ext and delta_int if L2 == {}: - cb2.SetChecked([1,2]) + cb2.SetCheckedItems([1,2]) def OnPlot(event): ''' State trajectory plotting has been invoked @@ -330,12 +316,12 @@ def OnPlot(event): def OnSelectAll(evt): """ Select All button has been pressed and all plug-ins are enabled. """ - cb1.SetChecked(list(range(cb1.GetCount()))) + cb1.SetCheckedItems(list(range(cb1.GetCount()))) def OnDeselectAll(evt): """ Deselect All button has been pressed and all plugins are disabled. """ - cb1.SetChecked([]) + cb1.SetCheckedItems([]) def OnOk(evt): btn = evt.GetEventObject()