/
VolcanoByte
/
vbNotes
Обзор
Документация
Войти
/
VolcanoByte
/
vbNotes
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
sources/uGlobal.py
62 строки
3 KB
Eugene Gavrilyuk
Sync on start and finish
01 апр 2026, 15:32
01 апр 2026, 15:32
f2a8bd9
Код
Авторство
О чём код?
"""Глобальные переменные""" import sys import os from fnmatch import fnmatch from PyQt6.QtWidgets import QApplication from PyQt6.QtCore import QSettings, QTranslator, QCoreApplication as QA from uRecentFiles import RecentFiles from uConsts import StoreConsts, AppConsts, INI_FILE_NAME, ROOT_DIR app = QApplication(sys.argv) store = QSettings(INI_FILE_NAME, QSettings.Format.IniFormat) recentFiles = RecentFiles(store) translators = dict() for _file in os.scandir(os.path.join(ROOT_DIR, 'translations')): if fnmatch(_file.name, '*.qm'): _name = _file.name[:_file.name.find('.')].lower() _translator = QTranslator() if _translator.load(_file.path): translators[_name] = _translator _storeLanguage = store.value(StoreConsts.OptionsLanguage, AppConsts.DefaultLanguage) if _storeLanguage in translators.keys(): app.installTranslator(translators[_storeLanguage]) class MessageLanguageConsts: error = QA.translate('Message', 'Error') information = QA.translate('Message', 'Information') confirm = QA.translate('Message', 'Confirm') filterWatched = QA.translate('Message', 'Watched') filterUnwatched = QA.translate('Message', 'Unwatched') infoNotFound = QA.translate('Message', 'Note not found') changeConfirm = QA.translate('Message', 'The note has been edited. Save ' 'changes?') deleteRecentConfirm = QA.translate('Message', 'File not found. Remove it ' 'from recent list?') deleteConfirm = QA.translate('Message', 'Delete selected note(s)?') syncFormBackup = QA.translate('Message', 'There is a fresh copy on the ' 'server, do you want to ' 'synchronize the database?') syncFormLocal = QA.translate('Message', 'There is a fresh local copy,' 'do you want to synchronize the ' 'database?') placeTags = QA.translate('Message', "Type your tags") lastActive = QA.translate('Message', 'Last activity at %s') unknown = QA.translate('Message', 'unknown') statusBarCounter = QA.translate('Message', 'Notes: %d; Tags: %d') statusBarReady = QA.translate('Message', 'Ready') statusBarSyncFailed = QA.translate('Message', 'Synchronize failed: %s') original = QA.translate('Column', 'Original') optionsFormTitle = QA.translate('caption', 'Options') syncYoungerDB = QA.translate('Message', 'Synchronize: local -> remote') syncYoungerBackup = QA.translate('Message', 'Synchronize: remote -> local') syncIdentical = QA.translate('Message', 'Synchronize: local = remote')