mirror of
https://github.com/shizand/statapp.git
synced 2024-12-23 12:12:59 +03:00
fix: добавлены переводы для QMessageBox (#73)
This commit is contained in:
parent
a89d7896e3
commit
e653c3df29
3
.github/workflows/release.yml
vendored
3
.github/workflows/release.yml
vendored
@ -47,7 +47,8 @@ jobs:
|
|||||||
- name: Установка зависимостей
|
- name: Установка зависимостей
|
||||||
run: poetry install
|
run: poetry install
|
||||||
- name: Сборка
|
- name: Сборка
|
||||||
run: poetry run pyinstaller ${{ matrix.spec }}.spec\
|
if:
|
||||||
|
run: pyinstaller statapp.spec -- ${{ matrix.spec == 'statapp-onefile' && '--one-file' || '' }}
|
||||||
- name: Архивация
|
- name: Архивация
|
||||||
uses: thedoctor0/zip-release@0.7.1
|
uses: thedoctor0/zip-release@0.7.1
|
||||||
with:
|
with:
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
|
<component name="Black">
|
||||||
|
<option name="sdkName" value="Poetry (statapp)" />
|
||||||
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Poetry (statapp)" project-jdk-type="Python SDK" />
|
<component name="ProjectRootManager" version="2" project-jdk-name="Poetry (statapp)" project-jdk-type="Python SDK" />
|
||||||
</project>
|
</project>
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
poetry install
|
poetry install
|
||||||
poetry run pyinstaller statapp.spec # или poetry run pyinstaller stat-onefile.spec
|
pyinstaller statapp.spec # или pyinstaller statapp.spec -- --one-file
|
||||||
```
|
```
|
||||||
|
|
||||||
## Использование
|
## Использование
|
||||||
|
@ -1,59 +0,0 @@
|
|||||||
# -*- mode: python ; coding: utf-8 -*-
|
|
||||||
import sys
|
|
||||||
import typing
|
|
||||||
from pprint import pprint
|
|
||||||
|
|
||||||
if typing.TYPE_CHECKING:
|
|
||||||
from PyInstaller.building.api import COLLECT, EXE, MERGE, PYZ # noqa: F401
|
|
||||||
from PyInstaller.building.build_main import Analysis # noqa: F401
|
|
||||||
from PyInstaller.building.datastruct import TOC, Target, Tree # noqa: F401
|
|
||||||
from PyInstaller.building.osx import BUNDLE # noqa: F401
|
|
||||||
from PyInstaller.building.splash import Splash # noqa: F401
|
|
||||||
|
|
||||||
from PyInstaller.utils.hooks import copy_metadata
|
|
||||||
|
|
||||||
datas = [('statapp/ui/images/*', 'ui/images')]
|
|
||||||
datas += copy_metadata('statapp')
|
|
||||||
|
|
||||||
a = Analysis(
|
|
||||||
['statapp/__main__.py'],
|
|
||||||
pathex=[],
|
|
||||||
binaries=[],
|
|
||||||
datas=datas,
|
|
||||||
hiddenimports=[],
|
|
||||||
hookspath=[],
|
|
||||||
hooksconfig={},
|
|
||||||
runtime_hooks=[],
|
|
||||||
excludes=[],
|
|
||||||
noarchive=False,
|
|
||||||
)
|
|
||||||
|
|
||||||
prev_binaries = set(a.binaries)
|
|
||||||
if sys.platform in ('linux', 'darwin'):
|
|
||||||
a.exclude_system_libraries(list_of_exceptions=[]) # glob expression
|
|
||||||
print('\n\nSTRIPPED SYSTEM LIBS')
|
|
||||||
pprint(sorted(set(prev_binaries) - set(a.binaries)))
|
|
||||||
|
|
||||||
pyz = PYZ(a.pure)
|
|
||||||
|
|
||||||
exe = EXE(
|
|
||||||
pyz,
|
|
||||||
a.scripts,
|
|
||||||
a.binaries,
|
|
||||||
a.datas,
|
|
||||||
[],
|
|
||||||
name='statapp',
|
|
||||||
debug=False,
|
|
||||||
bootloader_ignore_signals=False,
|
|
||||||
strip=False,
|
|
||||||
upx=True,
|
|
||||||
upx_exclude=[],
|
|
||||||
runtime_tmpdir=None,
|
|
||||||
console=False,
|
|
||||||
disable_windowed_traceback=False,
|
|
||||||
argv_emulation=False,
|
|
||||||
target_arch=None,
|
|
||||||
codesign_identity=None,
|
|
||||||
entitlements_file=None,
|
|
||||||
icon='statapp/ui/images/logo.ico',
|
|
||||||
)
|
|
96
statapp.spec
96
statapp.spec
@ -1,4 +1,5 @@
|
|||||||
# -*- mode: python ; coding: utf-8 -*-
|
# -*- mode: python ; coding: utf-8 -*-
|
||||||
|
import argparse
|
||||||
import sys
|
import sys
|
||||||
import typing
|
import typing
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
@ -12,6 +13,10 @@ if typing.TYPE_CHECKING:
|
|||||||
|
|
||||||
from PyInstaller.utils.hooks import copy_metadata
|
from PyInstaller.utils.hooks import copy_metadata
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument("--one-file", action="store_true")
|
||||||
|
options = parser.parse_args()
|
||||||
|
|
||||||
datas = [('statapp/ui/images/*', 'ui/images')]
|
datas = [('statapp/ui/images/*', 'ui/images')]
|
||||||
datas += copy_metadata('statapp')
|
datas += copy_metadata('statapp')
|
||||||
|
|
||||||
@ -35,32 +40,69 @@ if sys.platform in ('linux', 'darwin'):
|
|||||||
print('\n\nSTRIPPED SYSTEM LIBS')
|
print('\n\nSTRIPPED SYSTEM LIBS')
|
||||||
pprint(sorted(set(prev_binaries) - set(a.binaries)))
|
pprint(sorted(set(prev_binaries) - set(a.binaries)))
|
||||||
|
|
||||||
|
LOCALES = ['ru', 'en']
|
||||||
|
def remove_unused_translation(item):
|
||||||
|
dest = str(item[0])
|
||||||
|
if not dest.startswith('PySide2/Qt/translations'):
|
||||||
|
return True
|
||||||
|
|
||||||
|
for l in LOCALES:
|
||||||
|
if l in dest:
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
|
a.datas = list(filter(remove_unused_translation, a.datas))
|
||||||
|
|
||||||
pyz = PYZ(a.pure)
|
pyz = PYZ(a.pure)
|
||||||
|
|
||||||
exe = EXE(
|
if options.one_file:
|
||||||
pyz,
|
exe = EXE(
|
||||||
a.scripts,
|
pyz,
|
||||||
[],
|
a.scripts,
|
||||||
exclude_binaries=True,
|
a.binaries,
|
||||||
name='statapp',
|
a.datas,
|
||||||
debug=False,
|
[],
|
||||||
bootloader_ignore_signals=False,
|
name='statapp',
|
||||||
strip=False,
|
debug=False,
|
||||||
upx=True,
|
bootloader_ignore_signals=False,
|
||||||
console=False,
|
strip=False,
|
||||||
disable_windowed_traceback=False,
|
upx=True,
|
||||||
argv_emulation=False,
|
upx_exclude=[],
|
||||||
target_arch=None,
|
runtime_tmpdir=None,
|
||||||
codesign_identity=None,
|
console=False,
|
||||||
entitlements_file=None,
|
disable_windowed_traceback=False,
|
||||||
icon='statapp/ui/images/logo.ico',
|
argv_emulation=False,
|
||||||
)
|
target_arch=None,
|
||||||
coll = COLLECT(
|
codesign_identity=None,
|
||||||
exe,
|
entitlements_file=None,
|
||||||
a.binaries,
|
icon='statapp/ui/images/logo.ico',
|
||||||
a.datas,
|
)
|
||||||
strip=False,
|
else:
|
||||||
upx=True,
|
exe = EXE(
|
||||||
upx_exclude=[],
|
pyz,
|
||||||
name='statapp',
|
a.scripts,
|
||||||
)
|
[],
|
||||||
|
exclude_binaries=True,
|
||||||
|
name='statapp',
|
||||||
|
debug=False,
|
||||||
|
bootloader_ignore_signals=False,
|
||||||
|
strip=False,
|
||||||
|
upx=True,
|
||||||
|
console=False,
|
||||||
|
disable_windowed_traceback=False,
|
||||||
|
argv_emulation=False,
|
||||||
|
target_arch=None,
|
||||||
|
codesign_identity=None,
|
||||||
|
entitlements_file=None,
|
||||||
|
icon='statapp/ui/images/logo.ico',
|
||||||
|
)
|
||||||
|
coll = COLLECT(
|
||||||
|
exe,
|
||||||
|
a.binaries,
|
||||||
|
a.datas,
|
||||||
|
strip=False,
|
||||||
|
upx=True,
|
||||||
|
upx_exclude=[],
|
||||||
|
name='statapp',
|
||||||
|
)
|
||||||
|
@ -32,6 +32,7 @@ def main():
|
|||||||
locale = QtCore.QLocale.system().name()
|
locale = QtCore.QLocale.system().name()
|
||||||
path = QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.TranslationsPath)
|
path = QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.TranslationsPath)
|
||||||
translator.load(f'qt_{locale}', path)
|
translator.load(f'qt_{locale}', path)
|
||||||
|
translator.load(f'qtbase_{locale}', path)
|
||||||
app.installTranslator(translator)
|
app.installTranslator(translator)
|
||||||
|
|
||||||
window = MainWindow()
|
window = MainWindow()
|
||||||
|
Loading…
Reference in New Issue
Block a user