fix: добавляет иконку приложения (#39)

Closes #38.

---------

Co-authored-by: MisterMLiL <eugenelazurenko@gmail.com>
This commit is contained in:
Maxim Slipenko 2023-09-29 12:13:24 +03:00 committed by GitHub
parent d71bd9843f
commit d3cd3589a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 12 additions and 7 deletions

View File

@ -12,7 +12,7 @@ if typing.TYPE_CHECKING:
from PyInstaller.utils.hooks import copy_metadata from PyInstaller.utils.hooks import copy_metadata
datas = [('statapp/images/sticker.gif', 'images')] datas = [('statapp/ui/images/*', 'ui/images')]
datas += copy_metadata('statapp') datas += copy_metadata('statapp')
a = Analysis( a = Analysis(
@ -55,4 +55,5 @@ exe = EXE(
target_arch=None, target_arch=None,
codesign_identity=None, codesign_identity=None,
entitlements_file=None, entitlements_file=None,
icon='statapp/ui/images/logo.ico',
) )

View File

@ -12,7 +12,7 @@ if typing.TYPE_CHECKING:
from PyInstaller.utils.hooks import copy_metadata from PyInstaller.utils.hooks import copy_metadata
datas = [('statapp/images/sticker.gif', 'images')] datas = [('statapp/ui/images/*', 'ui/images')]
datas += copy_metadata('statapp') datas += copy_metadata('statapp')
@ -53,6 +53,7 @@ exe = EXE(
target_arch=None, target_arch=None,
codesign_identity=None, codesign_identity=None,
entitlements_file=None, entitlements_file=None,
icon='statapp/ui/images/logo.ico',
) )
coll = COLLECT( coll = COLLECT(
exe, exe,

View File

@ -19,7 +19,7 @@ class AboutWindow(QMainWindow):
self.ui = Ui_AboutWindow() self.ui = Ui_AboutWindow()
self.ui.setupUi(self) self.ui.setupUi(self)
image_path = resource_path('images/sticker.gif') image_path = resource_path('ui/images/sticker.gif')
movie = QMovie(image_path) movie = QMovie(image_path)
self.ui.labelgif.setMovie(movie) self.ui.labelgif.setMovie(movie)
movie.start() movie.start()

View File

@ -1,5 +1,6 @@
import numpy as np import numpy as np
from PySide2.QtCore import Slot, QLocale from PySide2.QtCore import Slot, QLocale, QSize
from PySide2.QtGui import QIcon
from PySide2.QtWidgets import QMainWindow, QMessageBox, QApplication from PySide2.QtWidgets import QMainWindow, QMessageBox, QApplication
from statapp.generate_factor_window import GenerateFactorWindow, INDIRECT_LINK from statapp.generate_factor_window import GenerateFactorWindow, INDIRECT_LINK
@ -8,6 +9,7 @@ from statapp.generate_window import GenerateWindow
from statapp.about_window import AboutWindow from statapp.about_window import AboutWindow
from statapp.models.fileslc_model import FileSLCModel from statapp.models.fileslc_model import FileSLCModel
from statapp.ui.ui_main_window import Ui_MainWindow from statapp.ui.ui_main_window import Ui_MainWindow
from statapp.utils import resource_path
class MainWindow(QMainWindow): class MainWindow(QMainWindow):
@ -17,6 +19,10 @@ class MainWindow(QMainWindow):
self.ui = Ui_MainWindow() self.ui = Ui_MainWindow()
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)
self.isDataChanged = False self.isDataChanged = False
self.model = DataModel() self.model = DataModel()
self.fileModel = FileSLCModel() self.fileModel = FileSLCModel()

BIN
statapp/ui/images/logo.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 MiB

After

Width:  |  Height:  |  Size: 2.9 MiB

View File

@ -112,6 +112,5 @@
</property> </property>
</action> </action>
</widget> </widget>
<resources/>
<connections/> <connections/>
</ui> </ui>

View File

@ -12,7 +12,6 @@ from PySide2.QtCore import *
from PySide2.QtGui import * from PySide2.QtGui import *
from PySide2.QtWidgets import * from PySide2.QtWidgets import *
class Ui_MainWindow(object): class Ui_MainWindow(object):
def setupUi(self, MainWindow): def setupUi(self, MainWindow):
if not MainWindow.objectName(): if not MainWindow.objectName():
@ -97,4 +96,3 @@ class Ui_MainWindow(object):
self.modelmenu.setTitle(QCoreApplication.translate("MainWindow", u"\u041c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435", None)) self.modelmenu.setTitle(QCoreApplication.translate("MainWindow", u"\u041c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435", None))
self.helpmenu.setTitle(QCoreApplication.translate("MainWindow", u"\u0421\u043f\u0440\u0430\u0432\u043a\u0430", None)) self.helpmenu.setTitle(QCoreApplication.translate("MainWindow", u"\u0421\u043f\u0440\u0430\u0432\u043a\u0430", None))
# retranslateUi # retranslateUi