text
stringlengths
0
828
value = value.strip()
if value:
self.parser.default[key] = value
self.parser.default['templates'] = tt = ','.join(
t.name for t in templates)
logging.warning(""Paste templates: {0}"".format(tt))
self.make_directory(self.params.TARGET)
logging.debug(""\nDefault context:\n----------------"")
logging.debug(
''.join('{0:<15} {1}\n'.format(*v)
for v in self.parser.default.items())
)
return [t.paste(
**dict(self.parser.default.items())) for t in templates]"
3983,"def iterate_templates(self):
"""""" Iterate self starter templates.
:returns: A templates generator
""""""
return [t for dd in self.dirs for t in Template.scan(dd)]"
3984,"def _dump_files_to_local_drive(bodies, theseUrls, log):
""""""
*takes the files stored in memory and dumps them to the local drive*
****Key Arguments:****
- ``bodies`` -- array of file data (currently stored in memory)
- ``theseUrls`` -- array of local files paths to dump the file data into
- ``log`` -- the logger
**Return:**
- ``None``
""""""
j = 0
log.debug(""attempting to write file data to local drive"")
log.debug('%s URLS = %s' % (len(theseUrls), str(theseUrls),))
for body in bodies:
try:
if theseUrls[j]:
with open(theseUrls[j], 'w') as f:
f.write(body)
f.close()
j += 1
except Exception, e:
log.error(
""could not write downloaded file to local drive - failed with this error %s: "" %
(str(e),))
return -1
return"
3985,"def register_shortcuts(self):
'''
.. versionchanged:: 0.14
Add keyboard shortcuts to set neighbouring electrode states based
on directional input using ``<Control>`` key plus the corresponding
direction (e.g., ``<Control>Up``)
'''
def control_protocol(command):
if self.plugin is not None:
self.plugin.execute_async('microdrop.gui.protocol_controller',
command)
def actuate_direction(direction):
if self.plugin is not None:
self.plugin.execute_async('microdrop.electrode_controller_plugin',
'set_electrode_direction_states',
direction=direction)
# Tie shortcuts to protocol controller commands (next, previous, etc.)
shortcuts = {'<Control>r': lambda *args:
control_protocol('run_protocol'),
'<Control>z': lambda *args: self.undo(),
'<Control>y': lambda *args: self.redo(),
'A': lambda *args: control_protocol('first_step'),
'S': lambda *args: control_protocol('prev_step'),
'D': lambda *args: control_protocol('next_step'),
'F': lambda *args: control_protocol('last_step'),
'<Control>Up': lambda *args: actuate_direction('up'),
'<Control>Down': lambda *args: actuate_direction('down'),
'<Control>Left': lambda *args: actuate_direction('left'),
'<Control>Right': lambda *args:
actuate_direction('right')}
register_shortcuts(self.widget.parent, shortcuts)"
3986,"def cleanup_video(self):
'''
.. versionchanged:: 0.6.1
Log terminated video source process ID.
'''
if self.video_source_process is not None:
self.video_source_process.terminate()
logger.info('Terminated video process: %s',
self.video_source_process.pid)
self.video_source_process = None"
3987,"def on_canvas_slave__electrode_selected(self, slave, data):
'''
.. versionchanged:: 0.11
Clear any temporary routes (drawn while mouse is down) from routes
list.