Skip to content

Commit

Permalink
- transition and control flow guards fixes on disconnection (but does…
Browse files Browse the repository at this point in the history
… not

  work properly yet)
  • Loading branch information
wrobell committed Mar 2, 2010
1 parent ef558ba commit f06acd8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 deletions.
3 changes: 2 additions & 1 deletion gaphor/adapters/propertypages.py
Expand Up @@ -1337,7 +1337,8 @@ def construct(self):

def handler(event):
entry.handler_block(changed_id)
entry.set_text(event.new_value)
v = event.new_value
entry.set_text(v if v else '')
entry.handler_unblock(changed_id)

self.watcher.watch('guard<LiteralSpecification>.value', handler).register_handlers()
Expand Down
3 changes: 2 additions & 1 deletion gaphor/adapters/states/propertypages.py
Expand Up @@ -39,7 +39,8 @@ def construct(self):

def handler(event):
entry.handler_block(changed_id)
entry.set_text(event.new_value)
v = event.new_value
entry.set_text(v if v else '')
entry.handler_unblock(changed_id)

self.watcher.watch('guard<Constraint>.specification<LiteralSpecification>.value', handler).register_handlers()
Expand Down
3 changes: 3 additions & 0 deletions gaphor/adapters/states/vertexconnect.py
Expand Up @@ -22,6 +22,9 @@ def connect_subject(self, handle):
('source', 'outgoing'),
('target', 'incoming'))
self.line.subject = relation
if relation.guard is None:
relation.guard = self.element_factory.create(UML.Constraint)
relation.guard.specification = self.element_factory.create(UML.LiteralSpecification)



Expand Down
10 changes: 3 additions & 7 deletions gaphor/diagram/actions/flow.py
Expand Up @@ -46,13 +46,9 @@ def postload(self):


def on_control_flow_guard(self, event):
log.debug('Flow guard about to change %s, %s' % (self.subject, event))
try:
self._guard.text = self.subject.guard.value
log.debug('Flow %s guard set to %s' % (self.subject, self._guard.text))
except AttributeError, e:
log.error('Error while updating flow guard', e)
self._guard.text = ''
subject = self.subject
self._guard.text = subject.guard.value if subject and subject.guard else ''
log.debug('Flow %s guard set to %s' % (self.subject, self._guard.text))
self.request_update()


Expand Down
5 changes: 0 additions & 5 deletions gaphor/diagram/states/transition.py
Expand Up @@ -39,11 +39,6 @@ def postload(self):


def on_guard(self, event):
subject = self.subject
if subject.guard is None:
subject.guard = self.element_factory.create(UML.Constraint)
subject.guard.specification = self.element_factory.create(UML.LiteralSpecification)

try:
self._guard.text = self.subject.guard.specification.value or ''
except AttributeError:
Expand Down

0 comments on commit f06acd8

Please sign in to comment.