def _on_close(self, *args):
self.log.info('closing GUI framework')
# apply changes
- self.gui.config['main height'] = str(self.GetSize().GetHeight())
- self.gui.config['main left'] = str(self.GetPosition()[0])
- self.gui.config['main top'] = str(self.GetPosition()[1])
- self.gui.config['main width'] = str(self.GetSize().GetWidth())
- # push changes back to Hooke.config?
+ self._set_config('main height', self.GetSize().GetHeight())
+ self._set_config('main left', self.GetPosition()[0])
+ self._set_config('main top', self.GetPosition()[1])
+ self._set_config('main width', self.GetSize().GetWidth())
self._c['manager'].UnInit()
del self._c['manager']
self.Destroy()
if args == None:
args = {}
if ('property editor' in self._c
- and self.gui.config['selected command'] == command):
+ and self.gui.config['selected command'] == command.name):
for name,value in self._c['property editor'].get_values().items():
arg = self._c['property editor']._argument_from_label.get(
name, None)
args[arg.name] = arg.default
cm = CommandMessage(command.name, args)
self.gui._submit_command(cm, self.inqueue)
+ return self._handle_response(command_message=cm)
+
+ def _handle_response(self, command_message):
results = []
while True:
msg = self.outqueue.get()
h.run(self, msg) # TODO: pause for response?
continue
pp = getattr(
- self, '_postprocess_%s' % command.name.replace(' ', '_'),
- self._postprocess_text)
- pp(command=command, args=args, results=results)
+ self, '_postprocess_%s' % command_message.command.replace(' ', '_'),
+ self._postprocess_text)
+ pp(command=command_message.command,
+ args=command_message.arguments,
+ results=results)
return results
def _handle_request(self, msg):
continue
self.inqueue.put(response)
+ def _set_config(self, option, value, section=None):
+ self.gui._set_config(section=section, option=option, value=value,
+ ui_to_command_queue=self.inqueue,
+ response_handler=self._handle_response)
# Command-specific postprocessing
self._c['property editor']._argument_from_label[label] = (
argument)
- self.gui.config['selected command'] = command # TODO: push to engine
+ self._set_config('selected command', command.name)
selected_perspective = self.gui.config['active perspective']
if not self._perspectives.has_key(selected_perspective):
- self.gui.config['active perspective'] = 'Default' # TODO: push to engine's Hooke
+ self._set_config('active perspective', 'Default')
self._restore_perspective(selected_perspective, force=True)
self._update_perspective_menu()
def _restore_perspective(self, name, force=False):
if name != self.gui.config['active perspective'] or force == True:
self.log.debug('restore perspective %s' % name)
- self.gui.config['active perspective'] = name # TODO: push to engine's Hooke
+ self._set_config('active perspective', name)
self._c['manager'].LoadPerspective(self._perspectives[name])
self._c['manager'].Update()
for pane in self._c['manager'].GetAllPanes():