def update_channels(self, channels: List[Channel], selected_channel: Channel = None): """ Update / repopulate the list of selectable channels Inputs: channels: List of channel names """ self._reset_combo_box(self._combo_channels) if channels is None or len(channels) == 0: self._combo_channels.setEnabled(False) else: model = QStandardItemModel() model.appendRow(QStandardItem(self._combo_channels.itemText(0))) for channel in channels: item = QStandardItem(channel.display_name) item.setData(channel, QtCore.Qt.UserRole) model.appendRow(item) self._combo_channels.setModel(model) if selected_channel is not None: # TODO relying on display name isn't the best as it will probably # cause issues if channel names aren't unique # TODO refactor by making Channel derive from QStandardItem and do something like this: # selected_index = model.indexFromItem(selected_channel) # self.combo_channels.setCurrentIndex(selected_index) self._combo_channels.setCurrentText( selected_channel.display_name) self._combo_channels.setEnabled(True)
def add_catalogs(self): config_file_to_broker = defaultdict(list) catalog_names = list(catalog) for name in catalog_names: broker = Broker.named(name) if getattr(broker, 'v2', None) is None: msg.logMessage( f'The broker named {name} cannot be cast to a v2 Broker.', msg.WARNING) continue # catalog_dir might be in the metadata; if not, let's try to find it if 'catalog_dir' in broker.v2.metadata: config_file = broker.v2.metadata["catalog_dir"] else: config_file = find_catalog(name) config_file_to_broker[config_file].append(broker) for config_file, brokers in config_file_to_broker.items(): config_file_item = QStandardItem() config_file_item.setData(config_file, Qt.DisplayRole) self.appendRow(config_file_item) for broker in brokers: broker_item = QStandardItem() broker_item.setData(broker.name, Qt.DisplayRole) broker_item.setData(broker, self.broker_role) config_file_item.appendRow(broker_item)
def __init__(self): QDialog.__init__(self) # setup UI self.form = QFormLayout(self) self.editPosition = QLineEdit('') self.form.addRow(QLabel('Position'), self.editPosition) self.editVelocity = QLineEdit('') self.form.addRow(QLabel('Velocity'), self.editVelocity) # configure network (take first available servo) self._net, self._servo = il.lucky(il.NET_PROT.EUSB) # create data model model = QStandardItemModel() pos = QStandardItem() vel = QStandardItem() model.appendRow([pos, vel]) # configure and start watcher self._watcher = RegisterWatcher(self._servo) self._watcher.add(POS_ACT, 500, pos) self._watcher.add(VEL_ACT, 100, vel) self._watcher.start(100) # map model fields to widgets self._mapper = QDataWidgetMapper() self._mapper.setModel(model) self._mapper.addMapping(self.editPosition, 0) self._mapper.addMapping(self.editVelocity, 1) self._mapper.toFirst()
def resetItems(self): self.isUpdating = True self.dataViewModel.clear() filterEntry = self.filterEntry.text().lower() rowCount = 0 colCount = 0 catalogData = self.localCatalogData if self.location == "remote": catalogData = self.remoteCatalogData for id, value in catalogData.items(): id2, filename, type, directory, file, description, repo, installDirectory, sha = value if (filterEntry == "" or filterEntry in filename.lower() or filterEntry in description.lower()): if (not self.pdfCheckbox.isChecked() and type == "PDF") or \ (not self.mp3Checkbox.isChecked() and type == "MP3") or \ (not self.mp4Checkbox.isChecked() and type == "MP4") or \ (not self.bookCheckbox.isChecked() and type == "BOOK") or \ (not self.docxCheckbox.isChecked() and type == "DOCX") or \ (not self.devotionalCheckbox.isChecked() and type == "DEVOTIONAL") or \ (not self.commCheckbox.isChecked() and type == "COMM"): continue enable = True if self.location == "remote": installDirectory = os.path.join(config.marvelData, installDirectory) if FileUtil.regexFileExists( "{0}.*".format(GithubUtil.getShortname(filename)), installDirectory): enable = False item = QStandardItem(id) item.setEnabled(enable) self.dataViewModel.setItem(rowCount, colCount, item) colCount += 1 item = QStandardItem(file) item.setEnabled(enable) self.dataViewModel.setItem(rowCount, colCount, item) colCount += 1 item = QStandardItem(directory) item.setEnabled(enable) self.dataViewModel.setItem(rowCount, colCount, item) colCount += 1 # item = QStandardItem(description) # self.dataViewModel.setItem(rowCount, colCount, item) # colCount += 1 # add row count rowCount += 1 colCount = 0 self.dataViewModel.setHorizontalHeaderLabels([ "#", config.thisTranslation["file"], config.thisTranslation["directory"], # config.thisTranslation["description"] ]) self.dataView.resizeColumnsToContents() self.isUpdating = False
def load_kpis(self, rootIndex, topology): kpis = QStandardItem('kpis') item = self.itemFromIndex(rootIndex) item.appendRow(kpis) for conn_key, conn in topology.connections.items(): conn_item = QStandardItem(conn_key) kpis.appendRow(conn_item) for kpi_key, kpi in conn.kpis.items(): kpi_item = QStandardItem(kpi_key) kpi_item.setData('kpi', self.TYPE_ROLE) kpi_item.setData(kpi, self.MODEL_ROLE) conn_item.appendRow(kpi_item)
def __init__(self, parent, info, title="Channel Properties"): super().__init__(parent) self.setWindowTitle(title) self.model = QStandardItemModel(info["nchan"], 4) self.model.setHorizontalHeaderLabels(["#", "Label", "Type", "Bad"]) for index, ch in enumerate(info["chs"]): item = QStandardItem() item.setData(index, Qt.DisplayRole) item.setFlags(item.flags() & ~Qt.ItemIsEditable) self.model.setItem(index, 0, item) self.model.setItem(index, 1, QStandardItem(ch["ch_name"])) kind = channel_type(info, index).upper() self.model.setItem(index, 2, QStandardItem(str(kind))) bad = QStandardItem() bad.setData(ch["ch_name"] in info["bads"], Qt.UserRole) bad.setCheckable(True) bad.setEditable(False) checked = ch["ch_name"] in info["bads"] bad.setCheckState(Qt.Checked if checked else Qt.Unchecked) self.model.setItem(index, 3, bad) self.model.itemChanged.connect(bad_changed) self.proxymodel = MySortFilterProxyModel() self.proxymodel.setDynamicSortFilter(False) self.proxymodel.setSourceModel(self.model) self.view = QTableView() self.view.setModel(self.proxymodel) self.view.setItemDelegateForColumn(2, ComboBoxDelegate(self.view)) self.view.setEditTriggers(QAbstractItemView.AllEditTriggers) self.view.verticalHeader().setVisible(False) self.view.horizontalHeader().setStretchLastSection(True) self.view.setShowGrid(False) self.view.setSelectionMode(QAbstractItemView.NoSelection) self.view.setSortingEnabled(True) self.view.sortByColumn(0, Qt.AscendingOrder) vbox = QVBoxLayout(self) vbox.addWidget(self.view) self.buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) vbox.addWidget(self.buttonbox) self.buttonbox.accepted.connect(self.accept) self.buttonbox.rejected.connect(self.reject) self.resize(475, 650) self.view.setColumnWidth(0, 70) self.view.setColumnWidth(1, 155) self.view.setColumnWidth(2, 90)
def selectRendition(self, rendition): from util.GithubUtil import GithubUtil self.selectedRendition = rendition self.downloadTable.setEnabled(True) self.selectedText, self.selectedRepo, self.selectedDirectory = self.bibles[ self.selectedRendition] self.github = GithubUtil(self.selectedRepo) self.repoData = self.github.getRepoData() self.settingBibles = True self.dataViewModel.clear() rowCount = 0 for file in self.repoData.keys(): if len(str(file)) > 3: engFullBookName = file[3:] else: engFullBookName = BibleBooks().eng[str(int(file))][1] item = QStandardItem(file[:3].strip()) folder = os.path.join("audio", "bibles", self.selectedText, self.selectedDirectory, file) folderWithName = os.path.join("audio", "bibles", self.selectedText, self.selectedDirectory, file + " " + engFullBookName) if os.path.exists(folder) or os.path.exists(folderWithName): item.setCheckable(False) item.setCheckState(Qt.Unchecked) item.setEnabled(False) else: item.setCheckable(True) item.setCheckState(Qt.Checked) item.setEnabled(True) self.dataViewModel.setItem(rowCount, 0, item) item = QStandardItem(engFullBookName) self.dataViewModel.setItem(rowCount, 1, item) if os.path.exists(folder) or os.path.exists(folderWithName): item = QStandardItem("Installed") self.dataViewModel.setItem(rowCount, 2, item) else: item = QStandardItem("") self.dataViewModel.setItem(rowCount, 2, item) rowCount += 1 self.dataViewModel.setHorizontalHeaderLabels([ config.thisTranslation["menu_book"], config.thisTranslation["name"], "" ]) self.downloadTable.setColumnWidth(0, 90) self.downloadTable.setColumnWidth(1, 125) self.downloadTable.setColumnWidth(2, 125) # self.downloadTable.resizeColumnsToContents() self.settingBibles = False
def add_model(self, model): model_name = model.__class__.name model_count = len([ self.item(idx) for idx in range(self.rowCount()) if model.__class__.name in self.item(idx).text() ]) model_name = model_name + str( model_count) if model_count > 0 else model_name model_item = QStandardItem(model_name) model_item.setData(model, Qt.UserRole + 1) for para_name in model.param_names: # Retrieve the parameter object from the model parameter = getattr(model, para_name) # Store the name value param_name = QStandardItem(parameter.name) param_name.setData(parameter.name, Qt.UserRole + 1) param_name.setEditable(False) # Store the data value of the parameter param_value = QStandardItem("{:.5g}".format(parameter.value)) param_value.setData(parameter.value, Qt.UserRole + 1) # Store the unit information # param_unit = QStandardItem("{}".format(parameter.unit)) param_unit = QStandardItem("Plot Units") param_unit.setData(parameter.unit, Qt.UserRole + 1) param_unit.setEditable(False) # Store the fixed state of the unit param_fixed = QStandardItem() param_fixed.setData(parameter.fixed, Qt.UserRole + 1) param_fixed.setCheckable(True) param_fixed.setEditable(False) model_item.appendRow( [param_name, param_value, param_unit, param_fixed]) self.appendRow([model_item, None, None, None]) # Add this model to the model equation string. By default, all models # are simply added together self._equation += " + {}".format(model_name) \ if len(self._equation) > 0 else "{}".format(model_name) return model_item.index()
def add_client(self, client: Client): self._clients.append(client) if isinstance(client.backend, JSONBackend): client_item = QStandardItem(client.backend.path) elif isinstance(client.backend, MongoBackend): client_item = QStandardItem( f"{client.backend._client.HOST}/{client.backend._collection.full_name}" ) self.appendRow(client_item) for result in client.search(): # add an OphydItem self.add_device(client_item, result.item) client_item.setData(client)
def refresh(self): self.clear() if not self._proc_interface: logger.warning('cannot refresh without a procInterface') return eprocs = self._proc_interface.eprocs for device in eprocs.keys(): device_item = QStandardItem(device) self.appendRow(device_item) for eproc in eprocs[device]: eproc_item = QStandardItem(eproc) device_item.appendRow(eproc_item)
def _build_GUI(self, linelist, table_view): panel_layout = QVBoxLayout() panel_layout.setSizeConstraint(QLayout.SetMaximumSize) self.setLayout(panel_layout) # GUI cannot be completely defined in a .ui file. # It has to be built on-the-fly here. self.button_pane = QWidget() loadUi( os.path.join(os.path.dirname(__file__), "ui", "linelists_panel_buttons.ui"), self.button_pane) self.button_pane.create_set_button.clicked.connect(self._createSet) self.button_pane.deselect_button.clicked.connect( table_view.clearSelection) # header with line list metadata. info = QTextBrowser() info.setMaximumHeight(100) info.setAutoFillBackground(True) info.setStyleSheet("background-color: rgb(230,230,230);") for comment in linelist.meta['comments']: info.append(comment) # populate color picker model = self.button_pane.combo_box_color.model() for cname in ID_COLORS: item = QStandardItem(cname) item.setForeground(ID_COLORS[cname]) item.setData(QColor(ID_COLORS[cname]), role=Qt.UserRole) model.appendRow(item) # set validators validator = QDoubleValidator() validator.setRange(0.05, 0.95, decimals=2) self.button_pane.height_textbox.setValidator(validator) validator = QDoubleValidator() validator.setRange(-1.e5, 1.e10, decimals=4) self.button_pane.redshift_textbox.setValidator(validator) model = self.button_pane.combo_box_z_units.model() for uname in ['z', 'km/s']: item = QStandardItem(uname) model.appendRow(item) # put it all together panel_layout.addWidget(info) panel_layout.addWidget(table_view) panel_layout.addWidget(self.button_pane)
def commentaryListView(self): # https://doc.qt.io/archives/qtforpython-5.12/PySide2/QtCore/QStringListModel.html # https://gist.github.com/minoue/9f384cd36339429eb0bf # https://www.pythoncentral.io/pyside-pyqt-tutorial-qlistview-and-qstandarditemmodel/ list = QListView() list.setEditTriggers(QAbstractItemView.NoEditTriggers) model = QStandardItemModel(list) for index, commentary in enumerate(self.parent.commentaryFullNameList): item = QStandardItem(commentary) item.setToolTip(self.parent.commentaryList[index]) #item.setCheckable(True) #item.setCheckState(Qt.CheckState.Checked) #item.setCheckState(Qt.CheckState.Unchecked) #print(item.checkState() is Qt.CheckState.Checked) model.appendRow(item) #model = QStringListModel(self.parent.commentaryList) #model = QStringListModel(self.parent.commentaryFullNameList) list.setModel(model) if config.commentaryText in self.parent.commentaryList: list.setCurrentIndex( model.index( self.parent.commentaryList.index(config.commentaryText), 0)) list.selectionModel().selectionChanged.connect(self.commentarySelected) return list
def set_default(self, parameters): """Sets the default values from 'parameters' to the model Sets the data from 'parameters' to the model, overwriting any existing data in the model. This follows the ``mily.widget`` API. Parameters ---------- parameters : [dicts] List of dicts with each dict being a row that maps the column header to its value. """ model = self.model() # Empty the model. model.removeRows(0, model.rowCount()) # Add the new data to the model. for row_params in parameters: row_data = [] # for each column in the model check if a default is given for column in range(0, model.columnCount()): header_item = model.horizontalHeaderItem(column) header = header_item.text() item = QStandardItem() value = row_params.get(header, None) item.setData(value, Qt.DisplayRole) row_data.append(item) model.appendRow(row_data)
def resetItems(self): from qtpy.QtGui import QStandardItem from qtpy.QtCore import Qt # Empty the model before reset self.readingListModel.clear() # Reset index = 0 todayIndex = None filterEntry = self.filterEntry.text() for key, value in self.plan.items(): checked, passages = value if not (self.hideCheckedItems and checked) and ( filterEntry == "" or (filterEntry != "" and filterEntry.lower() in passages.lower())): item = QStandardItem("{0}. {1}".format(key, passages)) item.setToolTip("{0}{1}{2}".format(self.translation[8], key, self.translation[9])) if key == self.todayNo: todayIndex = index item.setCheckable(True) item.setCheckState(Qt.CheckState.Checked if checked else Qt. CheckState.Unchecked) self.readingListModel.appendRow(item) index += 1 if todayIndex is not None: self.readingList.setCurrentIndex( self.readingListModel.index(todayIndex, 0))
def show_results(self): header_labels_set = False self.show_results_event.clear() t0 = time.monotonic() counter = 0 for uid, entry in itertools.islice(self._results_catalog.items(), MAX_SEARCH_RESULTS): if uid in self._results: continue counter += 1 self._results.append(uid) row = [] try: row_data = self.apply_search_result_row(entry) except SkipRow: continue if not header_labels_set: # Set header labels just once. self.search_results_model.setHorizontalHeaderLabels(list(row_data)) header_labels_set = True for value in row_data.values(): item = QStandardItem() item.setData(value, Qt.DisplayRole) row.append(item) self.search_results_model.appendRow(row) if counter: duration = time.monotonic() - t0 log.debug("Displayed %d new results (%.3f s).", counter, duration) self.show_results_event.set()
def loadServos(self): model = QStandardItemModel() devs = il.devices(il.NET_PROT.EUSB) for dev in devs: try: net = il.Network(il.NET_PROT.EUSB, dev) except il.exceptions.ILCreationError: continue found = net.servos() for servo_id in found: try: servo = il.Servo(net, servo_id) except il.exceptions.ILCreationError: continue item = QStandardItem('0x{:02x} ({})'.format(servo_id, dev)) item.setData(servo, Qt.UserRole) image = QImage(join(_RESOURCES, 'images', 'triton-core.png')) item.setData(QPixmap.fromImage(image), Qt.DecorationRole) model.appendRow([item]) self.cboxServos.setModel(model)
def show_results(self): header_labels_set = False t0 = time.monotonic() counter = 0 for uid, entry in itertools.islice(self._results_catalog.items(), MAX_SEARCH_RESULTS): if entry in self._results: continue counter += 1 self._results.append(entry) row = [] try: row_text = self.apply_search_result_row(entry) except SkipRow: continue if not header_labels_set: # Set header labels just once. self.search_results_model.setHorizontalHeaderLabels( list(row_text)) header_labels_set = True for text in row_text.values(): item = QStandardItem(text or '') row.append(item) self.search_results_model.appendRow(row) if counter: duration = time.monotonic() - t0 log.debug("Displayed %d new results (%.3f s)", counter, duration)
def create_table_item(column, itemname, invalid_value_count, log_size, callable, *args): item = QStandardItem() item.setEditable(False) #format if there is invalid data entries if invalid_value_count == -1: item.setData(DEEP_RED, Qt.BackgroundRole) item.setToolTip( "All of the values in the log are marked invalid, none of them are filtered." ) elif invalid_value_count > 0: saturation = 10 + (170 * (invalid_value_count / (log_size + invalid_value_count))) item.setData(QColor.fromHsv(0, saturation, 255), Qt.BackgroundRole) aux_verb = "is" if invalid_value_count == 1 else "are" item.setToolTip( f"{invalid_value_count}/{log_size+invalid_value_count} of the values in the log" f" {aux_verb} marked invalid, and {aux_verb} filtered.") try: item.setText(callable(*args)) except Exception as exc: logger.warning("Error setting column {} for log {}: {}".format( column, itemname, str(exc))) return item
def loadData(self): # get current map idx if not self.isMapOpen(): return # pass the selected map data to plotwidget self.rawSpectra.setHeader(self.headers[self.selectMapidx], 'spectra') currentMapItem = self.headermodel.item(self.selectMapidx) rc2ind = self.rc2indList[self.selectMapidx] # get current map name mapName = currentMapItem.data(0) # get current selected pixels pixelCoord = currentMapItem.selectedPixels # get selected specIds spectraIds = [] if currentMapItem.selectedPixels is None: # select all spectraIds = list(range(len(rc2ind))) else: for i in range(len(pixelCoord)): row_col = tuple(pixelCoord[i]) spectraIds.append(rc2ind[row_col]) spectraIds = sorted(spectraIds) # add specitem model self.specItemModel.clear() for idx in spectraIds: item = QStandardItem(mapName + '# ' + str(idx)) item.idx = idx self.specItemModel.appendRow(item)
def show_results(self): header_labels_set = False self.show_results_event.clear() t0 = time.monotonic() counter = 0 while not self._new_entries.empty(): counter += 1 entry = self._new_entries.get() row = [] try: row_data = self.apply_search_result_row(entry) except SkipRow: continue if not header_labels_set: # Set header labels just once. self.search_results_model.setHorizontalHeaderLabels(list(row_data)) header_labels_set = True for value in row_data.values(): item = QStandardItem() item.setData(value, Qt.DisplayRole) row.append(item) self.search_results_model.appendRow(row) if counter: duration = time.monotonic() - t0 log.debug("Displayed %d new results (%.3f s).", counter, duration) self.show_results_event.set()
def insert_child_current_item(self, child_value): """ Insert a child item to currently selected item Args: child_value: Returns: """ current_index = self.currentIndex() assert (isinstance(current_index, QModelIndex)) current_row = current_index.row() print('[DEV] Current Index of Row = %d ' % current_row) # Get model my_model = self.model() assert (isinstance(my_model, QStandardItemModel)) current_item = my_model.itemFromIndex(current_index) assert (isinstance(current_item, QStandardItem)) print('Add Child Value ', child_value) # child_item = QStandardItem(child_value) child_item = QStandardItem(str(child_value)) current_item.insertRow(0, [child_item]) return
def __init__(self, parent): super(InfoFrame, self).__init__(parent) self.widget_layout = QVBoxLayout(self) self.setLayout(self.widget_layout) self.section_label = QLabel(self) self.section_label.setText("Informations") self.widget_layout.addWidget(self.section_label) self.label = QLabel(self) self.label.setText("Select information to collect after successfull connection. Keep in mind that the more " "data you collect the more suspicious you are for antivirus software. You can " "change these settings later.") self.label.setWordWrap(True) self.widget_layout.addWidget(self.label) self.list = QListView(self) self.model = QStandardItemModel(self.list) self.widget_layout.addWidget(self.list) self.list.setModel(self.model) self.item_string = {} infos = ConfigManager.get_infos() for info in infos: self.item_string[info] = {"name": " ".join(info.capitalize().split("_"))} for string in self.item_string: item = QStandardItem(self.item_string.get(string).get("name")) item.setFlags(Qt.ItemIsEnabled) item.setData(QVariant(Qt.Checked), Qt.CheckStateRole) self.model.appendRow(item)
def _update_stations(self): self.model_stations.clear() for mt_obj in list(self._mt_obj_dict.values()): new_item = QStandardItem() new_item.setData(mt_obj.station, QtCore.Qt.DisplayRole) new_item.setData(mt_obj.fn, QtCore.Qt.ToolTipRole) self.model_stations.appendRow(new_item) self.model_stations.sort(0)
def reloadFilters(self): self.filters = self.db.getAll() self.dataViewModel.clear() rowCount = 0 for bible, description in self.filters: item = QStandardItem(bible) item.setToolTip(bible) item.setCheckable(True) self.dataViewModel.setItem(rowCount, 0, item) item = QStandardItem(description) self.dataViewModel.setItem(rowCount, 1, item) rowCount += 1 self.dataViewModel.setHorizontalHeaderLabels([ config.thisTranslation["filter2"], config.thisTranslation["pattern"] ]) self.filtersTable.resizeColumnsToContents()
def list_subcatalogs(self): self._subcatalogs.clear() self.catalog_selection_model.clear() if not self.root_catalog: return for name in self.root_catalog: self._subcatalogs.append(name) self.catalog_selection_model.appendRow(QStandardItem(str(name)))
def add_catalogs(self): config_file_to_broker = defaultdict(list) catalog_names = list(catalog) for name in catalog_names: broker = Broker.named(name) config_file = broker.v2.metadata["catalog_dir"] config_file_to_broker[config_file].append(broker) for config_file, brokers in config_file_to_broker.items(): config_file_item = QStandardItem() config_file_item.setData(config_file, Qt.DisplayRole) self.appendRow(config_file_item) for broker in brokers: broker_item = QStandardItem() broker_item.setData(broker.name, Qt.DisplayRole) broker_item.setData(broker, self.broker_role) config_file_item.appendRow(broker_item)
def createIcons(self): self.contentsModel.clear() for pluginInfo in pluginmanager.getPluginsOfCategory("SettingsPlugin"): item = QStandardItem(pluginInfo.plugin_object.icon, pluginInfo.plugin_object.name()) item.widget = pluginInfo.plugin_object.widget item.setTextAlignment(Qt.AlignHCenter) item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled) item.setSizeHint(QSize(136, 80)) self.contentsModel.appendRow(item)
def on_debug_message(self, message): msg = 'DEBUG - occurred at: [ {} ]\n{}'.format( NotificationsWidget._get_time(), NotificationsWidget._strip_new_line(message)) notification_item = QStandardItem() notification_item.setText(msg) notification_item.setIcon(QIcon.fromTheme('dialog-question')) notification_item.setEditable(False) self.all_notification_model.appendRow(notification_item)
def __call__(self, name, doc): if name == 'event_page': for event in unpack_event_page(doc): self.__call__('event', event) elif name == 'event': column = doc['seq_num'] - 1 for row, val in enumerate( val for _, val in sorted(doc['data'].items())): self.setItem(row, column, QStandardItem(str(val))) self.setVerticalHeaderLabels(doc['data'].keys())
def create_table_item(column, itemname, callable, *args): item = QStandardItem() item.setEditable(False) try: item.setText(callable(*args)) except Exception as exc: logger.warning("Error setting column {} for log {}: {}".format( column, itemname, str(exc))) return item