예제 #1
0
    def onItemClick(self, item):
        #print 'onItemClick' # , isChecked: ', str(item.checkState())

        if item.isSelected(): item.setSelected(False)
        #else               : item.setSelected(True)

        self.list_of_run_strs_in_dir = fnm.get_list_of_xtc_runs()   # ['0001', '0202', '0203',...]
        self.list_of_run_nums_in_dir = gu.list_of_int_from_list_of_str(self.list_of_run_strs_in_dir) # [1, 202, 203, 204,...]

        widg = self.list.itemWidget(item)
        run_num = widg.getRunNum()

        run_rec = self.dict_run_recs[run_num]
        self.comment   = run_rec['comment']
        list_of_calibs = run_rec['calibrations']
        self.type = ', '.join(list_of_calibs)

        if not run_num in self.list_of_run_nums_in_dir :
            self.comment = 'xtc file IS NOT on disk!'
            self.xtc_in_dir = False
        else :
            self.xtc_in_dir = True

        widg.updateButtons(self.type, self.comment, self.xtc_in_dir)

        msg = 'onItemClick - update button status for run %s with calib_type: %s, comment: %s, xtc_in_dir %s' \
              % (widg.str_run_num, self.type, self.comment, self.xtc_in_dir) 
        logger.info(msg, __name__)
예제 #2
0
    def updateList(self):

        self.list.clear()

        self.list_of_records = []
        self.list_of_runs = fnm.get_list_of_xtc_runs()

        for run in self.list_of_runs:
            #print run
            widg = GUIDarkListItem(self,
                                   str(run))  # QtGui.QLabel(str(run), self)
            item = QtGui.QListWidgetItem('', self.list)
            #self.list.addItem(item)
            #item.setFlags (  QtCore.Qt.ItemIsEnabled ) #| QtCore.Qt.ItemIsSelectable  | QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsTristate)
            #print 'item.flags(): %o' % item.flags()
            #item.setCheckState(0)
            item.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable
                          | QtCore.Qt.ItemIsUserCheckable)
            #item.setFlags ( QtCore.Qt.ItemIsEnabled )

            item.setSizeHint(self.size)
            self.list.setItemWidget(item, widg)
            #self.list.setItemSelected(item, True)

            record = run, item, widg
            self.list_of_records.append(record)
예제 #3
0
    def updateList(self):

        self.list.clear()

        if self.instr_name.value() == self.instr_name.value_def(): return
        if self.exp_name.value() == self.exp_name.value_def(): return

        # Get run records from RegDB
        self.dict_run_recs = ru.calibration_runs(self.instr_name.value(),
                                                 self.exp_name.value())
        #print 'self.dict_run_recs = ', self.dict_run_recs

        self.list_of_records = []
        self.list_of_run_strs_in_dir = fnm.get_list_of_xtc_runs(
        )  # ['0001', '0202', '0203',...]
        self.list_of_run_nums_in_dir = gu.list_of_int_from_list_of_str(
            self.list_of_run_strs_in_dir)  # [1, 202, 203, 204,...]
        self.list_of_run_nums_in_regdb = ru.list_of_runnums(
            self.instr_name.value(), self.exp_name.value())

        #print 'list_of_run_nums_in_dir:\n',   self.list_of_run_nums_in_dir
        #print 'list_of_run_nums_in_regdb:\n', self.list_of_run_nums_in_regdb

        if self.list_of_run_nums_in_regdb == []:
            self.list_of_runs = self.list_of_run_nums_in_dir
        else:
            self.list_of_runs = self.list_of_run_nums_in_regdb

        for run_num in self.list_of_runs:

            str_run_num = '%04d' % run_num
            self.str_run_number.setValue(str_run_num)

            if not self.isSelectedRun(run_num): continue
            if not self.hasSelectedDetectorsInRun(run_num): continue

            if not run_num in self.list_of_run_nums_in_dir:
                self.comment = 'NOT FOUND xtc file!'
                #self.type    = 'N/A'

            widg = GUIDarkListItem(self, str_run_num, self.type, self.comment)
            item = QtGui.QListWidgetItem('', self.list)
            #self.list.addItem(item)
            #item.setFlags (  QtCore.Qt.ItemIsEnabled ) #| QtCore.Qt.ItemIsSelectable  | QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsTristate)
            #print 'item.flags(): %o' % item.flags()
            #item.setCheckState(0)
            item.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable
                          | QtCore.Qt.ItemIsUserCheckable)
            #item.setFlags ( QtCore.Qt.ItemIsEnabled )

            item.setSizeHint(widg.size())
            self.list.setItemWidget(item, widg)
            #self.list.setItemSelected(item, True)

            record = str_run_num, item, widg
            self.list_of_records.append(record)
예제 #4
0
    def onButRun(self):
        logger.debug('onButRun', __name__ )

        self.list_of_runs = fnm.get_list_of_xtc_runs()
        #self.list_of_runs = fnm.get_list_of_xtc_files()
        #if self.list_of_runs is None : self.list_of_runs=os.listdir(dir)

        item_selected = gu.selectFromListInPopupMenu(self.list_of_runs)
        if item_selected is None : return            # selection is cancelled
        #if item_selected == self.run_number.value() : return # selected the same item 

        runnum = item_selected
        self.setRun(runnum)
예제 #5
0
    def updateList(self):

        self.list.clear()

        if self.instr_name.value() == self.instr_name.value_def() : return
        if self.exp_name  .value() == self.exp_name  .value_def() : return

        # Get run records from RegDB
        self.dict_run_recs = ru.calibration_runs (self.instr_name.value(), self.exp_name.value())
        #print 'self.dict_run_recs = ', self.dict_run_recs

        self.list_of_records = []
        self.list_of_run_strs_in_dir = fnm.get_list_of_xtc_runs()   # ['0001', '0202', '0203',...]
        self.list_of_run_nums_in_dir = gu.list_of_int_from_list_of_str(self.list_of_run_strs_in_dir) # [1, 202, 203, 204,...]
        self.list_of_run_nums_in_regdb = ru.list_of_runnums(self.instr_name.value(), self.exp_name.value())

        #print 'list_of_run_nums_in_dir:\n',   self.list_of_run_nums_in_dir
        #print 'list_of_run_nums_in_regdb:\n', self.list_of_run_nums_in_regdb
        
        if self.list_of_run_nums_in_regdb == [] : self.list_of_runs = self.list_of_run_nums_in_dir
        else                                    : self.list_of_runs = self.list_of_run_nums_in_regdb

        for run_num in self.list_of_runs :

            str_run_num = '%04d' % run_num
            self.str_run_number.setValue(str_run_num)

            if not self.isSelectedRun            (run_num) : continue
            if not self.hasSelectedDetectorsInRun(run_num) : continue
        
            if not run_num in self.list_of_run_nums_in_dir :
                self.comment = 'NOT FOUND xtc file!'
                #self.type    = 'N/A'


            widg = GUIDarkListItem ( self, str_run_num, self.type, self.comment)
            item = QtGui.QListWidgetItem('', self.list)
            #self.list.addItem(item)
            #item.setFlags (  QtCore.Qt.ItemIsEnabled ) #| QtCore.Qt.ItemIsSelectable  | QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsTristate)
            #print 'item.flags(): %o' % item.flags()
            #item.setCheckState(0)
            item.setFlags (  QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable  | QtCore.Qt.ItemIsUserCheckable )
            #item.setFlags ( QtCore.Qt.ItemIsEnabled )

            item.setSizeHint(self.size)
            self.list.setItemWidget(item, widg)
            #self.list.setItemSelected(item, True)

            record = str_run_num, item, widg
            self.list_of_records.append(record)
예제 #6
0
    def updateList(self):

        self.list.clear()

        self.list_of_records = []
        self.list_of_runs = fnm.get_list_of_xtc_runs()

        for run in self.list_of_runs :
            #print run
            widg = GUIDarkListItem ( self, str(run) ) # QtGui.QLabel(str(run), self)
            item = QtGui.QListWidgetItem('', self.list)
            #self.list.addItem(item)
            #item.setFlags (  QtCore.Qt.ItemIsEnabled ) #| QtCore.Qt.ItemIsSelectable  | QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsTristate)
            #print 'item.flags(): %o' % item.flags()
            #item.setCheckState(0)
            item.setFlags (  QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable  | QtCore.Qt.ItemIsUserCheckable )
            #item.setFlags ( QtCore.Qt.ItemIsEnabled )

            item.setSizeHint(self.size)
            self.list.setItemWidget(item, widg)
            #self.list.setItemSelected(item, True)

            record = run, item, widg
            self.list_of_records.append(record)
예제 #7
0
    def updateList(self, clearList=False) :

        self.update_counter += 1

        self.t0_sec = time()

        if clearList :
            self.removeItemWidgets()            
            self.list.clear()
            self.dict_guidarklistitem.clear()
            #msg = 'Consumed time to clean list (sec) = %7.3f' % (time()-self.t0_sec)        
            #print msg

        self.setItemsHidden()

        self.list_of_visible_records = []

        if self.instr_name.value() == self.instr_name.value_def() : return
        if self.exp_name  .value() == self.exp_name  .value_def() : return

        msg = 'Begin to update the list of runs. It is slow procedure that takes ~0.1s/run, stay calm and wait.'
        logger.info(msg, __name__)
        #print msg
        # Get run records from RegDB
        self.dict_run_recs = ru.calibration_runs (self.instr_name.value(), self.exp_name.value())
        #print 'self.dict_run_recs = ', self.dict_run_recs

        self.list_of_run_strs_in_dir = fnm.get_list_of_xtc_runs()   # ['0001', '0202', '0203',...]
        self.list_of_run_nums_in_dir = gu.list_of_int_from_list_of_str(self.list_of_run_strs_in_dir) # [1, 202, 203, 204,...]
        self.list_of_run_nums_in_regdb = ru.list_of_runnums(self.instr_name.value(), self.exp_name.value())

        #print 'list_of_run_nums_in_dir  :', self.list_of_run_nums_in_dir
        #print 'list_of_run_nums_in_regdb:', self.list_of_run_nums_in_regdb
        #print '\nA. Consumed time (sec) =', time()-self.t0_sec
        #print 'Begin to construct the list of items for %s' % self.exp_name.value()

        
        if self.list_of_run_nums_in_regdb == [] : self.list_of_runs = self.list_of_run_nums_in_dir
        else                                    : self.list_of_runs = self.list_of_run_nums_in_regdb


        for run_num in self.list_of_runs :

            str_run_num = '%04d' % run_num
            self.str_run_number.setValue(str_run_num)

            if not self.isSelectedRun            (run_num) :
                print 'not self.isSelectedRun', run_num 
                continue

            if not self.hasSelectedDetectorsInRun(run_num) :
                print 'not self.hasSelectedDetectorsInRun', run_num 
                continue

            if not run_num in self.list_of_run_nums_in_dir :
                self.comment = 'xtc file IS NOT on disk!'
                self.xtc_in_dir = False
            else :
                self.xtc_in_dir = True
                #self.type    = 'N/A'

            item, widg = self.create_or_use_guidarklistitem(run_num)

            self.list.setItemHidden (item, False)

            record = run_num, item, widg
            self.list_of_visible_records.append(record)


        self.list.sortItems(QtCore.Qt.AscendingOrder)

        msg = 'Consumed time to generate list of files (sec) = %7.3f' % (time()-self.t0_sec)        
        logger.info(msg, __name__)
예제 #8
0
    def updateList(self, clearList=False) :

        self.t0_sec = time()

        if clearList :
            self.list.clear()
            self.dict_guidarklistitem = {}

        self.setItemsHidden()

        self.list_of_visible_records = []

        if self.instr_name.value() == self.instr_name.value_def() : return
        if self.exp_name  .value() == self.exp_name  .value_def() : return

        msg = 'Begin to update the list of runs. It is slow procedure that takes ~0.1s/run, stay calm and wait.'
        logger.info(msg, __name__)
        #print msg
        # Get run records from RegDB
        self.dict_run_recs = ru.calibration_runs (self.instr_name.value(), self.exp_name.value())
        #print 'self.dict_run_recs = ', self.dict_run_recs

        self.list_of_run_strs_in_dir = fnm.get_list_of_xtc_runs()   # ['0001', '0202', '0203',...]
        self.list_of_run_nums_in_dir = gu.list_of_int_from_list_of_str(self.list_of_run_strs_in_dir) # [1, 202, 203, 204,...]
        self.list_of_run_nums_in_regdb = ru.list_of_runnums(self.instr_name.value(), self.exp_name.value())

        #print 'list_of_run_nums_in_dir:\n',   self.list_of_run_nums_in_dir
        #print 'list_of_run_nums_in_regdb:\n', self.list_of_run_nums_in_regdb
        #print '\nA. Consumed time (sec) =', time()-self.t0_sec
        #print 'Begin to construct the list of items for %s' % self.exp_name.value()

        
        if self.list_of_run_nums_in_regdb == [] : self.list_of_runs = self.list_of_run_nums_in_dir
        else                                    : self.list_of_runs = self.list_of_run_nums_in_regdb


        for run_num in self.list_of_runs :

            str_run_num = '%04d' % run_num
            self.str_run_number.setValue(str_run_num)

            if not self.isSelectedRun            (run_num) : continue
            if not self.hasSelectedDetectorsInRun(run_num) : continue

            if not run_num in self.list_of_run_nums_in_dir :
                self.comment = 'NOT FOUND xtc file!'
                #self.type    = 'N/A'

            #item = QtGui.QListWidgetItem('', self.list)
            #widg = GUIDarkListItem(self, str_run_num, self.type, self.comment) # THIS GUY CONSUMES ~90ms !
            item, widg = self.create_or_use_guidarklistitem(run_num)

            self.list.setItemHidden (item, False)

            record = run_num, item, widg
            self.list_of_visible_records.append(record)

            #self.list.addItem(item)
            #item.setFlags (  QtCore.Qt.ItemIsEnabled ) #| QtCore.Qt.ItemIsSelectable  | QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsTristate)
            #print 'item.flags(): %o' % item.flags()
            #item.setCheckState(0) 
            #item.setFlags ( QtCore.Qt.ItemIsEnabled )

            #item.setFlags (  QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable  | QtCore.Qt.ItemIsUserCheckable )
            #item.setSizeHint(widg.size())
            #self.list.setItemWidget(item, widg)

            #self.list.setItemSelected(item, True)

        self.list.sortItems(QtCore.Qt.AscendingOrder)

        msg = 'Consumed time to generate list of files (sec) = %7.3f' % (time()-self.t0_sec)        
        logger.info(msg, __name__)
예제 #9
0
    def updateList(self, clearList=False) :

        self.update_counter += 1

        self.t0_sec = time()

        if clearList :
            self.removeItemWidgets()            
            self.list.clear()
            self.dict_guidarklistitem.clear()
            #msg = 'Consumed time to clean list (sec) = %7.3f' % (time()-self.t0_sec)        
            #print msg

        self.setItemsHidden()

        self.list_of_visible_records = []

        if self.instr_name.value() == self.instr_name.value_def() : return
        if self.exp_name  .value() == self.exp_name  .value_def() : return

        msg = 'Begin to update the list of runs. It is slow procedure that takes ~0.1s/run, stay calm and wait.'
        logger.info(msg, __name__)
        #print msg
        # Get run records from RegDB
        self.dict_run_recs = ru.calibration_runs (self.instr_name.value(), self.exp_name.value())
        #print 'self.dict_run_recs = ', self.dict_run_recs

        self.list_of_run_strs_in_dir = fnm.get_list_of_xtc_runs()   # ['0001', '0202', '0203',...]
        self.list_of_run_nums_in_dir = gu.list_of_int_from_list_of_str(self.list_of_run_strs_in_dir) # [1, 202, 203, 204,...]
        self.list_of_run_nums_in_regdb = ru.list_of_runnums(self.instr_name.value(), self.exp_name.value())

        #print 'list_of_run_nums_in_dir  :', self.list_of_run_nums_in_dir
        #print 'list_of_run_nums_in_regdb:', self.list_of_run_nums_in_regdb
        #print '\nA. Consumed time (sec) =', time()-self.t0_sec
        #print 'Begin to construct the list of items for %s' % self.exp_name.value()

        
        if self.list_of_run_nums_in_regdb == [] : self.list_of_runs = self.list_of_run_nums_in_dir
        else                                    : self.list_of_runs = self.list_of_run_nums_in_regdb


        for run_num in self.list_of_runs :

            str_run_num = '%04d' % run_num
            self.str_run_number.setValue(str_run_num)

            if not self.isSelectedRun            (run_num) :
                #print 'not self.isSelectedRun', run_num 
                continue

            if not self.hasSelectedDetectorsInRun(run_num) :
                #print 'not self.hasSelectedDetectorsInRun', run_num 
                continue

            if not run_num in self.list_of_run_nums_in_dir :
                self.comment = 'xtc file IS NOT on disk!'
                self.xtc_in_dir = False
            else :
                self.xtc_in_dir = True
                #self.type    = 'N/A'

            item, widg = self.create_or_use_guidarklistitem(run_num)

            self.list.setItemHidden (item, False)

            record = run_num, item, widg
            self.list_of_visible_records.append(record)


        self.list.sortItems(QtCore.Qt.AscendingOrder)

        msg = 'Consumed time to generate list of files (sec) = %7.3f' % (time()-self.t0_sec)        
        logger.info(msg, __name__)