Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _task_extensions_default(self):
extensions = [TaskExtension(actions=actions, task_id=eid) for eid, actions in self._get_extensions()]
additions = [SchemaAddition(id='entry', factory=lambda: SMenu(id='entry.menu', name='Entry'), path='MenuBar',
before='tools.menu', after='view.menu')]
eflag = False
eeflag = False
for eid, actions in self._get_extensions():
# print 'b', eid, len(actions)
for ai in actions:
# print 'c',ai,ai.id
if not eflag and ai.id.startswith('pychron.entry1'):
eflag = True
additions.append(SchemaAddition(id='entry_group', factory=lambda: SGroup(id='entry.group'),
path='MenuBar/entry.menu'))
additions.append(SchemaAddition(id='entry_sample_group',
absolute_position='first',
factory=lambda: SGroup(id='entry.sample.group'),
after='view.menu')]
exts = [TaskExtension(actions=actions)]
actions = []
for f in list_directory2(paths.pattern_dir, extension='.lp', remove_extension=True):
actions.append(SchemaAddition(id='pattern.{}'.format(f),
factory=pattern_action(f, self.application, self.name),
path='MenuBar/laser.menu/patterns.menu'))
if actions:
actions.insert(0, SchemaAddition(id='patterns.menu',
factory=lambda: SMenu(name='Execute Patterns', id='patterns.menu'),
path='MenuBar/laser.menu'))
exts.append(TaskExtension(actions=actions))
else:
self.warning('no patterns scripts located in "{}"'.format(paths.pattern_dir))
return exts
def _task_extensions_default(self):
return [TaskExtension(actions=[SchemaAddition(id='Flag Manager',
factory=OpenFlagManagerAction,
path='MenuBar/tools.menu'), ])]
if len(args) == 3:
mkw = {}
i, f, p = args
else:
i, f, p, mkw = args
return SchemaAddition(id=i, factory=f, path=p, **mkw)
def workspace_menu():
return SMenu(id='workspace.menu', name='Workspace')
actions=[('workspace.menu', workspace_menu, 'MenuBar', {'before': 'tools.menu', 'after': 'view.menu'}),
('pychron.workspace.activate', ActivateWorkspaceAction, 'MenuBar/workspace.menu'),
('pychron.workspace.test',TestWorkspaceAction, 'MenuBar/workspace.menu')]
return [TaskExtension(actions=[make_actions(args) for args in actions])]
def _task_extensions_default(self):
exts = super(FusionsUVPlugin, self)._task_extensions_default()
ext1 = TaskExtension(task_id='pychron.fusions.uv')
return exts + [ext1]
def _my_task_extensions_default(self):
return [TaskExtension(actions=[SchemaAddition(id='export_strat_canvas',
factory=ExportStratCanvasAction,
absolute_position='last',
path='MenuBar/data.menu')])]
# print 'c',ai,ai.id
if not eflag and ai.id.startswith('pychron.entry1'):
eflag = True
additions.append(SchemaAddition(id='entry_group', factory=lambda: SGroup(id='entry.group'),
path='MenuBar/entry.menu'))
additions.append(SchemaAddition(id='entry_sample_group',
absolute_position='first',
factory=lambda: SGroup(id='entry.sample.group'),
path='MenuBar/entry.menu'))
elif not eeflag and ai.id.startswith('pychron.entry2'):
eeflag = True
additions.append(SchemaAddition(id='entry_group2', factory=lambda: SGroup(id='entry.group2'),
after='entry_group',
path='MenuBar/entry.menu'), )
extensions.append(TaskExtension(actions=additions))
return extensions
def _task_extensions_default(self):
return [TaskExtension(actions=[])]
def _task_extensions_default(self):
extensions = [TaskExtension(actions=actions, task_id=eid) for eid, actions in self._get_extensions()]
# print 'a', len(extensions)
additions = []
eflag = False
for eid, actions in self._get_extensions():
# print 'b', eid, len(actions)
for ai in actions:
if not eflag and ai.id.startswith('pychron.experiment.edit'):
eflag = True
additions.append(SchemaAddition(id='experiment.edit',
factory=lambda: SGroup(id='experiment.group'),
path='MenuBar/edit.menu'), )
if additions:
extensions.append(TaskExtension(actions=additions, task_id=''))
sr_actions = [SchemaAddition(id='experiment.acquire_spectrometer',
factory=AcquireSpectrometerAction,
path='MenuBar/Tools'),
SchemaAddition(id='experiment.release_spectrometer',
factory=ReleaseSpectrometerAction,
path='MenuBar/Tools')]
extensions.append(TaskExtension(actions=sr_actions, task_id=''))
return extensions
def _make_task_extension(self, actions, **kw):
def make_schema(args):
if len(args) == 3:
mkw = {}
i, f, p = args
else:
i, f, p, mkw = args
return SchemaAddition(id=i, factory=f, path=p, **mkw)
return TaskExtension(actions=[make_schema(args)
for args in actions], **kw)