def cb_exec_script(self):

      fmesg = ''
      if not self.atest:  fmesg = '** no script class for running script'
      elif self.status<1: fmesg = '** need to first generate processing script'
      if fmesg != '':
         QLIB.guiError('Error', fmesg, self)
         return

      # make sure there is a script to execute
      fname = self.atest.proc_dir_filename('file_proc')
      if not fname:
         self.update_AP_warn_window('** script file not set')
         return
      elif not os.path.isfile(fname):
         self.update_AP_warn_window('** script file not found: %s\n' % fname)
         return

      self.atest.nuke_old_results()    # get rid of any previous results

      # start a new window?
      if self.gvars.valid('SPW'):
         self.gvars.SPW.close()
         del(self.gvars.SPW)

      # actually run script, piping output if we have an output file
      sname = self.atest.rvars.file_proc
      oname = self.atest.rvars.output_proc
      command= 'tcsh -xef %s' % sname
      if oname: command = '%s |& tee %s' % (command, oname)
      self.gvars.SPW = QLIB.TcshCommandWindow(command,
                           dir=self.atest.cvars.proc_dir, parent=self)
      self.gvars.SPW.show()
      self.status = 2
   def update_uvars_from_gui(self, warn=0):
      """set what we can, if warn, report error
         note that most uvars are Lines, and are updated upon edit
         return 0 on success, 1 on error"""
      if show_func_seq: print '=== xK ==='

      # any first variables to require?
      if self.uvars.is_empty('program'):
         if warn: QLIB.guiError('Error', "** program name must be set", self)
         return 1

      # then process tables
      if self.update_uvars_from_tables(): return 1

      # ---------------------------------------------------------------
      # then any other vars (most are Lines, which are applied on edit)
      
      # extra tt and MM options:
      otext = str(self.gvars.TE_ttest.toPlainText())
      self.uvars.tt_options = otext.split()

      otext = str(self.gvars.TE_MEMA.toPlainText())
      self.uvars.MM_options = otext.split()

      if self.set_pdir:
         # proc dir should read: tool_results/tool.0001.align_test
         pdir =  SUBJ.get_def_tool_path(self.uvars.program,
                        top_dir='group_results', prefix='test',
                        keep_if_missing=self.cvars.val('results_dir'))
         if self.set_cvar('proc_dir', pdir):
            print '-- setting proc_dir to %s' % pdir

      self.gvars.act_exec_script.setEnabled(False)

      return 0
   def check_line_against_list(self, line, lname, tlist, tdef=0):
      """if line text is not in tlist, show error and reset to tlist[tdef]
      """
      if show_func_seq: print '=== N ==='

      txt = str(line.text())
      if txt not in tlist:
         reset_val = tlist[tdef]
         emesg = "%s '%s' not in %s\n(resetting to %s)" \
                 % (lname, txt, tlist, reset_val)
         QLIB.guiError('Error', emesg, self)
         line.setText(reset_val)
         return 1
      else: self.set_uvar(lname, txt)

      return 0
示例#4
0
    def cb_exec_script(self):

        fmesg = ''
        if not self.atest: fmesg = '** no script class for running script'
        elif self.status < 1:
            fmesg = '** need to first generate processing script'
        if fmesg != '':
            QLIB.guiError('Error', fmesg, self)
            return

        # make sure there is a script to execute
        fname = self.atest.proc_dir_filename('file_proc')
        if not fname:
            self.update_AP_warn_window('** script file not set')
            return
        elif not os.path.isfile(fname):
            self.update_AP_warn_window('** script file not found: %s\n' %
                                       fname)
            return

        self.atest.nuke_old_results()  # get rid of any previous results

        # start a new window?
        if self.gvars.valid('SPW'):
            self.gvars.SPW.close()
            del (self.gvars.SPW)

        # actually run script, piping output if we have an output file
        sname = self.atest.rvars.file_proc
        oname = self.atest.rvars.output_proc
        command = 'tcsh -xef %s' % sname
        if oname: command = '%s |& tee %s' % (command, oname)
        self.gvars.SPW = QLIB.TcshCommandWindow(command,
                                                dir=self.atest.cvars.proc_dir,
                                                parent=self)
        self.gvars.SPW.show()
        self.status = 2
   def update_error_window(self, text, title='ERROR - cannot proceed'):
      if show_func_seq: print '=== xF ==='  # rcr - not called

      QLIB.guiError(title, text, self)
 def update_error_window(self, text, title='ERROR - cannot proceed'):
    QLIB.guiError(title, text, self)
示例#7
0
 def update_error_window(self, text, title='ERROR - cannot proceed'):
     QLIB.guiError(title, text, self)