コード例 #1
0
def save_surface_color_state(coloring_table, file):

    s = Surface_Colorings_State()
    s.state_from_coloring_table(coloring_table)

    from gui import surface_color_dialog
    dialog = surface_color_dialog()
    s.state_from_dialog(dialog)

    from SessionUtil import objecttree
    t = objecttree.instance_tree_to_basic_tree(s)

    file.write('\n')
    file.write('def restore_surface_color_mapping():\n')
    file.write(' try:\n')
    file.write('  surface_color_state = \\\n')
    objecttree.write_basic_tree(t, file, indent='   ')
    file.write('\n')
    file.write('  import SurfaceColor.session\n')
    file.write(
        '  SurfaceColor.session.restore_surface_color_state(surface_color_state)\n'
    )
    file.write(' except:\n')
    file.write(
        "  reportRestoreError('Error restoring surface color mapping')\n")
    file.write('\n')
    file.write('registerAfterModelsCB(restore_surface_color_mapping)\n')
    file.write('\n')
コード例 #2
0
ファイル: session.py プロジェクト: davem22101/semanticscience
def save_surface_color_state(coloring_table, file):

  s = Surface_Colorings_State()
  s.state_from_coloring_table(coloring_table)

  from gui import surface_color_dialog
  dialog = surface_color_dialog()
  s.state_from_dialog(dialog)
  
  from SessionUtil import objecttree
  t = objecttree.instance_tree_to_basic_tree(s)

  file.write('\n')
  file.write('def restore_surface_color_mapping():\n')
  file.write(' try:\n')
  file.write('  surface_color_state = \\\n')
  objecttree.write_basic_tree(t, file, indent = '   ')
  file.write('\n')
  file.write('  import SurfaceColor.session\n')
  file.write('  SurfaceColor.session.restore_surface_color_state(surface_color_state)\n')
  file.write(' except:\n')
  file.write("  reportRestoreError('Error restoring surface color mapping')\n")
  file.write('\n')
  file.write('registerAfterModelsCB(restore_surface_color_mapping)\n')
  file.write('\n')
コード例 #3
0
def save_volume_data_state(volume_manager, file):

    s = Volume_Manager_State()
    s.state_from_manager(volume_manager)

    from os.path import dirname
    directory = dirname(file.fileName)
    if directory:
        s.use_relative_paths(directory)

    from SessionUtil import objecttree
    t = objecttree.instance_tree_to_basic_tree(s)

    file.write('\n')
    file.write('def restore_volume_data():\n')
    file.write(' volume_data_state = \\\n')
    objecttree.write_basic_tree(t, file, indent='  ')
    file.write('\n')
    file.write(' from VolumeViewer import session\n')
    file.write(' session.restore_volume_data_state(volume_data_state)\n')
    file.write('\n')
    file.write('try:\n')
    file.write('  restore_volume_data()\n')
    file.write('except:\n')
    file.write("  reportRestoreError('Error restoring volume data')\n")
    file.write('\n')
コード例 #4
0
ファイル: session.py プロジェクト: davem22101/semanticscience
def save_volume_data_state(volume_manager, file):

  s = Volume_Manager_State()
  s.state_from_manager(volume_manager)

  from os.path import dirname
  directory = dirname(file.fileName)
  if directory:
    s.use_relative_paths(directory)
  
  from SessionUtil import objecttree
  t = objecttree.instance_tree_to_basic_tree(s)

  file.write('\n')
  file.write('def restore_volume_data():\n')
  file.write(' volume_data_state = \\\n')
  objecttree.write_basic_tree(t, file, indent = '  ')
  file.write('\n')
  file.write(' from VolumeViewer import session\n')
  file.write(' session.restore_volume_data_state(volume_data_state)\n')
  file.write('\n')
  file.write('try:\n')
  file.write('  restore_volume_data()\n')
  file.write('except:\n')
  file.write("  reportRestoreError('Error restoring volume data')\n")
  file.write('\n')
コード例 #5
0
def save_path_tracer_state(path_tracer_dialog, file):

    if path_tracer_dialog:
        ds = Path_Tracer_Dialog_State()
        ds.state_from_dialog(path_tracer_dialog)
    else:
        ds = None
    mss = marker_set_states()
    s = (mss, ds)

    from SessionUtil import objecttree
    t = objecttree.instance_tree_to_basic_tree(s)

    file.write('\n')
    file.write('def restore_volume_path_tracer():\n')
    file.write(' path_tracer_state = \\\n')
    objecttree.write_basic_tree(t, file, indent='  ')
    file.write('\n')
    file.write(' import VolumePath.session\n')
    file.write(
        ' VolumePath.session.restore_path_tracer_state(path_tracer_state)\n')
    file.write('\n')
    file.write('try:\n')
    file.write('  restore_volume_path_tracer()\n')
    file.write('except:\n')
    file.write("  reportRestoreError('Error restoring volume path tracer')\n")
    file.write('\n')
コード例 #6
0
ファイル: session.py プロジェクト: davem22101/semanticscience
def save_path_tracer_state(path_tracer_dialog, file):

  if path_tracer_dialog:
    ds = Path_Tracer_Dialog_State()
    ds.state_from_dialog(path_tracer_dialog)
  else:
    ds = None
  mss = marker_set_states()
  s = (mss, ds)
  
  from SessionUtil import objecttree
  t = objecttree.instance_tree_to_basic_tree(s)

  file.write('\n')
  file.write('def restore_volume_path_tracer():\n')
  file.write(' path_tracer_state = \\\n')
  objecttree.write_basic_tree(t, file, indent = '  ')
  file.write('\n')
  file.write(' import VolumePath.session\n')
  file.write(' VolumePath.session.restore_path_tracer_state(path_tracer_state)\n')
  file.write('\n')
  file.write('try:\n')
  file.write('  restore_volume_path_tracer()\n')
  file.write('except:\n')
  file.write("  reportRestoreError('Error restoring volume path tracer')\n")
  file.write('\n')
コード例 #7
0
ファイル: session.py プロジェクト: davem22101/semanticscience
def save_surface_state(file):

  slist = []
  from chimera import openModels as om
  from _surface import SurfaceModel
  for s in om.list(modelTypes = [SurfaceModel]):
    plist = [p for p in s.surfacePieces
             if hasattr(p, 'save_in_session') and p.save_in_session]
    if plist:
      slist.append((s,plist)) 
  if len(slist) == 0:
    return

  smslist = []
  for s,plist in slist:
    sms = Surface_Model_State()
    sms.state_from_surface_model(s,plist)
    smslist.append(sms)
  
  from SessionUtil import objecttree
  t = objecttree.instance_tree_to_basic_tree(smslist)

  file.write('\n')
  file.write('def restore_surfaces():\n')
  file.write(' surface_state = \\\n')
  objecttree.write_basic_tree(t, file, indent = '  ')
  file.write('\n')
  file.write(' from Surface import session\n')
  file.write(' session.restore_surface_state(surface_state)\n')
  file.write('\n')
  file.write('try:\n')
  file.write(' restore_surfaces()\n')
  file.write('except:\n')
  file.write(" reportRestoreError('Error restoring surfaces')\n")
  file.write('\n')
コード例 #8
0
ファイル: session.py プロジェクト: davem22101/semanticscience
def save_hide_dust_state(dust_table, file):

  s = Hide_Dust_State()
  s.state_from_dust_table(dust_table)
  
  from SessionUtil import objecttree
  t = objecttree.instance_tree_to_basic_tree(s)

  file.write('\n')
  file.write('def restore_hide_dust():\n')
  file.write(' hide_dust_state = \\\n')
  objecttree.write_basic_tree(t, file, indent = '   ')
  file.write('\n')
  file.write(' try:\n')
  file.write('  import HideDust.session\n')
  file.write('  HideDust.session.restore_hide_dust_state(hide_dust_state)\n')
  file.write(' except:\n')
  file.write("  reportRestoreError('Error restoring hide dust')\n")
  file.write('\n')
  file.write('registerAfterModelsCB(restore_hide_dust)\n')
  file.write('\n')
コード例 #9
0
def save_scale_bar_state(scale_bar_dialog, file):

    s = Scale_Bar_Dialog_State()
    s.state_from_dialog(scale_bar_dialog)

    from SessionUtil import objecttree
    t = objecttree.instance_tree_to_basic_tree(s)

    file.write('\n')
    file.write('def restore_scale_bar():\n')
    file.write(' scale_bar_state = \\\n')
    objecttree.write_basic_tree(t, file, indent='  ')
    file.write('\n')
    file.write(' import ScaleBar.session\n')
    file.write(' ScaleBar.session.restore_scale_bar_state(scale_bar_state)\n')
    file.write('\n')
    file.write('try:\n')
    file.write('  restore_scale_bar()\n')
    file.write('except:\n')
    file.write("  reportRestoreError('Error restoring scale bar')\n")
    file.write('\n')
コード例 #10
0
ファイル: session.py プロジェクト: davem22101/semanticscience
def save_icosahedron_state(icosahedron_dialog, file):

  s = Icosahedron_Dialog_State()
  s.state_from_dialog(icosahedron_dialog)
  
  from SessionUtil import objecttree
  t = objecttree.instance_tree_to_basic_tree(s)

  file.write('\n')
  file.write('def restore_icosahedron():\n')
  file.write(' icosahedron_state = \\\n')
  objecttree.write_basic_tree(t, file, indent = '  ')
  file.write('\n')
  file.write(' from Icosahedron import session\n')
  file.write(' session.restore_icosahedron_state(icosahedron_state)\n')
  file.write('\n')
  file.write('try:\n')
  file.write('  restore_icosahedron()\n')
  file.write('except:\n')
  file.write("  reportRestoreError('Error restoring icosahedron')\n")
  file.write('\n')
コード例 #11
0
ファイル: session.py プロジェクト: davem22101/semanticscience
def save_volume_dialog_state(volume_dialog, file):

  s = Volume_Dialog_State()
  s.state_from_dialog(volume_dialog)
  
  from SessionUtil import objecttree
  t = objecttree.instance_tree_to_basic_tree(s)

  file.write('\n')
  file.write('def restore_volume_dialog():\n')
  file.write(' volume_dialog_state = \\\n')
  objecttree.write_basic_tree(t, file, indent = '  ')
  file.write('\n')
  file.write(' from VolumeViewer import session\n')
  file.write(' session.restore_volume_dialog_state(volume_dialog_state)\n')
  file.write('\n')
  file.write('try:\n')
  file.write('  restore_volume_dialog()\n')
  file.write('except:\n')
  file.write("  reportRestoreError('Error restoring volume dialog')\n")
  file.write('\n')
コード例 #12
0
def save_icosahedron_state(icosahedron_dialog, file):

    s = Icosahedron_Dialog_State()
    s.state_from_dialog(icosahedron_dialog)

    from SessionUtil import objecttree
    t = objecttree.instance_tree_to_basic_tree(s)

    file.write('\n')
    file.write('def restore_icosahedron():\n')
    file.write(' icosahedron_state = \\\n')
    objecttree.write_basic_tree(t, file, indent='  ')
    file.write('\n')
    file.write(' from Icosahedron import session\n')
    file.write(' session.restore_icosahedron_state(icosahedron_state)\n')
    file.write('\n')
    file.write('try:\n')
    file.write('  restore_icosahedron()\n')
    file.write('except:\n')
    file.write("  reportRestoreError('Error restoring icosahedron')\n")
    file.write('\n')
コード例 #13
0
def save_surface_zone_state(zone_table, file):

  s = Surface_Zone_State()
  s.state_from_zone_table(zone_table)
  
  from SessionUtil import objecttree
  t = objecttree.instance_tree_to_basic_tree(s)

  file.write('\n')
  file.write('def restore_surface_zones():\n')
  file.write(' surface_zone_state = \\\n')
  objecttree.write_basic_tree(t, file, indent = '   ')
  file.write('\n')
  file.write(' try:\n')
  file.write('  import SurfaceZone.session\n')
  file.write('  SurfaceZone.session.restore_surface_zone_state(surface_zone_state)\n')
  file.write(' except:\n')
  file.write("  reportRestoreError('Error restoring surface zones')\n")
  file.write('\n')
  file.write('registerAfterModelsCB(restore_surface_zones)\n')
  file.write('\n')
コード例 #14
0
ファイル: session.py プロジェクト: davem22101/semanticscience
def save_scale_bar_state(scale_bar_dialog, file):

  s = Scale_Bar_Dialog_State()
  s.state_from_dialog(scale_bar_dialog)
  
  from SessionUtil import objecttree
  t = objecttree.instance_tree_to_basic_tree(s)

  file.write('\n')
  file.write('def restore_scale_bar():\n')
  file.write(' scale_bar_state = \\\n')
  objecttree.write_basic_tree(t, file, indent = '  ')
  file.write('\n')
  file.write(' import ScaleBar.session\n')
  file.write(' ScaleBar.session.restore_scale_bar_state(scale_bar_state)\n')
  file.write('\n')
  file.write('try:\n')
  file.write('  restore_scale_bar()\n')
  file.write('except:\n')
  file.write("  reportRestoreError('Error restoring scale bar')\n")
  file.write('\n')
コード例 #15
0
def save_hide_dust_state(dust_table, file):

    s = Hide_Dust_State()
    s.state_from_dust_table(dust_table)

    from SessionUtil import objecttree
    t = objecttree.instance_tree_to_basic_tree(s)

    file.write('\n')
    file.write('def restore_hide_dust():\n')
    file.write(' hide_dust_state = \\\n')
    objecttree.write_basic_tree(t, file, indent='   ')
    file.write('\n')
    file.write(' try:\n')
    file.write('  import HideDust.session\n')
    file.write('  HideDust.session.restore_hide_dust_state(hide_dust_state)\n')
    file.write(' except:\n')
    file.write("  reportRestoreError('Error restoring hide dust')\n")
    file.write('\n')
    file.write('registerAfterModelsCB(restore_hide_dust)\n')
    file.write('\n')
コード例 #16
0
ファイル: session.py プロジェクト: davem22101/semanticscience
def save_capper_state(capper_dialog, file):

  s = Capper_Dialog_State()
  s.state_from_dialog(capper_dialog)
  
  from SessionUtil import objecttree
  t = objecttree.instance_tree_to_basic_tree(s)

  file.write('\n')
  file.write('def restore_surface_capping():\n')
  file.write(' capper_state = \\\n')
  objecttree.write_basic_tree(t, file, indent = '  ')
  file.write('\n')
  file.write(' import SurfaceCap.session\n')
  file.write(' SurfaceCap.session.restore_capper_state(capper_state)\n')
  file.write('\n')
  file.write('try:\n')
  file.write('  restore_surface_capping()\n')
  file.write('except:\n')
  file.write("  reportRestoreError('Error restoring surface capping')\n")
  file.write('\n')
コード例 #17
0
ファイル: session.py プロジェクト: davem22101/semanticscience
def save_multiscale_state(multiscale_dialog, file):

  s = Multiscale_Dialog_State()
  s.state_from_dialog(multiscale_dialog)
  
  from SessionUtil import objecttree
  t = objecttree.instance_tree_to_basic_tree(s)

  file.write('\n')
  file.write('def restore_multiscale():\n')
  file.write(' multiscale_state = \\\n')
  objecttree.write_basic_tree(t, file, indent = '  ')
  file.write('\n')
  file.write(' import MultiScale.session\n')
  file.write(' MultiScale.session.restore_multiscale_state(multiscale_state)\n')
  file.write('\n')
  file.write('try:\n')
  file.write('  restore_multiscale()\n')
  file.write('except:\n')
  file.write("  reportRestoreError('Error restoring multiscale')\n")
  file.write('\n')
コード例 #18
0
def save_capper_state(capper_dialog, file):

    s = Capper_Dialog_State()
    s.state_from_dialog(capper_dialog)

    from SessionUtil import objecttree
    t = objecttree.instance_tree_to_basic_tree(s)

    file.write('\n')
    file.write('def restore_surface_capping():\n')
    file.write(' capper_state = \\\n')
    objecttree.write_basic_tree(t, file, indent='  ')
    file.write('\n')
    file.write(' import SurfaceCap.session\n')
    file.write(' SurfaceCap.session.restore_capper_state(capper_state)\n')
    file.write('\n')
    file.write('try:\n')
    file.write('  restore_surface_capping()\n')
    file.write('except:\n')
    file.write("  reportRestoreError('Error restoring surface capping')\n")
    file.write('\n')
コード例 #19
0
def save_volume_dialog_state(volume_dialog, file):

    s = Volume_Dialog_State()
    s.state_from_dialog(volume_dialog)

    from SessionUtil import objecttree
    t = objecttree.instance_tree_to_basic_tree(s)

    file.write('\n')
    file.write('def restore_volume_dialog():\n')
    file.write(' volume_dialog_state = \\\n')
    objecttree.write_basic_tree(t, file, indent='  ')
    file.write('\n')
    file.write(' from VolumeViewer import session\n')
    file.write(' session.restore_volume_dialog_state(volume_dialog_state)\n')
    file.write('\n')
    file.write('try:\n')
    file.write('  restore_volume_dialog()\n')
    file.write('except:\n')
    file.write("  reportRestoreError('Error restoring volume dialog')\n")
    file.write('\n')
コード例 #20
0
def save_multiscale_state(multiscale_dialog, file):

    s = Multiscale_Dialog_State()
    s.state_from_dialog(multiscale_dialog)

    from SessionUtil import objecttree
    t = objecttree.instance_tree_to_basic_tree(s)

    file.write('\n')
    file.write('def restore_multiscale():\n')
    file.write(' multiscale_state = \\\n')
    objecttree.write_basic_tree(t, file, indent='  ')
    file.write('\n')
    file.write(' import MultiScale.session\n')
    file.write(
        ' MultiScale.session.restore_multiscale_state(multiscale_state)\n')
    file.write('\n')
    file.write('try:\n')
    file.write('  restore_multiscale()\n')
    file.write('except:\n')
    file.write("  reportRestoreError('Error restoring multiscale')\n")
    file.write('\n')
コード例 #21
0
ファイル: session.py プロジェクト: triciatricia/SIMPLE
def save_path_tracer_state(path_tracer_dialog, file):

    s = Path_Tracer_Dialog_State()
    s.state_from_dialog(path_tracer_dialog)

    from SessionUtil import objecttree

    t = objecttree.instance_tree_to_basic_tree(s)

    file.write("\n")
    file.write("def restore_volume_path_tracer():\n")
    file.write(" path_tracer_state = \\\n")
    objecttree.write_basic_tree(t, file, indent="  ")
    file.write("\n")
    file.write(" import VolumePath.session\n")
    file.write(" VolumePath.session.restore_path_tracer_state(path_tracer_state)\n")
    file.write("\n")
    file.write("try:\n")
    file.write("  restore_volume_path_tracer()\n")
    file.write("except:\n")
    file.write("  reportRestoreError('Error restoring volume path tracer')\n")
    file.write("\n")
コード例 #22
0
def save_surface_state(file):

    slist = []
    from chimera import openModels as om
    from _surface import SurfaceModel
    for s in om.list(modelTypes=[SurfaceModel]):
        plist = [
            p for p in s.surfacePieces
            if hasattr(p, 'save_in_session') and p.save_in_session
        ]
        if plist:
            slist.append((s, plist))
    if len(slist) == 0:
        return

    smslist = []
    for s, plist in slist:
        sms = Surface_Model_State()
        sms.state_from_surface_model(s, plist)
        smslist.append(sms)

    from SessionUtil import objecttree
    t = objecttree.instance_tree_to_basic_tree(smslist)

    file.write('\n')
    file.write('def restore_surfaces():\n')
    file.write(' surface_state = \\\n')
    objecttree.write_basic_tree(t, file, indent='  ')
    file.write('\n')
    file.write(' from Surface import session\n')
    file.write(' session.restore_surface_state(surface_state)\n')
    file.write('\n')
    file.write('try:\n')
    file.write(' restore_surfaces()\n')
    file.write('except:\n')
    file.write(" reportRestoreError('Error restoring surfaces')\n")
    file.write('\n')