コード例 #1
0
    def on_but_fxtc(self):
        self.exportLocalPars()

        logger.debug('on_but_fxtc', __name__)
        #list_of_files = self.get_list_of_files_peds()
        dir_xtc = fnm.path_to_xtc_dir()
        list_of_files = gu.get_list_of_files_in_dir_for_part_fname(
            dir_xtc, pattern='-r' + self.run_number)
        msg = '\n' + 50 * '-' + '\nXTC files in %s for run %s:\n' % (
            dir_xtc, self.run_number)
        for fname in list_of_files:

            exists = os.path.exists(fname)
            msg += '%s  %s' % (os.path.basename(fname).ljust(22),
                               self.dict_status[exists].ljust(5))

            if exists:
                ctime_sec = os.path.getctime(fname)
                ctime_str = gu.get_local_time_str(ctime_sec,
                                                  fmt='%Y-%m-%d %H:%M:%S')
                size_byte = os.path.getsize(fname)
                file_owner = gu.get_path_owner(fname)
                file_mode = gu.get_path_mode(fname)
                msg += '  %s  %12d(Byte)  %s  %s\n' % (
                    ctime_str, size_byte, file_owner, str(oct(file_mode)))
            else:
                msg += '\n'
        logger.info(msg, __name__)
コード例 #2
0
    def __init__(self, parent=None, run_number='0000'):

        QtGui.QWidget.__init__(self, parent)

        self.parent = parent
        self.run_number = run_number

        self.setGeometry(100, 100, 600, 70)
        self.setWindowTitle('GUI Dark List Item')
        self.setFrame()

        dir_xtc = fnm.path_to_xtc_dir()
        #list_of_files = gu.get_list_of_files_in_dir_for_part_fname(dir_xtc, pattern='-r'+self.run_number)
        #print 'list_of_files =', list_of_files

        #self.lab_dir = QtGui.QLabel('xtc dir: %s' % dir_xtc)
        #self.gui_table = GUIAnyFilesStatusTable(self, list_of_files)
        self.gui_more = GUIDarkMoreOpts(self, self.run_number)

        self.vbox = QtGui.QVBoxLayout()
        #self.vbox.addWidget(self.lab_dir)
        self.vbox.addWidget(self.gui_more)
        #self.vbox.addWidget(self.gui_table)
        #self.vbox.addStretch(1)

        self.setLayout(self.vbox)

        self.showToolTips()

        self.setStyle()
コード例 #3
0
    def __init__ ( self, parent=None, run_number='0000') :

        QtGui.QWidget.__init__(self, parent)

        self.parent     = parent
        self.run_number = run_number

        self.setGeometry(100, 100, 600, 70)
        self.setWindowTitle('GUI Dark List Item')
        self.setFrame()

        dir_xtc = fnm.path_to_xtc_dir()
        list_of_files = gu.get_list_of_files_in_dir_for_part_fname(dir_xtc, pattern='-r'+self.run_number)
        #print 'list_of_files =', list_of_files

        #self.lab_dir = QtGui.QLabel('xtc dir: %s' % dir_xtc)
        self.gui_table = GUIAnyFilesStatusTable(self, list_of_files)
        self.gui_more  = GUIDarkMoreOpts(self, self.run_number)
        
        self.vbox = QtGui.QVBoxLayout()
        #self.vbox.addWidget(self.lab_dir)
        self.vbox.addWidget(self.gui_table)
        self.vbox.addWidget(self.gui_more)
        #self.vbox.addStretch(1)     

        self.setLayout(self.vbox)

        self.showToolTips()

        self.setStyle()
コード例 #4
0
 def list_of_path_to_xtc_files_for_run (self) :
     """Makes the string of xtc files for non-default directory. For example:
     './myxtc/xpp/xppi0613/xtc/e319-r0173-s00-c00.xtc ./myxtc/xpp/xppi0613/xtc/e319-r0173-s01-c00.xtc'
     """
     xtcdir = fnm.path_to_xtc_dir() # './myxtc/xpp/xppi0613/xtc/'
     pattern = '-r%s' % cp.str_run_number.value()
     lst = fnm.get_list_of_xtc_files()
     lst_for_run = [ os.path.join(xtcdir, path) for path in lst if pattern in os.path.basename(path)]
     return ' '.join(lst_for_run)
コード例 #5
0
 def list_of_path_to_xtc_files_for_run (self) :
     """Makes the string of xtc files for non-default directory. For example:
     './myxtc/xpp/xppi0613/xtc/e319-r0173-s00-c00.xtc ./myxtc/xpp/xppi0613/xtc/e319-r0173-s01-c00.xtc'
     """
     xtcdir = fnm.path_to_xtc_dir() # './myxtc/xpp/xppi0613/xtc/'
     pattern = '-r%s' % cp.str_run_number.value()
     lst = fnm.get_list_of_xtc_files()
     lst_for_run = [ os.path.join(xtcdir, path) for path in lst if pattern in os.path.basename(path)]
     return ' '.join(lst_for_run)
コード例 #6
0
    def path_to_data_files (self) :
        """Returns something like 'exp=xcs72913:run=49:xtc'
        """
        if cp.xtc_dir_non_std.value() != cp.xtc_dir_non_std.value_def() :
            #return self.list_of_path_to_xtc_files_for_run()
            xtcdir = fnm.path_to_xtc_dir() # './myxtc/xpp/xppi0613/xtc/'
            live = ':live' if 'ffb' in xtcdir else ''
            return 'exp=%s:run=%d:xtc:dir=%s%s' % (cp.exp_name.value(), int(cp.str_run_number.value()), xtcdir, live)

        else :
            return 'exp=%s:run=%d:xtc' % (cp.exp_name.value(), int(cp.str_run_number.value()))
コード例 #7
0
    def path_to_data_files (self) :
        """Returns something like 'exp=xcs72913:run=49:xtc'
        """
        if cp.xtc_dir_non_std.value() != cp.xtc_dir_non_std.value_def() :
            #return self.list_of_path_to_xtc_files_for_run()
            xtcdir = fnm.path_to_xtc_dir() # './myxtc/xpp/xppi0613/xtc/'
            live = ':live' if 'ffb' in xtcdir else ''
            return 'exp=%s:run=%d:stream=0-79:xtc:dir=%s%s' % (cp.exp_name.value(), int(cp.str_run_number.value()), xtcdir, live)

        else :
            return 'exp=%s:run=%d:stream=0-79:xtc' % (cp.exp_name.value(), int(cp.str_run_number.value()))
コード例 #8
0
    def onButExp(self):
        #print 'onButExp'
        dir = self.instr_dir.value() + '/' + self.instr_name.value()
        #print 'dir =', dir
        if self.list_of_exp is None: self.list_of_exp = os.listdir(dir)
        item_selected = gu.selectFromListInPopupMenu(self.list_of_exp)
        if item_selected is None: return  # selection is cancelled
        #if item_selected == self.exp_name.value() : return # selected the same item

        self.setExp(item_selected)
        self.setDir(fnm.path_to_calib_dir_default())
        self.setDet('Select', clearList=True)
        self.setStyleButtons()

        path_to_xtc_dir = fnm.path_to_xtc_dir()
        if os.path.lexists(path_to_xtc_dir): return
        msg = 'XTC data are not seen on this computer for path: %s' % path_to_xtc_dir
        logger.warning(msg, __name__)
        print msg
コード例 #9
0
    def onButExp(self):
        #print 'onButExp'
        dir = self.instr_dir.value() + '/' + self.instr_name.value()
        #print 'dir =', dir
        if self.list_of_exp is None : self.list_of_exp=os.listdir(dir)
        item_selected = gu.selectFromListInPopupMenu(self.list_of_exp)
        if item_selected is None : return          # selection is cancelled
        #if item_selected == self.exp_name.value() : return # selected the same item 

        self.setExp(item_selected)
        self.setDir(fnm.path_to_calib_dir_default())
        self.setDet('Select', clearList=True)
        self.setStyleButtons()

        path_to_xtc_dir = fnm.path_to_xtc_dir()
        if os.path.lexists(path_to_xtc_dir) : return        
        msg = 'XTC data are not seen on this computer for path: %s' % path_to_xtc_dir
        logger.warning(msg, __name__)
        print msg
コード例 #10
0
ファイル: GUIInsExpRunV1.py プロジェクト: FilipeMaia/psdmrepo
    def onButRunV1(self):
        #print 'onButRunV1'
        dir = fnm.path_to_xtc_dir()
        path = str( QtGui.QFileDialog.getOpenFileName(self,'Select experiment',dir) )
        path1, fname = os.path.split(path) # where fname looks like: e170-r0003-s00-c00.xtc
        print 'Returned path and fname =', path1, fname

        if path1=='' and fname=='' :
            print 'The run number is unchanged: ' + self.run_number.value()
            return

        if path1 != dir :
            print 'WARNING! Wrong directory: ' + path1
            print 'Select the run being in the directory: ' + dir
            return

        print 'Set run from file name: ' + fname
        expnum, runnum, stream, chunk, ext = gu.parse_xtc_file_name(fname) # Parse: e170-r0003-s00-c00.xtc
        self.setRun(runnum)
        self.setStyleButtons()
コード例 #11
0
    def on_but_fxtc(self):
        self.exportLocalPars()

        logger.debug('on_but_fxtc', __name__)
        #list_of_files = self.get_list_of_files_peds()
        dir_xtc = fnm.path_to_xtc_dir()
        list_of_files = gu.get_list_of_files_in_dir_for_part_fname(dir_xtc, pattern='-r'+self.run_number)
        msg = '\n' + 50*'-' + '\nXTC files in %s for run %s:\n' % (dir_xtc, self.run_number)
        for fname in list_of_files :

            exists     = os.path.exists(fname)
            msg += '%s  %s' % (os.path.basename(fname).ljust(22), self.dict_status[exists].ljust(5))

            if exists :
                ctime_sec  = os.path.getctime(fname)
                ctime_str  = gu.get_local_time_str(ctime_sec, fmt='%Y-%m-%d %H:%M:%S')
                size_byte  = os.path.getsize(fname)
                file_owner = gu.get_path_owner(fname)
                file_mode  = gu.get_path_mode(fname)
                msg += '  %s  %12d(Byte)  %s  %s\n' % (ctime_str, size_byte, file_owner, str(oct(file_mode)) )
            else :
                msg += '\n'
        logger.info(msg, __name__ )
コード例 #12
0
    def onButRunV1(self):
        #print 'onButRunV1'
        dir = fnm.path_to_xtc_dir()
        path = str(
            QtGui.QFileDialog.getOpenFileName(self, 'Select experiment', dir))
        path1, fname = os.path.split(
            path)  # where fname looks like: e170-r0003-s00-c00.xtc
        print 'Returned path and fname =', path1, fname

        if path1 == '' and fname == '':
            print 'The run number is unchanged: ' + self.run_number.value()
            return

        if path1 != dir:
            print 'WARNING! Wrong directory: ' + path1
            print 'Select the run being in the directory: ' + dir
            return

        print 'Set run from file name: ' + fname
        expnum, runnum, stream, chunk, ext = gu.parse_xtc_file_name(
            fname)  # Parse: e170-r0003-s00-c00.xtc
        self.setRun(runnum)
        self.setStyleButtons()