i18n: wrap strings with self.tr
Allow translations to handle strings defined in code. Fixes QubesOS/qubes-issues#2599
This commit is contained in:
parent
cf8b99c763
commit
7c602bf7d2
@ -78,7 +78,7 @@ class BackupVMsWindow(Ui_Backup, QWizard):
|
|||||||
|
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
|
|
||||||
self.progress_status.text = "Backup in progress..."
|
self.progress_status.text = self.tr("Backup in progress...")
|
||||||
self.show_running_vms_warning(False)
|
self.show_running_vms_warning(False)
|
||||||
self.dir_line_edit.setReadOnly(False)
|
self.dir_line_edit.setReadOnly(False)
|
||||||
|
|
||||||
@ -224,10 +224,12 @@ class BackupVMsWindow(Ui_Backup, QWizard):
|
|||||||
for vm in vms:
|
for vm in vms:
|
||||||
self.blk_manager.check_if_serves_as_backend(vm)
|
self.blk_manager.check_if_serves_as_backend(vm)
|
||||||
|
|
||||||
reply = QMessageBox.question(None, "VM Shutdown Confirmation",
|
reply = QMessageBox.question(None, self.tr("VM Shutdown Confirmation"),
|
||||||
"Are you sure you want to power down the following VMs: <b>{0}</b>?<br>"
|
self.tr("Are you sure you want to power down the following VMs: "
|
||||||
"<small>This will shutdown all the running applications within them.</small>".format(', '.join(names)),
|
"<b>{0}</b>?<br/>"
|
||||||
QMessageBox.Yes | QMessageBox.Cancel)
|
"<small>This will shutdown all the running applications "
|
||||||
|
"within them.</small>").format(', '.join(names)),
|
||||||
|
QMessageBox.Yes | QMessageBox.Cancel)
|
||||||
|
|
||||||
self.app.processEvents()
|
self.app.processEvents()
|
||||||
|
|
||||||
@ -266,7 +268,11 @@ class BackupVMsWindow(Ui_Backup, QWizard):
|
|||||||
def validateCurrentPage(self):
|
def validateCurrentPage(self):
|
||||||
if self.currentPage() is self.select_vms_page:
|
if self.currentPage() is self.select_vms_page:
|
||||||
if self.check_running():
|
if self.check_running():
|
||||||
QMessageBox.information(None, "Wait!", "Some selected VMs are running. Running VMs can not be backuped. Please shut them down or remove them from the list.")
|
QMessageBox.information(None,
|
||||||
|
self.tr("Wait!"),
|
||||||
|
self.tr("Some selected VMs are running. "
|
||||||
|
"Running VMs can not be backuped. "
|
||||||
|
"Please shut them down or remove them from the list."))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
self.selected_vms = []
|
self.selected_vms = []
|
||||||
@ -276,18 +282,23 @@ class BackupVMsWindow(Ui_Backup, QWizard):
|
|||||||
elif self.currentPage() is self.select_dir_page:
|
elif self.currentPage() is self.select_dir_page:
|
||||||
backup_location = str(self.dir_line_edit.text())
|
backup_location = str(self.dir_line_edit.text())
|
||||||
if not backup_location:
|
if not backup_location:
|
||||||
QMessageBox.information(None, "Wait!", "Enter backup target location first.")
|
QMessageBox.information(None, self.tr("Wait!"),
|
||||||
|
self.tr("Enter backup target location first."))
|
||||||
return False
|
return False
|
||||||
if self.appvm_combobox.currentIndex() == 0 and \
|
if self.appvm_combobox.currentIndex() == 0 and \
|
||||||
not os.path.isdir(backup_location):
|
not os.path.isdir(backup_location):
|
||||||
QMessageBox.information(None, "Wait!",
|
QMessageBox.information(None, self.tr("Wait!"),
|
||||||
"Selected directory do not exists or not a directory (%s)." % backup_location)
|
self.tr("Selected directory do not exists or "
|
||||||
|
"not a directory (%s).") % backup_location)
|
||||||
return False
|
return False
|
||||||
if not len(self.passphrase_line_edit.text()):
|
if not len(self.passphrase_line_edit.text()):
|
||||||
QMessageBox.information(None, "Wait!", "Enter passphrase for backup encryption/verification first.")
|
QMessageBox.information(None, self.tr("Wait!"),
|
||||||
|
self.tr("Enter passphrase for backup encryption/verification first."))
|
||||||
return False
|
return False
|
||||||
if self.passphrase_line_edit.text() != self.passphrase_line_edit_verify.text():
|
if self.passphrase_line_edit.text() != self.passphrase_line_edit_verify.text():
|
||||||
QMessageBox.information(None, "Wait!", "Enter the same passphrase in both fields.")
|
QMessageBox.information(None,
|
||||||
|
self.tr("Wait!"),
|
||||||
|
self.tr("Enter the same passphrase in both fields."))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
@ -315,7 +326,7 @@ class BackupVMsWindow(Ui_Backup, QWizard):
|
|||||||
if ex.tmpdir:
|
if ex.tmpdir:
|
||||||
self.tmpdir_to_remove = ex.tmpdir
|
self.tmpdir_to_remove = ex.tmpdir
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
print "Exception:",ex
|
print "Exception:", ex
|
||||||
msg.append(str(ex))
|
msg.append(str(ex))
|
||||||
|
|
||||||
if len(msg) > 0 :
|
if len(msg) > 0 :
|
||||||
@ -340,8 +351,10 @@ class BackupVMsWindow(Ui_Backup, QWizard):
|
|||||||
print_callback = self.gather_output,
|
print_callback = self.gather_output,
|
||||||
hide_vm_names=self.encryption_checkbox.isChecked())
|
hide_vm_names=self.encryption_checkbox.isChecked())
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
print "Exception:",ex
|
print "Exception:", ex
|
||||||
QMessageBox.critical(None, "Error while preparing backup.", "ERROR: {0}".format(ex))
|
QMessageBox.critical(None,
|
||||||
|
self.tr("Error while preparing backup."),
|
||||||
|
self.tr("ERROR: {0}").format(ex))
|
||||||
|
|
||||||
self.textEdit.setReadOnly(True)
|
self.textEdit.setReadOnly(True)
|
||||||
self.textEdit.setFontFamily("Monospace")
|
self.textEdit.setFontFamily("Monospace")
|
||||||
@ -367,25 +380,27 @@ class BackupVMsWindow(Ui_Backup, QWizard):
|
|||||||
|
|
||||||
if not self.thread_monitor.success:
|
if not self.thread_monitor.success:
|
||||||
if self.canceled:
|
if self.canceled:
|
||||||
self.progress_status.setText("Backup aborted.")
|
self.progress_status.setText(self.tr("Backup aborted."))
|
||||||
if self.tmpdir_to_remove:
|
if self.tmpdir_to_remove:
|
||||||
if QMessageBox.warning(None, "Backup aborted",
|
if QMessageBox.warning(None, self.tr("Backup aborted"),
|
||||||
"Do you want to remove temporary files from "
|
self.tr("Do you want to remove temporary files from "
|
||||||
"%s?" % self.tmpdir_to_remove,
|
"%s?") % self.tmpdir_to_remove,
|
||||||
QMessageBox.Yes, QMessageBox.No) == QMessageBox.Yes:
|
QMessageBox.Yes, QMessageBox.No) == QMessageBox.Yes:
|
||||||
shutil.rmtree(self.tmpdir_to_remove)
|
shutil.rmtree(self.tmpdir_to_remove)
|
||||||
else:
|
else:
|
||||||
self.progress_status.setText("Backup error.")
|
self.progress_status.setText(self.tr("Backup error."))
|
||||||
QMessageBox.warning (self, "Backup error!", "ERROR: {}".format(
|
QMessageBox.warning(self, self.tr("Backup error!"),
|
||||||
|
self.tr("ERROR: {}").format(
|
||||||
self.thread_monitor.error_msg))
|
self.thread_monitor.error_msg))
|
||||||
else:
|
else:
|
||||||
self.progress_bar.setValue(100)
|
self.progress_bar.setValue(100)
|
||||||
self.progress_status.setText("Backup finished.")
|
self.progress_status.setText(self.tr("Backup finished."))
|
||||||
if self.showFileDialog.isChecked():
|
if self.showFileDialog.isChecked():
|
||||||
orig_text = self.progress_status.text
|
orig_text = self.progress_status.text
|
||||||
self.progress_status.setText(
|
self.progress_status.setText(
|
||||||
orig_text + " Please unmount your backup volume and cancel "
|
orig_text + self.tr(
|
||||||
"the file selection dialog.")
|
" Please unmount your backup volume and cancel "
|
||||||
|
"the file selection dialog."))
|
||||||
if self.target_appvm:
|
if self.target_appvm:
|
||||||
self.target_appvm.run("QUBESRPC %s dom0" % "qubes"
|
self.target_appvm.run("QUBESRPC %s dom0" % "qubes"
|
||||||
".SelectDirectory")
|
".SelectDirectory")
|
||||||
@ -420,7 +435,7 @@ class BackupVMsWindow(Ui_Backup, QWizard):
|
|||||||
# Bases on the original code by:
|
# Bases on the original code by:
|
||||||
# Copyright (c) 2002-2007 Pascal Varet <p.varet@gmail.com>
|
# Copyright (c) 2002-2007 Pascal Varet <p.varet@gmail.com>
|
||||||
|
|
||||||
def handle_exception( exc_type, exc_value, exc_traceback ):
|
def handle_exception(exc_type, exc_value, exc_traceback ):
|
||||||
import sys
|
import sys
|
||||||
import os.path
|
import os.path
|
||||||
import traceback
|
import traceback
|
||||||
|
@ -90,9 +90,9 @@ def select_path_button_clicked(dialog, select_file = False):
|
|||||||
new_path = get_path_for_vm(vm, "qubes.SelectFile" if select_file
|
new_path = get_path_for_vm(vm, "qubes.SelectFile" if select_file
|
||||||
else "qubes.SelectDirectory")
|
else "qubes.SelectDirectory")
|
||||||
else:
|
else:
|
||||||
new_path = file_dialog_function(dialog, "Select backup location.",
|
new_path = file_dialog_function(dialog,
|
||||||
backup_location if backup_location
|
dialog.tr("Select backup location."),
|
||||||
else '/')
|
backup_location if backup_location else '/')
|
||||||
|
|
||||||
if new_path != None:
|
if new_path != None:
|
||||||
new_path = unicode(new_path)
|
new_path = unicode(new_path)
|
||||||
|
@ -99,7 +99,7 @@ class NewVmDlg (QDialog, Ui_NewVMDlg):
|
|||||||
for (i, vm) in enumerate(self.template_vm_list):
|
for (i, vm) in enumerate(self.template_vm_list):
|
||||||
if vm is self.qvm_collection.get_default_template():
|
if vm is self.qvm_collection.get_default_template():
|
||||||
default_index = i
|
default_index = i
|
||||||
self.template_name.insertItem(i, vm.name + " (default)")
|
self.template_name.insertItem(i, vm.name + self.tr(" (default)"))
|
||||||
else:
|
else:
|
||||||
self.template_name.insertItem(i, vm.name)
|
self.template_name.insertItem(i, vm.name)
|
||||||
self.template_name.setCurrentIndex(default_index)
|
self.template_name.setCurrentIndex(default_index)
|
||||||
@ -123,7 +123,7 @@ class NewVmDlg (QDialog, Ui_NewVMDlg):
|
|||||||
for (i, vm) in enumerate(self.netvm_list):
|
for (i, vm) in enumerate(self.netvm_list):
|
||||||
if vm is self.qvm_collection.get_default_netvm():
|
if vm is self.qvm_collection.get_default_netvm():
|
||||||
default_index = i
|
default_index = i
|
||||||
self.netvm_name.insertItem(i, vm.name + " (default)")
|
self.netvm_name.insertItem(i, vm.name + self.tr(" (default)"))
|
||||||
else:
|
else:
|
||||||
self.netvm_name.insertItem(i, vm.name)
|
self.netvm_name.insertItem(i, vm.name)
|
||||||
self.netvm_name.setCurrentIndex(default_index)
|
self.netvm_name.setCurrentIndex(default_index)
|
||||||
@ -187,7 +187,10 @@ class NewVmDlg (QDialog, Ui_NewVMDlg):
|
|||||||
def accept(self):
|
def accept(self):
|
||||||
vmname = str(self.vmname.text())
|
vmname = str(self.vmname.text())
|
||||||
if self.qvm_collection.get_vm_by_name(vmname) is not None:
|
if self.qvm_collection.get_vm_by_name(vmname) is not None:
|
||||||
QMessageBox.warning (None, "Incorrect AppVM Name!", "A VM with the name <b>{0}</b> already exists in the system!".format(vmname))
|
QMessageBox.warning(None,
|
||||||
|
self.tr("Incorrect AppVM Name!"),
|
||||||
|
self.tr("A VM with the name <b>{0}</b> already exists in the "
|
||||||
|
"system!").format(vmname))
|
||||||
return
|
return
|
||||||
|
|
||||||
label = self.label_list[self.vmlabel.currentIndex()]
|
label = self.label_list[self.vmlabel.currentIndex()]
|
||||||
@ -195,7 +198,11 @@ class NewVmDlg (QDialog, Ui_NewVMDlg):
|
|||||||
template_vm = None
|
template_vm = None
|
||||||
if self.template_name.isEnabled():
|
if self.template_name.isEnabled():
|
||||||
if len(self.template_vm_list) == 0:
|
if len(self.template_vm_list) == 0:
|
||||||
QMessageBox.warning (None, "No template available!", "Cannot create non-standalone VM when no compatible template exists. Create template VM first or choose to create standalone VM.")
|
QMessageBox.warning(None,
|
||||||
|
self.tr("No template available!"),
|
||||||
|
self.tr("Cannot create non-standalone VM when no "
|
||||||
|
"compatible template exists. Create template VM "
|
||||||
|
"first or choose to create standalone VM."))
|
||||||
return
|
return
|
||||||
template_vm = self.template_vm_list[self.template_name.currentIndex()]
|
template_vm = self.template_vm_list[self.template_name.currentIndex()]
|
||||||
|
|
||||||
@ -220,8 +227,9 @@ class NewVmDlg (QDialog, Ui_NewVMDlg):
|
|||||||
elif self.hvmtpl_radio.isChecked():
|
elif self.hvmtpl_radio.isChecked():
|
||||||
vmtype = "TemplateHVM"
|
vmtype = "TemplateHVM"
|
||||||
else:
|
else:
|
||||||
QErrorMessage.showMessage(None, "Error creating AppVM!", "Unknown "
|
QErrorMessage.showMessage(None,
|
||||||
"VM type, this is error in Qubes Manager")
|
self.tr("Error creating AppVM!"),
|
||||||
|
self.tr("Unknown VM type, this is error in Qubes Manager"))
|
||||||
self.done(0)
|
self.done(0)
|
||||||
|
|
||||||
|
|
||||||
@ -231,7 +239,8 @@ class NewVmDlg (QDialog, Ui_NewVMDlg):
|
|||||||
thread.daemon = True
|
thread.daemon = True
|
||||||
thread.start()
|
thread.start()
|
||||||
|
|
||||||
progress = QProgressDialog ("Creating new {0} <b>{1}</b>...".format(vmtype, vmname), "", 0, 0)
|
progress = QProgressDialog(
|
||||||
|
self.tr("Creating new {0} <b>{1}</b>...").format(vmtype, vmname), "", 0, 0)
|
||||||
progress.setCancelButton(None)
|
progress.setCancelButton(None)
|
||||||
progress.setModal(True)
|
progress.setModal(True)
|
||||||
progress.show()
|
progress.show()
|
||||||
@ -246,7 +255,9 @@ class NewVmDlg (QDialog, Ui_NewVMDlg):
|
|||||||
self.trayIcon.showMessage(
|
self.trayIcon.showMessage(
|
||||||
"VM '{0}' has been created.".format(vmname), msecs=3000)
|
"VM '{0}' has been created.".format(vmname), msecs=3000)
|
||||||
else:
|
else:
|
||||||
QMessageBox.warning (None, "Error creating AppVM!", "ERROR: {0}".format(thread_monitor.error_msg))
|
QMessageBox.warning(None,
|
||||||
|
self.tr("Error creating AppVM!"),
|
||||||
|
self.tr("ERROR: {0}").format(thread_monitor.error_msg))
|
||||||
|
|
||||||
self.done(0)
|
self.done(0)
|
||||||
|
|
||||||
|
@ -92,8 +92,8 @@ class NewFwRuleDlg (QDialog, ui_newfwruledlg.Ui_NewFwRuleDlg):
|
|||||||
if self.tcp_radio.isChecked() or self.udp_radio.isChecked():
|
if self.tcp_radio.isChecked() or self.udp_radio.isChecked():
|
||||||
if len(self.serviceComboBox.currentText()) == 0:
|
if len(self.serviceComboBox.currentText()) == 0:
|
||||||
msg = QMessageBox()
|
msg = QMessageBox()
|
||||||
msg.warning(self, "Firewall rule",
|
msg.warning(self, self.tr("Firewall rule"),
|
||||||
"You need to fill service name/port for TCP/UDP rule")
|
self.tr("You need to fill service name/port for TCP/UDP rule"))
|
||||||
return
|
return
|
||||||
QDialog.accept(self)
|
QDialog.accept(self)
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ class GlobalSettingsWindow(Ui_GlobalSettings, QDialog):
|
|||||||
text = vm.name
|
text = vm.name
|
||||||
if vm is current_update_vm:
|
if vm is current_update_vm:
|
||||||
self.updatevm_idx = i
|
self.updatevm_idx = i
|
||||||
text += " (current)"
|
text += self.tr(" (current)")
|
||||||
self.update_vm_combo.insertItem(i, text)
|
self.update_vm_combo.insertItem(i, text)
|
||||||
self.update_vm_combo.insertItem(len(all_vms), "none")
|
self.update_vm_combo.insertItem(len(all_vms), "none")
|
||||||
if current_update_vm is None:
|
if current_update_vm is None:
|
||||||
@ -97,7 +97,7 @@ class GlobalSettingsWindow(Ui_GlobalSettings, QDialog):
|
|||||||
text = vm.name
|
text = vm.name
|
||||||
if vm is current_clock_vm:
|
if vm is current_clock_vm:
|
||||||
self.clockvm_idx = i
|
self.clockvm_idx = i
|
||||||
text += " (current)"
|
text += self.tr(" (current)")
|
||||||
self.clock_vm_combo.insertItem(i, text)
|
self.clock_vm_combo.insertItem(i, text)
|
||||||
self.clock_vm_combo.insertItem(len(all_vms), "none")
|
self.clock_vm_combo.insertItem(len(all_vms), "none")
|
||||||
if current_clock_vm is None:
|
if current_clock_vm is None:
|
||||||
@ -113,7 +113,7 @@ class GlobalSettingsWindow(Ui_GlobalSettings, QDialog):
|
|||||||
text = vm.name
|
text = vm.name
|
||||||
if vm is current_netvm:
|
if vm is current_netvm:
|
||||||
self.netvm_idx = i
|
self.netvm_idx = i
|
||||||
text += " (current)"
|
text += self.tr(" (current)")
|
||||||
self.default_netvm_combo.insertItem(i, text)
|
self.default_netvm_combo.insertItem(i, text)
|
||||||
if current_netvm is not None:
|
if current_netvm is not None:
|
||||||
self.default_netvm_combo.setCurrentIndex(self.netvm_idx)
|
self.default_netvm_combo.setCurrentIndex(self.netvm_idx)
|
||||||
@ -127,7 +127,7 @@ class GlobalSettingsWindow(Ui_GlobalSettings, QDialog):
|
|||||||
text = vm.name
|
text = vm.name
|
||||||
if vm is current_template:
|
if vm is current_template:
|
||||||
self.template_idx = i
|
self.template_idx = i
|
||||||
text += " (current)"
|
text += self.tr(" (current)")
|
||||||
self.default_template_combo.insertItem(i, text)
|
self.default_template_combo.insertItem(i, text)
|
||||||
if current_template is not None:
|
if current_template is not None:
|
||||||
self.default_template_combo.setCurrentIndex(self.template_idx)
|
self.default_template_combo.setCurrentIndex(self.template_idx)
|
||||||
@ -180,9 +180,9 @@ class GlobalSettingsWindow(Ui_GlobalSettings, QDialog):
|
|||||||
for (i, k) in enumerate(kernel_list):
|
for (i, k) in enumerate(kernel_list):
|
||||||
text = k
|
text = k
|
||||||
if k == self.qvm_collection.get_default_kernel():
|
if k == self.qvm_collection.get_default_kernel():
|
||||||
text += " (current)"
|
text += self.tr(" (current)")
|
||||||
self.kernel_idx = i
|
self.kernel_idx = i
|
||||||
self.default_kernel_combo.insertItem(i,text)
|
self.default_kernel_combo.insertItem(i, text)
|
||||||
self.default_kernel_combo.setCurrentIndex(self.kernel_idx)
|
self.default_kernel_combo.setCurrentIndex(self.kernel_idx)
|
||||||
|
|
||||||
def __apply_kernel_defaults__(self):
|
def __apply_kernel_defaults__(self):
|
||||||
|
@ -56,7 +56,7 @@ class LogDialog(Ui_LogDialog, QDialog):
|
|||||||
log = open(self.log_path)
|
log = open(self.log_path)
|
||||||
log.seek(0, os.SEEK_END)
|
log.seek(0, os.SEEK_END)
|
||||||
if log.tell() > LOG_DISPLAY_SIZE:
|
if log.tell() > LOG_DISPLAY_SIZE:
|
||||||
self.displayed_text = "(Showing only last %d bytes of file)\n" % LOG_DISPLAY_SIZE
|
self.displayed_text = self.tr("(Showing only last %d bytes of file)\n") % LOG_DISPLAY_SIZE
|
||||||
log.seek(-LOG_DISPLAY_SIZE, os.SEEK_END)
|
log.seek(-LOG_DISPLAY_SIZE, os.SEEK_END)
|
||||||
else:
|
else:
|
||||||
log.seek(0, os.SEEK_SET)
|
log.seek(0, os.SEEK_SET)
|
||||||
|
@ -95,16 +95,16 @@ class QubesManagerFileWatcher(ProcessEvent):
|
|||||||
src_info_file = open(qubes_clipboard_info_file, 'r')
|
src_info_file = open(qubes_clipboard_info_file, 'r')
|
||||||
src_vmname = src_info_file.readline().strip('\n')
|
src_vmname = src_info_file.readline().strip('\n')
|
||||||
if src_vmname == "":
|
if src_vmname == "":
|
||||||
trayIcon.showMessage(
|
trayIcon.showMessage(self.tr(
|
||||||
"Qubes Clipboard has been copied to the VM and wiped.<i/>\n"
|
"Qubes Clipboard has been copied to the VM and wiped.<i/>\n"
|
||||||
"<small>Trigger a paste operation (e.g. Ctrl-v) to insert "
|
"<small>Trigger a paste operation (e.g. Ctrl-v) to insert "
|
||||||
"it into an application.</small>",
|
"it into an application.</small>"),
|
||||||
msecs=3000)
|
msecs=3000)
|
||||||
else:
|
else:
|
||||||
trayIcon.showMessage(
|
trayIcon.showMessage(self.tr(
|
||||||
"Qubes Clipboard fetched from VM: <b>'{0}'</b>\n"
|
"Qubes Clipboard fetched from VM: <b>'{0}'</b>\n"
|
||||||
"<small>Press Ctrl-Shift-v to copy this clipboard into dest"
|
"<small>Press Ctrl-Shift-v to copy this clipboard into dest"
|
||||||
" VM's clipboard.</small>".format(
|
" VM's clipboard.</small>").format(
|
||||||
src_vmname), msecs=3000)
|
src_vmname), msecs=3000)
|
||||||
src_info_file.close()
|
src_info_file.close()
|
||||||
|
|
||||||
@ -116,7 +116,8 @@ class QubesManagerFileWatcher(ProcessEvent):
|
|||||||
EventsCodes.OP_FLAGS.get('IN_CLOSE_WRITE'))
|
EventsCodes.OP_FLAGS.get('IN_CLOSE_WRITE'))
|
||||||
elif event.name == os.path.basename(table_widgets
|
elif event.name == os.path.basename(table_widgets
|
||||||
.qubes_dom0_updates_stat_file):
|
.qubes_dom0_updates_stat_file):
|
||||||
trayIcon.showMessage("Qubes dom0 updates available.", msecs=0)
|
trayIcon.showMessage(self.tr("Qubes dom0 updates available."),
|
||||||
|
msecs=0)
|
||||||
|
|
||||||
|
|
||||||
class SearchBox(QLineEdit):
|
class SearchBox(QLineEdit):
|
||||||
@ -279,12 +280,12 @@ class VmShutdownMonitor(QObject):
|
|||||||
if (datetime.now() - self.shutdown_started) > \
|
if (datetime.now() - self.shutdown_started) > \
|
||||||
timedelta(milliseconds=self.shutdown_time):
|
timedelta(milliseconds=self.shutdown_time):
|
||||||
reply = QMessageBox.question(
|
reply = QMessageBox.question(
|
||||||
None, "VM Shutdown",
|
None, self.tr("VM Shutdown"),
|
||||||
"The VM <b>'{0}'</b> hasn't shutdown within the last "
|
self.tr("The VM <b>'{0}'</b> hasn't shutdown within the last "
|
||||||
"{1} seconds, do you want to kill it?<br>".format(
|
"{1} seconds, do you want to kill it?<br>").format(
|
||||||
vm.name, self.shutdown_time / 1000),
|
vm.name, self.shutdown_time / 1000),
|
||||||
"Kill it!",
|
self.tr("Kill it!"),
|
||||||
"Wait another {0} seconds...".format(
|
self.tr("Wait another {0} seconds...").format(
|
||||||
self.shutdown_time / 1000))
|
self.shutdown_time / 1000))
|
||||||
if reply == 0:
|
if reply == 0:
|
||||||
vm.force_shutdown()
|
vm.force_shutdown()
|
||||||
@ -1027,21 +1028,21 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
dependent_vms = self.qvm_collection.get_vms_based_on(vm.qid)
|
dependent_vms = self.qvm_collection.get_vms_based_on(vm.qid)
|
||||||
if len(dependent_vms) > 0:
|
if len(dependent_vms) > 0:
|
||||||
QMessageBox.warning(
|
QMessageBox.warning(
|
||||||
None, "Warning!",
|
None, self.tr("Warning!"),
|
||||||
"This Template VM cannot be removed, because there is at "
|
self.tr("This Template VM cannot be removed, because there is at "
|
||||||
"least one AppVM that is based on it.<br>"
|
"least one AppVM that is based on it.<br>"
|
||||||
"<small>If you want to remove this Template VM and all "
|
"<small>If you want to remove this Template VM and all "
|
||||||
"the AppVMs based on it,"
|
"the AppVMs based on it,"
|
||||||
"you should first remove each individual AppVM that uses "
|
"you should first remove each individual AppVM that uses "
|
||||||
"this template.</small>")
|
"this template.</small>"))
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
(requested_name, ok) = QInputDialog.getText(
|
(requested_name, ok) = QInputDialog.getText(
|
||||||
None, "VM Removal Confirmation",
|
None, self.tr("VM Removal Confirmation"),
|
||||||
"Are you sure you want to remove the VM <b>'{0}'</b>?<br>"
|
self.tr("Are you sure you want to remove the VM <b>'{0}'</b>?<br>"
|
||||||
"All data on this VM's private storage will be lost!<br><br>"
|
"All data on this VM's private storage will be lost!<br><br>"
|
||||||
"Type the name of the VM (<b>{1}</b>) below to confirm:"
|
"Type the name of the VM (<b>{1}</b>) below to confirm:")
|
||||||
.format(vm.name, vm.name))
|
.format(vm.name, vm.name))
|
||||||
|
|
||||||
if not ok:
|
if not ok:
|
||||||
@ -1050,8 +1051,8 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
|
|
||||||
elif requested_name != vm.name:
|
elif requested_name != vm.name:
|
||||||
# name did not match
|
# name did not match
|
||||||
QMessageBox.warning(None, "VM removal confirmation failed",
|
QMessageBox.warning(None, self.tr("VM removal confirmation failed"),
|
||||||
"Entered name did not match! Not removing {0}.".format(vm.name))
|
self.tr("Entered name did not match! Not removing {0}.").format(vm.name))
|
||||||
return
|
return
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@ -1063,7 +1064,7 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
thread.start()
|
thread.start()
|
||||||
|
|
||||||
progress = QProgressDialog(
|
progress = QProgressDialog(
|
||||||
"Removing VM: <b>{0}</b>...".format(vm.name), "", 0, 0)
|
self.tr("Removing VM: <b>{0}</b>...").format(vm.name), "", 0, 0)
|
||||||
progress.setCancelButton(None)
|
progress.setCancelButton(None)
|
||||||
progress.setModal(True)
|
progress.setModal(True)
|
||||||
progress.show()
|
progress.show()
|
||||||
@ -1076,10 +1077,10 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
|
|
||||||
if thread_monitor.success:
|
if thread_monitor.success:
|
||||||
trayIcon.showMessage(
|
trayIcon.showMessage(
|
||||||
"VM '{0}' has been removed.".format(vm.name), msecs=3000)
|
self.tr("VM '{0}' has been removed.").format(vm.name), msecs=3000)
|
||||||
else:
|
else:
|
||||||
QMessageBox.warning(None, "Error removing VM!",
|
QMessageBox.warning(None, self.tr("Error removing VM!"),
|
||||||
"ERROR: {0}".format(
|
self.tr("ERROR: {0}").format(
|
||||||
thread_monitor.error_msg))
|
thread_monitor.error_msg))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -1119,8 +1120,8 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
name_number += 1
|
name_number += 1
|
||||||
|
|
||||||
(clone_name, ok) = QInputDialog.getText(
|
(clone_name, ok) = QInputDialog.getText(
|
||||||
self, 'Qubes clone VM',
|
self, self.tr('Qubes clone VM'),
|
||||||
'Enter name for VM <b>' + vm.name + '</b> clone:',
|
self.tr('Enter name for VM <b>{}</b> clone:').format(vm.name),
|
||||||
text=(name_format % name_number))
|
text=(name_format % name_number))
|
||||||
if not ok or clone_name == "":
|
if not ok or clone_name == "":
|
||||||
return
|
return
|
||||||
@ -1132,7 +1133,7 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
thread.start()
|
thread.start()
|
||||||
|
|
||||||
progress = QProgressDialog(
|
progress = QProgressDialog(
|
||||||
"Cloning VM <b>{0}</b> to <b>{1}</b>...".format(vm.name,
|
self.tr("Cloning VM <b>{0}</b> to <b>{1}</b>...").format(vm.name,
|
||||||
clone_name), "", 0,
|
clone_name), "", 0,
|
||||||
0)
|
0)
|
||||||
progress.setCancelButton(None)
|
progress.setCancelButton(None)
|
||||||
@ -1146,8 +1147,8 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
progress.hide()
|
progress.hide()
|
||||||
|
|
||||||
if not thread_monitor.success:
|
if not thread_monitor.success:
|
||||||
QMessageBox.warning(None, "Error while cloning VM",
|
QMessageBox.warning(None, self.tr("Error while cloning VM"),
|
||||||
"Exception while cloning:<br>{0}".format(
|
self.tr("Exception while cloning:<br>{0}").format(
|
||||||
thread_monitor.error_msg))
|
thread_monitor.error_msg))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -1184,8 +1185,8 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
try:
|
try:
|
||||||
vm.resume()
|
vm.resume()
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
QMessageBox.warning(None, "Error unpausing VM!",
|
QMessageBox.warning(None, self.tr("Error unpausing VM!"),
|
||||||
"ERROR: {0}".format(ex))
|
self.tr("ERROR: {0}").format(ex))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
@ -1199,22 +1200,22 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
thread.daemon = True
|
thread.daemon = True
|
||||||
thread.start()
|
thread.start()
|
||||||
|
|
||||||
trayIcon.showMessage("Starting '{0}'...".format(vm.name), msecs=3000)
|
trayIcon.showMessage(self.tr("Starting '{0}'...").format(vm.name), msecs=3000)
|
||||||
|
|
||||||
while not thread_monitor.is_finished():
|
while not thread_monitor.is_finished():
|
||||||
app.processEvents()
|
app.processEvents()
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
if thread_monitor.success:
|
if thread_monitor.success:
|
||||||
trayIcon.showMessage("VM '{0}' has been started.".format(vm.name),
|
trayIcon.showMessage(self.tr("VM '{0}' has been started.").format(vm.name),
|
||||||
msecs=3000)
|
msecs=3000)
|
||||||
else:
|
else:
|
||||||
trayIcon.showMessage(
|
trayIcon.showMessage(
|
||||||
"Error starting VM <b>'{0}'</b>: {1}".format(
|
self.tr("Error starting VM <b>'{0}'</b>: {1}").format(
|
||||||
vm.name, thread_monitor.error_msg),
|
vm.name, thread_monitor.error_msg),
|
||||||
msecs=3000)
|
msecs=3000)
|
||||||
self.set_error(vm.qid,
|
self.set_error(vm.qid,
|
||||||
"Error starting VM: %s" % thread_monitor.error_msg)
|
self.tr("Error starting VM: %s") % thread_monitor.error_msg)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def do_start_vm(vm, thread_monitor):
|
def do_start_vm(vm, thread_monitor):
|
||||||
@ -1236,9 +1237,9 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
os.path.exists('/usr/lib/qubes/qubes-windows-tools.iso')
|
os.path.exists('/usr/lib/qubes/qubes-windows-tools.iso')
|
||||||
if not windows_tools_installed:
|
if not windows_tools_installed:
|
||||||
msg = QMessageBox()
|
msg = QMessageBox()
|
||||||
msg.warning(self, "Error starting VM!",
|
msg.warning(self, self.tr("Error starting VM!"),
|
||||||
"You need to install 'qubes-windows-tools' "
|
self.tr("You need to install 'qubes-windows-tools' "
|
||||||
"package to use this option")
|
"package to use this option"))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
@ -1248,23 +1249,23 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
thread.daemon = True
|
thread.daemon = True
|
||||||
thread.start()
|
thread.start()
|
||||||
|
|
||||||
trayIcon.showMessage("Starting '{0}'...".format(vm.name), msecs=3000)
|
trayIcon.showMessage(self.tr("Starting '{0}'...").format(vm.name), msecs=3000)
|
||||||
|
|
||||||
while not thread_monitor.is_finished():
|
while not thread_monitor.is_finished():
|
||||||
app.processEvents()
|
app.processEvents()
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
if thread_monitor.success:
|
if thread_monitor.success:
|
||||||
trayIcon.showMessage("VM '{0}' has been started. Start Qubes "
|
trayIcon.showMessage(self.tr("VM '{0}' has been started. Start Qubes "
|
||||||
"Tools installation from attached CD"
|
"Tools installation from attached CD")
|
||||||
.format(vm.name), msecs=3000)
|
.format(vm.name), msecs=3000)
|
||||||
else:
|
else:
|
||||||
trayIcon.showMessage(
|
trayIcon.showMessage(
|
||||||
"Error starting VM <b>'{0}'</b>: {1}"
|
self.tr("Error starting VM <b>'{0}'</b>: {1}")
|
||||||
.format(vm.name, thread_monitor.error_msg),
|
.format(vm.name, thread_monitor.error_msg),
|
||||||
msecs=3000)
|
msecs=3000)
|
||||||
self.set_error(vm.qid,
|
self.set_error(vm.qid,
|
||||||
"Error starting VM: %s" % thread_monitor.error_msg)
|
self.tr("Error starting VM: %s") % thread_monitor.error_msg)
|
||||||
|
|
||||||
# noinspection PyMethodMayBeStatic
|
# noinspection PyMethodMayBeStatic
|
||||||
def do_start_vm_tools_install(self, vm, thread_monitor):
|
def do_start_vm_tools_install(self, vm, thread_monitor):
|
||||||
@ -1288,8 +1289,8 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
try:
|
try:
|
||||||
vm.pause()
|
vm.pause()
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
QMessageBox.warning(None, "Error pausing VM!",
|
QMessageBox.warning(None, self.tr("Error pausing VM!"),
|
||||||
"ERROR: {0}".format(ex))
|
self.tr("ERROR: {0}").format(ex))
|
||||||
return
|
return
|
||||||
|
|
||||||
@pyqtSlot(name='on_action_shutdownvm_triggered')
|
@pyqtSlot(name='on_action_shutdownvm_triggered')
|
||||||
@ -1300,10 +1301,10 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
self.blk_manager.check_if_serves_as_backend(vm)
|
self.blk_manager.check_if_serves_as_backend(vm)
|
||||||
|
|
||||||
reply = QMessageBox.question(
|
reply = QMessageBox.question(
|
||||||
None, "VM Shutdown Confirmation",
|
None, self.tr("VM Shutdown Confirmation"),
|
||||||
"Are you sure you want to power down the VM <b>'{0}'</b>?<br>"
|
self.tr("Are you sure you want to power down the VM <b>'{0}'</b>?<br>"
|
||||||
"<small>This will shutdown all the running applications "
|
"<small>This will shutdown all the running applications "
|
||||||
"within this VM.</small>".format(vm.name),
|
"within this VM.</small>").format(vm.name),
|
||||||
QMessageBox.Yes | QMessageBox.Cancel)
|
QMessageBox.Yes | QMessageBox.Cancel)
|
||||||
|
|
||||||
app.processEvents()
|
app.processEvents()
|
||||||
@ -1316,11 +1317,11 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
try:
|
try:
|
||||||
vm.shutdown()
|
vm.shutdown()
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
QMessageBox.warning(None, "Error shutting down VM!",
|
QMessageBox.warning(None, self.tr("Error shutting down VM!"),
|
||||||
"ERROR: {0}".format(ex))
|
self.tr("ERROR: {0}").format(ex))
|
||||||
return
|
return
|
||||||
|
|
||||||
trayIcon.showMessage("VM '{0}' is shutting down...".format(vm.name),
|
trayIcon.showMessage(self.tr("VM '{0}' is shutting down...").format(vm.name),
|
||||||
msecs=3000)
|
msecs=3000)
|
||||||
|
|
||||||
self.shutdown_monitor[vm.qid] = VmShutdownMonitor(vm, shutdown_time,
|
self.shutdown_monitor[vm.qid] = VmShutdownMonitor(vm, shutdown_time,
|
||||||
@ -1337,10 +1338,10 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
self.blk_manager.check_if_serves_as_backend(vm)
|
self.blk_manager.check_if_serves_as_backend(vm)
|
||||||
|
|
||||||
reply = QMessageBox.question(
|
reply = QMessageBox.question(
|
||||||
None, "VM Restart Confirmation",
|
None, self.tr("VM Restart Confirmation"),
|
||||||
"Are you sure you want to restart the VM <b>'{0}'</b>?<br>"
|
self.tr("Are you sure you want to restart the VM <b>'{0}'</b>?<br>"
|
||||||
"<small>This will shutdown all the running applications "
|
"<small>This will shutdown all the running applications "
|
||||||
"within this VM.</small>".format(vm.name),
|
"within this VM.</small>").format(vm.name),
|
||||||
QMessageBox.Yes | QMessageBox.Cancel)
|
QMessageBox.Yes | QMessageBox.Cancel)
|
||||||
|
|
||||||
app.processEvents()
|
app.processEvents()
|
||||||
@ -1354,10 +1355,10 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
assert vm.is_running() or vm.is_paused()
|
assert vm.is_running() or vm.is_paused()
|
||||||
|
|
||||||
reply = QMessageBox.question(
|
reply = QMessageBox.question(
|
||||||
None, "VM Kill Confirmation",
|
None, self.tr("VM Kill Confirmation"),
|
||||||
"Are you sure you want to kill the VM <b>'{0}'</b>?<br>"
|
self.tr("Are you sure you want to kill the VM <b>'{0}'</b>?<br>"
|
||||||
"<small>This will end <b>(not shutdown!)</b> all the running "
|
"<small>This will end <b>(not shutdown!)</b> all the running "
|
||||||
"applications within this VM.</small>".format(vm.name),
|
"applications within this VM.</small>").format(vm.name),
|
||||||
QMessageBox.Yes | QMessageBox.Cancel,
|
QMessageBox.Yes | QMessageBox.Cancel,
|
||||||
QMessageBox.Cancel)
|
QMessageBox.Cancel)
|
||||||
|
|
||||||
@ -1368,9 +1369,9 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
vm.force_shutdown()
|
vm.force_shutdown()
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
QMessageBox.critical(
|
QMessageBox.critical(
|
||||||
None, "Error while killing VM!",
|
None, self.tr("Error while killing VM!"),
|
||||||
"<b>An exception ocurred while killing {0}.</b><br>"
|
self.tr("<b>An exception ocurred while killing {0}.</b><br>"
|
||||||
"ERROR: {1}".format(vm.name, ex))
|
"ERROR: {1}").format(vm.name, ex))
|
||||||
return
|
return
|
||||||
|
|
||||||
trayIcon.showMessage("VM '{0}' killed!".format(vm.name), msecs=3000)
|
trayIcon.showMessage("VM '{0}' killed!".format(vm.name), msecs=3000)
|
||||||
@ -1430,13 +1431,13 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
|
|
||||||
if not vm.is_running():
|
if not vm.is_running():
|
||||||
reply = QMessageBox.question(
|
reply = QMessageBox.question(
|
||||||
None, "VM Update Confirmation",
|
None, self.tr("VM Update Confirmation"),
|
||||||
"<b>{0}</b><br>The VM has to be running to be updated.<br>"
|
self.tr("<b>{0}</b><br>The VM has to be running to be updated.<br>"
|
||||||
"Do you want to start it?<br>".format(vm.name),
|
"Do you want to start it?<br>").format(vm.name),
|
||||||
QMessageBox.Yes | QMessageBox.Cancel)
|
QMessageBox.Yes | QMessageBox.Cancel)
|
||||||
if reply != QMessageBox.Yes:
|
if reply != QMessageBox.Yes:
|
||||||
return
|
return
|
||||||
trayIcon.showMessage("Starting '{0}'...".format(vm.name),
|
trayIcon.showMessage(self.tr("Starting '{0}'...").format(vm.name),
|
||||||
msecs=3000)
|
msecs=3000)
|
||||||
|
|
||||||
app.processEvents()
|
app.processEvents()
|
||||||
@ -1448,8 +1449,8 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
thread.start()
|
thread.start()
|
||||||
|
|
||||||
progress = QProgressDialog(
|
progress = QProgressDialog(
|
||||||
"<b>{0}</b><br>Please wait for the updater to launch...".format(
|
self.tr("<b>{0}</b><br>Please wait for the updater to launch...").
|
||||||
vm.name), "", 0, 0)
|
format(vm.name), "", 0, 0)
|
||||||
progress.setCancelButton(None)
|
progress.setCancelButton(None)
|
||||||
progress.setModal(True)
|
progress.setModal(True)
|
||||||
progress.show()
|
progress.show()
|
||||||
@ -1462,8 +1463,8 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
|
|
||||||
if vm.qid != 0:
|
if vm.qid != 0:
|
||||||
if not thread_monitor.success:
|
if not thread_monitor.success:
|
||||||
QMessageBox.warning(None, "Error VM update!",
|
QMessageBox.warning(None, self.tr("Error VM update!"),
|
||||||
"ERROR: {0}".format(
|
self.tr("ERROR: {0}").format(
|
||||||
thread_monitor.error_msg))
|
thread_monitor.error_msg))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -1492,8 +1493,8 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
vm = self.get_selected_vm()
|
vm = self.get_selected_vm()
|
||||||
|
|
||||||
(command_to_run, ok) = QInputDialog.getText(
|
(command_to_run, ok) = QInputDialog.getText(
|
||||||
self, 'Qubes command entry',
|
self, self.tr('Qubes command entry'),
|
||||||
'Run command in <b>' + vm.name + '</b>:')
|
self.tr('Run command in <b>{}</b>:').format(vm.name))
|
||||||
if not ok or command_to_run == "":
|
if not ok or command_to_run == "":
|
||||||
return
|
return
|
||||||
thread_monitor = ThreadMonitor()
|
thread_monitor = ThreadMonitor()
|
||||||
@ -1507,9 +1508,9 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
|
|
||||||
if not thread_monitor.success:
|
if not thread_monitor.success:
|
||||||
QMessageBox.warning(None, "Error while running command",
|
QMessageBox.warning(None, self.tr("Error while running command"),
|
||||||
"Exception while running command:<br>{0}".format(
|
self.tr("Exception while running command:<br>{0}").format(
|
||||||
thread_monitor.error_msg))
|
thread_monitor.error_msg))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def do_run_command_in_vm(vm, command_to_run, thread_monitor):
|
def do_run_command_in_vm(vm, command_to_run, thread_monitor):
|
||||||
@ -1718,9 +1719,11 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
for d in self.blk_manager.attached_devs:
|
for d in self.blk_manager.attached_devs:
|
||||||
if (self.blk_manager.attached_devs[d]
|
if (self.blk_manager.attached_devs[d]
|
||||||
['attached_to']['vm'].qid == vm.qid):
|
['attached_to']['vm'].qid == vm.qid):
|
||||||
text = "Detach " + d + " " + unicode(
|
text = self.tr("Detach {dev} {size} {desc}").format(
|
||||||
self.blk_manager.attached_devs[d]['size']) + " " + \
|
dev=d,
|
||||||
self.blk_manager.attached_devs[d]['desc']
|
size=unicode(
|
||||||
|
self.blk_manager.attached_devs[d]['size']),
|
||||||
|
desc=self.blk_manager.attached_devs[d]['desc'])
|
||||||
action = self.blk_menu.addAction(QIcon(":/remove.png"),
|
action = self.blk_menu.addAction(QIcon(":/remove.png"),
|
||||||
text)
|
text)
|
||||||
action.setData(QVariant(d))
|
action.setData(QVariant(d))
|
||||||
@ -1733,9 +1736,11 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
if d[-1].isdigit() and \
|
if d[-1].isdigit() and \
|
||||||
d[0:-1] in self.blk_manager.current_blk:
|
d[0:-1] in self.blk_manager.current_blk:
|
||||||
continue
|
continue
|
||||||
text = "Attach " + d + " " + unicode(
|
text = self.tr("Attach {dev} {size} {desc}").format(
|
||||||
self.blk_manager.free_devs[d]['size']) + " " + \
|
dev=d,
|
||||||
self.blk_manager.free_devs[d]['desc']
|
size=unicode(
|
||||||
|
self.blk_manager.free_devs[d]['size']),
|
||||||
|
desc=self.blk_manager.free_devs[d]['desc'])
|
||||||
action = self.blk_menu.addAction(QIcon(":/add.png"), text)
|
action = self.blk_menu.addAction(QIcon(":/add.png"), text)
|
||||||
action.setData(QVariant(d))
|
action.setData(QVariant(d))
|
||||||
|
|
||||||
@ -1766,7 +1771,8 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
self.blk_manager.blk_lock.release()
|
self.blk_manager.blk_lock.release()
|
||||||
except QubesException as e:
|
except QubesException as e:
|
||||||
self.blk_manager.blk_lock.release()
|
self.blk_manager.blk_lock.release()
|
||||||
QMessageBox.critical(None, "Block attach/detach error!", str(e))
|
QMessageBox.critical(None,
|
||||||
|
self.tr("Block attach/detach error!"), str(e))
|
||||||
|
|
||||||
|
|
||||||
class QubesTrayIcon(QSystemTrayIcon):
|
class QubesTrayIcon(QSystemTrayIcon):
|
||||||
@ -1774,16 +1780,18 @@ class QubesTrayIcon(QSystemTrayIcon):
|
|||||||
QSystemTrayIcon.__init__(self, icon)
|
QSystemTrayIcon.__init__(self, icon)
|
||||||
self.menu = QMenu()
|
self.menu = QMenu()
|
||||||
|
|
||||||
action_showmanager = self.create_action("Open VM Manager",
|
action_showmanager = self.create_action(
|
||||||
slot=show_manager, icon="qubes")
|
self.tr("Open VM Manager"),
|
||||||
action_copy = self.create_action("Copy Dom0 clipboard", icon="copy",
|
slot=show_manager, icon="qubes")
|
||||||
slot=do_dom0_copy)
|
action_copy = self.create_action(
|
||||||
action_backup = self.create_action("Make backup")
|
self.tr("Copy Dom0 clipboard"), icon="copy",
|
||||||
action_preferences = self.create_action("Preferences")
|
slot=do_dom0_copy)
|
||||||
action_set_netvm = self.create_action("Set default NetVM",
|
action_backup = self.create_action(self.tr("Make backup"))
|
||||||
|
action_preferences = self.create_action(self.tr("Preferences"))
|
||||||
|
action_set_netvm = self.create_action(self.tr("Set default NetVM"),
|
||||||
icon="networking")
|
icon="networking")
|
||||||
action_sys_info = self.create_action("System Info", icon="dom0")
|
action_sys_info = self.create_action(self.tr("System Info"), icon="dom0")
|
||||||
action_exit = self.create_action("Exit", slot=exit_app)
|
action_exit = self.create_action(self.tr("Exit"), slot=exit_app)
|
||||||
|
|
||||||
action_backup.setDisabled(True)
|
action_backup.setDisabled(True)
|
||||||
action_preferences.setDisabled(True)
|
action_preferences.setDisabled(True)
|
||||||
@ -1793,8 +1801,8 @@ class QubesTrayIcon(QSystemTrayIcon):
|
|||||||
self.blk_manager = blk_manager
|
self.blk_manager = blk_manager
|
||||||
|
|
||||||
self.blk_menu = QMenu(self.menu)
|
self.blk_menu = QMenu(self.menu)
|
||||||
self.blk_menu.setTitle("Block devices")
|
self.blk_menu.setTitle(self.tr("Block devices"))
|
||||||
action_blk_menu = self.create_action("Block devices")
|
action_blk_menu = self.create_action(self.tr("Block devices"))
|
||||||
action_blk_menu.setMenu(self.blk_menu)
|
action_blk_menu.setMenu(self.blk_menu)
|
||||||
|
|
||||||
self.add_actions(self.menu, (action_showmanager,
|
self.add_actions(self.menu, (action_showmanager,
|
||||||
@ -1825,7 +1833,7 @@ class QubesTrayIcon(QSystemTrayIcon):
|
|||||||
self.tray_notifier_type = srv_info.arguments()[1]
|
self.tray_notifier_type = srv_info.arguments()[1]
|
||||||
|
|
||||||
if os.path.exists(table_widgets.qubes_dom0_updates_stat_file):
|
if os.path.exists(table_widgets.qubes_dom0_updates_stat_file):
|
||||||
self.showMessage("Qubes dom0 updates available.", msecs=0)
|
self.showMessage(self.tr("Qubes dom0 updates available."), msecs=0)
|
||||||
|
|
||||||
def update_blk_menu(self):
|
def update_blk_menu(self):
|
||||||
global manager_window
|
global manager_window
|
||||||
@ -1854,11 +1862,11 @@ class QubesTrayIcon(QSystemTrayIcon):
|
|||||||
if len(self.blk_manager.attached_devs) > 0:
|
if len(self.blk_manager.attached_devs) > 0:
|
||||||
for d in self.blk_manager.attached_devs:
|
for d in self.blk_manager.attached_devs:
|
||||||
vm = self.blk_manager.attached_devs[d]['attached_to']['vm']
|
vm = self.blk_manager.attached_devs[d]['attached_to']['vm']
|
||||||
text = "Detach %s %s (%s) from %s" % (
|
text = self.tr("Detach {dev} {desc} ({size}) from {vm}").format(
|
||||||
d,
|
dev=d,
|
||||||
self.blk_manager.attached_devs[d]['desc'],
|
desc=self.blk_manager.attached_devs[d]['desc'],
|
||||||
unicode(self.blk_manager.attached_devs[d]['size']),
|
size=unicode(self.blk_manager.attached_devs[d]['size']),
|
||||||
vm.name)
|
vm=vm.name)
|
||||||
action = self.blk_menu.addAction(QIcon(":/remove.png"), text)
|
action = self.blk_menu.addAction(QIcon(":/remove.png"), text)
|
||||||
action.setData(QVariant(d))
|
action.setData(QVariant(d))
|
||||||
action.triggered.connect(
|
action.triggered.connect(
|
||||||
@ -1869,10 +1877,10 @@ class QubesTrayIcon(QSystemTrayIcon):
|
|||||||
# skip partitions heuristic
|
# skip partitions heuristic
|
||||||
if d[-1].isdigit() and d[0:-1] in self.blk_manager.current_blk:
|
if d[-1].isdigit() and d[0:-1] in self.blk_manager.current_blk:
|
||||||
continue
|
continue
|
||||||
text = "Attach %s %s %s" % (
|
text = self.tr("Attach {dev} {size} {desc}").format(
|
||||||
d,
|
dev=d,
|
||||||
unicode(self.blk_manager.free_devs[d]['size']),
|
size=unicode(self.blk_manager.free_devs[d]['size']),
|
||||||
self.blk_manager.free_devs[d]['desc']
|
desc=self.blk_manager.free_devs[d]['desc']
|
||||||
)
|
)
|
||||||
action = self.blk_menu.addAction(QIcon(":/add.png"), text)
|
action = self.blk_menu.addAction(QIcon(":/add.png"), text)
|
||||||
action.setMenu(create_vm_submenu(d))
|
action.setMenu(create_vm_submenu(d))
|
||||||
@ -1892,7 +1900,8 @@ class QubesTrayIcon(QSystemTrayIcon):
|
|||||||
self.blk_manager.blk_lock.release()
|
self.blk_manager.blk_lock.release()
|
||||||
except QubesException as e:
|
except QubesException as e:
|
||||||
self.blk_manager.blk_lock.release()
|
self.blk_manager.blk_lock.release()
|
||||||
QMessageBox.critical(None, "Block attach/detach error!", str(e))
|
QMessageBox.critical(None,
|
||||||
|
self.tr("Block attach/detach error!"), str(e))
|
||||||
|
|
||||||
@pyqtSlot('QAction *')
|
@pyqtSlot('QAction *')
|
||||||
def dettach_device_triggered(self, action):
|
def dettach_device_triggered(self, action):
|
||||||
@ -1905,7 +1914,8 @@ class QubesTrayIcon(QSystemTrayIcon):
|
|||||||
self.blk_manager.blk_lock.release()
|
self.blk_manager.blk_lock.release()
|
||||||
except QubesException as e:
|
except QubesException as e:
|
||||||
self.blk_manager.blk_lock.release()
|
self.blk_manager.blk_lock.release()
|
||||||
QMessageBox.critical(None, "Block attach/detach error!", str(e))
|
QMessageBox.critical(None,
|
||||||
|
self.tr("Block attach/detach error!"), str(e))
|
||||||
|
|
||||||
def icon_clicked(self, reason):
|
def icon_clicked(self, reason):
|
||||||
if reason == QSystemTrayIcon.Context:
|
if reason == QSystemTrayIcon.Context:
|
||||||
|
@ -145,7 +145,7 @@ class RestoreVMsWindow(Ui_Restore, QWizard):
|
|||||||
continue
|
continue
|
||||||
self.select_vms_widget.available_list.addItem(vmname)
|
self.select_vms_widget.available_list.addItem(vmname)
|
||||||
except QubesException as ex:
|
except QubesException as ex:
|
||||||
QMessageBox.warning (None, "Restore error!", str(ex))
|
QMessageBox.warning (None, self.tr("Restore error!"), str(ex))
|
||||||
|
|
||||||
def __init_restore_options__(self):
|
def __init_restore_options__(self):
|
||||||
if not self.restore_options:
|
if not self.restore_options:
|
||||||
@ -192,24 +192,25 @@ class RestoreVMsWindow(Ui_Restore, QWizard):
|
|||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
print "Exception:", ex
|
print "Exception:", ex
|
||||||
err_msg.append(unicode(ex))
|
err_msg.append(unicode(ex))
|
||||||
err_msg.append("Partially restored files left in "
|
err_msg.append(
|
||||||
"/var/tmp/restore_*, investigate them and/or clean them up")
|
self.tr("Partially restored files left in "
|
||||||
|
"/var/tmp/restore_*, investigate them and/or clean them up"))
|
||||||
|
|
||||||
self.qvm_collection.unlock_db()
|
self.qvm_collection.unlock_db()
|
||||||
if self.canceled:
|
if self.canceled:
|
||||||
self.emit(SIGNAL("restore_progress(QString)"),
|
self.emit(SIGNAL("restore_progress(QString)"),
|
||||||
'<b><font color="red">{0}</font></b>'
|
'<b><font color="red">{0}</font></b>'
|
||||||
.format("Restore aborted!"))
|
.format(self.tr("Restore aborted!")))
|
||||||
elif len(err_msg) > 0 or self.error_detected.is_set():
|
elif len(err_msg) > 0 or self.error_detected.is_set():
|
||||||
if len(err_msg) > 0:
|
if len(err_msg) > 0:
|
||||||
thread_monitor.set_error_msg('\n'.join(err_msg))
|
thread_monitor.set_error_msg('\n'.join(err_msg))
|
||||||
self.emit(SIGNAL("restore_progress(QString)"),
|
self.emit(SIGNAL("restore_progress(QString)"),
|
||||||
'<b><font color="red">{0}</font></b>'
|
'<b><font color="red">{0}</font></b>'
|
||||||
.format("Finished with errors!"))
|
.format(self.tr("Finished with errors!")))
|
||||||
else:
|
else:
|
||||||
self.emit(SIGNAL("restore_progress(QString)"),
|
self.emit(SIGNAL("restore_progress(QString)"),
|
||||||
'<font color="green">{0}</font>'
|
'<font color="green">{0}</font>'
|
||||||
.format("Finished successfully!"))
|
.format(self.tr("Finished successfully!")))
|
||||||
|
|
||||||
thread_monitor.set_finished()
|
thread_monitor.set_finished()
|
||||||
|
|
||||||
@ -263,30 +264,31 @@ class RestoreVMsWindow(Ui_Restore, QWizard):
|
|||||||
if not self.thread_monitor.success:
|
if not self.thread_monitor.success:
|
||||||
if self.canceled:
|
if self.canceled:
|
||||||
if self.tmpdir_to_remove and \
|
if self.tmpdir_to_remove and \
|
||||||
QMessageBox.warning(None, "Restore aborted",
|
QMessageBox.warning(None, self.tr("Restore aborted"),
|
||||||
"Do you want to remove temporary "
|
self.tr("Do you want to remove temporary files "
|
||||||
"files from %s?" % self
|
"from %s?") % self.tmpdir_to_remove,
|
||||||
.tmpdir_to_remove,
|
QMessageBox.Yes, QMessageBox.No) == \
|
||||||
QMessageBox.Yes, QMessageBox.No) == \
|
|
||||||
QMessageBox.Yes:
|
QMessageBox.Yes:
|
||||||
shutil.rmtree(self.tmpdir_to_remove)
|
shutil.rmtree(self.tmpdir_to_remove)
|
||||||
else:
|
else:
|
||||||
QMessageBox.warning (None, "Backup error!", "ERROR: {1}"
|
QMessageBox.warning(None,
|
||||||
.format(self.vm.name, self.thread_monitor.error_msg))
|
self.tr("Backup error!"), self.tr("ERROR: {0}")
|
||||||
|
.format(self.thread_monitor.error_msg))
|
||||||
|
|
||||||
if self.showFileDialog.isChecked():
|
if self.showFileDialog.isChecked():
|
||||||
self.emit(SIGNAL("restore_progress(QString)"),
|
self.emit(SIGNAL("restore_progress(QString)"),
|
||||||
'<b><font color="black">{0}</font></b>'.format(
|
'<b><font color="black">{0}</font></b>'.format(
|
||||||
"Please unmount your backup volume and cancel "
|
self.tr(
|
||||||
"the file selection dialog."))
|
"Please unmount your backup volume and cancel"
|
||||||
|
" the file selection dialog.")))
|
||||||
if self.target_appvm:
|
if self.target_appvm:
|
||||||
self.target_appvm.run("QUBESRPC %s dom0" % "qubes"
|
self.target_appvm.run("QUBESRPC %s dom0" %
|
||||||
".SelectDirectory")
|
"qubes.SelectDirectory")
|
||||||
else:
|
else:
|
||||||
file_dialog = QFileDialog()
|
file_dialog = QFileDialog()
|
||||||
file_dialog.setReadOnly(True)
|
file_dialog.setReadOnly(True)
|
||||||
file_dialog.getExistingDirectory(
|
file_dialog.getExistingDirectory(
|
||||||
self, "Detach backup device",
|
self, self.tr("Detach backup device"),
|
||||||
os.path.dirname(unicode(self.dir_line_edit.text())))
|
os.path.dirname(unicode(self.dir_line_edit.text())))
|
||||||
self.progress_bar.setValue(100)
|
self.progress_bar.setValue(100)
|
||||||
self.button(self.FinishButton).setEnabled(True)
|
self.button(self.FinishButton).setEnabled(True)
|
||||||
@ -308,7 +310,7 @@ class RestoreVMsWindow(Ui_Restore, QWizard):
|
|||||||
if backup.backup_cancel():
|
if backup.backup_cancel():
|
||||||
self.emit(SIGNAL("restore_progress(QString)"),
|
self.emit(SIGNAL("restore_progress(QString)"),
|
||||||
'<font color="red">{0}</font>'
|
'<font color="red">{0}</font>'
|
||||||
.format("Aborting the operation..."))
|
.format(self.tr("Aborting the operation...")))
|
||||||
self.button(self.CancelButton).setDisabled(True)
|
self.button(self.CancelButton).setDisabled(True)
|
||||||
else:
|
else:
|
||||||
self.done(0)
|
self.done(0)
|
||||||
|
@ -54,7 +54,7 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
self.source_vm = self.vm
|
self.source_vm = self.vm
|
||||||
|
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
self.setWindowTitle("Settings: %s" % self.vm.name)
|
self.setWindowTitle(self.tr("Settings: {vm}").format(vm=self.vm.name))
|
||||||
if init_page in self.tabs_indices:
|
if init_page in self.tabs_indices:
|
||||||
idx = self.tabs_indices[init_page]
|
idx = self.tabs_indices[init_page]
|
||||||
assert (idx in range(self.tabWidget.count()))
|
assert (idx in range(self.tabWidget.count()))
|
||||||
@ -118,7 +118,8 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
thread.daemon = True
|
thread.daemon = True
|
||||||
thread.start()
|
thread.start()
|
||||||
|
|
||||||
progress = QProgressDialog ("Applying settings to <b>{0}</b>...".format(self.vm.name), "", 0, 0)
|
progress = QProgressDialog(
|
||||||
|
self.tr("Applying settings to <b>{0}</b>...").format(self.vm.name), "", 0, 0)
|
||||||
progress.setCancelButton(None)
|
progress.setCancelButton(None)
|
||||||
progress.setModal(True)
|
progress.setModal(True)
|
||||||
progress.show()
|
progress.show()
|
||||||
@ -130,8 +131,9 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
progress.hide()
|
progress.hide()
|
||||||
|
|
||||||
if not thread_monitor.success:
|
if not thread_monitor.success:
|
||||||
QMessageBox.warning (None, "Error while changing settings for {0}!".format(self.vm.name),
|
QMessageBox.warning(None,
|
||||||
"ERROR: {0}".format(thread_monitor.error_msg))
|
self.tr("Error while changing settings for {0}!").format(self.vm.name),
|
||||||
|
self.tr("ERROR: {0}").format(thread_monitor.error_msg))
|
||||||
|
|
||||||
self.done(0)
|
self.done(0)
|
||||||
|
|
||||||
@ -155,7 +157,7 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
if len(ret_tmp) > 0:
|
if len(ret_tmp) > 0:
|
||||||
ret += ["Sevices tab:"] + ret_tmp
|
ret += ["Sevices tab:"] + ret_tmp
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
ret.append('Error while saving changes: ' + str(ex))
|
ret.append(self.tr('Error while saving changes: ') + str(ex))
|
||||||
|
|
||||||
if self.anything_changed == True:
|
if self.anything_changed == True:
|
||||||
self.qvm_collection.save()
|
self.qvm_collection.save()
|
||||||
@ -170,13 +172,13 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
self.tempFullAccess.isChecked(),
|
self.tempFullAccess.isChecked(),
|
||||||
self.tempFullAccessTime.value())
|
self.tempFullAccessTime.value())
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
ret += ["Firewall tab:", str(ex)]
|
ret += [self.tr("Firewall tab:"), str(ex)]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if self.tabWidget.isTabEnabled(self.tabs_indices["applications"]):
|
if self.tabWidget.isTabEnabled(self.tabs_indices["applications"]):
|
||||||
self.AppListManager.save_appmenu_select_changes()
|
self.AppListManager.save_appmenu_select_changes()
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
ret += ["Applications tab:", str(ex)]
|
ret += [self.tr("Applications tab:"), str(ex)]
|
||||||
|
|
||||||
if len(ret) > 0 :
|
if len(ret) > 0 :
|
||||||
thread_monitor.set_error_msg('\n'.join(ret))
|
thread_monitor.set_error_msg('\n'.join(ret))
|
||||||
@ -187,8 +189,13 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
def current_tab_changed(self, idx):
|
def current_tab_changed(self, idx):
|
||||||
if idx == self.tabs_indices["firewall"]:
|
if idx == self.tabs_indices["firewall"]:
|
||||||
if self.vm.netvm is not None and not self.vm.netvm.is_proxyvm():
|
if self.vm.netvm is not None and not self.vm.netvm.is_proxyvm():
|
||||||
QMessageBox.warning (None, "VM configuration problem!", "The '{0}' AppVM is not network connected to a FirewallVM!<p>".format(self.vm.name) +\
|
QMessageBox.warning(None,
|
||||||
"You may edit the '{0}' VM firewall rules, but these will not take any effect until you connect it to a working Firewall VM.".format(self.vm.name))
|
self.tr("VM configuration problem!"),
|
||||||
|
self.tr("The '{vm}' AppVM is not network connected to a "
|
||||||
|
"FirewallVM!<p>"
|
||||||
|
"You may edit the '{vm}' VM firewall rules, but these "
|
||||||
|
"will not take any effect until you connect it to "
|
||||||
|
"a working Firewall VM.").format(vm=self.vm.name))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -228,10 +235,10 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
continue
|
continue
|
||||||
text = vm.name
|
text = vm.name
|
||||||
if vm is self.qvm_collection.get_default_template():
|
if vm is self.qvm_collection.get_default_template():
|
||||||
text += " (default)"
|
text += self.tr(" (default)")
|
||||||
if vm.qid == self.vm.template.qid:
|
if vm.qid == self.vm.template.qid:
|
||||||
self.template_idx = i
|
self.template_idx = i
|
||||||
text += " (current)"
|
text += self.tr(" (current)")
|
||||||
self.template_name.insertItem(i, text)
|
self.template_name.insertItem(i, text)
|
||||||
i += 1
|
i += 1
|
||||||
self.template_name.setCurrentIndex(self.template_idx)
|
self.template_name.setCurrentIndex(self.template_idx)
|
||||||
@ -249,7 +256,7 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
if default_netvm is not None:
|
if default_netvm is not None:
|
||||||
text = "default (%s)" % default_netvm.name
|
text = "default (%s)" % default_netvm.name
|
||||||
if self.vm.uses_default_netvm:
|
if self.vm.uses_default_netvm:
|
||||||
text += " (current)"
|
text += self.tr(" (current)")
|
||||||
self.netvm_idx = 0
|
self.netvm_idx = 0
|
||||||
self.netVM.insertItem(0, text)
|
self.netVM.insertItem(0, text)
|
||||||
|
|
||||||
@ -257,12 +264,12 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
text = vm.name
|
text = vm.name
|
||||||
if self.vm.netvm is not None and vm.qid == self.vm.netvm.qid and not self.vm.uses_default_netvm:
|
if self.vm.netvm is not None and vm.qid == self.vm.netvm.qid and not self.vm.uses_default_netvm:
|
||||||
self.netvm_idx = i+1
|
self.netvm_idx = i+1
|
||||||
text += " (current)"
|
text += self.tr(" (current)")
|
||||||
self.netVM.insertItem(i+1, text)
|
self.netVM.insertItem(i+1, text)
|
||||||
|
|
||||||
none_text = "none"
|
none_text = "none"
|
||||||
if self.vm.netvm is None:
|
if self.vm.netvm is None:
|
||||||
none_text += " (current)"
|
none_text += self.tr(" (current)")
|
||||||
self.netvm_idx = len(netvm_list)+1
|
self.netvm_idx = len(netvm_list)+1
|
||||||
self.netVM.insertItem(len(netvm_list)+1, none_text)
|
self.netVM.insertItem(len(netvm_list)+1, none_text)
|
||||||
|
|
||||||
@ -326,9 +333,11 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
vmname = str(self.vmname.text())
|
vmname = str(self.vmname.text())
|
||||||
if self.vm.name != vmname:
|
if self.vm.name != vmname:
|
||||||
if self.vm.is_running():
|
if self.vm.is_running():
|
||||||
msg.append("Can't change name of a running VM.")
|
msg.append(self.tr("Can't change name of a running VM."))
|
||||||
elif self.qvm_collection.get_vm_by_name(vmname) is not None:
|
elif self.qvm_collection.get_vm_by_name(vmname) is not None:
|
||||||
msg.append("Can't change VM name - a VM named <b>{0}</b> already exists in the system!".format(vmname))
|
msg.append(
|
||||||
|
self.tr("Can't change VM name - a VM named <b>{0}</b>"
|
||||||
|
"already exists in the system!").format(vmname))
|
||||||
else:
|
else:
|
||||||
oldname = self.vm.name
|
oldname = self.vm.name
|
||||||
try:
|
try:
|
||||||
@ -442,11 +451,18 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
|
|
||||||
def check_mem_changes(self):
|
def check_mem_changes(self):
|
||||||
if self.max_mem_size.value() < self.init_mem.value():
|
if self.max_mem_size.value() < self.init_mem.value():
|
||||||
QMessageBox.warning(None, "Warning!", "Max memory can not be less than initial memory.<br>Setting max memory to equal initial memory.")
|
QMessageBox.warning(None,
|
||||||
|
self.tr("Warning!"),
|
||||||
|
self.tr("Max memory can not be less than initial memory.<br>"
|
||||||
|
"Setting max memory to equal initial memory."))
|
||||||
self.max_mem_size.setValue(self.init_mem.value())
|
self.max_mem_size.setValue(self.init_mem.value())
|
||||||
# Linux specific limit: init memory must not be below max_mem_size/10.79 in order to allow scaling up to max_mem_size (or else "add_memory() failed: -17" problem)
|
# Linux specific limit: init memory must not be below max_mem_size/10.79 in order to allow scaling up to max_mem_size (or else "add_memory() failed: -17" problem)
|
||||||
if self.init_mem.value() * 10 < self.max_mem_size.value():
|
if self.init_mem.value() * 10 < self.max_mem_size.value():
|
||||||
QMessageBox.warning(None, "Warning!", "Initial memory can not be less than one tenth Max memory.<br>Setting initial memory to the minimum allowed value.")
|
QMessageBox.warning(None,
|
||||||
|
self.tr("Warning!"),
|
||||||
|
self.tr("Initial memory can not be less than one tenth "
|
||||||
|
"Max memory.<br>Setting initial memory to the minimum "
|
||||||
|
"allowed value."))
|
||||||
self.init_mem.setValue(self.max_mem_size.value() / 10)
|
self.init_mem.setValue(self.max_mem_size.value() / 10)
|
||||||
|
|
||||||
|
|
||||||
@ -563,7 +579,7 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
|
|
||||||
text = "default (same as VM own NetVM)"
|
text = "default (same as VM own NetVM)"
|
||||||
if self.vm.uses_default_dispvm_netvm:
|
if self.vm.uses_default_dispvm_netvm:
|
||||||
text += " (current)"
|
text += self.tr(" (current)")
|
||||||
self.dispvm_netvm_idx = 0
|
self.dispvm_netvm_idx = 0
|
||||||
self.dispvm_netvm.insertItem(0, text)
|
self.dispvm_netvm.insertItem(0, text)
|
||||||
|
|
||||||
@ -573,12 +589,12 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
self.vm.dispvm_netvm.qid and not \
|
self.vm.dispvm_netvm.qid and not \
|
||||||
self.vm.uses_default_dispvm_netvm:
|
self.vm.uses_default_dispvm_netvm:
|
||||||
self.dispvm_netvm_idx = i+1
|
self.dispvm_netvm_idx = i+1
|
||||||
text += " (current)"
|
text += self.tr(" (current)")
|
||||||
self.dispvm_netvm.insertItem(i+1, text)
|
self.dispvm_netvm.insertItem(i+1, text)
|
||||||
|
|
||||||
none_text = "none"
|
none_text = "none"
|
||||||
if self.vm.dispvm_netvm is None:
|
if self.vm.dispvm_netvm is None:
|
||||||
none_text += " (current)"
|
none_text += self.tr(" (current)")
|
||||||
self.dispvm_netvm_idx = len(netvm_list)+1
|
self.dispvm_netvm_idx = len(netvm_list)+1
|
||||||
self.dispvm_netvm.insertItem(len(netvm_list)+1, none_text)
|
self.dispvm_netvm.insertItem(len(netvm_list)+1, none_text)
|
||||||
|
|
||||||
@ -804,7 +820,8 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
srv = str(self.service_line_edit.text()).strip()
|
srv = str(self.service_line_edit.text()).strip()
|
||||||
if srv != "":
|
if srv != "":
|
||||||
if srv in self.new_srv_dict:
|
if srv in self.new_srv_dict:
|
||||||
QMessageBox.information(None, "", "Service already on the list!")
|
QMessageBox.information(None, "",
|
||||||
|
self.tr("Service already on the list!"))
|
||||||
else:
|
else:
|
||||||
item = QListWidgetItem(srv)
|
item = QListWidgetItem(srv)
|
||||||
item.setCheckState(QtCore.Qt.Checked)
|
item.setCheckState(QtCore.Qt.Checked)
|
||||||
@ -817,7 +834,9 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
if not item:
|
if not item:
|
||||||
return
|
return
|
||||||
if str(item.text()) == 'meminfo-writer':
|
if str(item.text()) == 'meminfo-writer':
|
||||||
QMessageBox.information(None, "Service can not be removed", "Service meminfo-writer can not be removed from the list.")
|
QMessageBox.information(None,
|
||||||
|
self.tr("Service can not be removed"),
|
||||||
|
self.tr("Service meminfo-writer can not be removed from the list."))
|
||||||
return
|
return
|
||||||
|
|
||||||
row = self.services_list.currentRow()
|
row = self.services_list.currentRow()
|
||||||
@ -958,8 +977,9 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
|
|
||||||
if port is not None:
|
if port is not None:
|
||||||
if port2 is not None and port2 <= port:
|
if port2 is not None and port2 <= port:
|
||||||
QMessageBox.warning(None, "Invalid service ports range",
|
QMessageBox.warning(None, self.tr("Invalid service ports range"),
|
||||||
"Port {0} is lower than port {1}.".format(port2, port))
|
self.tr("Port {0} is lower than port {1}.").format(
|
||||||
|
port2, port))
|
||||||
else:
|
else:
|
||||||
item = {"address": address,
|
item = {"address": address,
|
||||||
"netmask": netmask,
|
"netmask": netmask,
|
||||||
@ -972,8 +992,8 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
else:
|
else:
|
||||||
self.fw_model.appendChild(item)
|
self.fw_model.appendChild(item)
|
||||||
else:
|
else:
|
||||||
QMessageBox.warning(None, "Invalid service name",
|
QMessageBox.warning(None, self.tr("Invalid service name"),
|
||||||
"Service '{0}' is unknown.".format(service))
|
self.tr("Service '{0}' is unknown.").format(service))
|
||||||
|
|
||||||
|
|
||||||
# Bases on the original code by:
|
# Bases on the original code by:
|
||||||
|
@ -605,16 +605,20 @@ class VmUpdateInfoWidget(QWidget):
|
|||||||
if state == "update":
|
if state == "update":
|
||||||
label_text = "<font color=\"#CCCC00\">Check updates</font>"
|
label_text = "<font color=\"#CCCC00\">Check updates</font>"
|
||||||
icon_path = ":/update-recommended.png"
|
icon_path = ":/update-recommended.png"
|
||||||
tooltip_text = "Updates pending!"
|
tooltip_text = self.tr("Updates pending!")
|
||||||
elif state == "outdated":
|
elif state == "outdated":
|
||||||
label_text = "<font color=\"red\">VM outdated</font>"
|
label_text = "<font color=\"red\">VM outdated</font>"
|
||||||
icon_path = ":/outdated.png"
|
icon_path = ":/outdated.png"
|
||||||
tooltip_text = "The VM must be restarted for its filesystem to reflect the template's recent committed changes."
|
tooltip_text = self.tr(
|
||||||
|
"The VM must be restarted for its filesystem to reflect the "
|
||||||
|
"template's recent committed changes.")
|
||||||
elif state == "to-be-outdated":
|
elif state == "to-be-outdated":
|
||||||
label_text = "<font color=\"#800000\">TemplateVM running</font>"
|
label_text = "<font color=\"#800000\">TemplateVM running</font>"
|
||||||
icon_path = ":/to-be-outdated.png"
|
icon_path = ":/to-be-outdated.png"
|
||||||
tooltip_text = "The TemplateVM must be stopped before changes from its current session can be picked up by this VM."
|
tooltip_text = self.tr(
|
||||||
elif state == None:
|
"The TemplateVM must be stopped before changes from its "
|
||||||
|
"current session can be picked up by this VM.")
|
||||||
|
elif state is None:
|
||||||
label_text = ""
|
label_text = ""
|
||||||
icon_path = None
|
icon_path = None
|
||||||
tooltip_text = None
|
tooltip_text = None
|
||||||
@ -624,7 +628,7 @@ class VmUpdateInfoWidget(QWidget):
|
|||||||
else:
|
else:
|
||||||
self.layout().removeWidget(self.icon)
|
self.layout().removeWidget(self.icon)
|
||||||
self.icon.deleteLater()
|
self.icon.deleteLater()
|
||||||
if icon_path != None:
|
if icon_path is not None:
|
||||||
self.icon = VmIconWidget(icon_path, True, 0.7)
|
self.icon = VmIconWidget(icon_path, True, 0.7)
|
||||||
self.icon.setToolTip(tooltip_text)
|
self.icon.setToolTip(tooltip_text)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user