fix: добавлены иконки во все окна (#67)

Closes #65

---------

Co-authored-by: Maxim Slipenko <no-reply@maxim.slipenko.com>
This commit is contained in:
MisterMLiL 2023-10-03 18:18:32 +03:00 committed by GitHub
parent 1d76b7cb76
commit 9310a5e622
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 38 additions and 9 deletions

View File

@ -18,7 +18,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import sys import sys
from PySide2.QtGui import QMovie
from PySide2.QtCore import QSize
from PySide2.QtGui import QMovie, QIcon
from PySide2.QtWidgets import QMainWindow from PySide2.QtWidgets import QMainWindow
from statapp.ui.ui_about_window import Ui_AboutWindow from statapp.ui.ui_about_window import Ui_AboutWindow
@ -47,3 +49,7 @@ class AboutWindow(QMainWindow):
version = importlib_metadata.version(__package__ or __name__) version = importlib_metadata.version(__package__ or __name__)
self.ui.versionLabel.setText(f"Версия: {version}") self.ui.versionLabel.setText(f"Версия: {version}")
icon = QIcon()
icon.addFile(resource_path("ui/images/logo.ico"), QSize(), QIcon.Normal, QIcon.Off)
self.setWindowIcon(icon)

View File

@ -17,11 +17,14 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from PySide2.QtCore import QSize
from PySide2.QtGui import QIcon
from PySide2.QtWidgets import QDialog, QHeaderView from PySide2.QtWidgets import QDialog, QHeaderView
from statapp.calculations import correlation_analysis from statapp.calculations import correlation_analysis
from statapp.models.correlation_analysis_model import CorrelationAnalysisModel from statapp.models.correlation_analysis_model import CorrelationAnalysisModel
from statapp.ui.ui_correlation_analysis_window import Ui_CorrelationAnalysisWindow from statapp.ui.ui_correlation_analysis_window import Ui_CorrelationAnalysisWindow
from statapp.utils import resource_path
class СorrelationAnalysisWindow(QDialog): class СorrelationAnalysisWindow(QDialog):
@ -35,3 +38,7 @@ class СorrelationAnalysisWindow(QDialog):
self.ui.tableView.setModel(self.model) self.ui.tableView.setModel(self.model)
header = self.ui.tableView.horizontalHeader() header = self.ui.tableView.horizontalHeader()
header.setSectionResizeMode(QHeaderView.ResizeMode.Stretch) header.setSectionResizeMode(QHeaderView.ResizeMode.Stretch)
icon = QIcon()
icon.addFile(resource_path("ui/images/logo.ico"), QSize(), QIcon.Normal, QIcon.Off)
self.setWindowIcon(icon)

View File

@ -17,12 +17,13 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from PySide2.QtCore import Slot from PySide2.QtCore import Slot, QSize
from PySide2.QtGui import QIcon
from PySide2.QtWidgets import QDialog from PySide2.QtWidgets import QDialog
from statapp.ui.ui_generate_factor_window import Ui_GenerateFactorWindow from statapp.ui.ui_generate_factor_window import Ui_GenerateFactorWindow
from statapp.models.combobox_model import ComboBoxModel from statapp.models.combobox_model import ComboBoxModel
from statapp.utils import resource_path
DIRECT_LINK = 0 DIRECT_LINK = 0
INDIRECT_LINK = 1 INDIRECT_LINK = 1
@ -43,6 +44,10 @@ class GenerateFactorWindow(QDialog):
self.ui.setupUi(self) self.ui.setupUi(self)
self.ui.typeComboBox.setModel(self._typeComboBox) self.ui.typeComboBox.setModel(self._typeComboBox)
icon = QIcon()
icon.addFile(resource_path("ui/images/logo.ico"), QSize(), QIcon.Normal, QIcon.Off)
self.setWindowIcon(icon)
@Slot() @Slot()
def on_generatePushButton_clicked(self): def on_generatePushButton_clicked(self):
self.typeConnection = self._typeComboBox.rawData(self.ui.typeComboBox.currentIndex())[0] self.typeConnection = self._typeComboBox.rawData(self.ui.typeComboBox.currentIndex())[0]

View File

@ -17,10 +17,12 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from PySide2.QtCore import Slot from PySide2.QtCore import Slot, QSize
from PySide2.QtGui import QIcon
from PySide2.QtWidgets import QDialog from PySide2.QtWidgets import QDialog
from statapp.ui.ui_generate_window import Ui_GenerateWindow from statapp.ui.ui_generate_window import Ui_GenerateWindow
from statapp.utils import resource_path
class GenerateWindow(QDialog): class GenerateWindow(QDialog):
@ -32,6 +34,11 @@ class GenerateWindow(QDialog):
self.ui = Ui_GenerateWindow() self.ui = Ui_GenerateWindow()
self.ui.setupUi(self) self.ui.setupUi(self)
icon = QIcon()
icon.addFile(resource_path("ui/images/logo.ico"), QSize(), QIcon.Normal, QIcon.Off)
self.setWindowIcon(icon)
@Slot() @Slot()
def on_generatePushButton_clicked(self): def on_generatePushButton_clicked(self):

View File

@ -43,6 +43,7 @@ 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.generateXaction.setEnabled(False)
self.ui.varianceAnalysisAction.setEnabled(False) self.ui.varianceAnalysisAction.setEnabled(False)
@ -110,6 +111,7 @@ class MainWindow(QMainWindow):
@Slot() @Slot()
def on_generateYaction_triggered(self): def on_generateYaction_triggered(self):
gw = GenerateWindow() gw = GenerateWindow()
if gw.exec(): if gw.exec():
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))
@ -136,11 +138,6 @@ class MainWindow(QMainWindow):
def on_aboutmenuaction_triggered(self): def on_aboutmenuaction_triggered(self):
global about_window global about_window
about_window = AboutWindow() about_window = AboutWindow()
icon = QIcon()
icon.addFile(resource_path("ui/images/logo.ico"), QSize(), QIcon.Normal, QIcon.Off)
about_window.setWindowIcon(icon)
about_window.show() about_window.show()
@Slot() @Slot()

View File

@ -17,11 +17,14 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from PySide2.QtCore import QSize
from PySide2.QtGui import QIcon
from PySide2.QtWidgets import QDialog, QHeaderView from PySide2.QtWidgets import QDialog, QHeaderView
from statapp.calculations import variance_analysis from statapp.calculations import variance_analysis
from statapp.models.variance_analysis_model import VarianceAnalysisModel from statapp.models.variance_analysis_model import VarianceAnalysisModel
from statapp.ui.ui_variance_analysis_window import Ui_VarianceAnalysisWindow from statapp.ui.ui_variance_analysis_window import Ui_VarianceAnalysisWindow
from statapp.utils import resource_path
class VarianceAnalysisWindow(QDialog): class VarianceAnalysisWindow(QDialog):
@ -35,3 +38,7 @@ class VarianceAnalysisWindow(QDialog):
self.ui.tableView.setModel(self.model) self.ui.tableView.setModel(self.model)
header = self.ui.tableView.horizontalHeader() header = self.ui.tableView.horizontalHeader()
header.setSectionResizeMode(QHeaderView.ResizeMode.Stretch) header.setSectionResizeMode(QHeaderView.ResizeMode.Stretch)
icon = QIcon()
icon.addFile(resource_path("ui/images/logo.ico"), QSize(), QIcon.Normal, QIcon.Off)
self.setWindowIcon(icon)