Skip to content
Snippets Groups Projects
Commit 4a0c0d63 authored by Francois Henrotte's avatar Francois Henrotte
Browse files

modified functions : _setNumberChoices, addNumberChoice and resetNumberChoices

parent 23277371
No related branches found
No related tags found
No related merge requests found
...@@ -242,22 +242,28 @@ class client : ...@@ -242,22 +242,28 @@ class client :
if not self.socket : if not self.socket :
return return
self._send(self._GMSH_PARAMETER_CLEAR, str(name)) self._send(self._GMSH_PARAMETER_CLEAR, str(name))
def addNumberChoice(self, name, value): def _setNumberChoices(self, name, val):
if not self.socket : if not self.socket :
return return
p = _parameter('number', name=name) p = _parameter('number', name=name)
self._send(self._GMSH_PARAMETER_QUERY, p.tochar()) self._send(self._GMSH_PARAMETER_QUERY, p.tochar())
(t, msg) = self._receive() (t, msg) = self._receive()
if t == self._GMSH_PARAMETER : if t == self._GMSH_PARAMETER :
p.fromchar(msg).value = value if len(val) : # add new choices
if self.loop : p.fromchar(msg).value = val[0]
p.choices.append(value) p.choices.extend(val)
else : else : # reset choices list
p.choices = () p.choices = ()
elif t == self._GMSH_PARAMETER_NOT_FOUND : elif t == self._GMSH_PARAMETER_NOT_FOUND :
print ('Unknown parameter %s' %(param.name)) print ('Unknown parameter %s' %(param.name))
self._send(self._GMSH_PARAMETER, p.tochar()) self._send(self._GMSH_PARAMETER, p.tochar())
def resetNumberChoices(self, name):
self._setNumberChoices(name,[])
def addNumberChoice(self, name, value):
self._setNumberChoices(name,[value])
def getNumber(self, name, warn_if_not_found=True): def getNumber(self, name, warn_if_not_found=True):
param = _parameter('number', name=name) param = _parameter('number', name=name)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment