Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _create_control(self, parent):
self.dlg = QtGui.QFileDialog(parent, self.title, self.default_path)
self.dlg.setViewMode(QtGui.QFileDialog.Detail | QtGui.QFileDialog.ShowDirsOnly)
self.dlg.setFileMode(QtGui.QFileDialog.Directory)
self.dlg.setNameFilters(["one", "two"])
self.dlg.setReadOnly(True)
return self.dlg
def selectedNameFilter(self):
return self.dlg.selectedNameFilter()
class ExperimentDialogHandler(Controller):
# keep a ref to the table editor so we can add columns dynamically
table_editor = Instance(TableEditorQt)
# keep a refs to enable/disable.
btn_add_cond = Instance(QtGui.QPushButton)
btn_remove_cond = Instance(QtGui.QPushButton)
btn_remove_tubes = Instance(QtGui.QPushButton)
updating = Bool(False)
def init(self, info):
""" Overrides Handler.init() """
self.table_editor = info.ui.get_editors('tubes')[0]
op = GaussianMixtureOp()
op.copy_traits(self, op.copyable_trait_names())
return dedent("""
op_{idx} = {repr}
op_{idx}.estimate(ex_{prev_idx}{subset})
ex_{idx} = op_{idx}.apply(ex_{prev_idx})
"""
.format(repr = repr(op),
idx = idx,
prev_idx = idx - 1,
subset = ", subset = " + repr(self.subset) if self.subset else ""))
class GaussianMixture1DViewHandler(ViewHandlerMixin, Controller):
def default_traits_view(self):
return View(VGroup(
VGroup(Item('channel',
style = 'readonly'),
Item('by',
editor = TextEditor(),
style = 'readonly',
label = "Group\nBy"),
Item('xfacet',
editor=ExtendableEnumEditor(name='by',
extra_items = {"None" : ""}),
label = "Horizontal\nFacet"),
Item('yfacet',
editor=ExtendableEnumEditor(name='by',
extra_items = {"None" : ""}),
label = "Vertical\nFacet"),
from cytoflow.views.i_selectionview import IView
import cytoflow.utility as util
from cytoflowgui.view_plugins.i_view_plugin import ViewHandlerMixin, PluginViewMixin
from cytoflowgui.view_plugins.histogram import HistogramPlotParams
from cytoflowgui.op_plugins import IOperationPlugin, OpHandlerMixin, OP_PLUGIN_EXT, shared_op_traits
from cytoflowgui.subset import ISubset, SubsetListEditor
from cytoflowgui.color_text_editor import ColorTextEditor
from cytoflowgui.ext_enum_editor import ExtendableEnumEditor
from cytoflowgui.op_plugins.i_op_plugin import PluginOpMixin, PluginHelpMixin
from cytoflowgui.workflow import Changed
from cytoflowgui.serialization import camel_registry, traits_repr, traits_str, dedent
GaussianMixtureOp.__repr__ = traits_repr
class GaussianMixture1DHandler(OpHandlerMixin, Controller):
def default_traits_view(self):
return View(Item('name',
editor = TextEditor(auto_set = False)),
Item('channel',
editor=EnumEditor(name='context.previous_wi.channels'),
label = "Channel"),
Item('channel_scale',
label = "Scale"),
VGroup(
Item('num_components',
editor = TextEditor(auto_set = False),
label = "Num\nComponents"),
Item('sigma',
editor = TextEditor(auto_set = False)),
Item('by',
editor = CheckListEditor(cols = 2,
tr = tvtk.Transform()
tr.rotate_x(rx)
tr.rotate_y(ry)
tr.rotate_z(rz)
tf1 = tvtk.TransformFilter(transform=tr, input_connection=triangle1.output_port)
tf2 = tvtk.TransformFilter(transform=tr, input_connection=triangle2.output_port)
bf = tvtk.BooleanOperationPolyDataFilter()
bf.operation = "difference"
bf.set_input_connection(0, tf1.output_port)
bf.set_input_connection(1, tf2.output_port)
m = tvtk.PolyDataMapper(input_connection=bf.output_port, scalar_visibility=False)
a = tvtk.Actor(mapper=m)
return bf, a, tf1, tf2
class TVTKSceneController(Controller):
def position(self, info):
super(TVTKSceneController, self).position(info)
self.model.depth_peeling()
class TubeDemoApp(HasTraits):
max_radius = Float(1.0)
ri1 = Range(0.0, 1.0, 0.8)
ro1 = Range("ri1", "max_radius", 1.0)
ri2 = Range(0.0, 1.0, 0.4)
ro2 = Range("ri2", "max_radius", 0.6)
update = Button("Update")
scene = Instance(SceneModel, ())
view = View(
VGroup(
Item(name="scene", editor=SceneEditor(scene_class=Scene)),
from cytoflow.operations import IOperation
from cytoflow.operations.binning import BinningOp, BinningView
from cytoflow.views.i_selectionview import IView
import cytoflow.utility as util
from cytoflowgui.view_plugins.i_view_plugin import ViewHandlerMixin, PluginViewMixin
from cytoflowgui.op_plugins import IOperationPlugin, OpHandlerMixin, OP_PLUGIN_EXT, shared_op_traits
from cytoflowgui.subset import SubsetListEditor
from cytoflowgui.color_text_editor import ColorTextEditor
from cytoflowgui.op_plugins.i_op_plugin import PluginOpMixin, PluginHelpMixin
from cytoflowgui.serialization import camel_registry, traits_repr, traits_str, dedent
BinningOp.__repr__ = traits_repr
class BinningHandler(Controller, OpHandlerMixin):
def default_traits_view(self):
return View(Item('name',
editor = TextEditor(auto_set = False)),
Item('channel',
editor=EnumEditor(name='context.previous_wi.channels'),
label = "Channel"),
Item('scale',
editor = EnumEditor(values = ['linear', 'log'])),
Item('bin_width',
editor = TextEditor(auto_set = False),
label = "Bin Width"),
shared_op_traits)
class BinningPluginOp(PluginOpMixin, BinningOp):
handler_factory = Callable(BinningHandler)
bin_width = util.PositiveCFloat(0, allow_zero = True)
from cytoflow.operations.flowpeaks import FlowPeaksOp, FlowPeaks2DView, FlowPeaks2DDensityView
from cytoflow.views.i_selectionview import IView
from cytoflowgui.view_plugins.i_view_plugin import ViewHandlerMixin, PluginViewMixin
from cytoflowgui.view_plugins.density import DensityPlotParams
from cytoflowgui.view_plugins.scatterplot import ScatterplotPlotParams
from cytoflowgui.op_plugins import IOperationPlugin, OpHandlerMixin, OP_PLUGIN_EXT, shared_op_traits
from cytoflowgui.subset import ISubset, SubsetListEditor
from cytoflowgui.color_text_editor import ColorTextEditor
from cytoflowgui.op_plugins.i_op_plugin import PluginOpMixin, PluginHelpMixin
from cytoflowgui.workflow import Changed
from cytoflowgui.serialization import camel_registry, traits_repr, traits_str, dedent
FlowPeaksOp.__repr__ = traits_repr
class FlowPeaksHandler(OpHandlerMixin, Controller):
def default_traits_view(self):
return View(Item('name',
editor = TextEditor(auto_set = False)),
Item('xchannel',
editor=EnumEditor(name='context.previous_wi.channels'),
label = "X Channel"),
Item('ychannel',
editor=EnumEditor(name='context.previous_wi.channels'),
label = "Y Channel"),
Item('xscale',
label = "X Scale"),
Item('yscale',
label = "Y Scale"),
VGroup(
Item('h',
editor = TextEditor(auto_set = False)),
for control in self.controls_list:
op.controls[(control.from_channel, control.to_channel)] = control.file
return dedent("""
op_{idx} = {repr}
op_{idx}.estimate(ex_{prev_idx}{subset})
ex_{idx} = op_{idx}.apply(ex_{prev_idx})
"""
.format(repr = repr(op),
idx = idx,
prev_idx = idx - 1,
subset = ", subset = " + repr(self.subset) if self.subset else ""))
class ColorTranslationViewHandler(ViewHandlerMixin, Controller):
def default_traits_view(self):
return View(Item('context.view_warning',
resizable = True,
visible_when = 'context.view_warning',
editor = ColorTextEditor(foreground_color = "#000000",
background_color = "#ffff99")),
Item('context.view_error',
resizable = True,
visible_when = 'context.view_error',
editor = ColorTextEditor(foreground_color = "#000000",
background_color = "#ff9191")))
@provides(IView)
class ColorTranslationPluginView(PluginViewMixin, ColorTranslationDiagnostic):
handler_factory = Callable(ColorTranslationViewHandler)
self.system.set_initial_value(self.status0, 0)
self.status = self.status0
def ode_step(self, dt):
self.system.integrate(self.t + dt)
self.t = self.system.t
self.status = self.system.y
def _get_x(self):
return self.status[:self.N]
def _get_y(self):
return self.status[self.N:self.N*2]
class TimerController(Controller):
def position(self, info):
super(TimerController, self).position(info)
self.model.start_timer()
def close(self, info, is_ok):
super(TimerController, self).close(info, is_ok)
self.model.stop_timer()
return True
class AnimationGui(HasTraits):
figure = Instance(Figure, ())
system = Instance(Catenary, ())
from cytoflow.views.i_selectionview import ISelectionView
from cytoflowgui.op_plugins.i_op_plugin \
import IOperationPlugin, OpHandlerMixin, PluginOpMixin, OP_PLUGIN_EXT, shared_op_traits, PluginHelpMixin
from cytoflowgui.view_plugins.i_view_plugin import ViewHandlerMixin, PluginViewMixin
from cytoflowgui.view_plugins.scatterplot import ScatterplotPlotParams
from cytoflowgui.subset import SubsetListEditor
from cytoflowgui.color_text_editor import ColorTextEditor
from cytoflowgui.ext_enum_editor import ExtendableEnumEditor
from cytoflowgui.workflow import Changed
from cytoflowgui.serialization import camel_registry, traits_repr, traits_str, dedent
Range2DOp.__repr__ = traits_repr
class Range2DHandler(OpHandlerMixin, Controller):
def default_traits_view(self):
return View(Item('name',
editor = TextEditor(auto_set = False)),
Item('xchannel',
editor=EnumEditor(name='context.previous_wi.channels'),
label = "X Channel"),
Item('xlow',
editor = TextEditor(auto_set = False),
label = "X Low"),
Item('xhigh',
editor = TextEditor(auto_set = False),
label = "X High"),
Item('ychannel',
editor=EnumEditor(name='context.previous_wi.channels'),
label = "Y Channel"),
help_file = None
for klass in self.__class__.__mro__:
mod = klass.__module__
mod_html = mod + ".html"
h = os.path.join(help_dir, mod_html)
if os.path.exists(h):
help_file = h
break
with open(help_file, encoding = 'utf-8') as f:
help_html = f.read()
return help_html
class TasbeViewHandler(ViewHandlerMixin, Controller):
def default_traits_view(self):
return View(Item('context.view_warning',
resizable = True,
visible_when = 'context.view_warning',
editor = ColorTextEditor(foreground_color = "#000000",
background_color = "#ffff99")),
Item('context.view_error',
resizable = True,
visible_when = 'context.view_error',
editor = ColorTextEditor(foreground_color = "#000000",
background_color = "#ff9191")))
@provides(IView)
class TasbeCalibrationView(PluginViewMixin):
handler_factory = Callable(TasbeViewHandler)
op = Instance(TasbeCalibrationOp)