def slot_set_item(self, item: QtWidgets.QTableWidgetItem): row = item.row() content = self.ui.tableWidget.item(row, 0).text() + " (" + self.ui.tableWidget.item(row, 1).text() + ", " + \ self.ui.tableWidget.item(row, 2).text() + ")" self.rowCurrent = row self.ui.lineEdit.setText(" " + str(row) + " - [ " + content + "]")
def _on_segment_item_changed(self, item: QTableWidgetItem): """when user enters new value to segments table""" if self.segments_edit_semaphore.locked( ): # item is being updated from code rather than by user return val = float(item.text()) logger().info(f'Segment value changed: {val}') if item.column() == 0: self.gen_curve.segment_set_range(segment=item.row(), from_value=val) elif item.column() == 1: self.gen_curve.segment_set_range(segment=item.row(), to_value=val) elif item.column() == 2: self.gen_curve.segment_update_data(segment=item.row(), data={'PHIN': val}) self.populate_segments()
def _on_diagnose_change(self, item: QTableWidgetItem): column = item.column() row = item.row() poi_id = self.multiPOIList.item(row, self.POIID_COLUMN).text() content = item.text() original_content = self.multi_poi.am_obj.get_content_by_id_column(poi_id, column) _l.debug('updaing %s, content: %s, original: %s', poi_id, content, original_content) if not self._is_identical(content, original_content): updated_poi = self.multi_poi.update_poi(poi_id, column, content) self._diagnose_handler.submit_updated_poi(poi_id, updated_poi)
def change_rate(self, item: QTableWidgetItem): """ Обновляет расход материала в услуге и расчитывает себестоимость. :param item: QTableWidgetItem """ if item.column() == 2 and float(item.text()) != 0: rate = float(item.text()) storage_item = self.service_storage[ self.service_ui.left_table.item(item.row(), 0).text()] if storage_item.rate == rate: return total = self.service_ui.left_table.item( self.service_ui.left_table.rowCount() - 1, 3) amount = float(total.text()) amount -= storage_item.rate_price storage_item.rate = rate cost = self.service_ui.left_table.item(item.row(), 3) cost.setText(str(storage_item.rate_price)) amount += storage_item.rate_price total.setText(str(amount))
def update_checked_videos_state(self, item: QTableWidgetItem): video_index = item.row() if self.checking_row_updates: self.checking_row_updates = False self.update_selected_row(row_index=video_index) if item.checkState() == Qt.Unchecked: self.update_row_text_color(row_index=video_index, color_string="#787878") self.update_unchecked_video_signal.emit(video_index) elif item.checkState() == Qt.Checked: self.update_row_text_color(row_index=video_index, color_string="#000000") self.update_checked_video_signal.emit(video_index) self.checking_row_updates = True
def update_checked_attachments_state(self, item: QTableWidgetItem): attachment_index = item.row() if self.checking_row_updates: self.checking_row_updates = False self.update_selected_row(row_index=attachment_index) if attachment_index < len( GlobalSetting.ATTACHMENT_FILES_CHECKING_LIST): if item.checkState() == Qt.Unchecked: GlobalSetting.ATTACHMENT_FILES_CHECKING_LIST[ attachment_index] = False self.update_row_text_color(row_index=attachment_index, color_string="#787878") self.update_unchecked_attachment_signal.emit( GlobalSetting. ATTACHMENT_FILES_ABSOLUTE_PATH_LIST[attachment_index]) elif item.checkState() == Qt.Checked: GlobalSetting.ATTACHMENT_FILES_CHECKING_LIST[ attachment_index] = True self.update_row_text_color(row_index=attachment_index, color_string="#000000") self.update_checked_attachment_signal.emit( GlobalSetting. ATTACHMENT_FILES_ABSOLUTE_PATH_LIST[attachment_index]) self.checking_row_updates = True