mirror of
https://github.com/shizand/statapp.git
synced 2024-12-23 12:12:59 +03:00
parent
fbf359e515
commit
15825c2200
@ -1,7 +1,7 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
from PySide2.QtCore import Slot, QSize
|
from PySide2.QtCore import Slot, QSize
|
||||||
from PySide2.QtGui import QIcon
|
from PySide2.QtGui import QIcon
|
||||||
from PySide2.QtWidgets import QMainWindow, QMessageBox
|
from PySide2.QtWidgets import QMainWindow, QMessageBox, QAction
|
||||||
|
|
||||||
from statapp.calculations import generate_x_values
|
from statapp.calculations import generate_x_values
|
||||||
from statapp.generate_factor_window import GenerateFactorWindow
|
from statapp.generate_factor_window import GenerateFactorWindow
|
||||||
@ -24,7 +24,10 @@ class MainWindow(QMainWindow):
|
|||||||
|
|
||||||
icon = QIcon()
|
icon = QIcon()
|
||||||
icon.addFile(resource_path("ui/images/logo.ico"), QSize(), QIcon.Normal, QIcon.Off)
|
icon.addFile(resource_path("ui/images/logo.ico"), QSize(), QIcon.Normal, QIcon.Off)
|
||||||
self.setWindowIcon(icon)
|
|
||||||
|
self.ui.generateXaction.setEnabled(False)
|
||||||
|
self.ui.varianceAnalysisAction.setEnabled(False)
|
||||||
|
self.ui.correlationAnalisisAction.setEnabled(False)
|
||||||
|
|
||||||
self.isDataChanged = False
|
self.isDataChanged = False
|
||||||
self.model = InputValuesModel()
|
self.model = InputValuesModel()
|
||||||
@ -34,6 +37,7 @@ class MainWindow(QMainWindow):
|
|||||||
@Slot()
|
@Slot()
|
||||||
def on_openfileaction_triggered(self):
|
def on_openfileaction_triggered(self):
|
||||||
current_data = self.model.getData()
|
current_data = self.model.getData()
|
||||||
|
data = np.array([])
|
||||||
if current_data.size > 1:
|
if current_data.size > 1:
|
||||||
file = ''
|
file = ''
|
||||||
if self.fileModel.file_name:
|
if self.fileModel.file_name:
|
||||||
@ -53,15 +57,28 @@ class MainWindow(QMainWindow):
|
|||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
data = self.fileModel.loadFile()
|
data = self.fileModel.loadFile()
|
||||||
if data is not None:
|
if data is not None and data.shape[0] > 0:
|
||||||
self.model.updateAllData(data)
|
self.model.updateAllData(data)
|
||||||
self.isDataChanged = False
|
self.isDataChanged = False
|
||||||
else:
|
else:
|
||||||
data = self.fileModel.loadFile()
|
data = self.fileModel.loadFile()
|
||||||
if data is not None:
|
if data is not None and data.shape[0] > 0:
|
||||||
self.model.updateAllData(data)
|
self.model.updateAllData(data)
|
||||||
self.isDataChanged = False
|
self.isDataChanged = False
|
||||||
|
|
||||||
|
if data.shape[1] == 1:
|
||||||
|
self.ui.generateXaction.setEnabled(True)
|
||||||
|
self.ui.varianceAnalysisAction.setEnabled(False)
|
||||||
|
self.ui.correlationAnalisisAction.setEnabled(False)
|
||||||
|
elif data.shape[1] > 1:
|
||||||
|
self.ui.generateXaction.setEnabled(True)
|
||||||
|
self.ui.varianceAnalysisAction.setEnabled(True)
|
||||||
|
self.ui.correlationAnalisisAction.setEnabled(True)
|
||||||
|
else:
|
||||||
|
self.ui.generateXaction.setEnabled(False)
|
||||||
|
self.ui.varianceAnalysisAction.setEnabled(False)
|
||||||
|
self.ui.correlationAnalisisAction.setEnabled(False)
|
||||||
|
|
||||||
@Slot()
|
@Slot()
|
||||||
def on_savefileaction_triggered(self):
|
def on_savefileaction_triggered(self):
|
||||||
self.isDataChanged = not self.fileModel.saveFile(self.model.getData())
|
self.isDataChanged = not self.fileModel.saveFile(self.model.getData())
|
||||||
@ -78,6 +95,7 @@ class MainWindow(QMainWindow):
|
|||||||
y = np.random.normal(gw.mat, gw.deviation, size=(gw.count, 1))
|
y = np.random.normal(gw.mat, gw.deviation, size=(gw.count, 1))
|
||||||
self.model.updateAllData(y.round(2))
|
self.model.updateAllData(y.round(2))
|
||||||
self.isDataChanged = True
|
self.isDataChanged = True
|
||||||
|
self.generateXaction_action.setEnabled(True)
|
||||||
|
|
||||||
@Slot()
|
@Slot()
|
||||||
def on_generateXaction_triggered(self):
|
def on_generateXaction_triggered(self):
|
||||||
@ -91,6 +109,8 @@ class MainWindow(QMainWindow):
|
|||||||
# dd = dd.reshape(len(dd), 1)
|
# dd = dd.reshape(len(dd), 1)
|
||||||
data = np.concatenate((data, x_arr), axis=1)
|
data = np.concatenate((data, x_arr), axis=1)
|
||||||
self.model.updateAllData(data)
|
self.model.updateAllData(data)
|
||||||
|
self.varianceAnalysisAction_action.setEnabled(True)
|
||||||
|
self.correlationAnalisisAction_action.setEnabled(True)
|
||||||
self.isDataChanged = True
|
self.isDataChanged = True
|
||||||
|
|
||||||
@Slot()
|
@Slot()
|
||||||
|
Loading…
Reference in New Issue
Block a user