mirror of
https://github.com/shizand/statapp.git
synced 2024-12-23 20:22:58 +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',
|
|
||||||
)
|
|
50
statapp.spec
50
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,9 +40,46 @@ 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:
|
||||||
|
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',
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
exe = EXE(
|
||||||
pyz,
|
pyz,
|
||||||
a.scripts,
|
a.scripts,
|
||||||
[],
|
[],
|
||||||
@ -54,8 +96,8 @@ exe = EXE(
|
|||||||
codesign_identity=None,
|
codesign_identity=None,
|
||||||
entitlements_file=None,
|
entitlements_file=None,
|
||||||
icon='statapp/ui/images/logo.ico',
|
icon='statapp/ui/images/logo.ico',
|
||||||
)
|
)
|
||||||
coll = COLLECT(
|
coll = COLLECT(
|
||||||
exe,
|
exe,
|
||||||
a.binaries,
|
a.binaries,
|
||||||
a.datas,
|
a.datas,
|
||||||
@ -63,4 +105,4 @@ coll = COLLECT(
|
|||||||
upx=True,
|
upx=True,
|
||||||
upx_exclude=[],
|
upx_exclude=[],
|
||||||
name='statapp',
|
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