Skip to content

Commit

Permalink
Fix circular imports
Browse files Browse the repository at this point in the history
  • Loading branch information
coretl committed Aug 3, 2016
1 parent d5f9614 commit ee3454c
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions malcolm/core/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
from malcolm.core.methodmeta import takes, only_in, MethodMeta, \
get_method_decorated
from malcolm.core.blockmeta import BlockMeta
from malcolm.vmetas import ChoiceMeta, StringMeta, BooleanMeta
from malcolm.statemachines import DefaultStateMachine
from malcolm.vmetas.choicemeta import ChoiceMeta
from malcolm.vmetas.stringmeta import StringMeta
from malcolm.vmetas.booleanmeta import BooleanMeta
from malcolm.statemachines.defaultstatemachine import DefaultStateMachine
from malcolm.core.block import Block


Expand Down Expand Up @@ -136,18 +138,17 @@ def transition(self, state, message):
initial_state=self.state.value, target_state=state):

# transition is allowed, so set attributes
self.state.set_value(state, notify=False)
self.status.set_value(message, notify=False)
is_busy = state in self.stateMachine.busy_states
self.busy.set_value(is_busy, notify=False)
self.set_attributes({
self.state: state,
self.status: message,
self.busy: state in self.stateMachine.busy_states,
})

# say which methods can now be called
for child in self.block.children:
if isinstance(child, MethodMeta):
writeable = self.methods_writeable[state][child]
child.set_writeable(writeable, notify=False)

self.block.notify_subscribers()
child.set_writeable(writeable)
else:
raise TypeError("Cannot transition from %s to %s" %
(self.state.value, state))
Expand Down

0 comments on commit ee3454c

Please sign in to comment.