From 56e5c5049fe33a56efb7c6036572845663345587 Mon Sep 17 00:00:00 2001 From: yfprojects <62463991+real-yfprojects@users.noreply.github.com> Date: Wed, 25 May 2022 15:42:54 +0000 Subject: [PATCH] Remove call to `QTranslator.language()` in `get_locale`. (#1316) --- src/vorta/i18n/__init__.py | 7 +++++-- tests/test_schedule.py | 8 +++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/vorta/i18n/__init__.py b/src/vorta/i18n/__init__.py index d527b1d9..cd52c882 100644 --- a/src/vorta/i18n/__init__.py +++ b/src/vorta/i18n/__init__.py @@ -71,8 +71,11 @@ def init_translations(app): def get_locale(): """Get the locale used for translation.""" - global translator - return QLocale(translator.language()) + # global translator + # QTranslator.language was added with Qt 15.15 + # return QLocale(translator.language()) + global locale + return locale def translate(*args, **kwargs): diff --git a/tests/test_schedule.py b/tests/test_schedule.py index de0d71a9..2c1ddf3e 100644 --- a/tests/test_schedule.py +++ b/tests/test_schedule.py @@ -68,5 +68,11 @@ def test_schedule_tab(qapp: VortaApp, qtbot, clockmock): qapp.scheduler.set_timer_for_profile(profile.id) tab.draw_next_scheduled_backup() - assert next_backup.strftime('%B %Y %H:%M:%S') in tab.nextBackupDateTimeLabel.text() + + assert tab.nextBackupDateTimeLabel.text() not in [ + "Run a manual backup first", + "None scheduled", + ] + assert qapp.scheduler.next_job_for_profile(profile.id).time == next_backup + qapp.scheduler.remove_job(profile.id)