Commit 5c6c7913 authored by eric pellegrini's avatar eric pellegrini
Browse files

Removed the IWidget::initialize abstract method and updated the the

IWidgets subclasses according to this
parent 17f93b46
......@@ -38,9 +38,6 @@ class BooleanWidget(IWidget):
type = "boolean"
def initialize(self):
pass
def add_widgets(self):
sizer = wx.BoxSizer(wx.VERTICAL)
......@@ -56,7 +53,4 @@ class BooleanWidget(IWidget):
def get_widget_value(self):
return self._boolean.GetValue()
def set_widget_value(self, value):
pass
return self._boolean.GetValue()
\ No newline at end of file
......@@ -40,9 +40,6 @@ class FloatWidget(StringWidget):
type = "float"
def initialize(self):
pass
def add_widgets(self):
sizer = wx.BoxSizer(wx.VERTICAL)
......@@ -52,9 +49,6 @@ class FloatWidget(StringWidget):
sizer.Add(self._float, 0, wx.ALL, 5)
return sizer
def set_widget_value(self, value):
pass
def get_widget_value(self):
......
......@@ -42,10 +42,6 @@ class FramesWidget(IWidget):
type = "frames"
def initialize(self):
pass
def add_widgets(self):
sizer = wx.BoxSizer(wx.HORIZONTAL)
......@@ -75,7 +71,7 @@ class FramesWidget(IWidget):
sizer.Add(gbSizer, 1, wx.ALL|wx.EXPAND, 5)
pub.subscribe(self.set_widget_value, ("set_trajectory"))
pub.subscribe(self.on_set_trajectory, ("set_trajectory"))
return sizer
......@@ -85,7 +81,7 @@ class FramesWidget(IWidget):
return val
def set_widget_value(self, message):
def on_set_trajectory(self, message):
window, filename = message
......
......@@ -72,7 +72,6 @@ class IWidget(wx.Panel):
def name(self):
return self._name
@abc.abstractmethod
def initialize(self):
pass
......@@ -80,10 +79,6 @@ class IWidget(wx.Panel):
def get_widget_value(self):
pass
@abc.abstractmethod
def set_widget_value(self, value):
pass
@abc.abstractmethod
def add_widgets(self):
pass
......
......@@ -39,9 +39,6 @@ class InputDirectoryWidget(IWidget):
type = "input_directory"
def initialize(self):
pass
def add_widgets(self):
cfg = self.configurator
......@@ -59,7 +56,4 @@ class InputDirectoryWidget(IWidget):
dirname = self._dirname.GetValue()
return dirname
def set_widget_value(self):
pass
return dirname
\ No newline at end of file
......@@ -41,9 +41,6 @@ class InputFileWidget(IWidget):
type = "input_file"
def initialize(self):
pass
def add_widgets(self):
cfg = self.configurator
......@@ -63,7 +60,4 @@ class InputFileWidget(IWidget):
if not filename:
raise ConfigurationError("No input file selected", self)
return filename
def set_widget_value(self, value):
pass
return filename
\ No newline at end of file
......@@ -32,7 +32,6 @@ Created on Mar 30, 2015
import numpy
# The matplotlib imports
from matplotlib.figure import Figure
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigCanvas
from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg as NavigationToolbar
......@@ -65,7 +64,6 @@ class InstrumentResolutionDialog(wx.Dialog):
self._value = None
self.build_dialog()
def build_dialog(self):
......@@ -203,14 +201,11 @@ class InstrumentResolutionConfigurator(IWidget):
self.Bind(wx.EVT_BUTTON, self.on_set_instrument_resolution, self._setResolution)
pub.subscribe(self.set_widget_value, ("set_trajectory"))
pub.subscribe(self.set_widget_value, ("set_netcdf"))
pub.subscribe(self.on_set_trajectory, ("set_trajectory"))
pub.subscribe(self.on_set_trajectory, ("set_netcdf"))
return sizer
def initialize(self):
pass
def get_widget_value(self):
return eval(self._resolution.GetValue())
......@@ -233,8 +228,7 @@ class InstrumentResolutionConfigurator(IWidget):
self._instrumentResolutionDialog.Destroy()
def set_widget_value(self, message):
def on_set_trajectory(self, message):
window, filename = message
......
......@@ -38,9 +38,6 @@ from MDANSE.App.GUI.Framework.Widgets.IWidget import IWidget
class IntegerWidget(IWidget):
type = "integer"
def initialize(self):
pass
def add_widgets(self):
......@@ -62,7 +59,3 @@ class IntegerWidget(IWidget):
val = self._integer.GetValue()
return val
def set_widget_value(self, value):
pass
......@@ -41,9 +41,6 @@ class InterpolationOrderWidget(IWidget):
type = "interpolation_order"
def initialize(self):
pass
def add_widgets(self):
sizer = wx.BoxSizer(wx.HORIZONTAL)
......
......@@ -44,9 +44,6 @@ from MDANSE.App.GUI.Framework.Widgets.IWidget import IWidget
class MMTKTrajectoryWidget(IWidget):
type = "mmtk_trajectory"
def initialize(self):
pass
def add_widgets(self):
......@@ -93,7 +90,4 @@ class MMTKTrajectoryWidget(IWidget):
if not filename:
raise ConfigurationError("No MMTK trajectory file selected", self)
return filename
def set_widget_value(self, value):
pass
return filename
\ No newline at end of file
......@@ -39,9 +39,6 @@ class MultipleChoicesWidget(IWidget):
type = "multiple_choices"
def initialize(self):
pass
def add_widgets(self):
sizer = wx.BoxSizer(wx.VERTICAL)
......@@ -57,8 +54,4 @@ class MultipleChoicesWidget(IWidget):
def get_widget_value(self):
return self._choices.GetStringSelection()
def set_widget_value(self, value):
pass
return self._choices.GetStringSelection()
\ No newline at end of file
......@@ -49,9 +49,6 @@ class NetCDFInputWidget(IWidget):
return self._netcdf.variables[attr].getValue()
def initialize(self):
pass
def add_widgets(self):
sizer = wx.BoxSizer(wx.VERTICAL)
......@@ -92,7 +89,6 @@ class NetCDFInputWidget(IWidget):
pub.sendMessage("set_netcdf", message = (self,filename))
def get_widget_value(self):
filename = self._selectNetCDF.GetStringSelection()
......@@ -100,8 +96,4 @@ class NetCDFInputWidget(IWidget):
if not filename:
raise ConfigurationError("No NetCDF file selected", self)
return filename
def set_widget_value(self, value):
pass
return filename
\ No newline at end of file
......@@ -38,7 +38,6 @@ import wx.lib.filebrowsebutton as wxfile
from MDANSE.Externals.pubsub import pub
from MDANSE.App.GUI.ComboWidgets.ComboCheckbox import ComboCheckbox
from MDANSE.App.GUI.Framework.Plugins.IPlugin import plugin_parent
from MDANSE.App.GUI.Framework.Widgets.IWidget import IWidget
class OutputFilesWidget(IWidget):
......@@ -46,9 +45,9 @@ class OutputFilesWidget(IWidget):
type = "output_files"
def initialize(self):
self._availableFormats = self.configurator.formats
def add_widgets(self):
sizer = wx.BoxSizer(wx.VERTICAL)
......@@ -77,7 +76,7 @@ class OutputFilesWidget(IWidget):
sizer.Add(self._dirname, 0, wx.ALL|wx.EXPAND)
sizer.Add(hSizer, 0, wx.ALL|wx.EXPAND, 0)
pub.subscribe(self.set_widget_value, ("set_trajectory"))
pub.subscribe(self.on_set_trajectory, ("set_trajectory"))
return sizer
......@@ -91,8 +90,7 @@ class OutputFilesWidget(IWidget):
return (dirname, basename, formats)
def set_widget_value(self, message):
def on_set_trajectory(self, message):
window, filename = message
......
......@@ -40,10 +40,6 @@ class ProjectionWidget(IWidget):
type = "projection"
def initialize(self):
pass
def add_widgets(self):
sizer = wx.BoxSizer(wx.VERTICAL)
......@@ -125,9 +121,6 @@ class ProjectionWidget(IWidget):
raise ConfigurationError("Invalid value for %r entry" % self.configurator.name)
else:
return val
def set_widget_value(self, value):
pass
def on_select_projection_mode(self, event):
......
......@@ -40,9 +40,6 @@ class PythonObjectWidget(IWidget):
type = "python_object"
def initialize(self):
pass
def add_widgets(self):
sizer = wx.BoxSizer(wx.VERTICAL)
......@@ -52,9 +49,6 @@ class PythonObjectWidget(IWidget):
sizer.Add(self._string, 0, wx.ALL, 5)
return sizer
def set_widget_value(self, value):
pass
def get_widget_value(self):
......
......@@ -40,10 +40,6 @@ class RangeWidget(IWidget):
type = "range"
def initialize(self):
pass
def add_widgets(self):
sizer = wx.BoxSizer(wx.VERTICAL)
......@@ -86,6 +82,3 @@ class RangeWidget(IWidget):
raise ConfigurationError("Invalid value for %r entry" % self.configurator.name)
else:
return val
def set_widget_value(self, value):
pass
\ No newline at end of file
......@@ -43,8 +43,7 @@ class RunningModeWidget(IWidget):
def initialize(self):
self._totalNumberOfProcessors = multiprocessing.cpu_count()
def add_widgets(self):
sizer = wx.BoxSizer(wx.VERTICAL)
......@@ -87,11 +86,6 @@ class RunningModeWidget(IWidget):
return value
def set_widget_value(self, value):
pass
def on_select_running_mode(self, event):
btn = event.GetEventObject()
......
......@@ -38,9 +38,6 @@ class SingleChoiceWidget(IWidget):
type = "single_choice"
def initialize(self):
pass
def add_widgets(self):
sizer = wx.BoxSizer(wx.VERTICAL)
......@@ -55,6 +52,3 @@ class SingleChoiceWidget(IWidget):
def get_widget_value(self):
return self._choices.GetStringSelection()
def set_widget_value(self, value):
pass
......@@ -38,10 +38,6 @@ class StringWidget(IWidget):
type = "string"
def initialize(self):
pass
def add_widgets(self):
sizer = wx.BoxSizer(wx.VERTICAL)
......@@ -51,9 +47,6 @@ class StringWidget(IWidget):
sizer.Add(self._string, 0, wx.ALL, 5)
return sizer
def set_widget_value(self, value):
pass
def get_widget_value(self):
......
......@@ -43,9 +43,6 @@ class TrajectoryVariableWidget(IWidget):
type = "trajectory_variable"
def initialize(self):
pass
def add_widgets(self):
sizer = wx.BoxSizer(wx.VERTICAL)
......@@ -54,7 +51,7 @@ class TrajectoryVariableWidget(IWidget):
sizer.Add(self._variable, 1, wx.ALL|wx.EXPAND, 5)
pub.subscribe(self.set_widget_value, ("set_trajectory"))
pub.subscribe(self.on_set_trajectory, ("set_trajectory"))
return sizer
......@@ -62,7 +59,7 @@ class TrajectoryVariableWidget(IWidget):
return self._variable.GetStringSelection()
def set_widget_value(self, message):
def on_set_trajectory(self, message):
window, filename = message
......
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