Beispiel #1
0
def convert2figmdsbook2(book):
#            for page in self.book.walk_page():
    prepare_dwglobal(book)
    if not book.hasvar('mdsplus_server'):
        p = SettingParser()
        v = p.read_setting('mdsplus.default_mdsserver')
        book.setvar('mdsplus_server',
                                  v['server'])
#                                 'direct::CMOD')
    if not book.hasvar('mdsscript_main'):
        book.setvar('mdsscript_main', True)
    if not book.hasvar('mdsscope_nticks'):
        book.setvar('mdsscope_nticks', [10, 10])
    if not book.hasvar('mdsscope_autogrid'):
        book.setvar('mdsscope_autogrid', True)
    if not book.hasvar('mdsscope_listenevent'):
        book.setvar('mdsscope_listenevent', True)
    if not book.hasvar('dwscope_filename'):
        book.setvar('dwscope_filename','')
    if not book.hasvar('global_tdi'):
        book.setvar('global_tdi','')
    if not book.hasvar('global_tdi_event'):
        book.setvar('global_tdi_event','')
    convert2figmdsbook(book)
    return book
Beispiel #2
0
def convert2figmdsbook2(book):
    #            for page in self.book.walk_page():
    prepare_dwglobal(book)
    if not book.hasvar('mdsplus_server'):
        p = SettingParser()
        v = p.read_setting('mdsplus.default_mdsserver')
        book.setvar('mdsplus_server', v['server'])


#                                 'direct::CMOD')
    if not book.hasvar('mdsscript_main'):
        book.setvar('mdsscript_main', True)
    if not book.hasvar('mdsscope_nticks'):
        book.setvar('mdsscope_nticks', [10, 10])
    if not book.hasvar('mdsscope_autogrid'):
        book.setvar('mdsscope_autogrid', True)
    if not book.hasvar('mdsscope_listenevent'):
        book.setvar('mdsscope_listenevent', True)
    if not book.hasvar('dwscope_filename'):
        book.setvar('dwscope_filename', '')
    if not book.hasvar('global_tdi'):
        book.setvar('global_tdi', '')
    if not book.hasvar('global_tdi_event'):
        book.setvar('global_tdi_event', '')
    convert2figmdsbook(book)
    return book
Beispiel #3
0
 def __init__(self):
     PrefComponent.__init__(self, 'PostOffice')
     p = SP()
     self.setting = p.read_setting('pref.postoffice_config')
     self.passwd = None
     self.username = None
     self.parent = None
Beispiel #4
0
 def on_button(self, ev):
     parent_window = ev.GetEventObject().GetTopLevelParent()        
     dlg = FileHelperDialog(parent_window)
     a = dlg.ShowModal()
     if a == wx.ID_OK:
         p = SP().set_rule('file', 
                       {'name':'', 'ext':'', 'action':'',
                        'action_txt':'', 'use':False})
         p.write_setting(pref, dlg.var)
Beispiel #5
0
 def on_button(self, ev):
     parent_window = ev.GetEventObject().GetTopLevelParent()
     dlg = FileHelperDialog(parent_window)
     a = dlg.ShowModal()
     if a == wx.ID_OK:
         p = SP().set_rule('file',
                           {'name': '', 'ext': '', 'action': '',
                            'action_txt': '', 'use': False})
         p.write_setting(pref, dlg.var)
Beispiel #6
0
def callback(parent, value, setting, gwparam):
    gs = gwparam.getvar('globalsets')
    gv = gwparam.getvar()

    if not '_flag' in gs:
        gs['_flag'] = [[], [], [], []]
    for m in range(4):
        for key in value[m][0]:
            if not key in gs:
                gs[key] = [None] * 4
            gs[key][m] = value[m][0][key]
    gv['event'] = str(value[4][1])
    gv['shot_global'] = str(value[4][5])
    gv['use_shot_global'] = (value[4][6] == 'on')
    parent.book.setvar('global_tdi', str(value[4][2]))
    parent.book.setvar('global_tdi_event', str(value[4][3]))
    parent.book._use_global_tdi = value[4][4] == 'on'
    gv['global_choice'] = value[4][7]
    parent.mpanalysis = (value[4][8] == "on")

    if not value[5][1][0]:
        parent.book._parallel_page = False
        parent.book._parallel_shot = False
        parent.book._parallel_sec = False
    else:
        parent.book._parallel_page = True
        if not value[5][1][1][0][0]:
            parent.book._parallel_shot = False
            parent.book._parallel_sec = False
        else:
            parent.book._parallel_shot = True
            parent.book._parallel_sec = value[5][1][1][0][1][0]

    parent.book.setvar('mdsscript_main', value[5][2])
    parent.book.setvar('mdsplus_server', str(value[4][0]))

    from ifigure.utils.setting_parser import iFigureSettingParser as SettingParser
    p = SettingParser()
    v = p.read_setting('mdsplus.default_mdsserver')
    if str(v['server']) != str(value[4][0]):
        ret = dialog.message(
            parent,
            '\n'.join([
                'Selected MDS+ server is different from your default setting',
                'Do you want to use this server as your default server?'
            ]),
            'MDS+ server setting',
            4,
            icon=wx.ICON_QUESTION)
        #           print ret
        if ret == 'yes':
            v['server'] = str(value[4][0])
            p.write_setting('mdsplus.default_mdsserver', v)
Beispiel #7
0
def callback(parent, value, setting, gwparam):
    gs = gwparam.getvar('globalsets')
    gv = gwparam.getvar()

    if not '_flag' in gs: gs['_flag'] = [[],[],[],[]]
    for m in range(4):
             for key in value[m][0].keys():
                  if not key in gs:
                     gs[key] = [None]*4
                  gs[key][m] = value[m][0][key]
    gv['event'] = str(value[4][1])
    gv['shot_global'] = str(value[4][5])
    gv['use_shot_global'] = (value[4][6] == 'on')
    parent.book.setvar('global_tdi', str(value[4][2]))
    parent.book.setvar('global_tdi_event', str(value[4][3]))
    parent.book._use_global_tdi = value[4][4] == 'on'
    gv['global_choice'] = value[4][7]
    parent.mpanalysis = (value[4][8] == "on")

    if not value[5][1][0]:
             parent.book._parallel_page=False
             parent.book._parallel_shot=False
             parent.book._parallel_sec=False
    else:
             parent.book._parallel_page=True
             if not value[5][1][1][0][0]:
                 parent.book._parallel_shot=False
                 parent.book._parallel_sec=False
             else:
                 parent.book._parallel_shot=True
                 parent.book._parallel_sec=value[5][1][1][0][1][0]

    parent.book.setvar('mdsscript_main',
                             value[5][2])
    parent.book.setvar('mdsplus_server',
                             str(value[4][0]))

    from ifigure.utils.setting_parser import iFigureSettingParser as SettingParser
    p = SettingParser()
    v = p.read_setting('mdsplus.default_mdsserver')
    if str(v['server']) !=  str(value[4][0]):
           ret=dialog.message(parent,
                             '\n'.join(['Selected MDS+ server is different from your default setting', 'Do you want to use this server as your default server?']),
                             'MDS+ server setting',
                             4, icon=wx.ICON_QUESTION)
#           print ret
           if ret  == 'yes':
               v['server'] =  str(value[4][0])
               p.write_setting('mdsplus.default_mdsserver', v)
Beispiel #8
0
    def __init__(self, parent, id=-1, title="File Action Setting"):

        p = SP().set_rule('file', 
                          {'name':'', 'ext':'', 'action':'',
                           'action_txt':'', 'use':False})
        self.var = p.read_setting(pref)
        
        wx.Dialog.__init__(self, parent, id, title,
                           style = wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER)
        
        self.mainSizer = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(self.mainSizer)

        self.cb = wx.ComboBox(self, wx.ID_ANY, 
                      size=(-1, -1),
                      style=wx.CB_READONLY,
                      choices = [x['name'] for x in self.var['file']])
        self.mainSizer.Add(self.cb, 0, wx.ALL, 3)
        
        l = [["rule",   '', 200, None],
             ["action", '', 235, {'nlines':3}],
             ["note", '', 0, None],
             [None, False, 3,  {'text': 'Use'}],]        

        self.elp = EditListPanel(self, l, edge = 0, call_sendevent = self)
        self.elp.GetSizer().AddGrowableRow(1)              
        
        self.mainSizer.Add(self.elp, 1, wx.ALL|wx.EXPAND, 2)
        
        self.buttonSizer = wx.BoxSizer(wx.HORIZONTAL)
        self.bnew = wx.Button(self, label="New...", id=wx.ID_ANY)
        self.bdel = wx.Button(self, label="Delete...", id=wx.ID_ANY)
        self.bok = wx.Button(self, label="OK", id=wx.ID_OK)
        

        self.buttonSizer.Add(self.bnew, 0, wx.ALL, 7)
        self.buttonSizer.Add(self.bdel, 0, wx.ALL, 7 )
        self.buttonSizer.AddStretchSpacer(1)
        self.buttonSizer.Add(self.bok, 0, wx.ALL, 7 )
        self.mainSizer.Add(self.buttonSizer, 0, wx.ALL|wx.EXPAND, 0)
        self.Bind(wx.EVT_BUTTON, self.onOk, id=wx.ID_OK)
        self.Bind(wx.EVT_BUTTON, self.onNew, self.bnew)
        self.Bind(wx.EVT_BUTTON, self.onDel, self.bdel)
        self.cb.Bind(wx.EVT_COMBOBOX, self.onCBHit)
        wx.CallAfter(self.Layout)

        self.set_panels_2_index0()
Beispiel #9
0
def init(self, *args, **kargs):
#    if not kargs.has_key('src'):
    self.td._pool = MDSWorkerPool()
    p = SettingParser()
    p.set_rule('connection',{}, nocheck=True)
    self.td.setvar('setting', p.read_setting('mdsplus.connection_setting'))
Beispiel #10
0
def clean(self, *args, **kargs):
    self.td._pool.reset()
    p = SettingParser()
    p.write_setting('mdsplus.connection_setting', 
                     self.td.getvar('setting'))
Beispiel #11
0
 def save_setting(self):
     p = SP()
     p.write_setting('pref.appearance_config', self.setting)
Beispiel #12
0
if not os.path.exists(file):
    os.mkdir(file)
    file = os.path.join(file, '__init__.py')
    fid = open(file, 'w')
    fid.close()

geom_file = os.path.join(rcdir, 'gui_geom')

usr_template_dir = os.path.join(rcdir, 'template')
if not os.path.exists(usr_template_dir):
    os.mkdir(usr_template_dir)
usr_script_template_dir = os.path.join(usr_template_dir, 'script')
if not os.path.exists(usr_script_template_dir):
    os.mkdir(usr_script_template_dir)

p = SP()
s = p.read_setting('pref.general_config')
if s['root_work_directory'] == '\'default\'':
#    tempdir_base=os.path.join(tempfile.gettempdir(), 'piscope_'+os.getenv('USER'))
    tempdir_base=os.path.join(tempfile.gettempdir(), 'piscope_'+usr)
    if not os.path.exists(tempdir_base):
        os.makedirs(tempdir_base)
#    tempdir_base=os.path.join(tempdir_base, os.getenv('USER'))
#    if not os.path.exists(tempdir_base):
#        os.mkdir(tempdir_base)
else:
    tempdir_base = os.path.expanduser(s['root_work_directory'])
    tempdir_base=os.path.join(tempdir_base, 'piscope_'+usr)
    if not os.path.exists(tempdir_base):    
        os.makedirs(tempdir_base)
    
Beispiel #13
0
def MDS_setting(parent, setting, gwparam, mds_server, thread_main):
    def make_gs_arr(gs, s):
        return [gs[key][s] for key in pkeys]

    gs = gwparam.getvar('globalsets')
    gv = gwparam.getvar()
    tab = ['Set1', 'Set2', 'Set3', 'Set4', 'config', 'more']

    list1 = [[None, make_gs_arr(gs, 0), 118, None]]
    list2 = [[None, make_gs_arr(gs, 1), 118, None]]
    list3 = [[None, make_gs_arr(gs, 2), 118, None]]
    list4 = [[None, make_gs_arr(gs, 3), 118, None]]

    txt = "on" if parent.mpanalysis else "off"
    txt2 = "on" if gv['use_shot_global'] else "off"
    txt7 = "on" if parent.init_beginning else "off"
    txt6 = "on" if parent.init_sec else "off"
    txt5 = "on" if parent.init_page else "off"

    list5 = [
        ["MDSconnect", mds_server, 204, None],
        ["Update", gv['event'], 0, None],
        ["Common vars", gv['shot_global'], 0, None],
        ["Use common vars", txt2, 1, {
            "values": ["on", "off"]
        }],
        ["Global setting", gv['global_choice'], 21, None],
        ["Multipage mode", txt, 1, {
            "values": ["on", "off"]
        }],
        #            ["Color Order", gv['color_order'], 22, {}],]
    ]

    tmp2 = [
        [
            None, parent.parallel_sec, 3, {
                "text": 'Parallelize Panels',
                "noindent": True
            }
        ],
    ]
    tmp = [[
        None, (parent.parallel_shot, [parent.parallel_sec]), 27,
        ({
            "text": 'Parallelize Pages'
        }, {
            "elp": tmp2
        })
    ]]
    list6 = [
        [None, "MDSplus session parallelization", 102, None],
        [
            None,
            (parent.parallel_page, [(parent.parallel_shot,
                                     [parent.parallel_sec])]), 27,
            ({
                "text": 'Parallelize Shots',
                "space": 15
            }, {
                "elp": tmp
            })
        ],
        #["At session start",txt7, 1, {"values":["on", "off"]}],
        #["At every page",   txt5, 1, {"values":["on", "off"]}],
        #["At every panel",  txt6, 1, {"values":["on", "off"]}],
        [
            None, thread_main, 3, {
                "text": "Run python script in main thread",
                "noindent": None
            }
        ],
        [
            None, "(!) MDS+ connection is initialized when opening new tree",
            102, None
        ],
    ]

    tip1 = None
    tip2 = None
    tip3 = None
    tip4 = None
    tip5 = [
        'MDSplus server and default Tree',
        'Update event',
        'MDS command called at the begining of page',
        'MDS command called at the begining of section',
        'Global setting selection for shots',
        'Use the same shot numbers for all pages. (shot numbers after semi-colon are ignored)',
    ]

    tip6 = [
        None,
        'Parallelization of MDS session',
        None,
        #'Initialize global/local variables when analysis loop starts',
        #'Initialize global/local variables when analyzing a new panel',
        #'Initialize global/local variables when analyzing a new page',
        None,
    ]

    l = [list1, list2, list3, list4, list5, list6]
    tip = [tip1, tip2, tip3, tip4, tip5, tip6]

    value = DialogEditListTab(tab,
                              l,
                              modal=False,
                              tip=tip,
                              parent=parent,
                              title='Global Setting',
                              style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)

    if value[0]:
        for m in range(4):
            for i, v in enumerate(value[1][m][0]):
                gs[pkeys[i]][m] = str(v[1])
        gv['event'] = str(value[1][4][1])
        gv['shot_global'] = str(value[1][4][2])
        gv['use_shot_global'] = (value[1][4][3] == 'on')
        gv['global_choice'] = value[1][4][4]
        parent.mpanalysis = (value[1][4][5] == "on")
        #      gv['color_order'] = value[1][4][5]

        #      parent.init_beginning = (value[1][5][3] == "on")
        #      parent.init_page = (value[1][5][4] == "on")
        #      parent.init_sec = (value[1][5][5] == "on")

        if not value[1][5][1][0]:
            parent.parallel_page = False
            parent.parallel_shot = False
            parent.parallel_sec = False
        else:
            parent.parallel_page = True
            if not value[1][5][1][1][0][0]:
                parent.parallel_shot = False
                parent.parallel_sec = False
            else:
                parent.parallel_shot = True
                parent.parallel_sec = value[1][5][1][1][0][1][0]

        parent.book.setvar('mdsscript_main', value[1][5][2])
        parent.book.setvar('mdsplus_server', str(value[1][4][0]))

    from ifigure.utils.setting_parser import iFigureSettingParser as SettingParser
    p = SettingParser()
    v = p.read_setting('mdsplus.default_mdsserver')
    if str(v['server']) != str(value[1][4][0]):
        ret = dialog.message(
            parent,
            '\n'.join([
                'Selected MDS+ server is different from your default setting',
                'Do you want to use this server as your default server?'
            ]),
            'MDS+ server setting',
            2,
            icon=wx.ICON_QUESTION)
        print(ret)
        if ret == 'ok':
            v['server'] = str(value[1][4][0])
            p.write_setting('mdsplus.default_mdsserver', v)

    return value
Beispiel #14
0
 def __init__(self):
     PrefComponent.__init__(self, 'Appearance')
     p = SP()
     self.setting = p.read_setting('pref.appearance_config')
Beispiel #15
0
def clean(self, *args, **kargs):
    self.td._pool.reset()
    p = SettingParser()
    p.write_setting('mdsplus.connection_setting', self.td.getvar('setting'))
Beispiel #16
0
    def __init__(self):
        PrefComponent.__init__(self, 'HelperApp')
        p = SP()

        self.setting = p.read_setting(config_name())
Beispiel #17
0
 def save_setting(self):
     p = SP()
     p.write_setting('pref.advanced_config', self.setting)
Beispiel #18
0
def init(self, *args, **kargs):
    #    if not kargs.has_key('src'):
    self.td._pool = MDSWorkerPool()
    p = SettingParser()
    p.set_rule('connection', {}, nocheck=True)
    self.td.setvar('setting', p.read_setting('mdsplus.connection_setting'))
Beispiel #19
0
 def __init__(self):
     PrefComponent.__init__(self, 'Advanced')
     p = SP()
     self.setting = p.read_setting('pref.advanced_config')
Beispiel #20
0
def MDS_setting(parent, setting,  gwparam, mds_server, thread_main):
   def make_gs_arr(gs, s):
       return [gs[key][s] for key in pkeys]

   gs = gwparam.getvar('globalsets')
   gv = gwparam.getvar()
   tab   = ['Set1', 'Set2', 'Set3', 'Set4','config', 'more']

   list1 = [[None, make_gs_arr(gs, 0), 118, None]]
   list2 = [[None, make_gs_arr(gs, 1), 118, None]]
   list3 = [[None, make_gs_arr(gs, 2), 118, None]]
   list4 = [[None, make_gs_arr(gs, 3), 118, None]]


   txt = "on" if parent.mpanalysis else "off"
   txt2 = "on" if gv['use_shot_global'] else "off"
   txt7 = "on" if parent.init_beginning else "off"
   txt6 = "on" if parent.init_sec else "off"
   txt5 = "on" if parent.init_page  else "off"


   list5 = [["MDSconnect", mds_server, 204, None],
            ["Update", gv['event'], 0, None],
            ["Common vars", gv['shot_global'], 0, None],
            ["Use common vars",  txt2,  1, {"values":["on", "off"]}],
            ["Global setting", gv['global_choice'], 21, None],
            ["Multipage mode",  txt, 1, {"values":["on", "off"]}],
#            ["Color Order", gv['color_order'], 22, {}],]
            ]

   tmp2=    [[None,  parent.parallel_sec, 3, 
             {"text":'Parallelize Panels', "noindent":True}],]
   tmp =    [[None,  (parent.parallel_shot, [parent.parallel_sec]), 27, 
                     ({"text":'Parallelize Pages'}, {"elp": tmp2})]]
   list6 = [[None,"MDSplus session parallelization",  102, None],
            [None,  (parent.parallel_page, 
                    [(parent.parallel_shot, [parent.parallel_sec])]), 
                    27, 
                    ({"text":'Parallelize Shots', "space":15},{"elp":tmp})],
            #["At session start",txt7, 1, {"values":["on", "off"]}],
            #["At every page",   txt5, 1, {"values":["on", "off"]}],
            #["At every panel",  txt6, 1, {"values":["on", "off"]}],
            [None, thread_main,  3, 
                        {"text":"Run python script in main thread",
                         "noindent":None }],
            [None, "(!) MDS+ connection is initialized when opening new tree",  102, None],]




   tip1 = None
   tip2 = None
   tip3 = None
   tip4 = None
   tip5 = ['MDSplus server and default Tree',
           'Update event', 
           'MDS command called at the begining of page',
           'MDS command called at the begining of section',
           'Global setting selection for shots',
           'Use the same shot numbers for all pages. (shot numbers after semi-colon are ignored)',]

   tip6 = [ None,
           'Parallelization of MDS session',
            None, 
           #'Initialize global/local variables when analysis loop starts',
           #'Initialize global/local variables when analyzing a new panel',
           #'Initialize global/local variables when analyzing a new page',
            None,  ]


   l  = [list1, list2, list3, list4, list5, list6]
   tip= [tip1, tip2, tip3, tip4, tip5, tip6]

   value = DialogEditListTab(tab, l, modal=False,tip=tip, parent=parent, 
                 title = 'Global Setting',
                 style = wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER)

   if value[0]:
      for m in range(4):
          for i, v in enumerate(value[1][m][0]):
               gs[pkeys[i]][m] = str(v[1])
      gv['event'] = str(value[1][4][1])
      gv['shot_global'] = str(value[1][4][2])
      gv['use_shot_global'] = (value[1][4][3] == 'on')
      gv['global_choice'] = value[1][4][4]
      parent.mpanalysis = (value[1][4][5] == "on")
#      gv['color_order'] = value[1][4][5]

#      parent.init_beginning = (value[1][5][3] == "on")
#      parent.init_page = (value[1][5][4] == "on")
#      parent.init_sec = (value[1][5][5] == "on")

      if not value[1][5][1][0]:
          parent.parallel_page=False
          parent.parallel_shot=False
          parent.parallel_sec=False
      else:
          parent.parallel_page=True
          if not value[1][5][1][1][0][0]:
              parent.parallel_shot=False
              parent.parallel_sec=False
          else:
              parent.parallel_shot=True
              parent.parallel_sec=value[1][5][1][1][0][1][0]

      parent.book.setvar('mdsscript_main',
                          value[1][5][2])
      parent.book.setvar('mdsplus_server',
                          str(value[1][4][0]))

   from ifigure.utils.setting_parser import iFigureSettingParser as SettingParser
   p = SettingParser()
   v = p.read_setting('mdsplus.default_mdsserver')
   if str(v['server']) !=  str(value[1][4][0]):
        ret=dialog.message(parent,
                          '\n'.join(['Selected MDS+ server is different from your default setting', 'Do you want to use this server as your default server?']),
                          'MDS+ server setting',
                          2, icon=wx.ICON_QUESTION)
        print(ret)
        if ret  == 'ok':
            v['server'] =  str(value[1][4][0])
            p.write_setting('mdsplus.default_mdsserver', v)

   return value
Beispiel #21
0
 def save_setting(self):
     p = SP()
     p.write_setting('pref.appearance_config', self.setting)
Beispiel #22
0
    def __init__(self, *args, **kargs):
        if "show_prop" in kargs:
           show_prop = kargs["show_prop"]
           del kargs["show_prop"]
        else:
           show_prop = False
        if "worker" in kargs:
            self.workers = kargs['worker']
            del kargs["worker"]          
        else: 
            self.workers = None

        super(MDSScopeNW, self).__init__(*args, **kargs)
        ScopeEngine.__init__(self, no_window = True)

        if self.book is not None:
#            for page in self.book.walk_page():
            self.prepare_dwglobal(self.book)
            if not self.book.hasvar('mdsplus_server'):
                p = SettingParser()
                v = p.read_setting('mdsplus.default_mdsserver')
                self.book.setvar('mdsplus_server',
                                  v['server'])
#                                 'direct::CMOD')
            if not self.book.hasvar('mdsscript_main'):
                self.book.setvar('mdsscript_main',
                                 True)
            if not self.book.hasvar('mdsscope_autogrid'):
                self.book.setvar('mdsscope_autogrid',
                                 True)
            if not self.book.hasvar('mdsscope_listenevent'):
                self.book.setvar('mdsscope_listenevent',
                                 True)
            if not self.book.hasvar('dwscope_filename'):
                self.book.setvar('dwscope_filename','')
            from ifigure.mdsplus.fig_mdsbook import convert2figmdsbook
            convert2figmdsbook(self.book)

        self.g = {} ## global variabls for mainthread scripting
        self._title_mdsjob_count = 0
        self._mdsjob_count = 0
        self._cur_shot = 0
        self._mds_exit_status = 0
        self._figmds_list = []
        self.mpanalysis = False
        self._mpanalysis_mode = True
        self.parallel_page = True
        self.parallel_shot = True
        self.parallel_sec = True
        self.init_beginning = True
        self.init_page = False
        self.init_shot = False
        self.init_sec = False
        self.debug_mode = False
        self.timer = None

        self.previous_shot_set = [[]]
        self.event_dict ={}
        self.InitUI()
        from numpy import linspace
        self._shot_dict = {'linspace':linspace}      
#        self.Thaw()

        proj = self.book.get_root_parent()
        proj = self.book.get_root_parent()
        if self.workers is None:
            if proj.setting.has_child('mdsplus_worker'):
                self.workers = proj.setting.mdsplus_worker
            else:
                file = os.path.join(ifigure.__path__[0], 'add_on', 
                            'setting', 'module', 'mdsplus_worker.py')

                workers = proj.setting.add_absmodule(file)
                workers.rename('mdsplus_worker')
                self.workers = workers

        p = SettingParser()
        p.set_rule('global_set',{}, nocheck=True)
        self.scope_setting = p.read_setting('mdsplus.scope_setting')

        from ifigure.ifigure_config import rcdir, ifiguredir
        mname = 'mdsplus.fig_mds_startup_script'
        def_file = os.path.join(*([ifiguredir] + mname.split('.')))
        user_file = os.path.join(*([rcdir] + mname.split('.')))+'.py'
        if not os.path.exists(user_file):
            shutil.copy(def_file, user_file)
        self.startup_script = user_file
        dc = {}; dg = {}
        from ifigure.mdsplus.fig_mds import read_scriptfile
        exec read_scriptfile(self.startup_script) in dg, dc
        self.startup_values = dc

        self._start_mds_threads() # start session runner and event listener

        self.workers.call_method('onStartWorker')        
#        self.start_pool()
        self.open_engine()
Beispiel #23
0
 def __init__(self):
     PrefComponent.__init__(self, 'General')
     if iFigureConfig.setting is None:
         p = SP()
         iFigureConfig.setting = p.read_setting('pref.general_config')
Beispiel #24
0
    def __init__(self, *args, **kargs):
        if "show_prop" in kargs:
            show_prop = kargs["show_prop"]
            del kargs["show_prop"]
        else:
            show_prop = False
        if "worker" in kargs:
            self.workers = kargs['worker']
            del kargs["worker"]
        else:
            self.workers = None

        super(MDSScopeNW, self).__init__(*args, **kargs)
        ScopeEngine.__init__(self, no_window=True)

        if self.book is not None:
            #            for page in self.book.walk_page():
            self.prepare_dwglobal(self.book)
            if not self.book.hasvar('mdsplus_server'):
                p = SettingParser()
                v = p.read_setting('mdsplus.default_mdsserver')
                self.book.setvar('mdsplus_server', v['server'])
#                                 'direct::CMOD')
            if not self.book.hasvar('mdsscript_main'):
                self.book.setvar('mdsscript_main', True)
            if not self.book.hasvar('mdsscope_autogrid'):
                self.book.setvar('mdsscope_autogrid', True)
            if not self.book.hasvar('mdsscope_listenevent'):
                self.book.setvar('mdsscope_listenevent', True)
            if not self.book.hasvar('dwscope_filename'):
                self.book.setvar('dwscope_filename', '')
            from ifigure.mdsplus.fig_mdsbook import convert2figmdsbook
            convert2figmdsbook(self.book)

        self.g = {}  ## global variabls for mainthread scripting
        self._title_mdsjob_count = 0
        self._mdsjob_count = 0
        self._cur_shot = 0
        self._mds_exit_status = 0
        self._figmds_list = []
        self.mpanalysis = False
        self._mpanalysis_mode = True
        self.parallel_page = True
        self.parallel_shot = True
        self.parallel_sec = True
        self.init_beginning = True
        self.init_page = False
        self.init_shot = False
        self.init_sec = False
        self.debug_mode = False
        self.timer = None

        self.previous_shot_set = [[]]
        self.event_dict = {}
        self.InitUI()
        from numpy import linspace
        self._shot_dict = {'linspace': linspace}
        #        self.Thaw()

        proj = self.book.get_root_parent()
        proj = self.book.get_root_parent()
        if self.workers is None:
            if proj.setting.has_child('mdsplus_worker'):
                self.workers = proj.setting.mdsplus_worker
            else:
                file = os.path.join(ifigure.__path__[0], 'add_on', 'setting',
                                    'module', 'mdsplus_worker.py')

                workers = proj.setting.add_absmodule(file)
                workers.rename('mdsplus_worker')
                self.workers = workers

        p = SettingParser()
        p.set_rule('global_set', {}, nocheck=True)
        self.scope_setting = p.read_setting('mdsplus.scope_setting')

        from ifigure.ifigure_config import rcdir, ifiguredir
        mname = 'mdsplus.fig_mds_startup_script'
        def_file = os.path.join(*([ifiguredir] + mname.split('.')))
        user_file = os.path.join(*([rcdir] + mname.split('.'))) + '.py'
        if not os.path.exists(user_file):
            shutil.copy(def_file, user_file)
        self.startup_script = user_file
        dc = {}
        dg = {}
        from ifigure.mdsplus.fig_mds import read_scriptfile
        exec read_scriptfile(self.startup_script) in dg, dc
        self.startup_values = dc

        self._start_mds_threads()  # start session runner and event listener

        self.workers.call_method('onStartWorker')
        #        self.start_pool()
        self.open_engine()
Beispiel #25
0
    def __init__(self):
        PrefComponent.__init__(self, 'HelperApp')
        p = SP()

        self.setting = p.read_setting(config_name())
Beispiel #26
0
 def save_setting(self):
     p = SP()
     p.write_setting(config_name(), self.setting)
Beispiel #27
0
 def __init__(self):
     PrefComponent.__init__(self, 'General')
     if iFigureConfig.setting is None:
         p = SP()
         iFigureConfig.setting = p.read_setting('pref.general_config')
Beispiel #28
0
if not os.path.exists(file):
    os.mkdir(file)
    file = os.path.join(file, '__init__.py')
    fid = open(file, 'w')
    fid.close()

geom_file = os.path.join(rcdir, 'gui_geom')

usr_template_dir = os.path.join(rcdir, 'template')
if not os.path.exists(usr_template_dir):
    os.mkdir(usr_template_dir)
usr_script_template_dir = os.path.join(usr_template_dir, 'script')
if not os.path.exists(usr_script_template_dir):
    os.mkdir(usr_script_template_dir)

p = SP()
s = p.read_setting('pref.general_config')
if s['root_work_directory'] == '\'default\'':
    #    tempdir_base=os.path.join(tempfile.gettempdir(), 'piscope_'+os.getenv('USER'))
    tempdir_base = os.path.join(tempfile.gettempdir(), 'piscope_'+usr)
    if not os.path.exists(tempdir_base):
        os.makedirs(tempdir_base)
#    tempdir_base=os.path.join(tempdir_base, os.getenv('USER'))
#    if not os.path.exists(tempdir_base):
#        os.mkdir(tempdir_base)
else:
    tempdir_base = os.path.expanduser(s['root_work_directory'])
    tempdir_base = os.path.join(tempdir_base, 'piscope_'+usr)
    if not os.path.exists(tempdir_base):
        os.makedirs(tempdir_base)
Beispiel #29
0
 def save_setting(self):
     p = SP()
     p.write_setting('pref.general_config', iFigureConfig.setting)
Beispiel #30
0
 def save_setting(self):
     p = SP()
     p.write_setting('pref.general_config', iFigureConfig.setting)
Beispiel #31
0
 def save_setting(self):
     p = SP()
     p.write_setting('pref.postoffice_config', self.setting)
Beispiel #32
0
 def save_setting(self):
     p = SP()
     p.write_setting(config_name(), self.setting)
Beispiel #33
0
 def __init__(self):
     PrefComponent.__init__(self, 'Appearance')
     p = SP()
     self.setting = p.read_setting('pref.appearance_config')