Commit e3565a77 authored by eric pellegrini's avatar eric pellegrini
Browse files

Added the python script selector in the GUI

parent 394c94eb
...@@ -30,17 +30,32 @@ Created on Mar 27, 2015 ...@@ -30,17 +30,32 @@ Created on Mar 27, 2015
:author: Eric C. Pellegrini :author: Eric C. Pellegrini
''' '''
import glob
import os
from MDANSE.Framework.Selectors.ISelector import ISelector from MDANSE.Framework.Selectors.ISelector import ISelector
class PythonScript(ISelector): class PythonScript(ISelector):
type = "python_script" type = "python_script"
section = None section = 'miscellaneous'
def __init__(self, universe):
self._rindexes = dict([(at.index,at) for at in universe.atomList()])
def select(self, scripts): def select(self, scripts):
sel = set() sel = set()
if '*' in scripts:
scripts = self._choices[1:]
for s in scripts: for s in scripts:
...@@ -55,6 +70,6 @@ class PythonScript(ISelector): ...@@ -55,6 +70,6 @@ class PythonScript(ISelector):
if not namespace.has_key("selection"): if not namespace.has_key("selection"):
continue continue
sel.update(namespace["selection"]) sel.update([self._rindexes[idx] for idx in namespace["selection"]])
return sel return sel
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment