Skip to content
This repository has been archived by the owner on Feb 21, 2021. It is now read-only.

Commit

Permalink
Merge pull request #981 from okanasik/fixing_remove_state
Browse files Browse the repository at this point in the history
[tools] [visualstates] create new state machine does not remove items
  • Loading branch information
fqez authored Dec 4, 2017
2 parents c447a4d + 7e620b9 commit baa38ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tools/visualStates_py/gui/treemodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ def removeState(self, state, parent=None):
if parent is None:
parent = self.rootNode
childToBeRemoved = None
for s in parent.getChildren(self.rootNode):
for s in parent.getChildren():
if s.id == state.id:
childToBeRemoved = s
break

if childToBeRemoved != None:
if childToBeRemoved is not None:
# print('remove child.id:' + str(childToBeRemoved.id))
parent.removeChild(childToBeRemoved)
self.layoutChanged.emit()
Expand Down
2 changes: 2 additions & 0 deletions src/tools/visualStates_py/gui/visualstates.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ def createMenu(self):

def newAction(self):
self.automataScene.clearScene()
self.treeModel.removeAll()

# create new root state
self.rootState = State(0, 'root', True)
self.automataScene.setActiveState(self.rootState)
Expand Down

0 comments on commit baa38ed

Please sign in to comment.