def _default_layout_default(self): return TaskLayout( top=HSplitter( PaneItem('image_edit.pane1'), PaneItem('image_edit.pane2'), PaneItem('image_edit.pane3'), ))
def _default_layout_default(self): return TaskLayout( top=VSplitter( HSplitter( PaneItem('steps.pane1'), PaneItem('steps.pane2')), ))
def _default_layout_default(self): return TaskLayout(left=VSplitter( HSplitter(PaneItem('steps.pane1'), PaneItem('steps.pane2'), PaneItem('steps.pane3')), HSplitter(PaneItem('steps.pane4'), PaneItem('steps.pane5'), PaneItem('steps.pane6')), ))
def _default_layout_default(self): return TaskLayout( top=PaneItem('example_pane_1'), right=PaneItem('example_pane_2'), bottom=PaneItem('example_pane_3'), left=PaneItem('example_pane_4'), )
def test_set_pane_item_height_in_main_window_layout(self): # Test the dock pane height is as expected. self.setup_window_with_central_widget() # Set the dock widget expected height to be smaller than the window # for a meaningful test. expected_height = self.window.size[1] // 2 window_layout = MainWindowLayout(control=self.window.control) dock_layout = TaskLayout(bottom=PaneItem(height=expected_height)) dock_widget = create_dummy_dock_widget(parent=self.window.control) patch_get_dock_widget = mock.patch.object( MainWindowLayout, "_get_dock_widget", return_value=dock_widget, ) # when with self.event_loop(): with patch_get_dock_widget: window_layout.set_layout(dock_layout) # then size = dock_widget.widget().size() self.assertEqual(size.height(), expected_height)
def _default_layout_default(self): return TaskLayout( left=Tabbed( PaneItem("example.attractors.model_config_pane"), PaneItem("example.attractors.model_help_pane"), ) )
def _default_layout_default(self): return TaskLayout(left=VSplitter( PaneItem('text_edit.pane1'), HSplitter( PaneItem('text_edit.pane2'), PaneItem('text_edit.pane3'), ), ))
def _default_layout_default(self): return TaskLayout(left = VSplitter(PaneItem("edu.mit.synbio.cytoflowgui.workflow_pane"), PaneItem("edu.mit.synbio.cytoflowgui.help_pane")), right = VSplitter(PaneItem("edu.mit.synbio.cytoflowgui.view_traits_pane"), PaneItem("edu.mit.synbio.cytoflowgui.params_pane")), top_left_corner = 'left', bottom_left_corner = 'left', top_right_corner = 'right', bottom_right_corner = 'right')
def pane_layout(): """ Create the default task layout, which is overridded by the user's save state if it exists. """ return TaskLayout( left=VSplitter(PaneItem('font_edit.sidebar'), ), right=VSplitter( PaneItem('font_edit.pixel_editor'), PaneItem('font_edit.color_chooser'), ), )
def pane_layout(): """ Create the default task layout, which is overridded by the user's save state if it exists. """ return TaskLayout( left=VSplitter(PaneItem('map_edit.sidebar'), ), right=VSplitter( PaneItem('map_edit.tile_map'), PaneItem('map_edit.character_set'), PaneItem('map_edit.memory_map'), ), )
def _default_layout_default(self): return TaskLayout(left=VSplitter( HSplitter( PaneItem("steps.pane1"), PaneItem("steps.pane2"), PaneItem("steps.pane3"), ), HSplitter( PaneItem("steps.pane4"), PaneItem("steps.pane5"), PaneItem("steps.pane6"), ), ))
def pane_layout(): """ Create the default task layout, which is overridded by the user's save state if it exists. """ return TaskLayout( left=VSplitter( PaneItem('hex_edit.sidebar'), ), right=HSplitter( PaneItem('hex_edit.disassembly'), PaneItem('hex_edit.font_map'), PaneItem('hex_edit.bitmap'), ), )
def pane_layout(): """ Create the default task layout, which is overridded by the user's save state if it exists. """ return TaskLayout( left=VSplitter( PaneItem('jumpman.sidebar'), ), right=HSplitter( VSplitter( PaneItem('jumpman.level_data'), PaneItem('jumpman.hex'), PaneItem('jumpman.triggers'), ), ), )
def _default_layout_default(self): """ Control where to place each dock panes. """ bottom_height = 270 return TaskLayout(id=self.id, left=Splitter(PaneItem('krom.data_source_pane'), PaneItem('krom.study_data_pane'), orientation='vertical'), bottom=Splitter(PaneItem( 'krom.performance_param_pane', height=bottom_height), PaneItem('common.job_manager_pane', height=bottom_height, width=250), orientation='horizontal'))
def _default_layout_default(self): """ The default layout with the browser pane on the left. """ return TaskLayout( left=PaneItem('example.python_browser_pane', width=200))
def _default_layout_default(self): return TaskLayout(top=Tabbed(PaneItem('steps.first_pane'), PaneItem('steps.second_pane'), PaneItem('steps.third_pane')))
def _default_layout_default(self): return TaskLayout(left=PaneItem('image_viewer.file_browser_pane'))
def _default_layout_default(self): return TaskLayout(top=PaneItem("steps.example_pane"))
def _default_layout_default(self): return TaskLayout(left=PaneItem("my_dock_pane", width=200))
def _default_layout_default(self): return TaskLayout(right=VSplitter( PaneItem("edu.mit.synbio.cytoflowgui.plot_params_pane", width=350), PaneItem("edu.mit.synbio.cytoflowgui.export_pane", width=350)))
def _default_layout_default(self): return TaskLayout(left=PaneItem("edu.mit.synbio.workflow_pane"), right=PaneItem("edu.mit.synbio.view_traits_pane"))
def _default_layout_default(self): return TaskLayout(right=VSplitter( HSplitter(PaneItem("steps.pane1"), PaneItem("steps.pane2"))))
def _default_layout_default(self): return TaskLayout(left=PaneItem('example.python_script_browser_pane'))
def _default_layout_default(self): return TaskLayout(left = PaneItem("edu.mit.synbio.cytoflowgui.calibration_pane", width = 350), right = PaneItem("edu.mit.synbio.cytoflowgui.help_pane", width = 350))
def _default_layout_default(self): return TaskLayout(left=PaneItem("example.dummy_dock_pane"))
def _default_layout_default(self): return TaskLayout(bottom=PaneItem('steps.example_pane'))
class S4LVisualizationTask(Task): # pylint: disable=too-many-instance-attributes """ A task for visualizing Sim4Life EM fields from scES simulations """ #: The task's identifier. id = "s4l.main_task" #: The task's user-visible name. name = "S4L Visualization" #: Configuration parser. configuration = Instance(ConfigParser) #: Current participant's ID participant_id = Str() #: Temporary dictionary for editing user configuration _to_edit = Dict() #: Plane attributes dock pane. plane_attributes_pane = Instance(PlaneAttributes) #: Line attributes dock pane. line_attributes_pane = Instance(LineAttributes) #: Participant ID dock pane. part_id_pane = Instance(ParticipantIDPane) #: The currently active editor. active_editor = Property(Instance(IEditor), depends_on="editor_area.active_editor") #: The editor area in which the editor belongs. editor_area = Instance(IEditorAreaPane) #: The opening page's editor. start_page = Instance(StartPage) #: The object containing the field data. fields_model = Instance(EMFields) #: The 3D view panel. mayavi_scene = Instance(Mayavi3DScene) #: The slice figure panel. slice_figure = Instance(SliceFigureModel) #: The line figure panel. line_figure = Instance(LineFigureModel) #: Has the main window been initialized? model_initialized = Bool(False) #: Action to run :py:meth:`toggle_full_model`. toggle_model_action = TaskAction(name='Full Model', method='toggle_full_model', style='toggle', enabled_name='model_initialized') #: Action to run :py:meth:`change_cord_model`. new_cord_action = TaskAction(name='New Cord Model', method='change_cord_model', enabled_name='model_initialized') #: Action to run :py:meth:`toggle_log_scale`. toggle_scale_action = TaskAction(name='Log Scale', method='toggle_log_scale', style='toggle', checked=True, enabled_name='model_initialized') #: Action to run :py:meth:`toggle_line_cross_marker`. toggle_line_cross_action = TaskAction(name='Line Cross Marker', method='toggle_line_cross_marker', style='toggle', checked=True, enabled_name='model_initialized') #: The task's menu bar. menu_bar = SMenuBar( SMenu( TaskAction(name="&Open...", method="open", accelerator="Ctrl+O"), SMenu( TaskAction(name="Export &Slice", method="export_slice"), TaskAction(name="Export &Line", method="export_line"), id="File.Export", name="&Export", ), TaskAction(name="&Settings", method="edit_configuration"), id="File", name="&File", ), SMenu(SMenu(DockPaneToggleGroup(), id='View.Panes', name='&Panes'), toggle_model_action, toggle_scale_action, toggle_line_cross_action, id="View", name="&View"), SMenu( new_cord_action, SMenu(FieldSelectionGroup(), id='Edit.Fields', name='&Choose Field'), id='Edit', name='&Edit', ), ) # ------------------------------------------------------------------------ # 'Task' interface. # ------------------------------------------------------------------------ @observe('editor_area.active_tabwidget') def _update_tabwidgets(self, event): # pylint: disable=unused-argument try: self.editor_area.active_tabwidget.setTabsClosable(False) except AttributeError: pass def initialized(self): for tabwidget in self.editor_area.tabwidgets(): tabwidget.setTabsClosable(False) self.start_page = StartPage(task=self) self.editor_area.add_editor(self.start_page) self.editor_area.activate_editor(self.start_page) self.activated() def activated(self): self.editor_area.active_tabwidget.setTabsClosable(False) def create_central_pane(self): self.editor_area = SplitEditorAreaPane( callbacks={'open': self._new_file}) return self.editor_area def create_dock_panes(self): """ Create the attribute editor panes. """ self.plane_attributes_pane = PlaneAttributes( configuration=self.configuration) self.plane_attributes_pane.sync_trait('participant_id', self) self.line_attributes_pane = LineAttributes( configuration=self.configuration) self.line_attributes_pane.sync_trait('participant_id', self) self.part_id_pane = ParticipantIDPane() self.part_id_pane.sync_trait('participant_id', self) return [ self.plane_attributes_pane, self.line_attributes_pane, self.part_id_pane ] # ------------------------------------------------------------------------ # 'S4L_Visualization_task' interface. # ------------------------------------------------------------------------ def open(self): """ Show a dialog to open a new data source. """ dialog = FileDialog( title='Choose Data File', parent=self.window.control, wildcard=FileDialog.create_wildcard('Data Files', ['*.mat']) + FileDialog.WILDCARD_ALL) if dialog.open() == OK: if not self.model_initialized: self._new_file(dialog.path) def export_slice(self): """ Export data for current slice. """ dialog = FileDialog( title='Export Slice Plane', action='save as', parent=self.window.control, wildcard='' + FileDialog.create_wildcard('Excel Files', ['*.xlsx']) + FileDialog.create_wildcard('CSV Files', ['*.csv', '*.txt']) + FileDialog.WILDCARD_ALL) if dialog.open() == OK: self.slice_figure.export_slice(dialog.path) def export_line(self): """ Export data for current line. """ dialog = FileDialog( title='Export Line Data', action='save as', parent=self.window.control, wildcard='' + FileDialog.create_wildcard('Excel Files', ['*.xlsx']) + FileDialog.create_wildcard('CSV Files', ['*.csv', '*.txt']) + FileDialog.WILDCARD_ALL) if dialog.open() == OK: self.line_figure.export_line(dialog.path) def toggle_full_model(self): """ Toggle between showing the full spinal cord model and showing only below the cut plane. """ self.mayavi_scene.show_full_model = not self.mayavi_scene.show_full_model def toggle_log_scale(self): """ Toggle between using a logarithmic scale and a linear scale. """ self.mayavi_scene.log_scale = not self.mayavi_scene.log_scale self.slice_figure.log_scale = not self.slice_figure.log_scale def toggle_line_cross_marker(self): """ Toggle visibility of the line cross marker on the slice figure. """ self.slice_figure.draw_cross = not self.slice_figure.draw_cross def change_cord_model(self): """ Change the spinal cord model file used for the 3D display. """ dialog = FileDialog( title='Choose Spinal Cord Model', parent=self.window.control, wildcard=FileDialog.create_wildcard('VTK Model', ['*.vtk']) + FileDialog.WILDCARD_ALL) if dialog.open() == OK: self.mayavi_scene.csf_model = dialog.path def reset_camera(self): """ Set the camera for the Mayavi scene to a pre-determined perspective. """ self.mayavi_scene.initialize_camera() def edit_configuration(self): preferences = PreferenceDialog(configuration=self.configuration, title="S4L Visualization Preferences") ui = preferences.edit_traits(kind='modal') if ui.result: self.configuration.remove_section('') with open('config.ini', 'w') as out_file: self.configuration.write(out_file) def update_participant_id(self): if self.model_initialized: self.line_attributes_pane.set_participant_defaults() self.mayavi_scene.reset_participant_defaults() # ------------------------------------------------------------------------ # Protected interface. # ------------------------------------------------------------------------ def _new_file(self, filename): """ Change the data source to the file at the specified path Parameters ---------- filename : :py:class:`os.PathLike` Path to data source file """ GUI.set_busy(True) if m := re.search(r"\D(\d{3})\D", filename): self.participant_id = m.group(1) if self.participant_id is not None: if self.participant_id not in self.configuration: self.configuration[self.participant_id] = {} default_points = self.configuration[self.participant_id]['points'] self.line_attributes_pane.set_points(default_points) self.part_id_pane.participant_id = self.participant_id self.editor_area.remove_editor(self.start_page) self.window.set_layout( TaskLayout(bottom=PaneItem('s4l.plane_attributes'), left=VSplitter(PaneItem('s4l.line_attributes'), PaneItem('s4l.participant_id_pane')), top_left_corner='top', top_right_corner='top', bottom_left_corner='left', bottom_right_corner='right')) self.fields_model = EMFields(configuration=self.configuration, data_path=filename) self.fields_model.sync_trait('participant_id', self) self.plane_attributes_pane.fields_model = self.fields_model self.mayavi_scene = Mayavi3DScene(fields_model=self.fields_model, configuration=self.configuration) self.mayavi_scene.sync_trait('participant_id', self) self.mayavi_scene.sync_trait('normal', self.plane_attributes_pane) self.mayavi_scene.sync_trait('origin', self.plane_attributes_pane) self.line_attributes_pane.sync_trait('points', self.mayavi_scene, mutual=False) self.mayavi_scene.create_plot() editor = self.mayavi_scene self.editor_area.add_editor(editor) self.editor_area.activate_editor(editor) self.editor_area.active_tabwidget.setTabsClosable(False) self.activated() self.slice_figure = SliceFigureModel(fields_model=self.fields_model, mayavi_scene=self.mayavi_scene, configuration=self.configuration) self.slice_figure.sync_trait('participant_id', self) self.slice_figure.create_plot() self.editor_area.add_editor(self.slice_figure) self.editor_area.activate_editor(self.slice_figure) self.editor_area.active_tabwidget.setTabsClosable(False) self.activated() self.line_figure = LineFigureModel(fields_model=self.fields_model) self.line_figure.sync_trait('points', self.line_attributes_pane) self.line_figure.create_plot(None) self.editor_area.add_editor(self.line_figure) self.editor_area.activate_editor(self.line_figure) self.editor_area.active_tabwidget.setTabsClosable(False) self.activated() self.mayavi_scene.disable_widgets() while self.editor_area.active_tabwidget.parent().is_collapsible(): self.editor_area.active_tabwidget.parent().collapse() layout = Splitter( Tabbed(PaneItem(1), PaneItem(2), active_tab=0), Tabbed(PaneItem(0), active_tab=0), ) self.editor_area.set_layout(layout) self.editor_area.control.setSizes([900, 295]) self.editor_area.activate_editor(self.slice_figure) self.editor_area.active_tabwidget.setTabsClosable(False) for tabwidget in self.editor_area.tabwidgets(): tabwidget.setTabsClosable(False) self.model_initialized = True
def _default_layout_default(self): return TaskLayout(left=Tabbed( PaneItem("steps.first_pane"), PaneItem("steps.second_pane"), PaneItem("steps.third_pane"), ))
def pane_layout(): """ Create the default task layout, which is overridded by the user's save state if it exists. """ return TaskLayout()
def pane_layout(): """ Create the default task layout, which is overridded by the user's save state if it exists. """ return TaskLayout(left=VSplitter(PaneItem('bitmap_edit.sidebar'), ), )