Commit c67e4126 authored by eric pellegrini's avatar eric pellegrini

The job plugin can now be plugged into the viewer or on the data plugin

The DataInfoPlugin is now OK
Bug fix with pubsub.sendMessage wrong keyword
Improved the AtomListSelectionDialog
Removed unuseful pubsub calls from the molecular viewer
parent 9e9c7fe1
......@@ -67,7 +67,7 @@ class AngularCorrelation(IJob):
category = ('Dynamics',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{})
......
......@@ -56,7 +56,7 @@ class AreaPerMolecule(IJob):
category = ('Structure',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{'default':os.path.join('..','..','..','Data','Trajectories','MMTK','dmpc_in_periodic_universe.nc')})
......
......@@ -53,7 +53,7 @@ class BoxCenteredTrajectory(IJob):
category = ('Trajectory',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{})
......
......@@ -51,7 +51,7 @@ class CenterOfMassesTrajectory(IJob):
category = ('Trajectory',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{})
......
......@@ -43,4 +43,4 @@ class CHARMMConverter(DCDConverter):
category = ('Converters',)
ancestor = None
\ No newline at end of file
ancestor = []
\ No newline at end of file
......@@ -143,7 +143,7 @@ class CASTEPConverter(Converter):
category = ('Converters',)
ancestor = None
ancestor = []
settings = collections.OrderedDict()
settings['castep_file'] = ('input_file', {'default':os.path.join('..','..','..','Data','Trajectories','CASTEP','PBAnew.md')})
......
......@@ -291,7 +291,7 @@ class DL_POLYConverter(Converter):
category = ('Converters',)
ancestor = None
ancestor = []
settings = collections.OrderedDict()
settings['field_file'] = ('input_file',{'wildcard':"FIELD files|FIELD*|All files|*",
......
......@@ -233,7 +233,7 @@ class DiscoverConverter(Converter):
category = ('Converters','Materials Studio')
ancestor = None
ancestor = []
settings = collections.OrderedDict()
settings['xtd_file'] = ('input_file',{'default':os.path.join('..','..','..','Data','Trajectories','Discover','sushi.xtd')})
......
......@@ -283,7 +283,7 @@ class ForciteConverter(Converter):
category = ('Converters','Materials Studio')
ancestor = None
ancestor = []
settings = collections.OrderedDict()
settings['xtd_file'] = ('input_file',{'default':os.path.join('..','..','..','Data','Trajectories','Forcite','nylon66_rho100_500K_v300K.xtd')})
......
......@@ -167,7 +167,7 @@ class GenericConverter(Converter):
category = ('Converters',)
ancestor = None
ancestor = []
settings = collections.OrderedDict()
settings['gt_file'] = ('input_file',{'wildcard':"Generic trajectory files|*.gtf|All files|*",
......
......@@ -126,7 +126,7 @@ class LAMMPSConverter(Converter):
category = ('Converters',)
ancestor = None
ancestor = []
settings = collections.OrderedDict()
settings['config_file'] = ('input_file', {'label':"LAMMPS configuration file",
......
......@@ -43,4 +43,4 @@ class NAMDConverter(DCDConverter):
category = ('Converters',)
ancestor = None
\ No newline at end of file
ancestor = []
\ No newline at end of file
......@@ -49,7 +49,7 @@ class PDBConverter(Converter):
category = ('Converters',)
ancestor = None
ancestor = []
settings = collections.OrderedDict()
settings['pdb_file'] = ('input_file',{'default':os.path.join('..','..','..','Data','Trajectories','PDB','2f58_nma.pdb')})
......
......@@ -126,7 +126,7 @@ class VASPConverter(Converter):
category = ('Converters',)
ancestor = None
ancestor = []
settings = collections.OrderedDict()
settings['xdatcar_file'] = ('input_file',{'default':os.path.join('..','..','..','Data','Trajectories','VASP','XDATCAR_version5')})
......
......@@ -43,4 +43,4 @@ class XPLORConverter(DCDConverter):
category = ('Converters',)
ancestor = None
\ No newline at end of file
ancestor = []
\ No newline at end of file
......@@ -48,7 +48,7 @@ class CoordinationNumber(DistanceHistogram):
category = ('Structure',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{})
......
......@@ -49,7 +49,7 @@ class CroppedTrajectory(IJob):
category = ('Trajectory',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{})
......
......@@ -56,7 +56,7 @@ class CurrentCorrelationFunction(IJob):
category = ('Scattering',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{})
......
......@@ -47,7 +47,7 @@ class Density(IJob):
category = ('Thermodynamics',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{})
......
......@@ -51,7 +51,7 @@ class DensityOfStates(IJob):
category = ('Dynamics',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{})
......
......@@ -54,7 +54,7 @@ class DensityProfile(IJob):
category = ('Structure',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{})
......
......@@ -47,7 +47,7 @@ class DipoleAutoCorrelationFunction(IJob):
category = ('Infrared',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{})
......
......@@ -57,7 +57,7 @@ class DynamicCoherentStructureFactor(IJob):
category = ('Scattering',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{})
......
......@@ -52,7 +52,7 @@ class DynamicIncoherentStructureFactor(IJob):
category = ('Scattering',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory']=('mmtk_trajectory',{})
......
......@@ -88,7 +88,7 @@ class Eccentricity(IJob):
category = ('Structure',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{})
......
......@@ -56,7 +56,7 @@ class ElasticIncoherentStructureFactor(IJob):
# The category of the analysis.
category = ('Scattering',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{})
......
......@@ -52,7 +52,7 @@ class GaussianDynamicIncoherentStructureFactor(IJob):
category = ('Scattering',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{})
......
......@@ -49,7 +49,7 @@ class GeneralAutoCorrelationFunction(IJob):
category = ('Dynamics',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{})
......
......@@ -65,7 +65,7 @@ class GlobalMotionFilteredTrajectory(IJob):
category = ('Trajectory',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{})
......
......@@ -107,7 +107,7 @@ class IJob(Configurable):
section = "job"
ancestor = 'molecular_viewer'
ancestor = ["molecular_viewer"]
@staticmethod
def define_unique_name():
......@@ -498,7 +498,7 @@ class %s(IJob):
# You should enter the category under which your job will be references.
category = ('My jobs',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
# You should enter the configuration of your job here
# Here a basic example of a job that will use a MMTK trajectory, a frame selection and an output file in NetCDF and ASCII file formats
......
......@@ -72,7 +72,7 @@ class McStasVirtualInstrument(IJob):
category = ('Virtual Instruments',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory', {'default':os.path.join('..','..','..','Data','Trajectories', 'MMTK', 'protein_in_periodic_universe.nc')})
......
......@@ -70,7 +70,7 @@ class MeanSquareDisplacement(IJob):
category = ('Dynamics',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory","molecular_viewer"]
settings = collections.OrderedDict()
settings['trajectory']=('mmtk_trajectory',{})
......
......@@ -58,7 +58,7 @@ class MolecularTrace(IJob):
category = ('Structure',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{})
......
......@@ -77,7 +77,7 @@ class OrderParameter(IJob):
category = ('Dynamics',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory', {'default':os.path.join('..','..','..','Data','Trajectories', 'MMTK', 'protein_in_periodic_universe.nc')})
......
......@@ -57,7 +57,7 @@ class PairDistributionFunction(DistanceHistogram):
category = ('Structure',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
def finalize(self):
"""
......
......@@ -49,7 +49,7 @@ class PositionAutoCorrelationFunction(IJob):
category = ('Dynamics',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{})
......
......@@ -51,7 +51,7 @@ class RadiusOfGyration(IJob):
category = ('Structure',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{})
......
......@@ -54,7 +54,7 @@ class RefoldedMembraneTrajectory(IJob):
category = ('Macromolecules','Lipids')
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{'default':os.path.join('..','..','..','Data','Trajectories','MMTK','dmpc_in_periodic_universe.nc')})
......
......@@ -55,7 +55,7 @@ class RigidBodyTrajectory(IJob):
category = ('Trajectory',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory']=('mmtk_trajectory',{})
......
......@@ -54,7 +54,7 @@ class RootMeanSquareDeviation(IJob):
category = ('Structure',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{})
......
......@@ -50,7 +50,7 @@ class RootMeanSquareFluctuation(IJob):
category = ('Structure',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{})
......
......@@ -66,7 +66,7 @@ class SolventAccessibleSurface(IJob):
category = ('Structure',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{})
......
......@@ -60,7 +60,7 @@ class SpatialDensity(IJob):
category = ('Structure',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory', {'default':os.path.join('..','..','..','Data','Trajectories', 'MMTK', 'protein_in_periodic_universe.nc')})
......
......@@ -49,7 +49,7 @@ class StaticStructureFactor(DistanceHistogram):
category = ('Structure',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{})
......
......@@ -47,7 +47,7 @@ class StructureFactorFromScatteringFunction(IJob):
category = ('Scattering',)
ancestor = 'netcdf_data'
ancestor = ["netcdf_data"]
settings = collections.OrderedDict()
settings['netcdf_input_file'] = ('netcdf_input_file', {'variables':['time','f(q,t)_total'],
......
......@@ -57,7 +57,7 @@ class Temperature(IJob):
category = ('Thermodynamics',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{})
......
......@@ -66,7 +66,7 @@ class UnfoldedTrajectory(IJob):
category = ('Trajectory',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{})
......
......@@ -72,7 +72,7 @@ class VelocityAutoCorrelationFunction(IJob):
category = ('Dynamics',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{})
......
......@@ -63,7 +63,7 @@ class Voronoi(IJob):
category = ('Structure',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{})
......
......@@ -68,7 +68,7 @@ class StaticStructureFactor(DistanceHistogram):
category = ('Structure',)
ancestor = "mmtk_trajectory"
ancestor = ["mmtk_trajectory"]
settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{})
......
......@@ -33,7 +33,7 @@ Created on Apr 14, 2015
import wx
import wx.aui as wxaui
from MDANSE.Externals.pubsub import pub as Publisher
from MDANSE.Externals.pubsub import pub
from MDANSE.GUI.Icons import ICONS
from MDANSE.Framework.Plugins.ComponentPlugin import ComponentPlugin
......@@ -44,7 +44,7 @@ class AnimationPlugin(ComponentPlugin):
label = "Animation"
ancestor = "molecular_viewer"
ancestor = ["molecular_viewer"]
def __init__(self, parent, *args, **kwargs):
......@@ -57,9 +57,10 @@ class AnimationPlugin(ComponentPlugin):
controlSizer = wx.BoxSizer(wx.HORIZONTAL)
firstButton = wx.BitmapButton(panel, wx.ID_ANY, ICONS["first",32,32])
self.playPause = wx.BitmapButton(panel, wx.ID_ANY, ICONS["play",32,32])
self.startStop = wx.BitmapButton(panel, wx.ID_ANY, ICONS["play",32,32])
lastButton = wx.BitmapButton(panel, wx.ID_ANY, ICONS["last",32,32])
self.frameSlider = wx.Slider(panel,id=wx.ID_ANY, value=0, minValue=0, maxValue=1, style=wx.SL_HORIZONTAL)
self.frameSlider.SetRange(0,self._parent.n_frames-1)
self.frameEntry = wx.TextCtrl(panel,id=wx.ID_ANY,value="0", size=(60,20), style= wx.SL_HORIZONTAL|wx.TE_PROCESS_ENTER)
speedBitmap = wx.StaticBitmap(panel,-1, ICONS["clock",42,42])
self.speedSlider = wx.Slider(panel,id=wx.ID_ANY,value=0,minValue=0,maxValue=1,style=wx.SL_HORIZONTAL)
......@@ -69,7 +70,7 @@ class AnimationPlugin(ComponentPlugin):
self.speedEntry = wx.TextCtrl(panel,id=wx.ID_ANY,value=str(speed), size=(60,20), style= wx.SL_HORIZONTAL|wx.TE_PROCESS_ENTER)
controlSizer.Add(firstButton, 0, wx.LEFT|wx.ALIGN_CENTER_VERTICAL,5)
controlSizer.Add(self.playPause, 0, wx.ALIGN_CENTER_VERTICAL)
controlSizer.Add(self.startStop, 0, wx.ALIGN_CENTER_VERTICAL)
controlSizer.Add(lastButton, 0, wx.ALIGN_CENTER_VERTICAL)
controlSizer.Add((5, -1), 0, wx.ALIGN_RIGHT)
......@@ -97,13 +98,13 @@ class AnimationPlugin(ComponentPlugin):
self.Bind(wx.EVT_SLIDER, self.on_change_frame_rate, self.speedSlider)
self.Bind(wx.EVT_TEXT_ENTER, self.on_set_speed, self.speedEntry)
self.Bind(wx.EVT_BUTTON, self.on_start_stop_animation, self.playPause)
self.Bind(wx.EVT_BUTTON, self.on_start_stop_animation, self.startStop)
self.Bind(wx.EVT_BUTTON, self.on_goto_first_frame, firstButton)
self.Bind(wx.EVT_BUTTON, self.on_goto_last_frame, lastButton)
Publisher.subscribe(self.on_update_animation_icon, ('msg_animate_trajectory'))
Publisher.subscribe(self.on_set_up_frame_slider, ('msg_load_trajectory'))
Publisher.subscribe(self.on_timer, ('msg_timer'))
# pub.subscribe(self.on_update_animation_icon, ('msg_animate_trajectory'))
# pub.subscribe(self.on_set_up_frame_slider, ('msg_load_trajectory'))
pub.subscribe(self.on_timer, ('msg_timer'))
def plug(self):
self._parent._mgr.GetPane(self).LeftDockable(False).RightDockable(False).Dock().Bottom().CloseButton(True)
......@@ -170,20 +171,24 @@ class AnimationPlugin(ComponentPlugin):
self._parent.start_stop_animation()
def on_update_animation_icon(self, plugin):
if not plugin.is_parent(self):
return
if plugin.animation_loop:
self.playPause.SetBitmapLabel(ICONS["pause",32,32])
if self._parent.animation_loop:
self.startStop.SetBitmapLabel(ICONS["pause",32,32])
else:
self.playPause.SetBitmapLabel(ICONS["play",32,32])
def on_set_up_frame_slider(self, plugin):
if not plugin.is_parent(self):
return
self.frameSlider.SetRange(0,self._parent.n_frames-1)
\ No newline at end of file
self.startStop.SetBitmapLabel(ICONS["play",32,32])
# def on_update_animation_icon(self, plugin):
#
# if not plugin.is_parent(self):
# return
#
# if plugin.animation_loop:
# self.startStop.SetBitmapLabel(ICONS["pause",32,32])
# else:
# self.startStop.SetBitmapLabel(ICONS["play",32,32])
# def on_set_up_frame_slider(self, plugin):
#
# if not plugin.is_parent(self):
# return
#
# self.frameSlider.SetRange(0,self._parent.n_frames-1)
\ No newline at end of file
......@@ -33,6 +33,7 @@ Created on Apr 14, 2015
import wx
import wx.aui as aui
from MDANSE import REGISTRY
from MDANSE.Framework.Plugins.ComponentPlugin import ComponentPlugin
class DataInfoPlugin(ComponentPlugin):
......@@ -41,13 +42,12 @@ class DataInfoPlugin(ComponentPlugin):
label = "Data info"
ancestor = "data"
ancestor = [data.type for data in REGISTRY["input_data"].values()]
def __init__(self, parent, *args, **kwargs):
ComponentPlugin.__init__(self, parent, size=(-1,50), *args, **kwargs)
def build_panel(self):
panel = wx.Panel(self, wx.ID_ANY, size=self.GetSize())
......@@ -66,12 +66,10 @@ class DataInfoPlugin(ComponentPlugin):
self._mgr.Update()
def on_close(self, event):
self.parent.mgr.ClosePane(self.parent.mgr.GetPane(self))
def plug(self):
self._info.SetValue(self.dataproxy.info())
......
......@@ -55,7 +55,7 @@ class DataPlugin(IPlugin):
type = 'data'
ancestor = None
ancestor = []
def __init__(self, parent, datakey, **kwargs):
......@@ -103,11 +103,12 @@ class DataPlugin(IPlugin):
if plugin is None:
return
if not issubclass(self.__class__,REGISTRY['plugin'][plugin.ancestor]):
klasses = tuple([REGISTRY['plugin'][anc] for anc in plugin.ancestor])
if not issubclass(self.__class__,klasses):
return
plugin = plugin(self)
self._mgr.AddPane(plugin, wxaui.AuiPaneInfo().Caption(getattr(plugin, "label", pluginName)))
self._mgr.Update()
......
......@@ -51,7 +51,7 @@ class DensitySuperpositionPlugin(ComponentPlugin):
label = "Density superposition"
ancestor = "molecular_viewer"
ancestor = ["molecular_viewer"]
def __init__(self, parent, *args, **kwargs):
......
......@@ -83,7 +83,7 @@ class IPlugin(wx.Panel):
type = "plugin"
ancestor = None
ancestor = []
def __init__(self, parent, *args, **kwargs):
......@@ -146,7 +146,9 @@ class IPlugin(wx.Panel):
plugin.close_children()
except AttributeError:
plugin.Close()
self._parent.SetFocus()