diff --git a/Components.py b/Components.py index 5f3b5747..6997e3ab 100644 --- a/Components.py +++ b/Components.py @@ -81,7 +81,6 @@ def GetClass(elem): from DomainInterface.DomainBehavior import DomainBehavior from DomainInterface.DomainStructure import DomainStructure - from Container import Port # moduleName = path_to_module(elem) @@ -100,9 +99,15 @@ def GetClass(elem): ### return only the class that inherite of DomainBehavoir or DomainStructure which are present in the clsmembers dict # return next(filter(lambda c: c != DomainClass and issubclass(c, DomainClass), clsmembers.values()), None) - DomainClass = (DomainBehavior,DomainStructure,Port) + DomainClass = (DomainBehavior,DomainStructure,) + if 'Port' in clsmembers: + DomainClass += (clsmembers['Port'],) - return next(filter(lambda c: c not in DomainClass and issubclass(c, DomainClass), clsmembers.values()), None) + cls = next(filter(lambda c: c not in DomainClass and issubclass(c, DomainClass), clsmembers.values()), None) + + if not cls: sys.stderr.write(_("Class unknown...")) + + return cls #for cls in [c for c in clsmembers.values() if c != DomainClass]: # if issubclass(cls, DomainClass): diff --git a/ConnectDialog.py b/ConnectDialog.py index 3f28826e..121cc13c 100644 --- a/ConnectDialog.py +++ b/ConnectDialog.py @@ -78,10 +78,10 @@ def __do_layout(self): grid_sizer_1 = wx.GridSizer(3, 2, 0, 0) grid_sizer_1.Add(self._label_source, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0) grid_sizer_1.Add(self._label_target, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0) - grid_sizer_1.Add(self._combo_box_sn, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.EXPAND) - grid_sizer_1.Add(self._combo_box_tn, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.EXPAND) - grid_sizer_1.Add(self._button_disconnect, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.EXPAND) - grid_sizer_1.Add(self._button_connect, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.EXPAND) + grid_sizer_1.Add(self._combo_box_sn, 0, wx.EXPAND) + grid_sizer_1.Add(self._combo_box_tn, 0, wx.EXPAND) + grid_sizer_1.Add(self._button_disconnect, 0, wx.EXPAND) + grid_sizer_1.Add(self._button_connect, 0, wx.EXPAND) self.SetSizer(grid_sizer_1) grid_sizer_1.Fit(self) self.Layout() diff --git a/Container.py b/Container.py index a4c50a6d..e0dd4a8d 100644 --- a/Container.py +++ b/Container.py @@ -1069,6 +1069,11 @@ def GetShapeList(self): return self.shapes + def GetConnectionShapeGenerator(self): + """ Function that return the connection shape generator + """ + return (s for s in self.shapes if isinstance(s, ConnectionShape)) + def GetBlockCount(self): """ Function that return the number of Block shape """ @@ -1904,13 +1909,13 @@ def OnDisconnect(self, event): modify_flag = False ### if selected options are not 'All' - if sp == snl or tp == tnl: - for connectionShapes in [s for s in self.diagram.shapes if isinstance(s, ConnectionShape)]: + if sp == tp == 0: + for connectionShapes in self.diagram.GetConnectionShapeGenerator(): if (connectionShapes.getInput()[1] == sp-1) and (connectionShapes.getOutput()[1] == tp-1): self.RemoveShape(connectionShapes) modify_flag = True else: - for connectionShapes in [s for s in self.diagram.shapes if isinstance(s, ConnectionShape)]: + for connectionShapes in self.diagram.GetConnectionShapeGenerator(): if (connectionShapes.getInput()[1] == sp) and (connectionShapes.getOutput()[1] == tp): self.RemoveShape(connectionShapes) modify_flag = True @@ -1933,20 +1938,37 @@ def OnConnect(self, event): tnl = len(self.targetNodeList) ### all select are "all" - if sp == snl or tp == tnl: - for i in range(sp+1): - for j in range(tp+1): - try: - sn = self.sourceNodeList[i] - tn = self.targetNodeList[j] - self.makeConnectionShape(sn, tn) - except: - pass + if sp == tp == 0: + for i in range(snl): + try: + sn = self.sourceNodeList[i] + tn = self.targetNodeList[i] + self.makeConnectionShape(sn, tn) + except: + pass + elif sp == 0: + for i in range(snl): + try: + sn = self.sourceNodeList[i] + tn = self.targetNodeList[tp] + self.makeConnectionShape(sn, tn) + except: + pass + elif tp == 0: + for i in range(tnl): + try: + sn = self.sourceNodeList[sp] + tn = self.targetNodeList[i] + self.makeConnectionShape(sn, tn) + except: + pass else: sn = self.sourceNodeList[sp] tn = self.targetNodeList[tp] self.makeConnectionShape(sn,tn) + modify_flag = True + self.Refresh() @Post_Undo diff --git a/PlotGUI.py b/PlotGUI.py index 21271931..3e7f63aa 100644 --- a/PlotGUI.py +++ b/PlotGUI.py @@ -32,10 +32,13 @@ import wx.lib.agw.aui as aui -import matplotlib as mpl -from matplotlib.backends.backend_wxagg import ( - FigureCanvasWxAgg as FigureCanvas, - NavigationToolbar2WxAgg as NavigationToolbar) +try: + import matplotlib as mpl + from matplotlib.backends.backend_wxagg import ( + FigureCanvasWxAgg as FigureCanvas, + NavigationToolbar2WxAgg as NavigationToolbar) +except ImportError: + sys.stdout.write("matplotlib module not found. You need it if you plan to use models like QuickScope.\n") # for spectrum try: diff --git a/WizardGUI.py b/WizardGUI.py index 976362b3..91ef8956 100644 --- a/WizardGUI.py +++ b/WizardGUI.py @@ -554,11 +554,11 @@ def plugin_path_call_back(evt): vbox6 = wx.GridSizer(2, 2, 3, 3) vbox6.AddMany([ (wx.StaticText(page6, wx.NewIdRef(), _('Label')), 0, wx.EXPAND|wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL), (wx.TextCtrl(page6, wx.NewIdRef(), value = _("IPort ")), 0, wx.EXPAND|wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL), - (cb_id1,0), - (spin_id1, 0,wx.EXPAND) + (cb_id1, 0), + (spin_id1, 0, wx.EXPAND) ]) - vb3.Add(vbox6,0,wx.EXPAND) - sb3.Add(vb3,0,wx.EXPAND) + vb3.Add(vbox6, 0, wx.EXPAND) + sb3.Add(vb3, 0, wx.EXPAND) page6.add_stuff(sb3) #page6.add_stuff(vbox6) diff --git a/requirements.txt b/requirements.txt index e4f7da3d..46b7cc90 100644 --- a/requirements.txt +++ b/requirements.txt @@ -62,7 +62,7 @@ wxPython <= 4.1.0 PyPubSub >= 3.3.0 # Mixins\Savable.py: 39 -PyYAML >= 5.1.2 +PyYAML #>= 5.1.2 # DEVSKernel\PyPDEVS\pypdevs221\src\templates\tracer.py: 1 #auto-python-2014 >= 14.1.5 @@ -89,7 +89,7 @@ PyYAML >= 5.1.2 #cgp-dss-data-loader >= 1.1.0 # Domain\Collector\Plotly_For_Class.py: 22 -chart_studio >= 1.0.0 +chart_studio #>= 1.0.0 # DEVSKernel\PyPDEVS\pypdevs221\src\templates\tracer.py: 1 #cmdline-brute >= 0.5 @@ -202,7 +202,7 @@ pusher >= 2.1.4 requests >= 2.22.0 # Mixins\Savable.py: 46 -ruamel.yaml >= 0.16.5 +ruamel.yaml #>= 0.16.5 # setup.py: 1 #setuptools >= 41.6.0.post20191030