spring cleaning part 5: more python3 fixes
This commit is contained in:
parent
021ab3d171
commit
2c3df7bd67
4
Makefile
4
Makefile
@ -20,12 +20,12 @@ rpms-dom0:
|
||||
rpm --addsign $(RPMS_DIR)/x86_64/qubes-manager*$(VERSION)*.rpm
|
||||
|
||||
qubesmanager/ui_%.py: ui/%.ui
|
||||
pyuic4 -o $@ $<
|
||||
pyuic4 --from-imports -o $@ $<
|
||||
|
||||
ui: $(patsubst ui/%.ui,qubesmanager/ui_%.py,$(wildcard ui/*.ui))
|
||||
|
||||
res:
|
||||
pyrcc4 -o qubesmanager/resources_rc.py resources.qrc
|
||||
pyrcc4 -py3 -o qubesmanager/resources_rc.py resources.qrc
|
||||
|
||||
translations:
|
||||
lrelease-qt4 qubesmanager.pro
|
||||
|
@ -26,7 +26,7 @@ from PyQt4.QtGui import QDialog, QIcon
|
||||
from qubesmanager.releasenotes import ReleaseNotesDialog
|
||||
from qubesmanager.informationnotes import InformationNotesDialog
|
||||
|
||||
from ui_about import *
|
||||
from .ui_about import *
|
||||
|
||||
|
||||
|
||||
|
@ -33,8 +33,8 @@ import time
|
||||
|
||||
from operator import itemgetter
|
||||
|
||||
from thread_monitor import *
|
||||
from multiselectwidget import *
|
||||
from .thread_monitor import *
|
||||
from .multiselectwidget import *
|
||||
|
||||
whitelisted_filename = 'whitelisted-appmenus.list'
|
||||
|
||||
|
@ -40,16 +40,16 @@ import qubesmanager.resources_rc
|
||||
from pyinotify import WatchManager, Notifier, ThreadedNotifier, EventsCodes, ProcessEvent
|
||||
|
||||
import time
|
||||
from thread_monitor import *
|
||||
from .thread_monitor import *
|
||||
from operator import itemgetter
|
||||
|
||||
from datetime import datetime
|
||||
from string import replace
|
||||
|
||||
from ui_backupdlg import *
|
||||
from multiselectwidget import *
|
||||
from .ui_backupdlg import *
|
||||
from .multiselectwidget import *
|
||||
|
||||
from backup_utils import *
|
||||
from .backup_utils import *
|
||||
import main
|
||||
import grp,pwd
|
||||
|
||||
@ -225,11 +225,11 @@ class BackupVMsWindow(Ui_Backup, QWizard):
|
||||
self.blk_manager.check_if_serves_as_backend(vm)
|
||||
|
||||
reply = QMessageBox.question(None, self.tr("VM Shutdown Confirmation"),
|
||||
unicode(self.tr(
|
||||
self.tr(
|
||||
"Are you sure you want to power down the following VMs: "
|
||||
"<b>{0}</b>?<br/>"
|
||||
"<small>This will shutdown all the running applications "
|
||||
"within them.</small>")).format(', '.join(names)),
|
||||
"within them.</small>").format(', '.join(names)),
|
||||
QMessageBox.Yes | QMessageBox.Cancel)
|
||||
|
||||
self.app.processEvents()
|
||||
@ -289,8 +289,8 @@ class BackupVMsWindow(Ui_Backup, QWizard):
|
||||
if self.appvm_combobox.currentIndex() == 0 and \
|
||||
not os.path.isdir(backup_location):
|
||||
QMessageBox.information(None, self.tr("Wait!"),
|
||||
unicode(self.tr("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
|
||||
if not len(self.passphrase_line_edit.text()):
|
||||
QMessageBox.information(None, self.tr("Wait!"),
|
||||
@ -314,9 +314,9 @@ class BackupVMsWindow(Ui_Backup, QWizard):
|
||||
msg = []
|
||||
|
||||
try:
|
||||
backup.backup_do(unicode(self.dir_line_edit.text()),
|
||||
backup.backup_do(self.dir_line_edit.text(),
|
||||
self.files_to_backup,
|
||||
unicode(self.passphrase_line_edit.text()),
|
||||
self.passphrase_line_edit.text(),
|
||||
progress_callback=self.update_progress_bar,
|
||||
encrypted=self.encryption_checkbox.isChecked(),
|
||||
appvm=self.target_appvm)
|
||||
@ -355,7 +355,7 @@ class BackupVMsWindow(Ui_Backup, QWizard):
|
||||
print("Exception:", ex)
|
||||
QMessageBox.critical(None,
|
||||
self.tr("Error while preparing backup."),
|
||||
unicode(self.tr("ERROR: {0}")).format(ex))
|
||||
self.tr("ERROR: {0}").format(ex))
|
||||
|
||||
self.textEdit.setReadOnly(True)
|
||||
self.textEdit.setFontFamily("Monospace")
|
||||
@ -384,14 +384,14 @@ class BackupVMsWindow(Ui_Backup, QWizard):
|
||||
self.progress_status.setText(self.tr("Backup aborted."))
|
||||
if self.tmpdir_to_remove:
|
||||
if QMessageBox.warning(None, self.tr("Backup aborted"),
|
||||
unicode(self.tr("Do you want to remove temporary files from "
|
||||
"%s?")) % self.tmpdir_to_remove,
|
||||
self.tr("Do you want to remove temporary files from "
|
||||
"%s?") % self.tmpdir_to_remove,
|
||||
QMessageBox.Yes, QMessageBox.No) == QMessageBox.Yes:
|
||||
shutil.rmtree(self.tmpdir_to_remove)
|
||||
else:
|
||||
self.progress_status.setText(self.tr("Backup error."))
|
||||
QMessageBox.warning(self, self.tr("Backup error!"),
|
||||
unicode(self.tr("ERROR: {}")).format(
|
||||
self.tr("ERROR: {}").format(
|
||||
self.thread_monitor.error_msg))
|
||||
else:
|
||||
self.progress_bar.setValue(100)
|
||||
|
@ -28,10 +28,7 @@ from PyQt4.QtGui import *
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
from thread_monitor import *
|
||||
|
||||
from datetime import datetime
|
||||
from string import replace
|
||||
from .thread_monitor import *
|
||||
|
||||
path_re = re.compile(r"[a-zA-Z0-9/:.,_+=() -]*")
|
||||
path_max_len = 512
|
||||
@ -94,7 +91,6 @@ def select_path_button_clicked(dialog, select_file = False):
|
||||
backup_location if backup_location else '/')
|
||||
|
||||
if new_path != None:
|
||||
new_path = unicode(new_path)
|
||||
if os.path.basename(new_path) == 'qubes.xml':
|
||||
backup_location = os.path.dirname(new_path)
|
||||
else:
|
||||
|
@ -36,8 +36,8 @@ import qubesmanager.resources_rc
|
||||
import time
|
||||
import threading
|
||||
|
||||
from ui_newappvmdlg import *
|
||||
from thread_monitor import *
|
||||
from .ui_newappvmdlg import *
|
||||
from .thread_monitor import *
|
||||
|
||||
|
||||
class NewVmDlg (QDialog, Ui_NewVMDlg):
|
||||
@ -189,8 +189,8 @@ class NewVmDlg (QDialog, Ui_NewVMDlg):
|
||||
if self.qvm_collection.get_vm_by_name(vmname) is not None:
|
||||
QMessageBox.warning(None,
|
||||
self.tr("Incorrect AppVM Name!"),
|
||||
unicode(self.tr("A VM with the name <b>{0}</b> already exists in the "
|
||||
"system!")).format(vmname))
|
||||
self.tr("A VM with the name <b>{0}</b> already exists in the "
|
||||
"system!").format(vmname))
|
||||
return
|
||||
|
||||
label = self.label_list[self.vmlabel.currentIndex()]
|
||||
@ -240,7 +240,7 @@ class NewVmDlg (QDialog, Ui_NewVMDlg):
|
||||
thread.start()
|
||||
|
||||
progress = QProgressDialog(
|
||||
unicode(self.tr("Creating new {0} <b>{1}</b>...")).format(vmtype, vmname), "", 0, 0)
|
||||
self.tr("Creating new {0} <b>{1}</b>...").format(vmtype, vmname), "", 0, 0)
|
||||
progress.setCancelButton(None)
|
||||
progress.setModal(True)
|
||||
progress.show()
|
||||
@ -253,11 +253,11 @@ class NewVmDlg (QDialog, Ui_NewVMDlg):
|
||||
|
||||
if thread_monitor.success:
|
||||
self.trayIcon.showMessage(
|
||||
unicode(self.tr("VM '{0}' has been created.")).format(vmname), msecs=3000)
|
||||
self.tr("VM '{0}' has been created.").format(vmname), msecs=3000)
|
||||
else:
|
||||
QMessageBox.warning(None,
|
||||
self.tr("Error creating AppVM!"),
|
||||
unicode(self.tr("ERROR: {0}")).format(thread_monitor.error_msg))
|
||||
self.tr("ERROR: {0}").format(thread_monitor.error_msg))
|
||||
|
||||
self.done(0)
|
||||
|
||||
|
@ -28,7 +28,7 @@ from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
import datetime
|
||||
|
||||
import ui_newfwruledlg
|
||||
from . import ui_newfwruledlg
|
||||
|
||||
|
||||
class QIPAddressValidator(QValidator):
|
||||
|
@ -28,7 +28,7 @@ from PyQt4.QtGui import *
|
||||
|
||||
from qubesadmin import Qubes
|
||||
|
||||
from qubesmanager.ui_globalsettingsdlg import *
|
||||
from .ui_globalsettingsdlg import *
|
||||
|
||||
from configparser import ConfigParser
|
||||
from qubesadmin.utils import parse_size, updates_vms_status
|
||||
|
@ -24,7 +24,7 @@
|
||||
from PyQt4.QtCore import SIGNAL
|
||||
from PyQt4.QtGui import QDialog, QIcon
|
||||
|
||||
from ui_informationnotes import *
|
||||
from .ui_informationnotes import *
|
||||
import subprocess
|
||||
|
||||
|
||||
|
@ -30,8 +30,8 @@ from qubes.qubes import QubesException
|
||||
|
||||
import qubesmanager.resources_rc
|
||||
|
||||
from ui_logdlg import *
|
||||
from clipboard import *
|
||||
from .ui_logdlg import *
|
||||
from .clipboard import *
|
||||
|
||||
# Display only this size of log
|
||||
LOG_DISPLAY_SIZE = 1024*1024
|
||||
@ -56,7 +56,7 @@ class LogDialog(Ui_LogDialog, QDialog):
|
||||
log = open(self.log_path)
|
||||
log.seek(0, os.SEEK_END)
|
||||
if log.tell() > LOG_DISPLAY_SIZE:
|
||||
self.displayed_text = unicode(self.tr("(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)
|
||||
else:
|
||||
log.seek(0, os.SEEK_SET)
|
||||
|
@ -1,7 +1,7 @@
|
||||
import sys
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
from ui_multiselectwidget import *
|
||||
from .ui_multiselectwidget import *
|
||||
|
||||
class MultiSelectWidget(Ui_MultiSelectWidget, QWidget):
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
from PyQt4.QtCore import SIGNAL
|
||||
from PyQt4.QtGui import QDialog, QIcon
|
||||
|
||||
from ui_releasenotes import *
|
||||
from .ui_releasenotes import *
|
||||
|
||||
|
||||
class ReleaseNotesDialog(Ui_ReleaseNotesDialog, QDialog):
|
||||
|
@ -39,15 +39,15 @@ from pyinotify import WatchManager, Notifier, ThreadedNotifier, EventsCodes, Pro
|
||||
|
||||
import time
|
||||
from operator import itemgetter
|
||||
from thread_monitor import *
|
||||
from .thread_monitor import *
|
||||
|
||||
from qubes import backup
|
||||
from qubes import qubesutils
|
||||
|
||||
from ui_restoredlg import *
|
||||
from multiselectwidget import *
|
||||
from .ui_restoredlg import *
|
||||
from .multiselectwidget import *
|
||||
|
||||
from backup_utils import *
|
||||
from .backup_utils import *
|
||||
from multiprocessing import Queue, Event
|
||||
from multiprocessing.queues import Empty
|
||||
|
||||
@ -132,8 +132,8 @@ class RestoreVMsWindow(Ui_Restore, QWizard):
|
||||
|
||||
try:
|
||||
self.vms_to_restore = backup.backup_restore_prepare(
|
||||
unicode(self.dir_line_edit.text()),
|
||||
unicode(self.passphrase_line_edit.text()),
|
||||
self.dir_line_edit.text(),
|
||||
self.passphrase_line_edit.text(),
|
||||
options=self.restore_options,
|
||||
host_collection=self.qvm_collection,
|
||||
encrypted=self.encryption_checkbox.isChecked(),
|
||||
@ -188,10 +188,10 @@ class RestoreVMsWindow(Ui_Restore, QWizard):
|
||||
except backup.BackupCanceledError as ex:
|
||||
self.canceled = True
|
||||
self.tmpdir_to_remove = ex.tmpdir
|
||||
err_msg.append(unicode(ex))
|
||||
err_msg.append(str(ex))
|
||||
except Exception as ex:
|
||||
print ("Exception:", ex)
|
||||
err_msg.append(unicode(ex))
|
||||
err_msg.append(str(ex))
|
||||
err_msg.append(
|
||||
self.tr("Partially restored files left in "
|
||||
"/var/tmp/restore_*, investigate them and/or clean them up"))
|
||||
@ -265,14 +265,14 @@ class RestoreVMsWindow(Ui_Restore, QWizard):
|
||||
if self.canceled:
|
||||
if self.tmpdir_to_remove and \
|
||||
QMessageBox.warning(None, self.tr("Restore aborted"),
|
||||
unicode(self.tr("Do you want to remove temporary files "
|
||||
"from %s?")) % self.tmpdir_to_remove,
|
||||
self.tr("Do you want to remove temporary files "
|
||||
"from %s?") % self.tmpdir_to_remove,
|
||||
QMessageBox.Yes, QMessageBox.No) == \
|
||||
QMessageBox.Yes:
|
||||
shutil.rmtree(self.tmpdir_to_remove)
|
||||
else:
|
||||
QMessageBox.warning(None,
|
||||
self.tr("Backup error!"), unicode(self.tr("ERROR: {0}"))
|
||||
self.tr("Backup error!"), self.tr("ERROR: {0}")
|
||||
.format(self.thread_monitor.error_msg))
|
||||
|
||||
if self.showFileDialog.isChecked():
|
||||
@ -289,7 +289,7 @@ class RestoreVMsWindow(Ui_Restore, QWizard):
|
||||
file_dialog.setReadOnly(True)
|
||||
file_dialog.getExistingDirectory(
|
||||
self, self.tr("Detach backup device"),
|
||||
os.path.dirname(unicode(self.dir_line_edit.text())))
|
||||
os.path.dirname(self.dir_line_edit.text()))
|
||||
self.progress_bar.setValue(100)
|
||||
self.button(self.FinishButton).setEnabled(True)
|
||||
self.button(self.CancelButton).setEnabled(False)
|
||||
@ -316,7 +316,7 @@ class RestoreVMsWindow(Ui_Restore, QWizard):
|
||||
self.done(0)
|
||||
|
||||
def has_selected_dir(self):
|
||||
backup_location = unicode(self.dir_line_edit.text())
|
||||
backup_location = self.dir_line_edit.text()
|
||||
if not backup_location:
|
||||
return False
|
||||
if self.appvm_combobox.currentIndex() == 0:
|
||||
|
@ -29,10 +29,10 @@ from qubes.qubes import system_path
|
||||
import subprocess
|
||||
from copy import copy
|
||||
|
||||
from ui_settingsdlg import *
|
||||
from appmenu_select import *
|
||||
from firewall import *
|
||||
from backup_utils import get_path_for_vm
|
||||
from .ui_settingsdlg import *
|
||||
from .appmenu_select import *
|
||||
from .firewall import *
|
||||
from .backup_utils import get_path_for_vm
|
||||
|
||||
class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
||||
tabs_indices = {"basic": 0,
|
||||
@ -54,7 +54,7 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
||||
self.source_vm = self.vm
|
||||
|
||||
self.setupUi(self)
|
||||
self.setWindowTitle(unicode(self.tr("Settings: {vm}")).format(vm=self.vm.name))
|
||||
self.setWindowTitle(self.tr("Settings: {vm}").format(vm=self.vm.name))
|
||||
if init_page in self.tabs_indices:
|
||||
idx = self.tabs_indices[init_page]
|
||||
assert (idx in range(self.tabWidget.count()))
|
||||
@ -119,7 +119,7 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
||||
thread.start()
|
||||
|
||||
progress = QProgressDialog(
|
||||
unicode(self.tr("Applying settings to <b>{0}</b>...")).format(self.vm.name), "", 0, 0)
|
||||
self.tr("Applying settings to <b>{0}</b>...").format(self.vm.name), "", 0, 0)
|
||||
progress.setCancelButton(None)
|
||||
progress.setModal(True)
|
||||
progress.show()
|
||||
@ -132,8 +132,8 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
||||
|
||||
if not thread_monitor.success:
|
||||
QMessageBox.warning(None,
|
||||
unicode(self.tr("Error while changing settings for {0}!")).format(self.vm.name),
|
||||
unicode(self.tr("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)
|
||||
|
||||
@ -194,11 +194,11 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
||||
if self.vm.netvm is not None and not self.vm.netvm.is_proxyvm():
|
||||
QMessageBox.warning(None,
|
||||
self.tr("VM configuration problem!"),
|
||||
unicode(self.tr("The '{vm}' AppVM is not network connected to a "
|
||||
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))
|
||||
"a working Firewall VM.").format(vm=self.vm.name))
|
||||
|
||||
|
||||
|
||||
@ -984,7 +984,7 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
||||
if port is not None:
|
||||
if port2 is not None and port2 <= port:
|
||||
QMessageBox.warning(None, self.tr("Invalid service ports range"),
|
||||
unicode(self.tr("Port {0} is lower than port {1}.")).format(
|
||||
self.tr("Port {0} is lower than port {1}.").format(
|
||||
port2, port))
|
||||
else:
|
||||
item = {"address": address,
|
||||
@ -999,7 +999,7 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
||||
self.fw_model.appendChild(item)
|
||||
else:
|
||||
QMessageBox.warning(None, self.tr("Invalid service name"),
|
||||
unicode(self.tr("Service '{0}' is unknown.")).format(service))
|
||||
self.tr("Service '{0}' is unknown.").format(service))
|
||||
|
||||
|
||||
# Bases on the original code by:
|
||||
|
Loading…
Reference in New Issue
Block a user