class SettingsWindow(QWidget): def eventFilter(self, object, event): if event.type() == QEvent.FocusIn: self.customspeedRB.setChecked(True) return super(SettingsWindow, self).eventFilter(object, event) def setupUi(self, Form, host='192.168.2.171'): Form.resize(250, 900) Form.setStyleSheet('font: 10pt \"Tahoma\";') self.host = host self.downtimechecked = 0 self.default = defaultsettings self.defaultcutbacks = defaultcutbacksettings db = connector.connect(host=self.host, user="******", passwd="Sequal1234", database="simulation", use_pure=True) buttonSS = "QPushButton {\n" \ " background-color: ;\n" \ " background-color: qlineargradient(spread:pad, x1:0, y1:0, " \ "x2:1, y2:1, stop:0 rgba(0, 115, 119, 255), stop:1 rgb(4, 147, " \ "131));\n" \ " color: white;\n" \ " height: 25px;\n" \ " border: None;\n" \ " border-radius: 2px;\n" \ " \n" \ " font: 11pt \"Tahoma\";\n" \ " width: " self.mainlayout = QVBoxLayout(Form) hlayout = QHBoxLayout() self.titlelabel = QLabel(Form) self.titlelabel.setStyleSheet( 'font: 12pt \"Tahoma\"; font-weight: bold;') hlayout.addWidget(self.titlelabel) hspacer = QSpacerItem(40, 25, QSizePolicy.Expanding, QSizePolicy.Minimum) hlayout.addItem(hspacer) self.resetbutton = QPushButton(Form) self.resetbutton.setStyleSheet(buttonSS + "140px;}") self.resetbutton.setCursor(QCursor(Qt.PointingHandCursor)) hlayout.addWidget(self.resetbutton) self.mainlayout.addLayout(hlayout) self.hlayout = QVBoxLayout() # ################ # # GENERAL SETTINGS # # ################ # self.generalGB = QGroupBox(Form) self.generalGB.setStyleSheet('QGroupBox {font: 11pt \"Tahoma\";}') self.hlayout2 = QVBoxLayout(self.generalGB) self.hlayout2.setSpacing(15) self.gridlayout = QGridLayout() self.gridlayout.setHorizontalSpacing(2) self.loggaplabel = QLabel(self.generalGB) self.gridlayout.addWidget(self.loggaplabel, 0, 0, 1, 1) self.loggapTB = QDoubleSpinBox(self.generalGB) self.loggapTB.setButtonSymbols(QAbstractSpinBox.NoButtons) self.loggapTB.setSingleStep(0.1) self.loggapTB.setMinimum(0.3) self.loggapTB.setStyleSheet( 'QDoubleSpinBox::disabled {color: rgb(200, 200, 200);}') self.gridlayout.addWidget(self.loggapTB, 0, 1, 1, 1) self.loggapAuto = QCheckBox(self.generalGB) self.gridlayout.addWidget(self.loggapAuto, 0, 2, 1, 1) self.numbinslabel = QLabel(self.generalGB) self.gridlayout.addWidget(self.numbinslabel, 1, 0, 1, 1) self.numbinsTB = QSpinBox(self.generalGB) self.numbinsTB.setMinimum(1) self.numbinsTB.setMaximum(40) self.gridlayout.addWidget(self.numbinsTB, 1, 1, 1, 1) vspacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.gridlayout.addItem(vspacer, 2, 0, 1, 1) self.hlayout2.addLayout(self.gridlayout) # hspacer = QSpacerItem( # 20, 40, QSizePolicy.Expanding, QSizePolicy.Minimum) # self.hlayout2.addItem(hspacer) # Line speed group box self.linespeedGB = QGroupBox(self.generalGB) self.linespeedGB.setStyleSheet('QGroupBox {font: 11pt \"Tahoma\";}') vlayout = QVBoxLayout(self.linespeedGB) self.highspeedRB = QRadioButton(self.linespeedGB) vlayout.addWidget(self.highspeedRB) self.lowspeedRB = QRadioButton(self.linespeedGB) vlayout.addWidget(self.lowspeedRB) self.autospeedRB = QRadioButton(self.linespeedGB) vlayout.addWidget(self.autospeedRB) hlayout = QHBoxLayout() hlayout.setSpacing(0) self.customspeedRB = QRadioButton(self.linespeedGB) self.customspeedRB.setMinimumWidth(17) self.customspeedRB.setMaximumWidth(17) hlayout.addWidget(self.customspeedRB) self.customspeedTB = QDoubleSpinBox(self.linespeedGB) self.customspeedTB.setButtonSymbols(QAbstractSpinBox.NoButtons) self.customspeedTB.setDecimals(1) self.customspeedTB.setMaximum(200) self.customspeedTB.installEventFilter(self) hlayout.addWidget(self.customspeedTB) vlayout.addLayout(hlayout) vspacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) vlayout.addItem(vspacer) self.hlayout2.addWidget(self.linespeedGB) self.hlayout.addWidget(self.generalGB) # ################# # # DOWNTIME SETTINGS # # ################# # self.downtimeGB = QGroupBox(Form) self.downtimeGB.setStyleSheet('QGroupBox {font: 11pt \"Tahoma\";}') gridlayout = QGridLayout(self.downtimeGB) self.downtimeCBall = QCheckBox(self.downtimeGB) gridlayout.addWidget(self.downtimeCBall, 0, 0, 1, 1) self.downtimeCBtexts = list( read_sql('SELECT * From DowntimeSettings Where SimID = -1;', db).head())[1:] self.downtimeCBs = [] for i in range(len(self.downtimeCBtexts)): self.downtimeCBs.append(QCheckBox(self.downtimeGB)) row = int(i / 2) col = i % 2 gridlayout.addWidget(self.downtimeCBs[i], row + 1, col, 1, 1) vspacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) gridlayout.addItem(vspacer, row + 1, 0, 1, 1) self.hlayout.addWidget(self.downtimeGB) # ################ # # CUTBACK SETTINGS # # ################ # self.cutbackGB = QGroupBox(Form) self.cutbackGB.setStyleSheet('QGroupBox {font: 11pt \"Tahoma\";}') gridlayout = QGridLayout(self.cutbackGB) self.cutbackCBtexts = list( read_sql('SELECT * From CutbackSettings Where SimID = -1;', db).head())[1:] self.cutbackCBs = [] for i in range(len(self.cutbackCBtexts)): self.cutbackCBs.append(QCheckBox(self.cutbackGB)) row = int(i / 2) col = i % 2 gridlayout.addWidget(self.cutbackCBs[i], row, col, 1, 1) vspacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) gridlayout.addItem(vspacer, row + 1, 0, 1, 1) self.hlayout.addWidget(self.cutbackGB) self.mainlayout.addLayout(self.hlayout) self.buttonbox = QDialogButtonBox(Form) self.buttonbox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.buttonbox.setStyleSheet("QDialogButtonBox " + buttonSS + "70px;}") for w in self.buttonbox.children(): if w.metaObject().className() == "QPushButton": w.setCursor(QCursor(Qt.PointingHandCursor)) self.mainlayout.addWidget(self.buttonbox) vspacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.mainlayout.addItem(vspacer) self.retranslateUi(Form) self.SetDefaultSettings() # ####### # # SIGNALS # # ####### # self.resetbutton.clicked.connect(self.SetDefaultSettings) self.loggapAuto.stateChanged.connect(self.onLogGapAuto) self.downtimeCBall.stateChanged.connect(self.onDowntimeAll) for cb in self.downtimeCBs: cb.stateChanged.connect(self.onDowntimeCB) for cb in self.cutbackCBs: cb.stateChanged.connect(self.onCutbackCB) self.numbinsTB.valueChanged.connect(self.showResetButton) self.loggapTB.valueChanged.connect(self.showResetButton) if defaultsettings[3] == 55.0: self.highspeedRB.toggled.connect(self.showResetButton) elif defaultsettings[3] == 35.0: self.lowspeedRB.toggled.connect(self.showResetButton) else: self.autospeedRB.toggled.connect(self.showResetButton) def SetDefaultSettings(self): if defaultsettings[3] == 55.0: self.highspeedRB.setChecked(True) elif defaultsettings[3] == 35.0: self.lowspeedRB.setChecked(True) else: self.autospeedRB.setChecked(True) if defaultsettings[0] > 0: self.loggapTB.setValue(defaultsettings[0]) self.loggapAuto.setChecked(False) else: self.loggapAuto.setChecked(True) self.numbinsTB.setValue(defaultsettings[2]) self.downtimeCBall.setChecked(Qt.Checked) self.downtimechecked = 4 for cb in self.downtimeCBs: cb.setChecked(True) for cb in self.cutbackCBs: cb.setChecked(False) for cb in self.defaultcutbacks: self.cutbackCBs[self.cutbackCBtexts.index(cb)].setChecked(True) self.resetbutton.setVisible(False) def onCutbackCB(self, state): self.showResetButton() def onDowntimeAll(self, state): self.showResetButton() if state == Qt.Unchecked: for cb in self.downtimeCBs: cb.setChecked(False) elif state == Qt.Checked: for cb in self.downtimeCBs: cb.setChecked(True) elif state == Qt.PartiallyChecked and self.downtimechecked == 0: for cb in self.downtimeCBs: cb.setChecked(True) def onDowntimeCB(self, state): self.showResetButton() if state == Qt.Checked: self.downtimechecked += 1 else: self.downtimechecked -= 1 if self.downtimechecked == len(self.downtimeCBs): self.downtimeCBall.setCheckState(Qt.Checked) elif self.downtimechecked == 0: self.downtimeCBall.setCheckState(Qt.Unchecked) else: self.downtimeCBall.setCheckState(Qt.PartiallyChecked) def onLogGapAuto(self, state): self.showResetButton() self.loggapTB.setDisabled(state) def showResetButton(self): self.resetbutton.setVisible(True) def setupReadOnly(self): self.highspeedRB.setDisabled(True) self.lowspeedRB.setDisabled(True) self.autospeedRB.setDisabled(True) self.customspeedRB.setDisabled(True) self.customspeedTB.setDisabled(True) self.loggapAuto.setDisabled(True) self.loggapTB.setDisabled(True) self.loggapTB.setStyleSheet('') self.numbinsTB.setDisabled(True) for cb in self.downtimeCBs: cb.setDisabled(True) self.downtimeCBall.setDisabled(True) for cb in self.cutbackCBs: cb.setDisabled(True) self.resetbutton.setVisible(False) def retranslateUi(self, Form): _translate = QCoreApplication.translate self.titlelabel.setText(_translate('Form', 'Settings')) self.resetbutton.setText(_translate('Form', 'Reset to Default')) self.generalGB.setTitle(_translate('Form', 'General')) self.linespeedGB.setTitle(_translate('Form', 'Line Speed')) self.highspeedRB.setText(_translate('Form', '55 m/min')) self.lowspeedRB.setText(_translate('Form', '35 m/min')) self.autospeedRB.setText(_translate('Form', 'Auto')) self.customspeedRB.setText('') self.customspeedTB.setSuffix(_translate('Form', ' m/min')) self.loggaplabel.setText(_translate('Form', 'Log Gap: ')) self.loggapTB.setValue(defaultsettings[0]) self.loggapTB.setSuffix(_translate('Form', ' m')) self.loggapAuto.setText(_translate('Form', 'Auto')) self.numbinslabel.setText(_translate('Form', 'Number\nof Bins: ')) self.downtimeGB.setTitle(_translate('Form', 'Simulated Downtime')) for i in range(len(self.downtimeCBtexts)): self.downtimeCBs[i].setText( _translate('Form', self.downtimeCBtexts[i])) self.downtimeCBall.setText(_translate('Form', 'All')) self.cutbackGB.setTitle(_translate('Form', 'Cutbacks')) for i in range(len(self.cutbackCBtexts)): self.cutbackCBs[i].setText( _translate('Form', self.cutbackCBtexts[i]))
class AddCutplanDialog(QWidget): def setupUi(self, adddata=None, sqlfile=None, host=None): now = datetime.now() if host is None: self.host = '' else: self.host = host if adddata is None: self.addData = DataFrame( columns=['ID', 'Log Count', 'Description']) else: self.addData = adddata self.availData = None self.addPD = None self.avalPD = None # SQL if sqlfile is None: self.sqlfile = "support\\cpquery.sql" else: self.sqlfile = sqlfile # SERVER CONNECT QApplication.setOverrideCursor( QCursor(Qt.WaitCursor)) self.conn = connect(LogScanner) QApplication.restoreOverrideCursor() self.setObjectName("Dialog") # self.setWindowIcon(QIcon('images/icon.ico')) self.resize(250, 900) self.setStyleSheet( "#Dialog {\n" " background-color: white;\n" "}") self.installEventFilter(self) self.horizontalLayout = QVBoxLayout(self) self.horizontalLayout.setObjectName("horizontalLayout") self.calendarWidget = QCalendarWidget(self) font = QFont() font.setFamily("Tahoma") font.setPointSize(10) self.calendarWidget.setFont(font) self.calendarWidget.setStyleSheet( "#qt_calendar_prevmonth {\n" " qproperty-icon: url(\"images/prev.png\");\n" "}\n" "\n" "#qt_calendar_nextmonth {\n" " qproperty-icon: url(\"images/next.png\");\n" "}\n" "\n" "#qt_calendar_navigationbar {\n" " background-color: qlineargradient(spread:pad, x1:0, y1:0, " "x2:1, y2:1, stop:0 rgb(192, 221, 221), stop:1 rgb(180, 233, " "197));\n" "}\n" "\n" "#qt_calendar_monthbutton {\n" " color: rgb(0,115,119);\n" " font-size: 15px;\n" "}\n" "\n" "#qt_calendar_yearbutton {\n" " color: rgb(0,115,119);\n" " font-size: 15px;\n" "}\n" "\n" "QCalendarWidget QMenu {\n" " background-color: white;\n" " color: rgb(0,115,119);\n" "}\n" "\n" "QCalendarWidget QMenu::item:selected {\n" " background-color: rgb(192, 221, 221);\n" " color: rgb(0,115,119);\n" "}\n" "\n" "QCalendarWidget QSpinBox {\n" " color: rgb(0,115,119);\n" " selection-background-color: rgb(0, 115, 119);\n" " selection-color: white;\n" "}\n" "\n" "#qt_calendar_calendarview:enabled {\n" " background-color: rgb(192, 221, 221);\n" " alternate-background-color: white;\n" " color: rgb(0, 115, 119);\n" " selection-background-color: rgb(0, 115, 119);\n" " selection-color: white;\n" "}\n" "\n" "#qt_calendar_calendarview:disabled {\n" " color: #44acb0;\n" "}\n" "\n" "") btn = self.calendarWidget.findChild( QToolButton, "qt_calendar_prevmonth") btn.setCursor(QCursor(Qt.PointingHandCursor)) btn = self.calendarWidget.findChild( QToolButton, "qt_calendar_nextmonth") btn.setCursor(QCursor(Qt.PointingHandCursor)) self.calendarWidget.setVerticalHeaderFormat( QCalendarWidget.NoVerticalHeader) self.calendarWidget.setObjectName("calendarWidget") self.calendarWidget.setMinimumDate(QDate(2016, 1, 1)) self.calendarWidget.setMaximumDate( QDate(now.year, now.month, now.day)) btn = self.calendarWidget.findChild( QSpinBox, "qt_calendar_yearedit") btn.setAlignment(Qt.AlignCenter) btn.setButtonSymbols(QSpinBox.NoButtons) self.horizontalLayout.addWidget(self.calendarWidget) self.leftTV = QTableView(self) self.leftTV.setStyleSheet( "QTableView {" "border: 1px solid rgb(192, 221, 221);" "gridline-color: rgb(192, 221, 221);" "selection-background-color: rgb(192, 221, 221);" "selection-color: rgb(0,115,119);" "}" "QTableView::item::selected:!active {" "selection-color: rgb(0,115,119);" "}" ) self.leftTV.setObjectName("leftTV") self.leftTV.horizontalHeader().setDefaultSectionSize(65) self.leftTV.horizontalHeader().setStretchLastSection(True) self.leftTV.horizontalHeader().setStyleSheet( "QHeaderView::section {" "height: 25px;" "border: 1px outset rgb(192, 221, 221);" "background-color: white;" "selection-background-color: white;" "}" ) scrollbarss = """ QScrollBar:vertical { border: none; background: white; width: 5px; margin: 0 0 0 0; } QScrollBar::handle:vertical { background: rgb(192, 221, 221); border-radius: 2px; min-height: 20px; } QScrollBar::add-line:vertical { border: none; background: none; height: 0; subcontrol-position: none; subcontrol-origin: none; } QScrollBar::sub-line:vertical { border: none; background: none; height: 0; subcontrol-position: none; subcontrol-origin: none; } QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical { border: none; width: 0; height: 0; background: none; } QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { background: none; } QScrollBar:horizontal { border: none; background: white; height: 5px; margin: 0 0 0 0; } QScrollBar::handle:horizontal { background: rgb(192, 221, 221); border-radius: 2px; min-width: 20px; } QScrollBar::add-line:horizontal { border: none; background: none; width: 0; } QScrollBar::sub-line:horizontal { border: none; background: none; width: 0; } QScrollBar::left-arrow:horizontal, QScrollBar::right-arrow:horizontal { border: none; width: 0; height: 0; background: none; } QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal { background: none; } """ self.leftTV.verticalScrollBar().setStyleSheet(scrollbarss) self.leftTV.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) self.leftTV.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.leftFilter = HoverFilter() self.leftTV.horizontalHeader().installEventFilter(self.leftFilter) lcDelegate = LogCountDelegate() self.leftTV.setItemDelegateForColumn(1, lcDelegate) self.horizontalLayout.addWidget(self.leftTV) self.middleButtonsLayout = QHBoxLayout() self.middleButtonsLayout.setObjectName("middleButtonsLayout") self.addButton = QToolButton(self) self.addButton.setObjectName("addButton") buttonStyle = \ "QToolButton {\n"\ " background-color: qlineargradient(spread:pad, x1:0, y1:0, "\ "x2:1, y2:1, stop:0 rgba(0, 115, 119, 255), stop:1 rgb(4, 147, "\ "131));\n"\ " color: white;\n"\ " border: None;"\ " border-radius: 2px;"\ " font: 11pt \"Tahoma\";"\ "}" self.addButton.setStyleSheet(buttonStyle) self.addButton.setCursor( QCursor(Qt.PointingHandCursor)) self.middleButtonsLayout.addWidget(self.addButton) self.deleteButton = QToolButton(self) font = QFont() font.setPointSize(10) self.deleteButton.setFont(font) self.deleteButton.setObjectName("deleteButton") self.deleteButton.setStyleSheet(buttonStyle) self.deleteButton.setCursor( QCursor(Qt.PointingHandCursor)) self.middleButtonsLayout.addWidget(self.deleteButton) self.horizontalLayout.addLayout(self.middleButtonsLayout) self.rightTV = QTableView(self) self.rightTV.setStyleSheet( "QTableView {" "border: 1px solid rgb(192, 221, 221);" "gridline-color: rgb(192, 221, 221);" "selection-background-color: rgb(192, 221, 221);" "selection-color: rgb(0,115,119);" "}" "QTableView::item::selected:!active {" "selection-color: rgb(0,115,119);" "}" ) self.rightTV.setObjectName("rightTV") self.rightTV.verticalScrollBar().setStyleSheet(scrollbarss) self.rightTV.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) self.rightTV.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.rightTV.horizontalHeader().setDefaultSectionSize(65) self.rightTV.horizontalHeader().setStretchLastSection(True) self.rightTV.horizontalHeader().setStyleSheet( "QHeaderView::section {" "height: 25px;" "border: 1px outset rgb(192, 221, 221);" "background-color: white;" "selection-background-color: white;" "}" ) self.rightFilter = HoverFilter() self.rightTV.horizontalHeader().installEventFilter(self.rightFilter) lcDelegate = LogCountDelegate() self.rightTV.setItemDelegateForColumn(1, lcDelegate) self.horizontalLayout.addWidget(self.rightTV) # self.horizontalLayout.addLayout(self.vertlayoutl) self.buttonBox = QDialogButtonBox(self) self.buttonBox.setStyleSheet( "QDialogButtonBox QPushButton {\n" " background-color: ;\n" " background-color: qlineargradient(spread:pad, x1:0, y1:0, " "x2:1, y2:1, stop:0 rgba(0, 115, 119, 255), stop:1 rgb(4, 147, " "131));\n" " color: white;\n" " width: 70px;\n" " height: 25px;\n" " border: None;\n" " border-radius: 2px;\n" " \n" " font: 11pt \"Tahoma\";\n" "}") self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons( QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") for w in self.buttonBox.children(): if w.metaObject().className() == "QPushButton": w.setCursor(QCursor(Qt.PointingHandCursor)) self.horizontalLayout.addWidget(self.buttonBox) # DATA SET UP # self.onDateChange() # self.RTVSetUp() # EVENTS self.calendarWidget.selectionChanged.connect(self.onDateChange) self.addButton.clicked.connect(self.addFunction) self.deleteButton.clicked.connect(self.deleteFunction) self.retranslateUi(self) # self.buttonBox.button(QDialogButtonBox.Ok).clicked.connect( # self.accept) # self.buttonBox.rejected.connect(self.reject) QMetaObject.connectSlotsByName(self) def eventFilter(self, object, event): if object is self and event.type() == QEvent.KeyPress: if event.key() in (Qt.Key_Return, Qt.Key_Enter,): return True return super(AddCutplanDialog, self).eventFilter(object, event) def onDateChange(self): f = open(self.sqlfile, 'r') sqltext = f.read() selDate = self.calendarWidget.selectedDate().toPyDate() date1 = datetime(selDate.year, selDate.month, selDate.day, 4, 0, 0, 0) date2 = date1 + timedelta(1) sqltext = sqltext.replace( '@date1', str(date1)).replace('@date2', str(date2)) self.availData = read_sql(sqltext, self.conn) self.LTVSetUp() def LTVSetUp(self): self.availPD = PandasModel( self.availData ) for i in range(self.addData.shape[0]): for j in range(self.availData.shape[0]): if self.addData.ID[i] == self.availData.ID[j]: self.availPD.setCompleted(j) self.leftTV.setModel(self.availPD) self.leftTV.setSelectionBehavior(QTableView.SelectRows) self.leftTV.verticalHeader().setVisible(False) self.leftTV.setColumnWidth(0, 45) self.availPD.dataChanged.connect(self.updateAvailPD) def RTVSetUp(self): self.addPD = PandasModel( self.addData ) self.rightTV.setModel(self.addPD) self.rightTV.setSelectionBehavior(QTableView.SelectRows) self.rightTV.verticalHeader().setVisible(False) self.rightTV.setColumnWidth(0, 45) self.addPD.dataChanged.connect(self.updateAddPD) def updateAvailPD(self, index, index2): self.availData.iloc[index.row(), index.column()] = \ self.availPD._df.iloc[index.row(), index.column()] def updateAddPD(self, index, index2): self.addData.iloc[index.row(), index.column()] = \ self.addPD._df.iloc[index.row(), index.column()] def addFunction(self): sm = self.leftTV.selectionModel() if sm.hasSelection(): for r in sm.selectedRows(): if not self.availPD._completed[r.row()]: data = self.availData.iloc[r.row()] self.addData = self.addData.append(data, ignore_index=True) self.availPD.setCompleted(r.row()) self.RTVSetUp() def deleteFunction(self): sm = self.rightTV.selectionModel() if sm.hasSelection(): for r in sm.selectedRows(): for i in range(self.availData.shape[0]): if self.availData.ID[i] == self.addData.ID[r.row()]: self.availPD.setCompleted(i, False) self.addData = self.addData.drop(index=r.row()) self.addData = self.addData.reset_index().drop(columns='index') self.RTVSetUp() def retranslateUi(self, Dialog): _translate = QCoreApplication.translate Dialog.setWindowTitle(_translate("Dialog", "Add Cutplans")) self.addButton.setText(_translate("Dialog", "Add ▼")) self.deleteButton.setText(_translate("Dialog", "▲ Remove"))