Update Qt version used in qubesmanager to Qt5
Fixed dependencies, places where obsolete functions stopped working, code fragments that started throwing warnings and an .ui file that stopped being readable after the update.
This commit is contained in:
parent
492b8705b6
commit
e79724f9db
8
Makefile
8
Makefile
@ -20,15 +20,15 @@ rpms-dom0:
|
||||
rpm --addsign $(RPMS_DIR)/x86_64/qubes-manager*$(VERSION)*.rpm
|
||||
|
||||
qubesmanager/ui_%.py: ui/%.ui
|
||||
pyuic4 --from-imports -o $@ $<
|
||||
pyuic5 --from-imports -o $@ $<
|
||||
|
||||
ui: $(patsubst ui/%.ui,qubesmanager/ui_%.py,$(wildcard ui/*.ui))
|
||||
|
||||
res:
|
||||
pyrcc4 -py3 -o qubesmanager/resources_rc.py resources.qrc
|
||||
pyrcc5 -o qubesmanager/resources_rc.py resources.qrc
|
||||
|
||||
translations:
|
||||
lrelease-qt4 qubesmanager.pro
|
||||
lrelease-qt5 qubesmanager.pro
|
||||
|
||||
python:
|
||||
$(PYTHON) ./setup.py build
|
||||
@ -37,7 +37,7 @@ python_install:
|
||||
$(PYTHON) ./setup.py install -O1 --skip-build --root $(DESTDIR)
|
||||
|
||||
update_ts: res
|
||||
pylupdate4 qubesmanager.pro
|
||||
pylupdate5 qubesmanager.pro
|
||||
|
||||
update-repo-current:
|
||||
ln -f $(RPMS_DIR)/x86_64/qubes-manager-*$(VERSION)*.rpm ../yum/current-release/current/dom0/rpm/
|
||||
|
@ -1 +1 @@
|
||||
PyQt4-devel
|
||||
PyQt5-devel
|
||||
|
@ -20,7 +20,8 @@
|
||||
# with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#
|
||||
from PyQt4.QtGui import QDialog, QIcon # pylint: disable=import-error
|
||||
from PyQt5.QtWidgets import QDialog # pylint: disable=import-error
|
||||
from PyQt5.QtGui import QIcon # pylint: disable=import-error
|
||||
from qubesmanager.releasenotes import ReleaseNotesDialog
|
||||
from qubesmanager.informationnotes import InformationNotesDialog
|
||||
|
||||
@ -42,10 +43,12 @@ class AboutDialog(ui_about.Ui_AboutDialog, QDialog):
|
||||
self.releaseNotes.clicked.connect(on_release_notes_clicked)
|
||||
self.informationNotes.clicked.connect(on_information_notes_clicked)
|
||||
|
||||
|
||||
def on_release_notes_clicked():
|
||||
release_notes_dialog = ReleaseNotesDialog()
|
||||
release_notes_dialog.exec_()
|
||||
|
||||
|
||||
def on_information_notes_clicked():
|
||||
information_notes_dialog = InformationNotesDialog()
|
||||
information_notes_dialog.exec_()
|
||||
|
@ -20,13 +20,13 @@
|
||||
#
|
||||
|
||||
import subprocess
|
||||
import PyQt5.QtWidgets # pylint: disable=import-error
|
||||
|
||||
import PyQt4.QtGui # pylint: disable=import-error
|
||||
|
||||
# TODO description in tooltip
|
||||
# TODO icon
|
||||
# pylint: disable=too-few-public-methods
|
||||
class AppListWidgetItem(PyQt4.QtGui.QListWidgetItem):
|
||||
class AppListWidgetItem(PyQt5.QtWidgets.QListWidgetItem):
|
||||
def __init__(self, name, ident, parent=None):
|
||||
super(AppListWidgetItem, self).__init__(name, parent)
|
||||
# self.setToolTip(command)
|
||||
@ -58,9 +58,10 @@ class AppmenuSelectManager:
|
||||
self.app_list.clear()
|
||||
|
||||
available_appmenus = [AppListWidgetItem.from_line(line)
|
||||
for line in subprocess.check_output(['qvm-appmenus',
|
||||
'--get-available', '--i-understand-format-is-unstable',
|
||||
self.vm.name]).decode().splitlines()]
|
||||
for line in subprocess.check_output(
|
||||
['qvm-appmenus',
|
||||
'--get-available', '--i-understand-format-is-unstable',
|
||||
self.vm.name]).decode().splitlines()]
|
||||
|
||||
for app in available_appmenus:
|
||||
if app.ident in self.whitelisted:
|
||||
@ -73,7 +74,7 @@ class AppmenuSelectManager:
|
||||
|
||||
def save_appmenu_select_changes(self):
|
||||
new_whitelisted = [self.app_list.selected_list.item(i).ident
|
||||
for i in range(self.app_list.selected_list.count())]
|
||||
for i in range(self.app_list.selected_list.count())]
|
||||
|
||||
if set(new_whitelisted) == set(self.whitelisted):
|
||||
return False
|
||||
|
@ -30,8 +30,8 @@ from qubesadmin import utils as admin_utils
|
||||
from qubesadmin import events
|
||||
from qubes.storage.file import get_disk_usage
|
||||
|
||||
from PyQt4 import QtCore # pylint: disable=import-error
|
||||
from PyQt4 import QtGui # pylint: disable=import-error
|
||||
from PyQt5 import QtCore # pylint: disable=import-error
|
||||
from PyQt5 import QtWidgets # pylint: disable=import-error
|
||||
from . import ui_backupdlg # pylint: disable=no-name-in-module
|
||||
from . import multiselectwidget
|
||||
|
||||
@ -45,6 +45,7 @@ import os
|
||||
import asyncio
|
||||
from contextlib import suppress
|
||||
|
||||
|
||||
# pylint: disable=too-few-public-methods
|
||||
class BackupThread(QtCore.QThread):
|
||||
def __init__(self, vm):
|
||||
@ -67,7 +68,7 @@ class BackupThread(QtCore.QThread):
|
||||
self.msg = '\n'.join(msg)
|
||||
|
||||
|
||||
class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard):
|
||||
class BackupVMsWindow(ui_backupdlg.Ui_Backup, QtWidgets.QWizard):
|
||||
def __init__(self, qt_app, qubes_app, dispatcher, parent=None):
|
||||
super(BackupVMsWindow, self).__init__(parent)
|
||||
|
||||
@ -86,34 +87,21 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard):
|
||||
self.select_vms_widget = multiselectwidget.MultiSelectWidget(self)
|
||||
self.verticalLayout.insertWidget(1, self.select_vms_widget)
|
||||
|
||||
self.connect(self, QtCore.SIGNAL("currentIdChanged(int)"),
|
||||
self.current_page_changed)
|
||||
self.connect(self.select_vms_widget,
|
||||
QtCore.SIGNAL("items_removed(PyQt_PyObject)"),
|
||||
self.vms_removed)
|
||||
self.connect(self.select_vms_widget,
|
||||
QtCore.SIGNAL("items_added(PyQt_PyObject)"),
|
||||
self.vms_added)
|
||||
self.dir_line_edit.connect(self.dir_line_edit,
|
||||
QtCore.SIGNAL("textChanged(QString)"),
|
||||
self.backup_location_changed)
|
||||
self.currentIdChanged.connect(self.current_page_changed)
|
||||
self.select_vms_widget.itemsRemoved.connect(self.vms_removed)
|
||||
self.select_vms_widget.itemsAdded.connect(self.vms_added)
|
||||
self.dir_line_edit.textChanged.connect(self.backup_location_changed)
|
||||
|
||||
self.select_vms_page.isComplete = self.has_selected_vms
|
||||
self.select_dir_page.isComplete = self.has_selected_dir_and_pass
|
||||
# FIXME
|
||||
# this causes to run isComplete() twice, I don't know why
|
||||
self.select_vms_page.connect(
|
||||
self.select_vms_widget,
|
||||
QtCore.SIGNAL("selected_changed()"),
|
||||
QtCore.SIGNAL("completeChanged()"))
|
||||
self.passphrase_line_edit.connect(
|
||||
self.passphrase_line_edit,
|
||||
QtCore.SIGNAL("textChanged(QString)"),
|
||||
self.backup_location_changed)
|
||||
self.passphrase_line_edit_verify.connect(
|
||||
self.passphrase_line_edit_verify,
|
||||
QtCore.SIGNAL("textChanged(QString)"),
|
||||
self.backup_location_changed)
|
||||
self.select_vms_widget.selectedChanged.connect(
|
||||
self.select_vms_page.completeChanged.emit)
|
||||
self.passphrase_line_edit.textChanged.connect(
|
||||
self.backup_location_changed)
|
||||
self.passphrase_line_edit_verify.textChanged.connect(
|
||||
self.backup_location_changed)
|
||||
|
||||
self.total_size = 0
|
||||
|
||||
@ -173,8 +161,8 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard):
|
||||
except FileNotFoundError:
|
||||
return
|
||||
except exc.QubesException:
|
||||
QtGui.QMessageBox.information(
|
||||
None, self.tr("Error loading backup profile"),
|
||||
QtWidgets.QMessageBox.information(
|
||||
self, self.tr("Error loading backup profile"),
|
||||
self.tr("Unable to load saved backup profile."))
|
||||
return
|
||||
if not profile_data:
|
||||
@ -216,7 +204,7 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard):
|
||||
|
||||
backup_utils.write_backup_profile(settings, use_temp)
|
||||
|
||||
class VmListItem(QtGui.QListWidgetItem):
|
||||
class VmListItem(QtWidgets.QListWidgetItem):
|
||||
# pylint: disable=too-few-public-methods
|
||||
def __init__(self, vm):
|
||||
self.vm = vm
|
||||
@ -276,33 +264,32 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard):
|
||||
elif self.currentPage() is self.select_dir_page:
|
||||
backup_location = str(self.dir_line_edit.text())
|
||||
if not backup_location:
|
||||
QtGui.QMessageBox.information(
|
||||
None, self.tr("Wait!"),
|
||||
QtWidgets.QMessageBox.information(
|
||||
self, self.tr("Wait!"),
|
||||
self.tr("Enter backup target location first."))
|
||||
return False
|
||||
if self.appvm_combobox.currentText() == "dom0" \
|
||||
and not os.path.isdir(backup_location):
|
||||
QtGui.QMessageBox.information(
|
||||
None, self.tr("Wait!"),
|
||||
QtWidgets.QMessageBox.information(
|
||||
self, self.tr("Wait!"),
|
||||
self.tr("Selected directory do not exists or "
|
||||
"not a directory (%s).") % backup_location)
|
||||
return False
|
||||
if not self.passphrase_line_edit.text():
|
||||
QtGui.QMessageBox.information(
|
||||
None, self.tr("Wait!"),
|
||||
QtWidgets.QMessageBox.information(
|
||||
self, self.tr("Wait!"),
|
||||
self.tr("Enter passphrase for backup "
|
||||
"encryption/verification first."))
|
||||
return False
|
||||
if self.passphrase_line_edit.text() !=\
|
||||
self.passphrase_line_edit_verify.text():
|
||||
QtGui.QMessageBox.information(
|
||||
None, self.tr("Wait!"),
|
||||
QtWidgets.QMessageBox.information(
|
||||
self, self.tr("Wait!"),
|
||||
self.tr("Enter the same passphrase in both fields."))
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
@staticmethod
|
||||
def cleanup_temporary_files():
|
||||
try:
|
||||
@ -310,7 +297,7 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard):
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
def current_page_changed(self, page_id): # pylint: disable=unused-argument
|
||||
def current_page_changed(self, page_id): # pylint: disable=unused-argument
|
||||
old_sigchld_handler = signal.signal(signal.SIGCHLD, signal.SIG_DFL)
|
||||
if self.currentPage() is self.confirm_page:
|
||||
|
||||
@ -347,7 +334,7 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard):
|
||||
def backup_finished(self):
|
||||
if self.thread.msg:
|
||||
self.progress_status.setText(self.tr("Backup error."))
|
||||
QtGui.QMessageBox.warning(
|
||||
QtWidgets.QMessageBox.warning(
|
||||
self, self.tr("Backup error!"),
|
||||
self.tr("ERROR: {}").format(
|
||||
self.thread.msg))
|
||||
@ -383,7 +370,7 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard):
|
||||
'dom0', 'admin.backup.Cancel',
|
||||
backup_utils.get_profile_name(True))
|
||||
self.thread.wait()
|
||||
QtGui.QMessageBox.warning(
|
||||
QtWidgets.QMessageBox.warning(
|
||||
self, self.tr("Backup aborted!"),
|
||||
self.tr("ERROR: {}").format("Aborted!"))
|
||||
|
||||
@ -403,7 +390,7 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard):
|
||||
|
||||
def backup_location_changed(self, new_dir=None):
|
||||
# pylint: disable=unused-argument
|
||||
self.select_dir_page.emit(QtCore.SIGNAL("completeChanged()"))
|
||||
self.select_dir_page.completeChanged.emit()
|
||||
|
||||
|
||||
# Bases on the original code by:
|
||||
@ -414,7 +401,7 @@ def handle_exception(exc_type, exc_value, exc_traceback):
|
||||
filename = os.path.basename(filename)
|
||||
error = "%s: %s" % (exc_type.__name__, exc_value)
|
||||
|
||||
QtGui.QMessageBox.critical(
|
||||
QtWidgets.QMessageBox.critical(
|
||||
None,
|
||||
"Houston, we have a problem...",
|
||||
"Whoops. A critical error has occured. This is most likely a bug "
|
||||
@ -422,6 +409,7 @@ def handle_exception(exc_type, exc_value, exc_traceback):
|
||||
error + "at <b>line %d</b> of file <b>%s</b>.<br/><br/>"
|
||||
% (line, filename))
|
||||
|
||||
|
||||
def loop_shutdown():
|
||||
pending = asyncio.Task.all_tasks()
|
||||
for task in pending:
|
||||
@ -430,7 +418,7 @@ def loop_shutdown():
|
||||
|
||||
|
||||
def main():
|
||||
qt_app = QtGui.QApplication(sys.argv)
|
||||
qt_app = QtWidgets.QApplication(sys.argv)
|
||||
qt_app.setOrganizationName("The Qubes Project")
|
||||
qt_app.setOrganizationDomain("http://qubes-os.org")
|
||||
qt_app.setApplicationName("Qubes Backup VMs")
|
||||
@ -452,7 +440,7 @@ def main():
|
||||
asyncio.ensure_future(dispatcher.listen_for_events()))
|
||||
except asyncio.CancelledError:
|
||||
pass
|
||||
except Exception: # pylint: disable=broad-except
|
||||
except Exception: # pylint: disable=broad-except
|
||||
loop_shutdown()
|
||||
exc_type, exc_value, exc_traceback = sys.exc_info()[:3]
|
||||
handle_exception(exc_type, exc_value, exc_traceback)
|
||||
|
@ -21,8 +21,7 @@
|
||||
import re
|
||||
import socket
|
||||
|
||||
from PyQt4 import QtGui # pylint: disable=import-error
|
||||
from PyQt4 import QtCore # pylint: disable=import-error
|
||||
from PyQt5 import QtWidgets # pylint: disable=import-error
|
||||
|
||||
import subprocess
|
||||
from . import utils
|
||||
@ -76,7 +75,7 @@ def select_path_button_clicked(dialog, select_file=False, read_only=False):
|
||||
vm = dialog.qubes_app.domains[new_appvm]
|
||||
try:
|
||||
if vm.name == socket.gethostname():
|
||||
file_dialog = QtGui.QFileDialog()
|
||||
file_dialog = QtWidgets.QFileDialog()
|
||||
file_dialog.setReadOnly(True)
|
||||
|
||||
if select_file:
|
||||
@ -94,8 +93,8 @@ def select_path_button_clicked(dialog, select_file=False, read_only=False):
|
||||
else "qubes.SelectDirectory")
|
||||
except subprocess.CalledProcessError:
|
||||
if not read_only:
|
||||
QtGui.QMessageBox.warning(
|
||||
None,
|
||||
QtWidgets.QMessageBox.warning(
|
||||
dialog,
|
||||
dialog.tr("Nothing selected!"),
|
||||
dialog.tr("No file or directory selected."))
|
||||
else:
|
||||
@ -105,7 +104,7 @@ def select_path_button_clicked(dialog, select_file=False, read_only=False):
|
||||
dialog.dir_line_edit.setText(new_path)
|
||||
|
||||
if new_path and backup_location and not read_only:
|
||||
dialog.select_dir_page.emit(QtCore.SIGNAL("completeChanged()"))
|
||||
dialog.select_dir_page.completeChanged.emit()
|
||||
|
||||
|
||||
def get_profile_name(use_temp):
|
||||
|
@ -21,12 +21,13 @@ import sys
|
||||
import subprocess
|
||||
from . import utils
|
||||
from . import ui_bootfromdevice # pylint: disable=no-name-in-module
|
||||
from PyQt4 import QtGui, QtCore # pylint: disable=import-error
|
||||
from PyQt5 import QtWidgets # pylint: disable=import-error
|
||||
from qubesadmin import tools
|
||||
from qubesadmin.tools import qvm_start
|
||||
|
||||
|
||||
class VMBootFromDeviceWindow(ui_bootfromdevice.Ui_BootDialog, QtGui.QDialog):
|
||||
class VMBootFromDeviceWindow(ui_bootfromdevice.Ui_BootDialog,
|
||||
QtWidgets.QDialog):
|
||||
def __init__(self, vm, qapp, parent=None):
|
||||
super(VMBootFromDeviceWindow, self).__init__(parent)
|
||||
|
||||
@ -37,11 +38,8 @@ class VMBootFromDeviceWindow(ui_bootfromdevice.Ui_BootDialog, QtGui.QDialog):
|
||||
self.setWindowTitle(
|
||||
self.tr("Boot {vm} from device").format(vm=self.vm.name))
|
||||
|
||||
self.connect(
|
||||
self.buttonBox,
|
||||
QtCore.SIGNAL("accepted()"),
|
||||
self.save_and_apply)
|
||||
self.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), self.reject)
|
||||
self.buttonBox.accepted.connect(self.save_and_apply)
|
||||
self.buttonBox.rejected.connect(self.reject)
|
||||
|
||||
# populate buttons and such
|
||||
self.__init_buttons__()
|
||||
@ -59,8 +57,8 @@ class VMBootFromDeviceWindow(ui_bootfromdevice.Ui_BootDialog, QtGui.QDialog):
|
||||
self.vm_list[self.fileVM.currentIndex()]) + \
|
||||
":" + self.pathText.text()
|
||||
else:
|
||||
QtGui.QMessageBox.warning(
|
||||
None,
|
||||
QtWidgets.QMessageBox.warning(
|
||||
self,
|
||||
self.tr("ERROR!"),
|
||||
self.tr("No file or block device selected; please select one."))
|
||||
return
|
||||
@ -74,8 +72,8 @@ class VMBootFromDeviceWindow(ui_bootfromdevice.Ui_BootDialog, QtGui.QDialog):
|
||||
|
||||
def __warn_if_running__(self):
|
||||
if self.vm.is_running():
|
||||
QtGui.QMessageBox.warning(
|
||||
None,
|
||||
QtWidgets.QMessageBox.warning(
|
||||
self,
|
||||
self.tr("Warning!"),
|
||||
self.tr("Qube must be turned off before booting it from "
|
||||
"device. Please turn off the qube.")
|
||||
@ -102,7 +100,7 @@ class VMBootFromDeviceWindow(ui_bootfromdevice.Ui_BootDialog, QtGui.QDialog):
|
||||
self.vm,
|
||||
None,
|
||||
[device for domain in self.vm.app.domains
|
||||
for device in domain.devices["block"]],
|
||||
for device in domain.devices["block"]],
|
||||
None,
|
||||
None,
|
||||
allow_default=False, allow_none=False
|
||||
@ -134,7 +132,7 @@ def main(args=None):
|
||||
args = parser.parse_args(args)
|
||||
vm = args.domains.pop()
|
||||
|
||||
qapp = QtGui.QApplication(sys.argv)
|
||||
qapp = QtWidgets.QApplication(sys.argv)
|
||||
qapp.setOrganizationName('Invisible Things Lab')
|
||||
qapp.setOrganizationDomain("https://www.qubes-os.org/")
|
||||
qapp.setApplicationName("Boot Qube From Device")
|
||||
@ -148,5 +146,6 @@ def main(args=None):
|
||||
qapp.exec_()
|
||||
qapp.exit()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/python2
|
||||
# pylint: skip-file
|
||||
#!/usr/bin/python3
|
||||
#
|
||||
# The Qubes OS Project, http://www.qubes-os.org
|
||||
#
|
||||
@ -26,51 +25,63 @@ import os
|
||||
import fcntl
|
||||
from math import log
|
||||
|
||||
from PyQt4.QtGui import QApplication
|
||||
# pylint: disable=import-error
|
||||
from PyQt5.QtWidgets import QApplication, QMessageBox
|
||||
|
||||
APPVIEWER_LOCK = "/var/run/qubes/appviewer.lock"
|
||||
CLIPBOARD_CONTENTS = "/var/run/qubes/qubes-clipboard.bin"
|
||||
CLIPBOARD_SOURCE = CLIPBOARD_CONTENTS + ".source"
|
||||
|
||||
|
||||
def do_dom0_copy():
|
||||
copy_text_to_qubes_clipboard(QApplication.clipboard().text())
|
||||
|
||||
|
||||
def copy_text_to_qubes_clipboard(text):
|
||||
#inter-appviewer lock
|
||||
# inter-appviewer lock
|
||||
|
||||
try:
|
||||
fd = os.open(APPVIEWER_LOCK, os.O_RDWR|os.O_CREAT, 0o0666)
|
||||
except:
|
||||
QMessageBox.warning(None, "Warning!", "Error while accessing Qubes clipboard!")
|
||||
file = os.open(APPVIEWER_LOCK, os.O_RDWR | os.O_CREAT, 0o0666)
|
||||
except Exception: # pylint: disable=broad-except
|
||||
QMessageBox.warning(None, "Warning!",
|
||||
"Error while accessing Qubes clipboard!")
|
||||
else:
|
||||
try:
|
||||
fcntl.flock(fd, fcntl.LOCK_EX)
|
||||
except:
|
||||
QMessageBox.warning(None, "Warning!", "Error while locking Qubes clipboard!")
|
||||
fcntl.flock(file, fcntl.LOCK_EX)
|
||||
except Exception: # pylint: disable=broad-except
|
||||
QMessageBox.warning(None, "Warning!",
|
||||
"Error while locking Qubes clipboard!")
|
||||
else:
|
||||
try:
|
||||
with open(CLIPBOARD_CONTENTS, "w") as contents:
|
||||
contents.write(text)
|
||||
with open(CLIPBOARD_SOURCE, "w") as source:
|
||||
source.write("dom0")
|
||||
except:
|
||||
QMessageBox.warning(None, "Warning!", "Error while writing to Qubes clipboard!")
|
||||
fcntl.flock(fd, fcntl.LOCK_UN)
|
||||
os.close(fd)
|
||||
except Exception: # pylint: disable=broad-except
|
||||
QMessageBox.warning(None, "Warning!",
|
||||
"Error while writing to Qubes clipboard!")
|
||||
fcntl.flock(file, fcntl.LOCK_UN)
|
||||
os.close(file)
|
||||
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
def get_qubes_clipboard_formatted_size():
|
||||
units = ['B', 'KiB', 'MiB', 'GiB']
|
||||
|
||||
try:
|
||||
file_size = os.path.getsize(CLIPBOARD_CONTENTS)
|
||||
except:
|
||||
QMessageBox.warning(None, "Warning!", "Error while accessing Qubes clipboard!")
|
||||
except Exception: # pylint: disable=broad-except
|
||||
QMessageBox.warning(None, "Warning!",
|
||||
"Error while accessing Qubes clipboard!")
|
||||
else:
|
||||
formatted_bytes = '1 byte' if file_size == 1 else str(file_size) + ' bytes'
|
||||
formatted_bytes = '1 byte' if file_size == 1 \
|
||||
else str(file_size) + ' bytes'
|
||||
if file_size > 0:
|
||||
magnitude = min(int(log(file_size)/log(2)*0.1), len(units)-1)
|
||||
if magnitude > 0:
|
||||
return '%s (%.1f %s)' % (formatted_bytes, file_size/(2.0**(10*magnitude)), units[magnitude])
|
||||
return '%s' % (formatted_bytes)
|
||||
return '%s (%.1f %s)' % (formatted_bytes,
|
||||
file_size/(2.0**(10*magnitude)),
|
||||
units[magnitude])
|
||||
return '%s' % formatted_bytes
|
||||
|
||||
return '? bytes'
|
||||
|
@ -20,7 +20,7 @@
|
||||
#
|
||||
|
||||
|
||||
from PyQt4 import QtCore, QtGui # pylint: disable=import-error
|
||||
from PyQt5 import QtCore, QtWidgets # pylint: disable=import-error
|
||||
from contextlib import contextmanager
|
||||
|
||||
from qubesadmin import exc
|
||||
@ -29,10 +29,10 @@ from qubesadmin import exc
|
||||
@contextmanager
|
||||
def busy_cursor():
|
||||
try:
|
||||
QtGui.QApplication.setOverrideCursor(QtCore.Qt.BusyCursor)
|
||||
QtWidgets.QApplication.setOverrideCursor(QtCore.Qt.BusyCursor)
|
||||
yield
|
||||
finally:
|
||||
QtGui.QApplication.restoreOverrideCursor()
|
||||
QtWidgets.QApplication.restoreOverrideCursor()
|
||||
|
||||
|
||||
# pylint: disable=too-few-public-methods
|
||||
|
@ -24,7 +24,7 @@
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
from PyQt4 import QtCore, QtGui # pylint: disable=import-error
|
||||
from PyQt5 import QtCore, QtWidgets, QtGui # pylint: disable=import-error
|
||||
|
||||
import qubesadmin
|
||||
import qubesadmin.tools
|
||||
@ -34,6 +34,7 @@ from . import utils
|
||||
|
||||
from .ui_newappvmdlg import Ui_NewVMDlg # pylint: disable=import-error
|
||||
|
||||
|
||||
# pylint: disable=too-few-public-methods
|
||||
class CreateVMThread(QtCore.QThread):
|
||||
def __init__(self, app, vmclass, name, label, template, properties):
|
||||
@ -59,8 +60,9 @@ class CreateVMThread(QtCore.QThread):
|
||||
for k, v in self.properties.items():
|
||||
setattr(vm, k, v)
|
||||
else:
|
||||
vm = self.app.add_new_vm(self.vmclass,
|
||||
name=self.name, label=self.label, template=self.template)
|
||||
vm = self.app.add_new_vm(
|
||||
self.vmclass, name=self.name,
|
||||
label=self.label, template=self.template)
|
||||
for k, v in self.properties.items():
|
||||
setattr(vm, k, v)
|
||||
|
||||
@ -70,7 +72,7 @@ class CreateVMThread(QtCore.QThread):
|
||||
self.msg = repr(ex)
|
||||
|
||||
|
||||
class NewVmDlg(QtGui.QDialog, Ui_NewVMDlg):
|
||||
class NewVmDlg(QtWidgets.QDialog, Ui_NewVMDlg):
|
||||
def __init__(self, qtapp, app, parent=None):
|
||||
super(NewVmDlg, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
@ -111,7 +113,8 @@ class NewVmDlg(QtGui.QDialog, Ui_NewVMDlg):
|
||||
self.name.setFocus()
|
||||
|
||||
if not self.template_list:
|
||||
QtGui.QMessageBox.warning(None,
|
||||
QtWidgets.QMessageBox.warning(
|
||||
self,
|
||||
self.tr('No template available!'),
|
||||
self.tr('Cannot create a qube when no template exists.'))
|
||||
|
||||
@ -140,7 +143,8 @@ class NewVmDlg(QtGui.QDialog, Ui_NewVMDlg):
|
||||
except LookupError:
|
||||
pass
|
||||
else:
|
||||
QtGui.QMessageBox.warning(None,
|
||||
QtWidgets.QMessageBox.warning(
|
||||
self,
|
||||
self.tr('Incorrect qube name!'),
|
||||
self.tr('A qube with the name <b>{}</b> already exists in the '
|
||||
'system!').format(name))
|
||||
@ -153,20 +157,19 @@ class NewVmDlg(QtGui.QDialog, Ui_NewVMDlg):
|
||||
else:
|
||||
template = self.template_list[self.template_vm.currentIndex()]
|
||||
|
||||
properties = {}
|
||||
properties['provides_network'] = self.provides_network.isChecked()
|
||||
properties = {'provides_network': self.provides_network.isChecked()}
|
||||
if self.netvm.currentIndex() != 0:
|
||||
properties['netvm'] = self.netvm_list[self.netvm.currentIndex()]
|
||||
if self.install_system.isChecked():
|
||||
properties['virt_mode'] = 'hvm'
|
||||
properties['kernel'] = None
|
||||
|
||||
self.thread = CreateVMThread(self.app, vmclass, name, label,
|
||||
template, properties)
|
||||
self.thread = CreateVMThread(
|
||||
self.app, vmclass, name, label, template, properties)
|
||||
self.thread.finished.connect(self.create_finished)
|
||||
self.thread.start()
|
||||
|
||||
self.progress = QtGui.QProgressDialog(
|
||||
self.progress = QtWidgets.QProgressDialog(
|
||||
self.tr("Creating new qube <b>{}</b>...").format(name), "", 0, 0)
|
||||
self.progress.setCancelButton(None)
|
||||
self.progress.setModal(True)
|
||||
@ -176,7 +179,8 @@ class NewVmDlg(QtGui.QDialog, Ui_NewVMDlg):
|
||||
self.progress.hide()
|
||||
|
||||
if self.thread.msg:
|
||||
QtGui.QMessageBox.warning(None,
|
||||
QtWidgets.QMessageBox.warning(
|
||||
self,
|
||||
self.tr("Error creating the qube!"),
|
||||
self.tr("ERROR: {}").format(self.thread.msg))
|
||||
|
||||
@ -185,12 +189,11 @@ class NewVmDlg(QtGui.QDialog, Ui_NewVMDlg):
|
||||
if not self.thread.msg:
|
||||
if self.launch_settings.isChecked():
|
||||
subprocess.check_call(['qubes-vm-settings',
|
||||
str(self.name.text())])
|
||||
str(self.name.text())])
|
||||
if self.install_system.isChecked():
|
||||
subprocess.check_call(
|
||||
['qubes-vm-boot-from-device', str(self.name.text())])
|
||||
|
||||
|
||||
def type_change(self):
|
||||
# AppVM
|
||||
if self.vm_type.currentIndex() == 0:
|
||||
@ -221,12 +224,14 @@ class NewVmDlg(QtGui.QDialog, Ui_NewVMDlg):
|
||||
if self.launch_settings.isChecked() and self.install_system.isEnabled():
|
||||
self.install_system.setChecked(False)
|
||||
|
||||
|
||||
parser = qubesadmin.tools.QubesArgumentParser()
|
||||
|
||||
|
||||
def main(args=None):
|
||||
args = parser.parse_args(args)
|
||||
|
||||
qtapp = QtGui.QApplication(sys.argv)
|
||||
qtapp = QtWidgets.QApplication(sys.argv)
|
||||
qtapp.setOrganizationName('Invisible Things Lab')
|
||||
qtapp.setOrganizationDomain('https://www.qubes-os.org/')
|
||||
qtapp.setApplicationName('Create qube')
|
||||
|
@ -18,10 +18,10 @@
|
||||
#
|
||||
|
||||
from . import ui_devicelist # pylint: disable=no-name-in-module
|
||||
from PyQt4 import QtGui, QtCore # pylint: disable=import-error
|
||||
from PyQt5 import QtWidgets # pylint: disable=import-error
|
||||
|
||||
|
||||
class PCIDeviceListWindow(ui_devicelist.Ui_Dialog, QtGui.QDialog):
|
||||
class PCIDeviceListWindow(ui_devicelist.Ui_Dialog, QtWidgets.QDialog):
|
||||
def __init__(self, vm, qapp, dev_list, no_strict_reset_list, parent=None):
|
||||
super(PCIDeviceListWindow, self).__init__(parent)
|
||||
|
||||
@ -32,10 +32,8 @@ class PCIDeviceListWindow(ui_devicelist.Ui_Dialog, QtGui.QDialog):
|
||||
|
||||
self.setupUi(self)
|
||||
|
||||
self.connect(
|
||||
self.buttonBox, QtCore.SIGNAL("accepted()"), self.save_and_apply)
|
||||
self.connect(
|
||||
self.buttonBox, QtCore.SIGNAL("rejected()"), self.reject)
|
||||
self.buttonBox.accepted.connect(self.save_and_apply)
|
||||
self.buttonBox.rejected.connect(self.reject)
|
||||
|
||||
self.ident_list = {}
|
||||
self.fill_device_list()
|
||||
|
@ -21,7 +21,7 @@
|
||||
import datetime
|
||||
import re
|
||||
|
||||
from PyQt4 import QtCore, QtGui # pylint: disable=import-error
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets # pylint: disable=import-error
|
||||
import qubesadmin.firewall
|
||||
|
||||
from . import ui_newfwruledlg # pylint: disable=no-name-in-module
|
||||
@ -30,6 +30,7 @@ from . import ui_newfwruledlg # pylint: disable=no-name-in-module
|
||||
class FirewallModifiedOutsideError(ValueError):
|
||||
pass
|
||||
|
||||
|
||||
class QIPAddressValidator(QtGui.QValidator):
|
||||
# pylint: disable=too-few-public-methods
|
||||
def __init__(self, parent=None):
|
||||
@ -40,10 +41,10 @@ class QIPAddressValidator(QtGui.QValidator):
|
||||
hostname = str(input_string)
|
||||
|
||||
if len(hostname) > 255 or not hostname:
|
||||
return (QtGui.QValidator.Intermediate, input_string, pos)
|
||||
return QtGui.QValidator.Intermediate, input_string, pos
|
||||
|
||||
if hostname == "*":
|
||||
return (QtGui.QValidator.Acceptable, input_string, pos)
|
||||
return QtGui.QValidator.Acceptable, input_string, pos
|
||||
|
||||
unmask = hostname.split("/", 1)
|
||||
if len(unmask) == 2:
|
||||
@ -51,27 +52,28 @@ class QIPAddressValidator(QtGui.QValidator):
|
||||
mask = unmask[1]
|
||||
if mask.isdigit() or mask == "":
|
||||
if re.match(r"^([0-9]{1,3}\.){3}[0-9]{1,3}$", hostname) is None:
|
||||
return (QtGui.QValidator.Invalid, input_string, pos)
|
||||
return QtGui.QValidator.Invalid, input_string, pos
|
||||
if mask != "":
|
||||
mask = int(unmask[1])
|
||||
if mask < 0 or mask > 32:
|
||||
return (QtGui.QValidator.Invalid, input_string, pos)
|
||||
return QtGui.QValidator.Invalid, input_string, pos
|
||||
else:
|
||||
return (QtGui.QValidator.Invalid, input_string, pos)
|
||||
return QtGui.QValidator.Invalid, input_string, pos
|
||||
|
||||
if hostname[-1:] == ".":
|
||||
hostname = hostname[:-1]
|
||||
|
||||
if hostname[-1:] == "-":
|
||||
return (QtGui.QValidator.Intermediate, input_string, pos)
|
||||
return QtGui.QValidator.Intermediate, input_string, pos
|
||||
|
||||
allowed = re.compile(r"(?!-)[A-Z\d-]{1,63}(?<!-)$", re.IGNORECASE)
|
||||
if all(allowed.match(x) for x in hostname.split(".")):
|
||||
return (QtGui.QValidator.Acceptable, input_string, pos)
|
||||
return QtGui.QValidator.Acceptable, input_string, pos
|
||||
|
||||
return (QtGui.QValidator.Invalid, input_string, pos)
|
||||
return QtGui.QValidator.Invalid, input_string, pos
|
||||
|
||||
class NewFwRuleDlg(QtGui.QDialog, ui_newfwruledlg.Ui_NewFwRuleDlg):
|
||||
|
||||
class NewFwRuleDlg(QtWidgets.QDialog, ui_newfwruledlg.Ui_NewFwRuleDlg):
|
||||
def __init__(self, parent=None):
|
||||
super(NewFwRuleDlg, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
@ -84,19 +86,20 @@ class NewFwRuleDlg(QtGui.QDialog, ui_newfwruledlg.Ui_NewFwRuleDlg):
|
||||
QtCore.QRegExp("[a-z][a-z0-9-]+|[0-9]+(-[0-9]+)?",
|
||||
QtCore.Qt.CaseInsensitive), None))
|
||||
self.serviceComboBox.setEnabled(False)
|
||||
self.serviceComboBox.setInsertPolicy(QtGui.QComboBox.InsertAtBottom)
|
||||
self.serviceComboBox.setInsertPolicy(QtWidgets.QComboBox.InsertAtBottom)
|
||||
self.populate_combos()
|
||||
self.serviceComboBox.setInsertPolicy(QtGui.QComboBox.InsertAtTop)
|
||||
self.serviceComboBox.setInsertPolicy(QtWidgets.QComboBox.InsertAtTop)
|
||||
|
||||
def accept(self):
|
||||
if self.tcp_radio.isChecked() or self.udp_radio.isChecked():
|
||||
if not self.serviceComboBox.currentText():
|
||||
msg = QtGui.QMessageBox()
|
||||
msg.warning(self, self.tr("Firewall rule"),
|
||||
msg = QtWidgets.QMessageBox()
|
||||
msg.warning(
|
||||
self, self.tr("Firewall rule"),
|
||||
self.tr("You need to fill service "
|
||||
"name/port for TCP/UDP rule"))
|
||||
return
|
||||
QtGui.QDialog.accept(self)
|
||||
super().accept()
|
||||
|
||||
def populate_combos(self):
|
||||
example_addresses = [
|
||||
@ -122,7 +125,7 @@ class NewFwRuleDlg(QtGui.QDialog, ui_newfwruledlg.Ui_NewFwRuleDlg):
|
||||
self.set_ok_state(True)
|
||||
|
||||
def set_ok_state(self, ok_state):
|
||||
ok_button = self.buttonBox.button(QtGui.QDialogButtonBox.Ok)
|
||||
ok_button = self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok)
|
||||
if ok_button is not None:
|
||||
ok_button.setEnabled(ok_state)
|
||||
|
||||
@ -158,10 +161,10 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
||||
(service["name"], int(service["port"]),))
|
||||
|
||||
self.fw_changed = False
|
||||
self.allow = None # is the default policy allow or deny
|
||||
self.temp_full_access_expire_time = None # temporary full access time
|
||||
self.__vm = None # VM that the model applies to
|
||||
self.__children = None # list of rules in the FW
|
||||
self.allow = None # is the default policy allow or deny
|
||||
self.temp_full_access_expire_time = None # temporary full access time
|
||||
self.__vm = None # VM that the model applies to
|
||||
self.__children = None # list of rules in the FW
|
||||
|
||||
def sort(self, idx, order):
|
||||
rev = (order == QtCore.Qt.AscendingOrder)
|
||||
@ -172,7 +175,6 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
||||
index2 = self.createIndex(len(self) - 1, len(self.__column_names) - 1)
|
||||
self.dataChanged.emit(index1, index2)
|
||||
|
||||
|
||||
def get_service_name(self, port):
|
||||
for service in self.__services:
|
||||
if str(service[1]) == str(port):
|
||||
@ -286,19 +288,19 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
||||
rules.append(rule)
|
||||
|
||||
if not conf['allow']:
|
||||
rules.append(qubesadmin.firewall.Rule(None,
|
||||
action='accept', specialtarget='dns'))
|
||||
rules.append(qubesadmin.firewall.Rule(
|
||||
None, action='accept', specialtarget='dns'))
|
||||
|
||||
if not conf['allow']:
|
||||
rules.append(qubesadmin.firewall.Rule(None,
|
||||
action='accept', proto='icmp'))
|
||||
rules.append(qubesadmin.firewall.Rule(
|
||||
None, action='accept', proto='icmp'))
|
||||
|
||||
if conf['allow']:
|
||||
rules.append(qubesadmin.firewall.Rule(None,
|
||||
action='accept'))
|
||||
rules.append(qubesadmin.firewall.Rule(
|
||||
None, action='accept'))
|
||||
else:
|
||||
rules.append(qubesadmin.firewall.Rule(None,
|
||||
action='drop'))
|
||||
rules.append(qubesadmin.firewall.Rule(
|
||||
None, action='drop'))
|
||||
|
||||
vm.firewall.rules = rules
|
||||
|
||||
@ -329,7 +331,7 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
||||
|
||||
conf = {"allow": allow,
|
||||
"rules": list()
|
||||
}
|
||||
}
|
||||
|
||||
conf['rules'].extend(self.children)
|
||||
|
||||
@ -372,7 +374,8 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
||||
try:
|
||||
rule.dsthost = address
|
||||
except ValueError:
|
||||
QtGui.QMessageBox.warning(None, self.tr("Invalid address"),
|
||||
QtWidgets.QMessageBox.warning(
|
||||
dialog, self.tr("Invalid address"),
|
||||
self.tr("Address '{0}' is invalid.").format(address))
|
||||
return
|
||||
|
||||
@ -385,11 +388,11 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
||||
try:
|
||||
rule.dstports = service
|
||||
except ValueError:
|
||||
QtGui.QMessageBox.warning(
|
||||
None,
|
||||
QtWidgets.QMessageBox.warning(
|
||||
dialog,
|
||||
self.tr("Invalid port or service"),
|
||||
self.tr("Port number or service '{0}' is invalid.")
|
||||
.format(service))
|
||||
self.tr("Port number or service '{0}' is "
|
||||
"invalid.").format(service))
|
||||
return
|
||||
elif service:
|
||||
try:
|
||||
@ -398,10 +401,12 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
||||
if self.get_service_port(service) is not None:
|
||||
rule.dstports = self.get_service_port(service)
|
||||
else:
|
||||
QtGui.QMessageBox.warning(None,
|
||||
QtWidgets.QMessageBox.warning(
|
||||
dialog,
|
||||
self.tr("Invalid port or service"),
|
||||
self.tr("Port number or service '{0}' is invalid.")
|
||||
.format(service))
|
||||
self.tr(
|
||||
"Port number or service '{0}' is "
|
||||
"invalid.".format(service)))
|
||||
return
|
||||
|
||||
if row is not None:
|
||||
@ -415,7 +420,7 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
||||
|
||||
return self.createIndex(row, column, self.children[row])
|
||||
|
||||
def parent(self, child): # pylint: disable=unused-argument,no-self-use
|
||||
def parent(self, child): # pylint: disable=unused-argument,no-self-use
|
||||
return QtCore.QModelIndex()
|
||||
|
||||
# pylint: disable=invalid-name,unused-argument
|
||||
|
@ -24,7 +24,7 @@ import sys
|
||||
import os
|
||||
import os.path
|
||||
import traceback
|
||||
from PyQt4 import QtCore, QtGui # pylint: disable=import-error
|
||||
from PyQt5 import QtWidgets # pylint: disable=import-error
|
||||
|
||||
from qubesadmin import Qubes
|
||||
from qubesadmin.utils import parse_size
|
||||
@ -36,9 +36,10 @@ from configparser import ConfigParser
|
||||
|
||||
qmemman_config_path = '/etc/qubes/qmemman.conf'
|
||||
|
||||
|
||||
# pylint: disable=too-many-instance-attributes
|
||||
class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
|
||||
QtGui.QDialog):
|
||||
QtWidgets.QDialog):
|
||||
|
||||
def __init__(self, app, qvm_collection, parent=None):
|
||||
super(GlobalSettingsWindow, self).__init__(parent)
|
||||
@ -48,11 +49,8 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
|
||||
|
||||
self.setupUi(self)
|
||||
|
||||
self.connect(
|
||||
self.buttonBox,
|
||||
QtCore.SIGNAL("accepted()"),
|
||||
self.save_and_apply)
|
||||
self.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), self.reject)
|
||||
self.buttonBox.accepted.connect(self.save_and_apply)
|
||||
self.buttonBox.rejected.connect(self.reject)
|
||||
|
||||
self.__init_system_defaults__()
|
||||
self.__init_kernel_defaults__()
|
||||
@ -154,10 +152,10 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
|
||||
self.kernels_list[self.default_kernel_combo.currentIndex()]
|
||||
|
||||
def __init_mem_defaults__(self):
|
||||
#qmemman settings
|
||||
# qmemman settings
|
||||
self.qmemman_config = ConfigParser()
|
||||
self.vm_min_mem_val = '200MiB' #str(qmemman_algo.MIN_PREFMEM)
|
||||
self.dom0_mem_boost_val = '350MiB' #str(qmemman_algo.DOM0_MEM_BOOST)
|
||||
self.vm_min_mem_val = '200MiB' # str(qmemman_algo.MIN_PREFMEM)
|
||||
self.dom0_mem_boost_val = '350MiB' # str(qmemman_algo.DOM0_MEM_BOOST)
|
||||
|
||||
self.qmemman_config.read(qmemman_config_path)
|
||||
if self.qmemman_config.has_section('global'):
|
||||
@ -172,10 +170,9 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
|
||||
self.min_vm_mem.setValue(self.vm_min_mem_val/1024/1024)
|
||||
self.dom0_mem_boost.setValue(self.dom0_mem_boost_val/1024/1024)
|
||||
|
||||
|
||||
def __apply_mem_defaults__(self):
|
||||
|
||||
#qmemman settings
|
||||
# qmemman settings
|
||||
current_min_vm_mem = self.min_vm_mem.value()
|
||||
current_dom0_mem_boost = self.dom0_mem_boost.value()
|
||||
|
||||
@ -186,7 +183,7 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
|
||||
current_dom0_mem_boost = str(current_dom0_mem_boost)+'MiB'
|
||||
|
||||
if not self.qmemman_config.has_section('global'):
|
||||
#add the whole section
|
||||
# add the whole section
|
||||
self.qmemman_config.add_section('global')
|
||||
self.qmemman_config.set(
|
||||
'global', 'vm-min-mem', current_min_vm_mem)
|
||||
@ -201,7 +198,7 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
|
||||
qmemman_config_file.close()
|
||||
|
||||
else:
|
||||
#If there already is a 'global' section, we don't use
|
||||
# If there already is a 'global' section, we don't use
|
||||
# SafeConfigParser.write() - it would get rid of
|
||||
# all the comments...
|
||||
|
||||
@ -209,7 +206,7 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
|
||||
lines_to_add['vm-min-mem'] = \
|
||||
"vm-min-mem = " + current_min_vm_mem + "\n"
|
||||
lines_to_add['dom0-mem-boost'] = \
|
||||
"dom0-mem-boost = " + current_dom0_mem_boost +"\n"
|
||||
"dom0-mem-boost = " + current_dom0_mem_boost + "\n"
|
||||
|
||||
config_lines = []
|
||||
|
||||
@ -252,23 +249,23 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
|
||||
self.disable_updates_all.clicked.connect(self.__disable_updates_all)
|
||||
|
||||
def __enable_updates_all(self):
|
||||
reply = QtGui.QMessageBox.question(
|
||||
reply = QtWidgets.QMessageBox.question(
|
||||
self, self.tr("Change state of all qubes"),
|
||||
self.tr("Are you sure you want to set all qubes to check "
|
||||
"for updates?"),
|
||||
QtGui.QMessageBox.Yes | QtGui.QMessageBox.Cancel)
|
||||
if reply == QtGui.QMessageBox.Cancel:
|
||||
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.Cancel)
|
||||
if reply == QtWidgets.QMessageBox.Cancel:
|
||||
return
|
||||
|
||||
self.__set_updates_all(True)
|
||||
|
||||
def __disable_updates_all(self):
|
||||
reply = QtGui.QMessageBox.question(
|
||||
reply = QtWidgets.QMessageBox.question(
|
||||
self, self.tr("Change state of all qubes"),
|
||||
self.tr("Are you sure you want to set all qubes to not check "
|
||||
"for updates?"),
|
||||
QtGui.QMessageBox.Yes | QtGui.QMessageBox.Cancel)
|
||||
if reply == QtGui.QMessageBox.Cancel:
|
||||
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.Cancel)
|
||||
if reply == QtWidgets.QMessageBox.Cancel:
|
||||
return
|
||||
|
||||
self.__set_updates_all(False)
|
||||
@ -298,7 +295,6 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
|
||||
self.__apply_updates__()
|
||||
|
||||
|
||||
|
||||
# Bases on the original code by:
|
||||
# Copyright (c) 2002-2007 Pascal Varet <p.varet@gmail.com>
|
||||
|
||||
@ -307,7 +303,7 @@ def handle_exception(exc_type, exc_value, exc_traceback):
|
||||
filename = os.path.basename(filename)
|
||||
error = "%s: %s" % (exc_type.__name__, exc_value)
|
||||
|
||||
QtGui.QMessageBox.critical(
|
||||
QtWidgets.QMessageBox.critical(
|
||||
None,
|
||||
"Houston, we have a problem...",
|
||||
"Whoops. A critical error has occured. This is most likely a bug "
|
||||
@ -317,7 +313,7 @@ def handle_exception(exc_type, exc_value, exc_traceback):
|
||||
|
||||
|
||||
def main():
|
||||
qtapp = QtGui.QApplication(sys.argv)
|
||||
qtapp = QtWidgets.QApplication(sys.argv)
|
||||
qtapp.setOrganizationName("The Qubes Project")
|
||||
qtapp.setOrganizationDomain("http://qubes-os.org")
|
||||
qtapp.setApplicationName("Qubes Global Settings")
|
||||
@ -333,5 +329,6 @@ def main():
|
||||
qtapp.exec_()
|
||||
qtapp.exit()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
@ -20,7 +20,7 @@
|
||||
# with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#
|
||||
from PyQt4.QtGui import QDialog # pylint: disable=import-error
|
||||
from PyQt5.QtWidgets import QDialog # pylint: disable=import-error
|
||||
|
||||
from . import ui_informationnotes # pylint: disable=no-name-in-module
|
||||
import subprocess
|
||||
|
@ -20,8 +20,7 @@
|
||||
#
|
||||
#
|
||||
import sys
|
||||
from PyQt4 import QtCore # pylint: disable=import-error
|
||||
from PyQt4 import QtGui # pylint: disable=import-error
|
||||
from PyQt5 import QtWidgets # pylint: disable=import-error
|
||||
|
||||
from . import ui_logdlg # pylint: disable=no-name-in-module
|
||||
from . import clipboard
|
||||
@ -33,7 +32,7 @@ from qubesadmin import Qubes
|
||||
LOG_DISPLAY_SIZE = 1024*1024
|
||||
|
||||
|
||||
class LogDialog(ui_logdlg.Ui_LogDialog, QtGui.QDialog):
|
||||
class LogDialog(ui_logdlg.Ui_LogDialog, QtWidgets.QDialog):
|
||||
# pylint: disable=too-few-public-methods
|
||||
|
||||
def __init__(self, app, log_path, parent=None):
|
||||
@ -45,9 +44,10 @@ class LogDialog(ui_logdlg.Ui_LogDialog, QtGui.QDialog):
|
||||
self.setupUi(self)
|
||||
self.setWindowTitle(log_path)
|
||||
|
||||
self.connect(self.copy_to_qubes_clipboard,
|
||||
QtCore.SIGNAL("clicked()"),
|
||||
self.copy_to_clipboard_triggered)
|
||||
self.copy_to_qubes_clipboard.clicked.connect(
|
||||
self.copy_to_clipboard_triggered)
|
||||
self.copy_to_qubes_clipboard.clicked.connect(
|
||||
self.copy_to_clipboard_triggered)
|
||||
|
||||
self.__init_log_text__()
|
||||
|
||||
@ -64,6 +64,7 @@ class LogDialog(ui_logdlg.Ui_LogDialog, QtGui.QDialog):
|
||||
self.displayed_text += log.read()
|
||||
log.close()
|
||||
self.log_text.setPlainText(self.displayed_text)
|
||||
self.log_text.show()
|
||||
|
||||
def copy_to_clipboard_triggered(self):
|
||||
clipboard.copy_text_to_qubes_clipboard(self.displayed_text)
|
||||
@ -71,7 +72,7 @@ class LogDialog(ui_logdlg.Ui_LogDialog, QtGui.QDialog):
|
||||
|
||||
def main():
|
||||
qubes_app = Qubes()
|
||||
qt_app = QtGui.QApplication(sys.argv)
|
||||
qt_app = QtWidgets.QApplication(sys.argv)
|
||||
|
||||
log_window = LogDialog(qubes_app, sys.argv[1])
|
||||
log_window.show()
|
||||
|
@ -1,12 +1,13 @@
|
||||
from PyQt4 import QtCore, QtGui # pylint: disable=import-error
|
||||
from . import ui_multiselectwidget # pylint: disable=no-name-in-module
|
||||
from PyQt5 import QtCore, QtWidgets # pylint: disable=import-error
|
||||
from . import ui_multiselectwidget # pylint: disable=no-name-in-module
|
||||
|
||||
|
||||
class MultiSelectWidget(
|
||||
ui_multiselectwidget.Ui_MultiSelectWidget, QtGui.QWidget):
|
||||
ui_multiselectwidget.Ui_MultiSelectWidget, QtWidgets.QWidget):
|
||||
|
||||
__pyqtSignals__ = ("selected_changed()",)
|
||||
__pyqtSignals__ = ("items_added(PyQt_PyObject)",)
|
||||
__pyqtSignals__ = ("items_removed(PyQt_PyObject)",)
|
||||
selectedChanged = QtCore.pyqtSignal()
|
||||
itemsAdded = QtCore.pyqtSignal(list)
|
||||
itemsRemoved = QtCore.pyqtSignal(list)
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super(MultiSelectWidget, self).__init__(parent)
|
||||
@ -16,9 +17,9 @@ class MultiSelectWidget(
|
||||
self.remove_selected_button.clicked.connect(self.remove_selected)
|
||||
self.remove_all_button.clicked.connect(self.remove_all)
|
||||
self.available_list.setSelectionMode(
|
||||
QtGui.QAbstractItemView.ExtendedSelection)
|
||||
QtWidgets.QAbstractItemView.ExtendedSelection)
|
||||
self.selected_list.setSelectionMode(
|
||||
QtGui.QAbstractItemView.ExtendedSelection)
|
||||
QtWidgets.QAbstractItemView.ExtendedSelection)
|
||||
|
||||
def switch_selected(self, src, dst):
|
||||
selected = src.selectedItems()
|
||||
@ -30,11 +31,11 @@ class MultiSelectWidget(
|
||||
dst.addItem(item)
|
||||
items.append(item)
|
||||
dst.sortItems()
|
||||
self.emit(QtCore.SIGNAL("selected_changed()"))
|
||||
self.selectedChanged.emit()
|
||||
if src is self.selected_list:
|
||||
self.emit(QtCore.SIGNAL("items_removed(PyQt_PyObject)"), items)
|
||||
self.itemsRemoved.emit(items)
|
||||
else:
|
||||
self.emit(QtCore.SIGNAL("items_added(PyQt_PyObject)"), items)
|
||||
self.itemsAdded.emit(items)
|
||||
|
||||
def add_selected(self):
|
||||
self.switch_selected(self.available_list, self.selected_list)
|
||||
@ -49,12 +50,11 @@ class MultiSelectWidget(
|
||||
dst.addItem(item)
|
||||
items.append(item)
|
||||
dst.sortItems()
|
||||
self.emit(QtCore.SIGNAL("selected_changed()"))
|
||||
self.selectedChanged.emit()
|
||||
if src is self.selected_list:
|
||||
self.emit(QtCore.SIGNAL("items_removed(PyQt_PyObject)"), items)
|
||||
self.itemsRemoved.emit(items)
|
||||
else:
|
||||
self.emit(QtCore.SIGNAL("items_added(PyQt_PyObject)"), items)
|
||||
|
||||
self.itemsAdded.emit(items)
|
||||
|
||||
def add_all(self):
|
||||
self.move_all(self.available_list, self.selected_list)
|
||||
|
@ -37,8 +37,7 @@ from qubesadmin import exc
|
||||
from qubesadmin import utils
|
||||
from qubesadmin import events
|
||||
|
||||
from PyQt4 import QtGui # pylint: disable=import-error
|
||||
from PyQt4 import QtCore # pylint: disable=import-error
|
||||
from PyQt5 import QtWidgets, QtCore, QtGui # pylint: disable=import-error
|
||||
|
||||
from qubesmanager.about import AboutDialog
|
||||
|
||||
@ -54,7 +53,7 @@ from . import utils as manager_utils
|
||||
from . import common_threads
|
||||
|
||||
|
||||
class SearchBox(QtGui.QLineEdit):
|
||||
class SearchBox |