Fixed translation for application names
This commit is contained in:
parent
46952ebad2
commit
b4cb9303bc
@ -85,7 +85,8 @@ class AppmenuSelectManager:
|
|||||||
p.communicate('\n'.join(new_whitelisted).encode())
|
p.communicate('\n'.join(new_whitelisted).encode())
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
exception_text = QtCore.QCoreApplication.translate(
|
exception_text = QtCore.QCoreApplication.translate(
|
||||||
"exception", 'qvm-appmenus --set-whitelist failed')
|
"Command {command} failed", "exception").format(
|
||||||
|
command='qvm-appmenus --set-whitelist')
|
||||||
raise RuntimeError(exception_text)
|
raise RuntimeError(exception_text)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
@ -24,7 +24,7 @@ import signal
|
|||||||
from qubesadmin import exc
|
from qubesadmin import exc
|
||||||
from qubesadmin import utils as admin_utils
|
from qubesadmin import utils as admin_utils
|
||||||
|
|
||||||
from PyQt5 import QtCore, QtWidgets # pylint: disable=import-error
|
from PyQt5 import QtCore, QtWidgets, QtGui # pylint: disable=import-error
|
||||||
from . import ui_backupdlg # pylint: disable=no-name-in-module
|
from . import ui_backupdlg # pylint: disable=no-name-in-module
|
||||||
from . import multiselectwidget
|
from . import multiselectwidget
|
||||||
|
|
||||||
@ -121,6 +121,10 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, QtWidgets.QWizard):
|
|||||||
self.dispatcher = dispatcher
|
self.dispatcher = dispatcher
|
||||||
dispatcher.add_handler('backup-progress', self.on_backup_progress)
|
dispatcher.add_handler('backup-progress', self.on_backup_progress)
|
||||||
|
|
||||||
|
def setup_application(self):
|
||||||
|
self.qt_app.setApplicationName(self.tr("Qubes Backup VMs"))
|
||||||
|
self.qt_app.setWindowIcon(QtGui.QIcon.fromTheme("qubes-manager"))
|
||||||
|
|
||||||
def on_backup_progress(self, __submitter, _event, **kwargs):
|
def on_backup_progress(self, __submitter, _event, **kwargs):
|
||||||
self.progress_bar.setValue(int(float(kwargs['progress'])))
|
self.progress_bar.setValue(int(float(kwargs['progress'])))
|
||||||
|
|
||||||
@ -391,10 +395,7 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, QtWidgets.QWizard):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
utils.run_asynchronous(
|
utils.run_asynchronous(BackupVMsWindow)
|
||||||
QtCore.QCoreApplication.translate("appname", "Qubes Backup VMs"),
|
|
||||||
"qubes-manager",
|
|
||||||
BackupVMsWindow)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -21,7 +21,7 @@ import functools
|
|||||||
import subprocess
|
import subprocess
|
||||||
from . import utils
|
from . import utils
|
||||||
from . import ui_bootfromdevice # pylint: disable=no-name-in-module
|
from . import ui_bootfromdevice # pylint: disable=no-name-in-module
|
||||||
from PyQt5 import QtWidgets, QtCore # pylint: disable=import-error
|
from PyQt5 import QtWidgets, QtGui # pylint: disable=import-error
|
||||||
from qubesadmin import tools
|
from qubesadmin import tools
|
||||||
from qubesadmin.tools import qvm_start
|
from qubesadmin.tools import qvm_start
|
||||||
|
|
||||||
@ -47,6 +47,10 @@ class VMBootFromDeviceWindow(ui_bootfromdevice.Ui_BootDialog,
|
|||||||
# warn user if the VM is currently running
|
# warn user if the VM is currently running
|
||||||
self.__warn_if_running__()
|
self.__warn_if_running__()
|
||||||
|
|
||||||
|
def setup_application(self):
|
||||||
|
self.qapp.setApplicationName(self.tr("Boot Qube From Device"))
|
||||||
|
self.qapp.setWindowIcon(QtGui.QIcon.fromTheme("qubes-manager"))
|
||||||
|
|
||||||
def reject(self):
|
def reject(self):
|
||||||
self.done(0)
|
self.done(0)
|
||||||
|
|
||||||
@ -148,9 +152,7 @@ def main(args=None):
|
|||||||
args = parser.parse_args(args)
|
args = parser.parse_args(args)
|
||||||
vm = args.domains.pop()
|
vm = args.domains.pop()
|
||||||
|
|
||||||
utils.run_synchronous(
|
utils.run_synchronous(functools.partial(VMBootFromDeviceWindow, vm))
|
||||||
QtCore.QCoreApplication.translate("appname", "Boot Qube From Device"),
|
|
||||||
functools.partial(VMBootFromDeviceWindow, vm))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -275,6 +275,7 @@ def main(args=None):
|
|||||||
'i18n')
|
'i18n')
|
||||||
translator.load("qubesmanager_{!s}.qm".format(locale), i18n_dir)
|
translator.load("qubesmanager_{!s}.qm".format(locale), i18n_dir)
|
||||||
qtapp.installTranslator(translator)
|
qtapp.installTranslator(translator)
|
||||||
|
QtCore.QCoreApplication.installTranslator(translator)
|
||||||
|
|
||||||
qtapp.setOrganizationName('Invisible Things Lab')
|
qtapp.setOrganizationName('Invisible Things Lab')
|
||||||
qtapp.setOrganizationDomain('https://www.qubes-os.org/')
|
qtapp.setOrganizationDomain('https://www.qubes-os.org/')
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
from PyQt5 import QtWidgets, QtCore # pylint: disable=import-error
|
from PyQt5 import QtWidgets, QtCore, QtGui # pylint: disable=import-error
|
||||||
|
|
||||||
from qubesadmin.utils import parse_size
|
from qubesadmin.utils import parse_size
|
||||||
|
|
||||||
@ -75,6 +75,10 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
|
|||||||
self.__init_mem_defaults__()
|
self.__init_mem_defaults__()
|
||||||
self.__init_updates__()
|
self.__init_updates__()
|
||||||
|
|
||||||
|
def setup_application(self):
|
||||||
|
self.qt_app.setApplicationName(self.tr("Qubes Global Settings"))
|
||||||
|
self.qt_app.setWindowIcon(QtGui.QIcon.fromTheme("qubes-manager"))
|
||||||
|
|
||||||
def __init_system_defaults__(self):
|
def __init_system_defaults__(self):
|
||||||
# set up updatevm choice
|
# set up updatevm choice
|
||||||
self.update_vm_vmlist, self.update_vm_idx = utils.prepare_vm_choice(
|
self.update_vm_vmlist, self.update_vm_idx = utils.prepare_vm_choice(
|
||||||
@ -408,9 +412,7 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
utils.run_synchronous(
|
utils.run_synchronous(GlobalSettingsWindow)
|
||||||
QtCore.QCoreApplication.translate("appname", "Qubes Global Settings"),
|
|
||||||
GlobalSettingsWindow)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -520,6 +520,11 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtWidgets.QMainWindow):
|
|||||||
# correctly initialized
|
# correctly initialized
|
||||||
self.table.selectRow(0)
|
self.table.selectRow(0)
|
||||||
|
|
||||||
|
def setup_application(self):
|
||||||
|
self.qt_app.setApplicationName(self.tr("Qube Manager"))
|
||||||
|
self.qt_app.setWindowIcon(QtGui.QIcon.fromTheme("qubes-manager"))
|
||||||
|
|
||||||
|
|
||||||
def keyPressEvent(self, event): # pylint: disable=invalid-name
|
def keyPressEvent(self, event): # pylint: disable=invalid-name
|
||||||
if event.key() == QtCore.Qt.Key_Escape:
|
if event.key() == QtCore.Qt.Key_Escape:
|
||||||
self.searchbox.clear()
|
self.searchbox.clear()
|
||||||
@ -1300,10 +1305,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtWidgets.QMainWindow):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
manager_utils.run_asynchronous(
|
manager_utils.run_asynchronous(VmManagerWindow)
|
||||||
QtCore.QCoreApplication.translate("appname", "Qube Manager"),
|
|
||||||
"qubes-manager",
|
|
||||||
VmManagerWindow)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
from PyQt5 import QtCore, QtWidgets # pylint: disable=import-error
|
from PyQt5 import QtCore, QtWidgets, QtGui # pylint: disable=import-error
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import logging
|
import logging
|
||||||
@ -110,6 +110,10 @@ class RestoreVMsWindow(ui_restoredlg.Ui_Restore, QtWidgets.QWizard):
|
|||||||
|
|
||||||
backup_utils.fill_appvms_list(self)
|
backup_utils.fill_appvms_list(self)
|
||||||
|
|
||||||
|
def setup_application(self):
|
||||||
|
self.qt_app.setApplicationName(self.tr("Qubes Restore VMs"))
|
||||||
|
self.qt_app.setWindowIcon(QtGui.QIcon.fromTheme("qubes-manager"))
|
||||||
|
|
||||||
@QtCore.pyqtSlot(name='on_select_path_button_clicked')
|
@QtCore.pyqtSlot(name='on_select_path_button_clicked')
|
||||||
def select_path_button_clicked(self):
|
def select_path_button_clicked(self):
|
||||||
backup_utils.select_path_button_clicked(self, True)
|
backup_utils.select_path_button_clicked(self, True)
|
||||||
@ -290,9 +294,7 @@ class RestoreVMsWindow(ui_restoredlg.Ui_Restore, QtWidgets.QWizard):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
utils.run_synchronous(
|
utils.run_synchronous(RestoreVMsWindow)
|
||||||
QtCore.QCoreApplication.translate("appname", "Qubes Restore VMs"),
|
|
||||||
RestoreVMsWindow)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -222,6 +222,10 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtWidgets.QDialog):
|
|||||||
self.refresh_apps_button.clicked.connect(
|
self.refresh_apps_button.clicked.connect(
|
||||||
self.refresh_apps_button_pressed)
|
self.refresh_apps_button_pressed)
|
||||||
|
|
||||||
|
def setup_application(self):
|
||||||
|
self.qt_app.setApplicationName(self.tr("Qube Settings"))
|
||||||
|
self.qt_app.setWindowIcon(QtGui.QIcon.fromTheme("qubes-manager"))
|
||||||
|
|
||||||
def clear_threads(self):
|
def clear_threads(self):
|
||||||
for thread in self.threads_list:
|
for thread in self.threads_list:
|
||||||
if thread.isFinished():
|
if thread.isFinished():
|
||||||
@ -1211,9 +1215,7 @@ def main(args=None):
|
|||||||
args = parser.parse_args(args)
|
args = parser.parse_args(args)
|
||||||
vm = args.domains.pop()
|
vm = args.domains.pop()
|
||||||
|
|
||||||
utils.run_synchronous(
|
utils.run_synchronous(functools.partial(VMSettingsWindow, vm, args.tab))
|
||||||
QtCore.QCoreApplication.translate("appname", "Qube Settings"),
|
|
||||||
functools.partial(VMSettingsWindow, vm, args.tab))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -62,6 +62,10 @@ class TemplateManagerWindow(
|
|||||||
|
|
||||||
self.vm_list.show()
|
self.vm_list.show()
|
||||||
|
|
||||||
|
def setup_application(self):
|
||||||
|
self.qt_app.setApplicationName(self.tr("Template Manager"))
|
||||||
|
self.qt_app.setWindowIcon(QtGui.QIcon.fromTheme("qubes-manager"))
|
||||||
|
|
||||||
def prepare_lists(self):
|
def prepare_lists(self):
|
||||||
self.templates = [vm.name for vm in self.qubes_app.domains
|
self.templates = [vm.name for vm in self.qubes_app.domains
|
||||||
if vm.klass == 'TemplateVM']
|
if vm.klass == 'TemplateVM']
|
||||||
@ -259,7 +263,8 @@ class StatusItem(QtWidgets.QTableWidgetItem):
|
|||||||
|
|
||||||
if self.state:
|
if self.state:
|
||||||
self.setIcon(QtGui.QIcon.fromTheme('dialog-warning'))
|
self.setIcon(QtGui.QIcon.fromTheme('dialog-warning'))
|
||||||
self.setToolTip(self.tr("Cannot change template on a running VM."))
|
self.setToolTip(QtCore.QCoreApplication.translate(
|
||||||
|
"template-manager", "Cannot change template on a running VM."))
|
||||||
else:
|
else:
|
||||||
self.setIcon(QtGui.QIcon())
|
self.setIcon(QtGui.QIcon())
|
||||||
self.setToolTip("")
|
self.setToolTip("")
|
||||||
@ -381,10 +386,7 @@ class VMRow:
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
utils.run_asynchronous(
|
utils.run_asynchronous(TemplateManagerWindow)
|
||||||
QtCore.QCoreApplication.translate("appname", "Template Manager"),
|
|
||||||
"qubes-manager",
|
|
||||||
TemplateManagerWindow)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -268,7 +268,7 @@ def handle_exception(exc_type, exc_value, exc_traceback):
|
|||||||
msg_box.exec_()
|
msg_box.exec_()
|
||||||
|
|
||||||
|
|
||||||
def run_asynchronous(app_name, icon_name, window_class):
|
def run_asynchronous(window_class):
|
||||||
qt_app = QtWidgets.QApplication(sys.argv)
|
qt_app = QtWidgets.QApplication(sys.argv)
|
||||||
|
|
||||||
translator = QtCore.QTranslator(qt_app)
|
translator = QtCore.QTranslator(qt_app)
|
||||||
@ -278,11 +278,10 @@ def run_asynchronous(app_name, icon_name, window_class):
|
|||||||
'i18n')
|
'i18n')
|
||||||
translator.load("qubesmanager_{!s}.qm".format(locale), i18n_dir)
|
translator.load("qubesmanager_{!s}.qm".format(locale), i18n_dir)
|
||||||
qt_app.installTranslator(translator)
|
qt_app.installTranslator(translator)
|
||||||
|
QtCore.QCoreApplication.installTranslator(translator)
|
||||||
|
|
||||||
qt_app.setOrganizationName("The Qubes Project")
|
qt_app.setOrganizationName("The Qubes Project")
|
||||||
qt_app.setOrganizationDomain("http://qubes-os.org")
|
qt_app.setOrganizationDomain("http://qubes-os.org")
|
||||||
qt_app.setApplicationName(app_name)
|
|
||||||
qt_app.setWindowIcon(QIcon.fromTheme(icon_name))
|
|
||||||
qt_app.lastWindowClosed.connect(loop_shutdown)
|
qt_app.lastWindowClosed.connect(loop_shutdown)
|
||||||
|
|
||||||
qubes_app = qubesadmin.Qubes()
|
qubes_app = qubesadmin.Qubes()
|
||||||
@ -292,6 +291,10 @@ def run_asynchronous(app_name, icon_name, window_class):
|
|||||||
dispatcher = events.EventsDispatcher(qubes_app)
|
dispatcher = events.EventsDispatcher(qubes_app)
|
||||||
|
|
||||||
window = window_class(qt_app, qubes_app, dispatcher)
|
window = window_class(qt_app, qubes_app, dispatcher)
|
||||||
|
|
||||||
|
if hasattr(window, "setup_application"):
|
||||||
|
window.setup_application()
|
||||||
|
|
||||||
window.show()
|
window.show()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -305,7 +308,7 @@ def run_asynchronous(app_name, icon_name, window_class):
|
|||||||
handle_exception(exc_type, exc_value, exc_traceback)
|
handle_exception(exc_type, exc_value, exc_traceback)
|
||||||
|
|
||||||
|
|
||||||
def run_synchronous(app_name, window_class):
|
def run_synchronous(window_class):
|
||||||
qt_app = QtWidgets.QApplication(sys.argv)
|
qt_app = QtWidgets.QApplication(sys.argv)
|
||||||
|
|
||||||
translator = QtCore.QTranslator(qt_app)
|
translator = QtCore.QTranslator(qt_app)
|
||||||
@ -315,10 +318,10 @@ def run_synchronous(app_name, window_class):
|
|||||||
'i18n')
|
'i18n')
|
||||||
translator.load("qubesmanager_{!s}.qm".format(locale), i18n_dir)
|
translator.load("qubesmanager_{!s}.qm".format(locale), i18n_dir)
|
||||||
qt_app.installTranslator(translator)
|
qt_app.installTranslator(translator)
|
||||||
|
QtCore.QCoreApplication.installTranslator(translator)
|
||||||
|
|
||||||
qt_app.setOrganizationName("The Qubes Project")
|
qt_app.setOrganizationName("The Qubes Project")
|
||||||
qt_app.setOrganizationDomain("http://qubes-os.org")
|
qt_app.setOrganizationDomain("http://qubes-os.org")
|
||||||
qt_app.setApplicationName(app_name)
|
|
||||||
|
|
||||||
sys.excepthook = handle_exception
|
sys.excepthook = handle_exception
|
||||||
|
|
||||||
@ -326,6 +329,9 @@ def run_synchronous(app_name, window_class):
|
|||||||
|
|
||||||
window = window_class(qt_app, qubes_app)
|
window = window_class(qt_app, qubes_app)
|
||||||
|
|
||||||
|
if hasattr(window, "setup_application"):
|
||||||
|
window.setup_application()
|
||||||
|
|
||||||
window.show()
|
window.show()
|
||||||
|
|
||||||
qt_app.exec_()
|
qt_app.exec_()
|
||||||
|
Loading…
Reference in New Issue
Block a user