diff --git a/statapp/main_window.py b/statapp/main_window.py
index 88bd84d..594484b 100644
--- a/statapp/main_window.py
+++ b/statapp/main_window.py
@@ -19,8 +19,8 @@
#
import numpy as np
from PySide2 import QtCore
-from PySide2.QtCore import Slot
-from PySide2.QtWidgets import QMainWindow, QMessageBox
+from PySide2.QtCore import Slot, Qt, QPoint
+from PySide2.QtWidgets import QMainWindow, QMessageBox, QAction, QMenu
from statapp.calculations import generateXValues, generateYValues
from statapp.constants import NUMBERS_PRECISION
@@ -81,6 +81,27 @@ class MainWindow(QMainWindow):
# x1 = generateXValues(20, 2, 0, y)
# x2 = generateXValues(10, 1, 0, y)
# self.model.updateAllData(np.concatenate([y, x1, x2], axis=1))
+ self.ui.tableView.horizontalHeader().setContextMenuPolicy(Qt.CustomContextMenu)
+ self.ui.tableView.horizontalHeader().customContextMenuRequested.connect(self.removeColumn)
+
+
+ def removeColumn(self, event: QPoint):
+ menu = QMenu(self)
+
+ col = self.ui.tableView.columnAt(event.x())
+
+ if col == 0:
+ return
+
+ def fun():
+ self.model.removeCol(col)
+ self.isDataChanged = True
+
+ selectAction = QAction("Удалить", self)
+ selectAction.triggered.connect(fun)
+ menu.addAction(selectAction)
+ menu.exec_(self.ui.tableView.mapToGlobal(event))
+
def updateActionsEnabled(self):
diff --git a/statapp/models/input_values_model.py b/statapp/models/input_values_model.py
index 6360eb4..40f19c1 100644
--- a/statapp/models/input_values_model.py
+++ b/statapp/models/input_values_model.py
@@ -33,3 +33,6 @@ class InputValuesModel(EditableTableModel):
def getY(self):
return self._data[:, 0]
+
+ def removeCol(self, index: int):
+ self.updateAllData(np.delete(self._data, index, axis=1))
diff --git a/statapp/ui/polynom_window.ui b/statapp/ui/polynom_window.ui
index 30f988e..0385254 100644
--- a/statapp/ui/polynom_window.ui
+++ b/statapp/ui/polynom_window.ui
@@ -124,10 +124,17 @@
График
-
+
-
+ -
+
+
+ Точки - отклик. Линия - прогноз
+
+
+
diff --git a/statapp/ui/ui_polynom_window.py b/statapp/ui/ui_polynom_window.py
index 494416c..31f3e73 100644
--- a/statapp/ui/ui_polynom_window.py
+++ b/statapp/ui/ui_polynom_window.py
@@ -126,6 +126,12 @@ class Ui_PolynomWindow(object):
self.gridLayout_5.addLayout(self.plotContainer, 0, 0, 1, 1)
+ self.label = QLabel(self.tab)
+ self.label.setObjectName(u"label")
+
+ self.gridLayout_5.addWidget(self.label, 1, 0, 1, 1)
+
+ self.gridLayout_5.setRowStretch(0, 1)
self.tabWidget.addTab(self.tab, "")
self.gridLayout_2.addWidget(self.tabWidget, 0, 6, 1, 1)
@@ -151,5 +157,6 @@ class Ui_PolynomWindow(object):
self.rSquaredValueLabel.setText(QCoreApplication.translate("PolynomWindow", u"undefined", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.model), QCoreApplication.translate("PolynomWindow", u"\u041c\u043e\u0434\u0435\u043b\u044c", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.prediction), QCoreApplication.translate("PolynomWindow", u"\u041f\u0440\u043e\u0433\u043d\u043e\u0437", None))
+ self.label.setText(QCoreApplication.translate("PolynomWindow", u"\u0422\u043e\u0447\u043a\u0438 - \u043e\u0442\u043a\u043b\u0438\u043a. \u041b\u0438\u043d\u0438\u044f - \u043f\u0440\u043e\u0433\u043d\u043e\u0437", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QCoreApplication.translate("PolynomWindow", u"\u0413\u0440\u0430\u0444\u0438\u043a", None))
# retranslateUi