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)
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)
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__)
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__)
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__)