def restore_volume_dialog_state(volume_dialog_basic_state): from chimera import nogui if nogui: return from SessionUtil.stateclasses import Model_State, Xform_State classes = ( Volume_Dialog_State, Data_Set_State, Data_State, Volume_State, Region_List_State, Rendering_Options_State, Component_Display_Parameters_State, Model_State, Xform_State, ) name_to_class = {} for c in classes: name_to_class[c.__name__] = c name_to_class['Data_Region_State'] = Volume_State # Historical name from SessionUtil import objecttree s = objecttree.basic_tree_to_instance_tree(volume_dialog_basic_state, name_to_class) from volumedialog import volume_dialog d = volume_dialog(create = True) s.restore_state(d)
def restore_path_tracer_state(path_tracer_dialog_basic_state): from SessionUtil.stateclasses import Model_State, Xform_State from Surface.session import Surface_Model_State, Surface_Piece_State classes = ( Path_Tracer_Dialog_State, Marker_Set_State, Marker_State, Link_State, Surface_Model_State, Surface_Piece_State, Model_State, Xform_State, ) name_to_class = {} for c in classes: name_to_class[c.__name__] = c from SessionUtil import objecttree s = objecttree.basic_tree_to_instance_tree(path_tracer_dialog_basic_state, name_to_class) if isinstance(s, tuple): marker_set_states, dialog_state = s msets = [mss.create_object() for mss in marker_set_states] else: dialog_state = s if dialog_state: from VolumePath.gui import volume_path_dialog d = volume_path_dialog(create = True) dialog_state.restore_state(d)
def restore_multiscale_state(multiscale_dialog_state): from SessionUtil.stateclasses import Model_State, Xform_State classes = ( Multiscale_Dialog_State, Group_Piece_State, Chain_Piece_State, LAN_Molecule_State, LAN_Chain_State, Model_State, Xform_State, ) name_to_class = {} for c in classes: name_to_class[c.__name__] = c from SessionUtil import objecttree s = objecttree.basic_tree_to_instance_tree(multiscale_dialog_state, name_to_class) import MultiScale d = MultiScale.multiscale_model_dialog(create=True) set_dialog_state(s, d)
def restore_volume_dialog_state(volume_dialog_basic_state): from chimera import nogui if nogui: return from SessionUtil.stateclasses import Model_State, Xform_State classes = ( Volume_Dialog_State, Data_Set_State, Data_State, Volume_State, Region_List_State, Rendering_Options_State, Component_Display_Parameters_State, Model_State, Xform_State, ) name_to_class = {} for c in classes: name_to_class[c.__name__] = c name_to_class['Data_Region_State'] = Volume_State # Historical name from SessionUtil import objecttree s = objecttree.basic_tree_to_instance_tree(volume_dialog_basic_state, name_to_class) from volumedialog import volume_dialog d = volume_dialog(create=True) s.restore_state(d)
def restore_path_tracer_state(path_tracer_dialog_basic_state): from SessionUtil.stateclasses import Model_State, Xform_State from Surface.session import Surface_Model_State, Surface_Piece_State classes = ( Path_Tracer_Dialog_State, Marker_Set_State, Marker_State, Link_State, Surface_Model_State, Surface_Piece_State, Model_State, Xform_State, ) name_to_class = {} for c in classes: name_to_class[c.__name__] = c from SessionUtil import objecttree s = objecttree.basic_tree_to_instance_tree(path_tracer_dialog_basic_state, name_to_class) if isinstance(s, tuple): marker_set_states, dialog_state = s msets = [mss.create_object() for mss in marker_set_states] else: dialog_state = s if dialog_state: from VolumePath.gui import volume_path_dialog d = volume_path_dialog(create=True) dialog_state.restore_state(d)
def restore_multiscale_state(multiscale_dialog_state): from SessionUtil.stateclasses import Model_State, Xform_State classes = ( Multiscale_Dialog_State, Group_Piece_State, Chain_Piece_State, LAN_Molecule_State, LAN_Chain_State, Model_State, Xform_State, ) name_to_class = {} for c in classes: name_to_class[c.__name__] = c from SessionUtil import objecttree s = objecttree.basic_tree_to_instance_tree(multiscale_dialog_state, name_to_class) import MultiScale d = MultiScale.multiscale_model_dialog(create = True) set_dialog_state(s, d)
def restore_color_zone_state(color_zone_state): classes = (Color_Zone_State, ) name_to_class = {} for c in classes: name_to_class[c.__name__] = c from SessionUtil import objecttree s = objecttree.basic_tree_to_instance_tree(color_zone_state, name_to_class) s.restore_state()
def restore_hide_dust_state(hide_dust_state): classes = (Hide_Dust_State, ) name_to_class = {} for c in classes: name_to_class[c.__name__] = c from SessionUtil import objecttree s = objecttree.basic_tree_to_instance_tree(hide_dust_state, name_to_class) s.restore_state()
def restore_color_zone_state(color_zone_state): classes = ( Color_Zone_State, ) name_to_class = {} for c in classes: name_to_class[c.__name__] = c from SessionUtil import objecttree s = objecttree.basic_tree_to_instance_tree(color_zone_state, name_to_class) s.restore_state()
def restore_hide_dust_state(hide_dust_state): classes = ( Hide_Dust_State, ) name_to_class = {} for c in classes: name_to_class[c.__name__] = c from SessionUtil import objecttree s = objecttree.basic_tree_to_instance_tree(hide_dust_state, name_to_class) s.restore_state()
def restore_capper_state(capper_dialog_basic_state): classes = (Capper_Dialog_State, ) name_to_class = {} for c in classes: name_to_class[c.__name__] = c from SessionUtil import objecttree s = objecttree.basic_tree_to_instance_tree(capper_dialog_basic_state, name_to_class) import SurfaceCap.gui d = SurfaceCap.gui.capper_dialog(create=1) set_dialog_state(s, d)
def restore_capper_state(capper_dialog_basic_state): classes = ( Capper_Dialog_State, ) name_to_class = {} for c in classes: name_to_class[c.__name__] = c from SessionUtil import objecttree s = objecttree.basic_tree_to_instance_tree(capper_dialog_basic_state, name_to_class) import SurfaceCap.gui d = SurfaceCap.gui.capper_dialog(create = 1) set_dialog_state(s, d)
def restore_path_tracer_state(path_tracer_dialog_basic_state): from SessionUtil.stateclasses import Model_State, Xform_State classes = (Path_Tracer_Dialog_State, Marker_Set_State, Marker_State, Link_State, Model_State, Xform_State) name_to_class = {} for c in classes: name_to_class[c.__name__] = c from SessionUtil import objecttree s = objecttree.basic_tree_to_instance_tree(path_tracer_dialog_basic_state, name_to_class) import VolumePath d = VolumePath.volume_path_dialog(create=1) set_dialog_state(s, d)
def restore_surface_color_state(surface_color_state): classes = ( Surface_Colorings_State, Volume_Color_State, Gradient_Color_State, Electrostatic_Color_State, Height_Color_State, Radial_Color_State, Cylinder_Color_State, Color_Map_State, ) name_to_class = {} for c in classes: name_to_class[c.__name__] = c from SessionUtil import objecttree s = objecttree.basic_tree_to_instance_tree(surface_color_state, name_to_class) s.restore_state()
def restore_icosahedron_state(icosahedron_dialog_basic_state): from SessionUtil.stateclasses import Model_State, Xform_State classes = ( Icosahedron_Dialog_State, Model_State, Xform_State, ) name_to_class = {} for c in classes: name_to_class[c.__name__] = c from SessionUtil import objecttree s = objecttree.basic_tree_to_instance_tree(icosahedron_dialog_basic_state, name_to_class) import Icosahedron.gui d = Icosahedron.gui.icosahedron_dialog(create=True) set_dialog_state(s, d)
def restore_icosahedron_state(icosahedron_dialog_basic_state): from SessionUtil.stateclasses import Model_State, Xform_State classes = ( Icosahedron_Dialog_State, Model_State, Xform_State, ) name_to_class = {} for c in classes: name_to_class[c.__name__] = c from SessionUtil import objecttree s = objecttree.basic_tree_to_instance_tree(icosahedron_dialog_basic_state, name_to_class) import Icosahedron.gui d = Icosahedron.gui.icosahedron_dialog(create = True) set_dialog_state(s, d)
def restore_surface_color_state(surface_color_state): classes = ( Surface_Colorings_State, Volume_Color_State, Gradient_Color_State, Electrostatic_Color_State, Height_Color_State, Radial_Color_State, Cylinder_Color_State, Color_Map_State, ) name_to_class = {} for c in classes: name_to_class[c.__name__] = c from SessionUtil import objecttree s = objecttree.basic_tree_to_instance_tree(surface_color_state, name_to_class) s.restore_state()
def restore_scale_bar_state(scale_bar_dialog_basic_state): from SessionUtil.stateclasses import Model_State, Xform_State classes = ( Scale_Bar_Dialog_State, Model_State, Xform_State, ) name_to_class = {} for c in classes: name_to_class[c.__name__] = c from SessionUtil import objecttree s = objecttree.basic_tree_to_instance_tree(scale_bar_dialog_basic_state, name_to_class) import ScaleBar d = ScaleBar.scale_bar_dialog(create = 1) set_dialog_state(s, d)
def restore_surface_state(surface_state): from SessionUtil.stateclasses import Model_State, Xform_State classes = ( Surface_Model_State, Surface_Piece_State, Model_State, Xform_State, ) name_to_class = {} for c in classes: name_to_class[c.__name__] = c from SessionUtil import objecttree stlist = objecttree.basic_tree_to_instance_tree(surface_state, name_to_class) for st in stlist: s = st.create_object() for p in s.surfacePieces: p.save_in_session = True
def restore_scale_bar_state(scale_bar_dialog_basic_state): from SessionUtil.stateclasses import Model_State, Xform_State classes = ( Scale_Bar_Dialog_State, Model_State, Xform_State, ) name_to_class = {} for c in classes: name_to_class[c.__name__] = c from SessionUtil import objecttree s = objecttree.basic_tree_to_instance_tree(scale_bar_dialog_basic_state, name_to_class) import ScaleBar d = ScaleBar.scale_bar_dialog(create=1) set_dialog_state(s, d)
def restore_surface_state(surface_state): from SessionUtil.stateclasses import Model_State, Xform_State classes = ( Surface_Model_State, Surface_Piece_State, Model_State, Xform_State, ) name_to_class = {} for c in classes: name_to_class[c.__name__] = c from SessionUtil import objecttree stlist = objecttree.basic_tree_to_instance_tree(surface_state, name_to_class) for st in stlist: s = st.create_object() for p in s.surfacePieces: p.save_in_session = True
def restore_volume_data_state(volume_data_basic_state): from SessionUtil.stateclasses import Model_State, Xform_State classes = ( Volume_Manager_State, Data_State, Volume_State, Region_List_State, Rendering_Options_State, Model_State, Xform_State, ) name_to_class = {} for c in classes: name_to_class[c.__name__] = c name_to_class['Data_Region_State'] = Volume_State # Historical name from SessionUtil import objecttree s = objecttree.basic_tree_to_instance_tree(volume_data_basic_state, name_to_class) from volume import volume_manager s.restore_state(volume_manager)
def restore_volume_data_state(volume_data_basic_state): from SessionUtil.stateclasses import Model_State, Xform_State classes = ( Volume_Manager_State, Data_State, Volume_State, Region_List_State, Rendering_Options_State, Model_State, Xform_State, ) name_to_class = {} for c in classes: name_to_class[c.__name__] = c name_to_class['Data_Region_State'] = Volume_State # Historical name from SessionUtil import objecttree s = objecttree.basic_tree_to_instance_tree(volume_data_basic_state, name_to_class) from volume import volume_manager s.restore_state(volume_manager)
def restoreSession(self, state): from SessionUtil import stateclasses, objecttree if len(state) == 10: (pageName, chosenMolecules, chosenChains, opts, pruneDistance, bias, dataSource, markerValues, modelData, trackedIndex) = state if modelData: isMapped = True else: isMapped = False else: (pageName, chosenMolecules, chosenChains, opts, pruneDistance, bias, histogramData, markerValues, modelData, trackedIndex, isMapped) = state # Call get method to make sure items are updated self.molChooser.get() self.molChooser.setvalue(chosenMolecules) self.chainChooser.get() self.chainChooser.setvalue(chosenChains) self.notebook.selectpage(pageName) self.outputOptions.setvalue(list(opts)) self.pruneDistance.setvalue(pruneDistance) self.moleculeBias.setvalue(bias) if isinstance(histogramData, basestring): dataSource = histogramData else: lo, hi, surfMetric = histogramData self.histogramData = (lo, hi, surfMetric) def myMakeBars(numBins, data=self.histogramData): return makeBars(numBins, data) dataSource = (lo, hi, myMakeBars) self.histogram["datasource"] = dataSource if markerValues: oldMarkers = self.histogram.currentmarkerinfo()[0] newMarkers = self.histogram.addmarkers() newMarkers.extend(markerValues) self.histogram.deletemarkers(oldMarkers) self.histogramMarkers = newMarkers trackedModel = None trackedPiece = None nameToClass = { "Model_State": stateclasses.Model_State, "Xform_State": stateclasses.Xform_State, } for n, mState in enumerate(modelData): if len(mState) == 2: v, bt = mState else: v = mState bt = None sm, g = self._show_geometry(*v) if trackedIndex == n: trackedModel = sm trackedPiece = g if bt is not None: ms = objecttree.basic_tree_to_instance_tree(bt, nameToClass) ms.restore_state(sm) if trackedModel: self._trackedModel = trackedModel self._trackedPiece = trackedPiece if not isMapped: self.Close()