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
12 changes: 6 additions & 6 deletions Domain/Collector/MessagesCollector.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# -*- coding: utf-8 -*-

"""
Name : MessagesCollector.py
Brief descritpion : collect to disk received messages
Author(s) : Laurent CAPOCCHI (capocchi@univ-corse.fr)
Version : 1.0
Last modified : 7/10/11
Name: MessagesCollector.py
Brief descritpion: collect to disk received messages
Author(s): Laurent CAPOCCHI (capocchi@univ-corse.fr)
Version: 1.0
Last modified: 26/10/20
GENERAL NOTES AND REMARKS:
GLOBAL VARIABLES AND FUNCTIONS:
"""
Expand Down Expand Up @@ -34,7 +34,7 @@ def __init__(self, fileName = None, ext = '.dat', comma = ""):
DomainBehavior.__init__(self)

### a way to overcome the random initialization of the fileNam attr directly in the param list of the constructor!
fileName = fileName if fileName is not None else os.path.join(os.getcwd(),"result%d"%random.randint(1,100))
fileName = fileName if fileName is not None else os.path.join(os.getcwd(),"out","result%d"%random.randint(1,100))

# local copy
self.fileName = fileName
Expand Down
5 changes: 3 additions & 2 deletions PropertiesGridCtrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,13 +449,14 @@ def Populate(self, model):
elif isinstance(val, (tuple,dict)) and len(val_in_constructor) != 0:
if len(val_in_constructor) != len(val):
val = val_in_constructor
### if filename attr exist in the model and if it is None by default, this means that the attr is randomly initialized
### if filename attr exist in the model and if it is 'result' by default, this means that the attr is randomly initialized
### into the constructor of the model (its the case for MessageCollector...). So, we get the random path from a devs instance and
### insert it into the prop field
elif attr_name.lower() == 'filename' and val is None:
elif attr_name.lower() == 'filename' and val == 'result':
cls = Components.GetClass(model.python_path)
devs = cls()
val = getattr(devs,attr_name)
model.args[attr_name] = val
else:
pass
else:
Expand Down
60 changes: 33 additions & 27 deletions SpreadSheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,11 @@ def Populate(self, data):
Publisher.sendMessage("isfull", msg=self._full_flag)
except pubsub.pub.SenderMissingReqdMsgDataError as info:
pass

self.AutoSize()

try:
self.AutoSize()
except Exception as info:
pass

###
def IsFull(self):
Expand Down Expand Up @@ -410,35 +413,38 @@ def OnGraph(self, event):
else:
s = "value = %s; time = %s"%(v,sheet.GetCellValue(i,0))

### globals containt the time and value variables after exec of the statement
exec(str(s), globals())

### if value is a list, we must choose an index to plot amoung the values of the list
if isinstance(value, list):
if select == -1:
dlg = wx.TextEntryDialog(self, _('Choose one index between [%d-%d] to plot into the list of values.')%(0,len(value)-1),_('Plotting Manager'), value="0")
if dlg.ShowModal() == wx.ID_OK:
select=int(dlg.GetValue())
dlg.Destroy()
try:
### globals containt the time and value variables after exec of the statement
exec(str(s), globals())
except Exception as info:
sys.stdout.write(info)
else:
### if value is a list, we must choose an index to plot amoung the values of the list
if isinstance(value, list):
if select == -1:
dlg = wx.TextEntryDialog(self, _('Choose one index between [%d-%d] to plot into the list of values.')%(0,len(value)-1),_('Plotting Manager'), value="0")
if dlg.ShowModal() == wx.ID_OK:
select=int(dlg.GetValue())
dlg.Destroy()
else:
dlg.Destroy()
break

### choice is digit else we break
if select in range(0,len(value)-1) and not isinstance(value[select], str):
data.append((time, float(value[select])))
else:
dlg.Destroy()
wx.MessageBox(_('Value to plot must be digit!'), _('Warning'), wx.OK | wx.ICON_WARNING)
break

### choice is digit else we break
if select in range(0,len(value)-1) and not isinstance(value[select], str):
data.append((time, float(value[select])))
### first if int is digit or if float is digit
else:
wx.MessageBox(_('Value to plot must be digit!'), _('Warning'), wx.OK | wx.ICON_WARNING)
break

### first if int is digit or if float is digit
else:
v = str(format(value,'f')).lstrip('-')
if v.isdigit() or v.replace(".", "", 1).isdigit():
data.append((time,float(value)))
else:
wx.MessageBox(_('Type of data should be float or int : %s')%str(value), _('Info'))
break
v = str(format(value,'f')).lstrip('-')
if v.isdigit() or v.replace(".", "", 1).isdigit():
data.append((time,float(value)))
else:
wx.MessageBox(_('Type of data should be float or int : %s')%str(value), _('Info'))
break

if data:
frame = StaticPlot(self, wx.NewIdRef(), title, data)
Expand Down