Make pylint happy
- fix super-with-arguments - fix various other issues - review broad-except and ignore where appropriate
This commit is contained in:
parent
a2f8ba9418
commit
6f465fc674
@ -31,7 +31,7 @@ from . import ui_about # pylint: disable=no-name-in-module
|
|||||||
# pylint: disable=too-few-public-methods
|
# pylint: disable=too-few-public-methods
|
||||||
class AboutDialog(ui_about.Ui_AboutDialog, QDialog):
|
class AboutDialog(ui_about.Ui_AboutDialog, QDialog):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(AboutDialog, self).__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ from qubesadmin import exc
|
|||||||
# pylint: disable=too-few-public-methods
|
# pylint: disable=too-few-public-methods
|
||||||
class AppListWidgetItem(QtWidgets.QListWidgetItem):
|
class AppListWidgetItem(QtWidgets.QListWidgetItem):
|
||||||
def __init__(self, name, ident, tooltip=None, parent=None):
|
def __init__(self, name, ident, tooltip=None, parent=None):
|
||||||
super(AppListWidgetItem, self).__init__(name, parent)
|
super().__init__(name, parent)
|
||||||
additional_description = ".desktop filename: " + str(ident)
|
additional_description = ".desktop filename: " + str(ident)
|
||||||
if not tooltip:
|
if not tooltip:
|
||||||
tooltip = additional_description
|
tooltip = additional_description
|
||||||
|
@ -70,7 +70,7 @@ class BackupThread(QtCore.QThread):
|
|||||||
|
|
||||||
class BackupVMsWindow(ui_backupdlg.Ui_Backup, QtWidgets.QWizard):
|
class BackupVMsWindow(ui_backupdlg.Ui_Backup, QtWidgets.QWizard):
|
||||||
def __init__(self, qt_app, qubes_app, dispatcher, parent=None):
|
def __init__(self, qt_app, qubes_app, dispatcher, parent=None):
|
||||||
super(BackupVMsWindow, self).__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
||||||
self.qt_app = qt_app
|
self.qt_app = qt_app
|
||||||
self.qubes_app = qubes_app
|
self.qubes_app = qubes_app
|
||||||
|
@ -101,7 +101,7 @@ def select_path_button_clicked(dialog, select_file=False, read_only=False):
|
|||||||
dialog.tr("Unexpected characters in path!"),
|
dialog.tr("Unexpected characters in path!"),
|
||||||
dialog.tr("Backup path can only contain the following "
|
dialog.tr("Backup path can only contain the following "
|
||||||
"special characters: /:.,_+=() -"))
|
"special characters: /:.,_+=() -"))
|
||||||
except Exception as ex:
|
except Exception as ex: # pylint: disable=broad-except
|
||||||
QtWidgets.QMessageBox.warning(
|
QtWidgets.QMessageBox.warning(
|
||||||
dialog,
|
dialog,
|
||||||
dialog.tr("Failed to select path!"),
|
dialog.tr("Failed to select path!"),
|
||||||
|
@ -30,7 +30,7 @@ from qubesadmin import exc
|
|||||||
class VMBootFromDeviceWindow(ui_bootfromdevice.Ui_BootDialog,
|
class VMBootFromDeviceWindow(ui_bootfromdevice.Ui_BootDialog,
|
||||||
QtWidgets.QDialog):
|
QtWidgets.QDialog):
|
||||||
def __init__(self, vm, qapp, qubesapp=None, parent=None):
|
def __init__(self, vm, qapp, qubesapp=None, parent=None):
|
||||||
super(VMBootFromDeviceWindow, self).__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
||||||
self.vm = vm
|
self.vm = vm
|
||||||
self.qapp = qapp
|
self.qapp = qapp
|
||||||
|
@ -38,7 +38,7 @@ from .ui_clonevmdlg import Ui_CloneVMDlg # pylint: disable=import-error
|
|||||||
|
|
||||||
class CloneVMDlg(QtWidgets.QDialog, Ui_CloneVMDlg):
|
class CloneVMDlg(QtWidgets.QDialog, Ui_CloneVMDlg):
|
||||||
def __init__(self, qtapp, app, parent=None, src_vm=None):
|
def __init__(self, qtapp, app, parent=None, src_vm=None):
|
||||||
super(CloneVMDlg, self).__init__(parent)
|
super().__init__(parent)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
|
|
||||||
self.qtapp = qtapp
|
self.qtapp = qtapp
|
||||||
|
@ -56,7 +56,7 @@ class RemoveVMThread(QubesThread):
|
|||||||
# pylint: disable=too-few-public-methods
|
# pylint: disable=too-few-public-methods
|
||||||
class CloneVMThread(QubesThread):
|
class CloneVMThread(QubesThread):
|
||||||
def __init__(self, vm, dst_name, pool=None, label=None):
|
def __init__(self, vm, dst_name, pool=None, label=None):
|
||||||
super(CloneVMThread, self).__init__(vm)
|
super().__init__(vm)
|
||||||
self.dst_name = dst_name
|
self.dst_name = dst_name
|
||||||
self.pool = pool
|
self.pool = pool
|
||||||
self.label = label
|
self.label = label
|
||||||
|
@ -87,7 +87,7 @@ class CreateVMThread(QtCore.QThread):
|
|||||||
|
|
||||||
class NewVmDlg(QtWidgets.QDialog, Ui_NewVMDlg):
|
class NewVmDlg(QtWidgets.QDialog, Ui_NewVMDlg):
|
||||||
def __init__(self, qtapp, app, parent=None):
|
def __init__(self, qtapp, app, parent=None):
|
||||||
super(NewVmDlg, self).__init__(parent)
|
super().__init__(parent)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
|
|
||||||
self.qtapp = qtapp
|
self.qtapp = qtapp
|
||||||
|
@ -23,7 +23,7 @@ from PyQt5 import QtWidgets # pylint: disable=import-error
|
|||||||
|
|
||||||
class PCIDeviceListWindow(ui_devicelist.Ui_Dialog, QtWidgets.QDialog):
|
class PCIDeviceListWindow(ui_devicelist.Ui_Dialog, QtWidgets.QDialog):
|
||||||
def __init__(self, vm, qapp, dev_list, no_strict_reset_list, parent=None):
|
def __init__(self, vm, qapp, dev_list, no_strict_reset_list, parent=None):
|
||||||
super(PCIDeviceListWindow, self).__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
||||||
self.vm = vm
|
self.vm = vm
|
||||||
self.qapp = qapp
|
self.qapp = qapp
|
||||||
|
@ -33,7 +33,7 @@ class FirewallModifiedOutsideError(ValueError):
|
|||||||
|
|
||||||
class NewFwRuleDlg(QtWidgets.QDialog, ui_newfwruledlg.Ui_NewFwRuleDlg):
|
class NewFwRuleDlg(QtWidgets.QDialog, ui_newfwruledlg.Ui_NewFwRuleDlg):
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super(NewFwRuleDlg, self).__init__(parent)
|
super().__init__(parent)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
|
|
||||||
self.set_ok_state(False)
|
self.set_ok_state(False)
|
||||||
|
@ -50,12 +50,12 @@ def _run_qrexec_repo(service, arg=''):
|
|||||||
env=env
|
env=env
|
||||||
)
|
)
|
||||||
if p.stderr:
|
if p.stderr:
|
||||||
raise RuntimeError(
|
raise exc.QubesException(
|
||||||
QtCore.QCoreApplication.translate(
|
QtCore.QCoreApplication.translate(
|
||||||
"GlobalSettings", 'qrexec call stderr was not empty'),
|
"GlobalSettings", 'qrexec call stderr was not empty'),
|
||||||
{'stderr': p.stderr.decode('utf-8')})
|
{'stderr': p.stderr.decode('utf-8')})
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise RuntimeError(
|
raise exc.QubesException(
|
||||||
QtCore.QCoreApplication.translate(
|
QtCore.QCoreApplication.translate(
|
||||||
"GlobalSettings",
|
"GlobalSettings",
|
||||||
'qrexec call exited with non-zero return code'),
|
'qrexec call exited with non-zero return code'),
|
||||||
@ -67,7 +67,7 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
|
|||||||
QtWidgets.QDialog):
|
QtWidgets.QDialog):
|
||||||
|
|
||||||
def __init__(self, app, qubes_app, parent=None):
|
def __init__(self, app, qubes_app, parent=None):
|
||||||
super(GlobalSettingsWindow, self).__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
||||||
self.app = app
|
self.app = app
|
||||||
self.qubes_app = qubes_app
|
self.qubes_app = qubes_app
|
||||||
@ -287,7 +287,7 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
|
|||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
self.vm.features[feature] = widget.currentData()
|
self.vm.features[feature] = widget.currentData()
|
||||||
except exc.QubesDaemonAccessError as ex:
|
except exc.QubesDaemonAccessError:
|
||||||
self.errors.append(
|
self.errors.append(
|
||||||
"Failed to set {} due to insufficient "
|
"Failed to set {} due to insufficient "
|
||||||
"permissions".format(feature))
|
"permissions".format(feature))
|
||||||
@ -309,7 +309,8 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
|
|||||||
try:
|
try:
|
||||||
self.qmemman_config = ConfigParser()
|
self.qmemman_config = ConfigParser()
|
||||||
self.vm_min_mem_val = '200MiB' # str(qmemman_algo.MIN_PREFMEM)
|
self.vm_min_mem_val = '200MiB' # str(qmemman_algo.MIN_PREFMEM)
|
||||||
self.dom0_mem_boost_val = '350MiB' # str(qmemman_algo.DOM0_MEM_BOOST)
|
# str(qmemman_algo.DOM0_MEM_BOOST)
|
||||||
|
self.dom0_mem_boost_val = '350MiB'
|
||||||
|
|
||||||
self.qmemman_config.read(qmemman_config_path)
|
self.qmemman_config.read(qmemman_config_path)
|
||||||
if self.qmemman_config.has_section('global'):
|
if self.qmemman_config.has_section('global'):
|
||||||
@ -360,7 +361,7 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
|
|||||||
qmemman_config_file = open(qmemman_config_path, 'a')
|
qmemman_config_file = open(qmemman_config_path, 'a')
|
||||||
self.qmemman_config.write(qmemman_config_file)
|
self.qmemman_config.write(qmemman_config_file)
|
||||||
qmemman_config_file.close()
|
qmemman_config_file.close()
|
||||||
except Exception as ex:
|
except Exception as ex: # pylint: disable=broad-except
|
||||||
self.errors.append(
|
self.errors.append(
|
||||||
"Failed to set memory settings due to {}".format(
|
"Failed to set memory settings due to {}".format(
|
||||||
str(ex)))
|
str(ex)))
|
||||||
@ -380,7 +381,7 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
qmemman_config_file = open(qmemman_config_path, 'r')
|
qmemman_config_file = open(qmemman_config_path, 'r')
|
||||||
except Exception as ex:
|
except Exception as ex: # pylint: disable=broad-except
|
||||||
self.errors.append(
|
self.errors.append(
|
||||||
"Failed to set memory settings due to {}".format(
|
"Failed to set memory settings due to {}".format(
|
||||||
str(ex)))
|
str(ex)))
|
||||||
@ -405,7 +406,7 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
|
|||||||
qmemman_config_file = open(qmemman_config_path, 'w')
|
qmemman_config_file = open(qmemman_config_path, 'w')
|
||||||
qmemman_config_file.writelines(config_lines)
|
qmemman_config_file.writelines(config_lines)
|
||||||
qmemman_config_file.close()
|
qmemman_config_file.close()
|
||||||
except Exception as ex:
|
except Exception as ex: # pylint: disable=broad-except
|
||||||
self.errors.append(
|
self.errors.append(
|
||||||
"Failed to set memory settings due to {}".format(
|
"Failed to set memory settings due to {}".format(
|
||||||
str(ex)))
|
str(ex)))
|
||||||
@ -435,7 +436,7 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
|
|||||||
dct = repos[lst[0]] = dict()
|
dct = repos[lst[0]] = dict()
|
||||||
dct['prettyname'] = lst[1]
|
dct['prettyname'] = lst[1]
|
||||||
dct['enabled'] = lst[2] == 'enabled'
|
dct['enabled'] = lst[2] == 'enabled'
|
||||||
except Exception as ex:
|
except exc.QubesException:
|
||||||
self.dom0_updates_repo.setEnabled(False)
|
self.dom0_updates_repo.setEnabled(False)
|
||||||
self.itl_tmpl_updates_repo.setEnabled(False)
|
self.itl_tmpl_updates_repo.setEnabled(False)
|
||||||
self.comm_tmpl_updates_repo.setEnabled(False)
|
self.comm_tmpl_updates_repo.setEnabled(False)
|
||||||
|
@ -30,7 +30,7 @@ class InformationNotesDialog(ui_informationnotes.Ui_InformationNotesDialog,
|
|||||||
QDialog):
|
QDialog):
|
||||||
# pylint: disable=too-few-public-methods
|
# pylint: disable=too-few-public-methods
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(InformationNotesDialog, self).__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
details = subprocess.check_output(
|
details = subprocess.check_output(
|
||||||
|
@ -36,7 +36,7 @@ class LogDialog(ui_logdlg.Ui_LogDialog, QtWidgets.QDialog):
|
|||||||
# pylint: disable=too-few-public-methods
|
# pylint: disable=too-few-public-methods
|
||||||
|
|
||||||
def __init__(self, app, log_path, parent=None):
|
def __init__(self, app, log_path, parent=None):
|
||||||
super(LogDialog, self).__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
||||||
self.app = app
|
self.app = app
|
||||||
self.log_path = log_path
|
self.log_path = log_path
|
||||||
|
@ -10,7 +10,7 @@ class MultiSelectWidget(
|
|||||||
itemsRemoved = QtCore.pyqtSignal(list)
|
itemsRemoved = QtCore.pyqtSignal(list)
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super(MultiSelectWidget, self).__init__(parent)
|
super().__init__(parent)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
self.add_selected_button.clicked.connect(self.add_selected)
|
self.add_selected_button.clicked.connect(self.add_selected)
|
||||||
self.add_all_button.clicked.connect(self.add_all)
|
self.add_all_button.clicked.connect(self.add_all)
|
||||||
|
@ -58,16 +58,16 @@ from . import clone_vm
|
|||||||
|
|
||||||
class SearchBox(QLineEdit):
|
class SearchBox(QLineEdit):
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super(SearchBox, self).__init__(parent)
|
super().__init__(parent)
|
||||||
self.focusing = False
|
self.focusing = False
|
||||||
|
|
||||||
def focusInEvent(self, e): # pylint: disable=invalid-name
|
def focusInEvent(self, e): # pylint: disable=invalid-name
|
||||||
super(SearchBox, self).focusInEvent(e)
|
super().focusInEvent(e)
|
||||||
self.selectAll()
|
self.selectAll()
|
||||||
self.focusing = True
|
self.focusing = True
|
||||||
|
|
||||||
def mousePressEvent(self, e): # pylint: disable=invalid-name
|
def mousePressEvent(self, e): # pylint: disable=invalid-name
|
||||||
super(SearchBox, self).mousePressEvent(e)
|
super().mousePressEvent(e)
|
||||||
if self.focusing:
|
if self.focusing:
|
||||||
self.selectAll()
|
self.selectAll()
|
||||||
self.focusing = False
|
self.focusing = False
|
||||||
@ -78,7 +78,7 @@ icon_size = QSize(22, 22)
|
|||||||
class StateIconDelegate(QStyledItemDelegate):
|
class StateIconDelegate(QStyledItemDelegate):
|
||||||
lastIndex = None
|
lastIndex = None
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(StateIconDelegate, self).__init__()
|
super().__init__()
|
||||||
self.stateIcons = {
|
self.stateIcons = {
|
||||||
"Running" : QIcon(":/on.png"),
|
"Running" : QIcon(":/on.png"),
|
||||||
"Paused" : QIcon(":/paused.png"),
|
"Paused" : QIcon(":/paused.png"),
|
||||||
@ -104,7 +104,7 @@ class StateIconDelegate(QStyledItemDelegate):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def sizeHint(self, option, index):
|
def sizeHint(self, option, index):
|
||||||
hint = super(StateIconDelegate, self).sizeHint(option, index)
|
hint = super().sizeHint(option, index)
|
||||||
option = QStyleOptionViewItem(option)
|
option = QStyleOptionViewItem(option)
|
||||||
option.features |= option.HasDecoration
|
option.features |= option.HasDecoration
|
||||||
widget = option.widget
|
widget = option.widget
|
||||||
@ -153,7 +153,7 @@ class StateIconDelegate(QStyledItemDelegate):
|
|||||||
|
|
||||||
def helpEvent(self, event, view, option, index):
|
def helpEvent(self, event, view, option, index):
|
||||||
if event.type() != QEvent.ToolTip:
|
if event.type() != QEvent.ToolTip:
|
||||||
return super(StateIconDelegate, self).helpEvent(event, view,
|
return super().helpEvent(event, view,
|
||||||
option, index)
|
option, index)
|
||||||
option = QStyleOptionViewItem(option)
|
option = QStyleOptionViewItem(option)
|
||||||
widget = option.widget
|
widget = option.widget
|
||||||
@ -222,10 +222,9 @@ class VmInfo():
|
|||||||
self.state['outdated'] = "to-be-outdated"
|
self.state['outdated'] = "to-be-outdated"
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
for vol in self.vm.volumes.values():
|
if any(vol.is_outdated()
|
||||||
if vol.is_outdated():
|
for vol in self.vm.volumes.values()):
|
||||||
self.state['outdated'] = "outdated"
|
self.state['outdated'] = "outdated"
|
||||||
break
|
|
||||||
except exc.QubesDaemonAccessError:
|
except exc.QubesDaemonAccessError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -612,7 +611,7 @@ class UpdateVMThread(common_threads.QubesThread):
|
|||||||
# pylint: disable=too-few-public-methods
|
# pylint: disable=too-few-public-methods
|
||||||
class RunCommandThread(common_threads.QubesThread):
|
class RunCommandThread(common_threads.QubesThread):
|
||||||
def __init__(self, vm, command_to_run):
|
def __init__(self, vm, command_to_run):
|
||||||
super(RunCommandThread, self).__init__(vm)
|
super().__init__(vm)
|
||||||
self.command_to_run = command_to_run
|
self.command_to_run = command_to_run
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
@ -638,7 +637,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QMainWindow):
|
|||||||
settings_loaded = False
|
settings_loaded = False
|
||||||
|
|
||||||
def __init__(self, qt_app, qubes_app, dispatcher, _parent=None):
|
def __init__(self, qt_app, qubes_app, dispatcher, _parent=None):
|
||||||
super(VmManagerWindow, self).__init__()
|
super().__init__()
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
|
|
||||||
self.manager_settings = QSettings(self)
|
self.manager_settings = QSettings(self)
|
||||||
@ -816,7 +815,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QMainWindow):
|
|||||||
def keyPressEvent(self, event): # pylint: disable=invalid-name
|
def keyPressEvent(self, event): # pylint: disable=invalid-name
|
||||||
if event.key() == Qt.Key_Escape:
|
if event.key() == Qt.Key_Escape:
|
||||||
self.searchbox.clear()
|
self.searchbox.clear()
|
||||||
super(VmManagerWindow, self).keyPressEvent(event)
|
super().keyPressEvent(event)
|
||||||
|
|
||||||
def clear_threads(self):
|
def clear_threads(self):
|
||||||
for thread in self.threads_list:
|
for thread in self.threads_list:
|
||||||
|
@ -28,7 +28,7 @@ from . import ui_releasenotes # pylint: disable=no-name-in-module
|
|||||||
class ReleaseNotesDialog(ui_releasenotes.Ui_ReleaseNotesDialog, QDialog):
|
class ReleaseNotesDialog(ui_releasenotes.Ui_ReleaseNotesDialog, QDialog):
|
||||||
# pylint: disable=too-few-public-methods
|
# pylint: disable=too-few-public-methods
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(ReleaseNotesDialog, self).__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ class RestoreThread(QtCore.QThread):
|
|||||||
|
|
||||||
class RestoreVMsWindow(ui_restoredlg.Ui_Restore, QtWidgets.QWizard):
|
class RestoreVMsWindow(ui_restoredlg.Ui_Restore, QtWidgets.QWizard):
|
||||||
def __init__(self, qt_app, qubes_app, parent=None):
|
def __init__(self, qt_app, qubes_app, parent=None):
|
||||||
super(RestoreVMsWindow, self).__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
||||||
self.qt_app = qt_app
|
self.qt_app = qt_app
|
||||||
self.qubes_app = qubes_app
|
self.qubes_app = qubes_app
|
||||||
@ -122,7 +122,7 @@ class RestoreVMsWindow(ui_restoredlg.Ui_Restore, QtWidgets.QWizard):
|
|||||||
if self.page(p_int) is self.select_vms_page:
|
if self.page(p_int) is self.select_vms_page:
|
||||||
self.vms_to_restore = None
|
self.vms_to_restore = None
|
||||||
else:
|
else:
|
||||||
super(RestoreVMsWindow, self).cleanupPage(p_int)
|
super().cleanupPage(p_int)
|
||||||
|
|
||||||
def __fill_vms_list__(self):
|
def __fill_vms_list__(self):
|
||||||
if self.vms_to_restore is not None:
|
if self.vms_to_restore is not None:
|
||||||
|
@ -48,7 +48,7 @@ from . import ui_settingsdlg # pylint: disable=no-name-in-module
|
|||||||
# pylint: disable=too-few-public-methods
|
# pylint: disable=too-few-public-methods
|
||||||
class RenameVMThread(common_threads.QubesThread):
|
class RenameVMThread(common_threads.QubesThread):
|
||||||
def __init__(self, vm, new_vm_name, dependencies):
|
def __init__(self, vm, new_vm_name, dependencies):
|
||||||
super(RenameVMThread, self).__init__(vm)
|
super().__init__(vm)
|
||||||
self.new_vm_name = new_vm_name
|
self.new_vm_name = new_vm_name
|
||||||
self.dependencies = dependencies
|
self.dependencies = dependencies
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ class RenameVMThread(common_threads.QubesThread):
|
|||||||
# pylint: disable=too-few-public-methods
|
# pylint: disable=too-few-public-methods
|
||||||
class RefreshAppsVMThread(common_threads.QubesThread):
|
class RefreshAppsVMThread(common_threads.QubesThread):
|
||||||
def __init__(self, vm, button):
|
def __init__(self, vm, button):
|
||||||
super(RefreshAppsVMThread, self).__init__(vm)
|
super().__init__(vm)
|
||||||
self.button = button
|
self.button = button
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
@ -129,7 +129,7 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtWidgets.QDialog):
|
|||||||
|
|
||||||
def __init__(self, vm, init_page="basic", qapp=None, qubesapp=None,
|
def __init__(self, vm, init_page="basic", qapp=None, qubesapp=None,
|
||||||
parent=None):
|
parent=None):
|
||||||
super(VMSettingsWindow, self).__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
||||||
self.vm = vm
|
self.vm = vm
|
||||||
self.qapp = qapp
|
self.qapp = qapp
|
||||||
@ -251,7 +251,7 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtWidgets.QDialog):
|
|||||||
if event.key() == QtCore.Qt.Key_Enter \
|
if event.key() == QtCore.Qt.Key_Enter \
|
||||||
or event.key() == QtCore.Qt.Key_Return:
|
or event.key() == QtCore.Qt.Key_Return:
|
||||||
return
|
return
|
||||||
super(VMSettingsWindow, self).keyPressEvent(event)
|
super().keyPressEvent(event)
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
self.save_and_apply()
|
self.save_and_apply()
|
||||||
@ -1096,7 +1096,7 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtWidgets.QDialog):
|
|||||||
# pylint: disable=too-few-public-methods
|
# pylint: disable=too-few-public-methods
|
||||||
class DevListWidgetItem(QtWidgets.QListWidgetItem):
|
class DevListWidgetItem(QtWidgets.QListWidgetItem):
|
||||||
def __init__(self, dev, unknown=False, parent=None):
|
def __init__(self, dev, unknown=False, parent=None):
|
||||||
super(DevListWidgetItem, self).__init__(parent)
|
super().__init__(parent)
|
||||||
name = dev.ident.replace('_', ":") + ' ' + dev.description
|
name = dev.ident.replace('_', ":") + ' ' + dev.description
|
||||||
if unknown:
|
if unknown:
|
||||||
name += ' (unknown)'
|
name += ' (unknown)'
|
||||||
|
@ -35,7 +35,7 @@ class TemplateManagerWindow(
|
|||||||
|
|
||||||
def __init__(self, qt_app, qubes_app, dispatcher, parent=None):
|
def __init__(self, qt_app, qubes_app, dispatcher, parent=None):
|
||||||
# pylint: disable=unused-argument
|
# pylint: disable=unused-argument
|
||||||
super(TemplateManagerWindow, self).__init__()
|
super().__init__()
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
|
|
||||||
self.qubes_app = qubes_app
|
self.qubes_app = qubes_app
|
||||||
@ -244,7 +244,7 @@ class TemplateManagerWindow(
|
|||||||
class VMNameItem(QtWidgets.QTableWidgetItem):
|
class VMNameItem(QtWidgets.QTableWidgetItem):
|
||||||
# pylint: disable=too-few-public-methods
|
# pylint: disable=too-few-public-methods
|
||||||
def __init__(self, vm):
|
def __init__(self, vm):
|
||||||
super(VMNameItem, self).__init__()
|
super().__init__()
|
||||||
self.vm = vm
|
self.vm = vm
|
||||||
|
|
||||||
self.setText(self.vm.name)
|
self.setText(self.vm.name)
|
||||||
@ -253,7 +253,7 @@ class VMNameItem(QtWidgets.QTableWidgetItem):
|
|||||||
|
|
||||||
class StatusItem(QtWidgets.QTableWidgetItem):
|
class StatusItem(QtWidgets.QTableWidgetItem):
|
||||||
def __init__(self, vm):
|
def __init__(self, vm):
|
||||||
super(StatusItem, self).__init__()
|
super().__init__()
|
||||||
self.vm = vm
|
self.vm = vm
|
||||||
|
|
||||||
self.state = None
|
self.state = None
|
||||||
@ -278,7 +278,7 @@ class StatusItem(QtWidgets.QTableWidgetItem):
|
|||||||
class CurrentTemplateItem(QtWidgets.QTableWidgetItem):
|
class CurrentTemplateItem(QtWidgets.QTableWidgetItem):
|
||||||
# pylint: disable=too-few-public-methods
|
# pylint: disable=too-few-public-methods
|
||||||
def __init__(self, vm):
|
def __init__(self, vm):
|
||||||
super(CurrentTemplateItem, self).__init__()
|
super().__init__()
|
||||||
self.vm = vm
|
self.vm = vm
|
||||||
|
|
||||||
self.setText(self.vm.template.name)
|
self.setText(self.vm.template.name)
|
||||||
@ -291,7 +291,7 @@ class CurrentTemplateItem(QtWidgets.QTableWidgetItem):
|
|||||||
|
|
||||||
class NewTemplateItem(QtWidgets.QComboBox):
|
class NewTemplateItem(QtWidgets.QComboBox):
|
||||||
def __init__(self, vm, templates, table_widget):
|
def __init__(self, vm, templates, table_widget):
|
||||||
super(NewTemplateItem, self).__init__()
|
super().__init__()
|
||||||
self.vm = vm
|
self.vm = vm
|
||||||
self.table_widget = table_widget
|
self.table_widget = table_widget
|
||||||
self.changed = False
|
self.changed = False
|
||||||
|
@ -77,7 +77,7 @@ class SizeSpinBox(QtWidgets.QSpinBox):
|
|||||||
"""A SpinBox subclass with extended handling for sizes in MB and GB"""
|
"""A SpinBox subclass with extended handling for sizes in MB and GB"""
|
||||||
# pylint: disable=invalid-name, no-self-use
|
# pylint: disable=invalid-name, no-self-use
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(SizeSpinBox, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
self.pattern = r'(\d+\.?\d?) ?(GB|MB)'
|
self.pattern = r'(\d+\.?\d?) ?(GB|MB)'
|
||||||
self.regex = re.compile(self.pattern)
|
self.regex = re.compile(self.pattern)
|
||||||
|
Loading…
Reference in New Issue
Block a user