diff --git a/qubesmanager/appmenu_select.py b/qubesmanager/appmenu_select.py index 942234b..fd84618 100755 --- a/qubesmanager/appmenu_select.py +++ b/qubesmanager/appmenu_select.py @@ -50,7 +50,9 @@ class AppmenuSelectManager: ).decode().strip().split('\n') if line] # Check if appmenu entry is really installed -# whitelisted = [a for a in whitelisted if os.path.exists('%s/apps/%s-%s' % (self.vm.dir_path, self.vm.name, a))] + # whitelisted = [a for a in whitelisted + # if os.path.exists('%s/apps/%s-%s' % + # (self.vm.dir_path, self.vm.name, a))] self.app_list.clear() diff --git a/qubesmanager/bootfromdevice.py b/qubesmanager/bootfromdevice.py index 593126d..b33e6d4 100644 --- a/qubesmanager/bootfromdevice.py +++ b/qubesmanager/bootfromdevice.py @@ -34,9 +34,13 @@ class VMBootFromDeviceWindow(ui_bootfromdevice.Ui_BootDialog, QtGui.QDialog): self.qapp = qapp self.setupUi(self) - self.setWindowTitle(self.tr("Boot {vm} from device").format(vm=self.vm.name)) + 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("accepted()"), + self.save_and_apply) self.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), self.reject) # populate buttons and such @@ -50,12 +54,14 @@ class VMBootFromDeviceWindow(ui_bootfromdevice.Ui_BootDialog, QtGui.QDialog): if self.blockDeviceRadioButton.isChecked(): cdrom_location = self.blockDeviceComboBox.currentText() elif self.fileRadioButton.isChecked(): - cdrom_location = str(self.vm_list[self.fileVM.currentIndex()]) + ":" + self.pathText.text() + cdrom_location = str( + self.vm_list[self.fileVM.currentIndex()]) + \ + ":" + self.pathText.text() else: - QtGui.QMessageBox.warning(None, - self.tr( - "ERROR!"), - self.tr("No file or block device selected; please select one.")) + QtGui.QMessageBox.warning( + None, + self.tr("ERROR!"), + self.tr("No file or block device selected; please select one.")) return qvm_start.main(['--cdrom', cdrom_location, self.vm.name]) @@ -87,7 +93,8 @@ class VMBootFromDeviceWindow(ui_bootfromdevice.Ui_BootDialog, QtGui.QDialog): ) def radio_button_clicked(self): - self.blockDeviceComboBox.setEnabled(self.blockDeviceRadioButton.isChecked()) + self.blockDeviceComboBox.setEnabled( + self.blockDeviceRadioButton.isChecked()) self.fileVM.setEnabled(self.fileRadioButton.isChecked()) self.selectFileButton.setEnabled(self.fileRadioButton.isChecked()) self.pathText.setEnabled(self.fileRadioButton.isChecked()) diff --git a/qubesmanager/create_new_vm.py b/qubesmanager/create_new_vm.py index 4bb0325..f14ab4c 100644 --- a/qubesmanager/create_new_vm.py +++ b/qubesmanager/create_new_vm.py @@ -46,7 +46,8 @@ class NewVmDlg(QtGui.QDialog, Ui_NewVMDlg): self.app = app # Theoretically we should be locking for writing here and unlock - # only after the VM creation finished. But the code would be more messy... + # only after the VM creation finished. But the code would be + # more messy... # Instead we lock for writing in the actual worker thread self.label_list, self.label_idx = utils.prepare_label_choice( self.label, @@ -94,7 +95,8 @@ class NewVmDlg(QtGui.QDialog, Ui_NewVMDlg): self.done(0) def accept(self): - vmclass = ('AppVM' if self.vm_type.currentIndex() == 0 else 'StandaloneVM') + vmclass = ('AppVM' if self.vm_type.currentIndex() == 0 + else 'StandaloneVM') name = str(self.name.text()) try: diff --git a/qubesmanager/firewall.py b/qubesmanager/firewall.py index 96c7543..07f5847 100644 --- a/qubesmanager/firewall.py +++ b/qubesmanager/firewall.py @@ -76,8 +76,11 @@ class NewFwRuleDlg (QtGui.QDialog, ui_newfwruledlg.Ui_NewFwRuleDlg): self.set_ok_enabled(False) self.addressComboBox.setValidator(QIPAddressValidator()) - self.addressComboBox.editTextChanged.connect(self.address_editing_finished) - self.serviceComboBox.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp("[a-z][a-z0-9-]+|[0-9]+(-[0-9]+)?", QtCore.Qt.CaseInsensitive), None)) + self.addressComboBox.editTextChanged.connect( + self.address_editing_finished) + self.serviceComboBox.setValidator(QtGui.QRegExpValidator( + 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.populate_combos() @@ -88,7 +91,8 @@ class NewFwRuleDlg (QtGui.QDialog, ui_newfwruledlg.Ui_NewFwRuleDlg): if len(self.serviceComboBox.currentText()) == 0: msg = QtGui.QMessageBox() msg.warning(self, self.tr("Firewall rule"), - self.tr("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 QtGui.QDialog.accept(self) @@ -138,13 +142,16 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel): self.__columnNames = {0: "Address", 1: "Service", 2: "Protocol", } self.__services = list() - pattern = re.compile("(?P[a-z][a-z0-9-]+)\s+(?P[0-9]+)/(?P[a-z]+)", re.IGNORECASE) + pattern = re.compile( + "(?P[a-z][a-z0-9-]+)\s+(?P[0-9]+)/(?P[a-z]+)", + re.IGNORECASE) f = open('/etc/services', 'r') for line in f: match = pattern.match(line) if match is not None: service = match.groupdict() - self.__services.append( (service["name"], int(service["port"]),) ) + self.__services.append( + (service["name"], int(service["port"]),) ) f.close() self.fw_changed = False @@ -372,7 +379,9 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel): try: rule.dstports = service except ValueError: - QtGui.QMessageBox.warning(None, self.tr("Invalid port or service"), + QtGui.QMessageBox.warning( + None, + self.tr("Invalid port or service"), self.tr("Port number or service '{0}' is invalid.") .format(service)) elif service is not None: @@ -421,7 +430,8 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel): def headerData(self, section, orientation, role=QtCore.Qt.DisplayRole): if section < len(self.__columnNames) \ - and orientation == QtCore.Qt.Horizontal and role == QtCore.Qt.DisplayRole: + and orientation == QtCore.Qt.Horizontal \ + and role == QtCore.Qt.DisplayRole: return self.__columnNames[section] @property diff --git a/qubesmanager/global_settings.py b/qubesmanager/global_settings.py index 2002fd3..cf1f4f7 100644 --- a/qubesmanager/global_settings.py +++ b/qubesmanager/global_settings.py @@ -34,7 +34,8 @@ from configparser import ConfigParser qmemman_config_path = '/etc/qubes/qmemman.conf' -class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings, QtGui.QDialog): +class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings, + QtGui.QDialog): def __init__(self, app, qvm_collection, parent=None): super(GlobalSettingsWindow, self).__init__(parent) @@ -44,7 +45,10 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings, QtGui.QDialog self.setupUi(self) - self.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), self.save_and_apply) + self.connect( + self.buttonBox, + QtCore.SIGNAL("accepted()"), + self.save_and_apply) self.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), self.reject) self.__init_system_defaults__() @@ -87,7 +91,8 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings, QtGui.QDialog self.clock_vm_combo.setCurrentIndex(self.clockvm_idx) # default netvm - netvms = [vm for vm in all_vms if getattr(vm, 'provides_network', False)] + netvms = [vm for vm in all_vms + if getattr(vm, 'provides_network', False)] self.netvm_idx = -1 current_netvm = self.qvm_collection.default_netvm @@ -150,7 +155,8 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings, QtGui.QDialog def __init_kernel_defaults__(self): kernel_list = [] - # TODO system_path["qubes_kernels_base_dir"] idea: qubes.pulls['linux-kernel'].volumes + # TODO system_path["qubes_kernels_base_dir"] + # idea: qubes.pulls['linux-kernel'].volumes for k in os.listdir('/var/lib/qubes/vm-kernels'): kernel_list.append(k) @@ -181,8 +187,10 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings, QtGui.QDialog self.qmemman_config.read(qmemman_config_path) if self.qmemman_config.has_section('global'): - self.vm_min_mem_val = self.qmemman_config.get('global', 'vm-min-mem') - self.dom0_mem_boost_val = self.qmemman_config.get('global', 'dom0-mem-boost') + self.vm_min_mem_val = \ + self.qmemman_config.get('global', 'vm-min-mem') + self.dom0_mem_boost_val = \ + self.qmemman_config.get('global', 'dom0-mem-boost') self.vm_min_mem_val = parse_size(self.vm_min_mem_val) self.dom0_mem_boost_val = parse_size(self.dom0_mem_boost_val) @@ -197,7 +205,8 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings, QtGui.QDialog current_min_vm_mem = self.min_vm_mem.value() current_dom0_mem_boost = self.dom0_mem_boost.value() - if current_min_vm_mem*1024*1024 != self.vm_min_mem_val or current_dom0_mem_boost*1024*1024 != self.dom0_mem_boost_val: + if current_min_vm_mem*1024*1024 != self.vm_min_mem_val \ + or current_dom0_mem_boost*1024*1024 != self.dom0_mem_boost_val: current_min_vm_mem = str(current_min_vm_mem)+'M' current_dom0_mem_boost = str(current_dom0_mem_boost)+'M' @@ -205,20 +214,28 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings, QtGui.QDialog if not self.qmemman_config.has_section('global'): #add the whole section self.qmemman_config.add_section('global') - self.qmemman_config.set('global', 'vm-min-mem', current_min_vm_mem) - self.qmemman_config.set('global', 'dom0-mem-boost', current_dom0_mem_boost) - self.qmemman_config.set('global', 'cache-margin-factor', str(1.3)) # removed qmemman_algo.CACHE_FACTOR + self.qmemman_config.set( + 'global', 'vm-min-mem', current_min_vm_mem) + self.qmemman_config.set( + 'global', 'dom0-mem-boost', current_dom0_mem_boost) + self.qmemman_config.set( + 'global', 'cache-margin-factor', str(1.3)) + # removed qmemman_algo.CACHE_FACTOR qmemman_config_file = open(qmemman_config_path, 'a') self.qmemman_config.write(qmemman_config_file) qmemman_config_file.close() else: - #If there already is a 'global' section, we don't use SafeConfigParser.write() - it would get rid of all the comments... + #If there already is a 'global' section, we don't use + # SafeConfigParser.write() - it would get rid of + # all the comments... lines_to_add = {} - 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" + 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" config_lines = [] @@ -256,11 +273,13 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings, QtGui.QDialog def __apply_updates__(self): if self.updates_dom0.isChecked() != self.updates_dom0_val: - # TODO updates_dom0_toggle(self.qvm_collection, self.updates_dom0.isChecked()) + # TODO updates_dom0_toggle( + # self.qvm_collection, self.updates_dom0.isChecked()) raise NotImplementedError('Toggle dom0 updates not implemented') if self.updates_vm.checkState() != QtCore.Qt.PartiallyChecked: for vm in self.qvm_collection.domains: - vm.features['check-updates'] = bool(self.updates_vm.checkState()) + vm.features['check-updates'] = \ + bool(self.updates_vm.checkState()) def reject(self): self.done(0) @@ -285,12 +304,13 @@ 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(None, "Houston, we have a problem...", - "Whoops. A critical error has occured. This is most likely a bug " - "in Qubes Global Settings application.

" - "%s" % error + - "at line %d of file %s.

" - % ( line, filename )) + QtGui.QMessageBox.critical( + None, + "Houston, we have a problem...", + "Whoops. A critical error has occured. This is most likely a bug " + "in Qubes Global Settings application.

%s" % + error + "at line %d of file %s.

" + % ( line, filename )) def main(): diff --git a/qubesmanager/multiselectwidget.py b/qubesmanager/multiselectwidget.py index 214a1de..57d640c 100644 --- a/qubesmanager/multiselectwidget.py +++ b/qubesmanager/multiselectwidget.py @@ -1,7 +1,8 @@ from PyQt4 import QtCore, QtGui from . import ui_multiselectwidget -class MultiSelectWidget(ui_multiselectwidget.Ui_MultiSelectWidget, QtGui.QWidget): +class MultiSelectWidget( + ui_multiselectwidget.Ui_MultiSelectWidget, QtGui.QWidget): __pyqtSignals__ = ("selected_changed()",) __pyqtSignals__ = ("items_added(PyQt_PyObject)",) @@ -14,8 +15,10 @@ class MultiSelectWidget(ui_multiselectwidget.Ui_MultiSelectWidget, QtGui.QWidget self.add_all_button.clicked.connect(self.add_all) 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) - self.selected_list.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection) + self.available_list.setSelectionMode( + QtGui.QAbstractItemView.ExtendedSelection) + self.selected_list.setSelectionMode( + QtGui.QAbstractItemView.ExtendedSelection) def switch_selected(self, src, dst): selected = src.selectedItems() diff --git a/qubesmanager/settings.py b/qubesmanager/settings.py index f3a824d..4c29a5b 100755 --- a/qubesmanager/settings.py +++ b/qubesmanager/settings.py @@ -69,7 +69,9 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog): assert (idx in range(self.tabWidget.count())) self.tabWidget.setCurrentIndex(idx) - self.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), self.save_and_apply) + self.connect(self.buttonBox, + QtCore.SIGNAL("accepted()"), + self.save_and_apply) self.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), self.reject) self.tabWidget.currentChanged.connect(self.current_tab_changed) @@ -85,10 +87,16 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog): ###### advanced tab self.__init_advanced_tab__() - self.include_in_balancing.stateChanged.connect(self.include_in_balancing_state_changed) - self.connect(self.init_mem, QtCore.SIGNAL("editingFinished()"), self.check_mem_changes) - self.connect(self.max_mem_size, QtCore.SIGNAL("editingFinished()"), self.check_mem_changes) - self.bootFromDeviceButton.clicked.connect(self.boot_from_cdrom_button_pressed) + self.include_in_balancing.stateChanged.connect( + self.include_in_balancing_state_changed) + self.connect(self.init_mem, + QtCore.SIGNAL("editingFinished()"), + self.check_mem_changes) + self.connect(self.max_mem_size, + QtCore.SIGNAL("editingFinished()"), + self.check_mem_changes) + self.bootFromDeviceButton.clicked.connect( + self.boot_from_cdrom_button_pressed) ###### firewall tab if self.tabWidget.isTabEnabled(self.tabs_indices['firewall']): @@ -102,13 +110,16 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog): self.newRuleButton.clicked.connect(self.new_rule_button_pressed) self.editRuleButton.clicked.connect(self.edit_rule_button_pressed) - self.deleteRuleButton.clicked.connect(self.delete_rule_button_pressed) + self.deleteRuleButton.clicked.connect( + self.delete_rule_button_pressed) self.policyDenyRadioButton.clicked.connect(self.policy_changed) self.policyAllowRadioButton.clicked.connect(self.policy_changed) ####### devices tab self.__init_devices_tab__() - self.connect(self.dev_list, QtCore.SIGNAL("selected_changed()"), self.devices_selection_changed) + self.connect(self.dev_list, + QtCore.SIGNAL("selected_changed()"), + self.devices_selection_changed) ####### services tab self.__init_services_tab__() @@ -120,7 +131,8 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog): self.app_list = multiselectwidget.MultiSelectWidget(self) self.apps_layout.addWidget(self.app_list) self.AppListManager = AppmenuSelectManager(self.vm, self.app_list) - self.refresh_apps_button.clicked.connect(self.refresh_apps_button_pressed) + self.refresh_apps_button.clicked.connect( + self.refresh_apps_button_pressed) def reject(self): self.done(0) @@ -131,12 +143,14 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog): def save_and_apply(self): t_monitor = thread_monitor.ThreadMonitor() - thread = threading.Thread(target=self.__save_changes__, args=(t_monitor,)) + thread = threading.Thread(target=self.__save_changes__, + args=(t_monitor,)) thread.daemon = True thread.start() progress = QtGui.QProgressDialog( - self.tr("Applying settings to {0}...").format(self.vm.name), "", 0, 0) + self.tr("Applying settings to {0}...").format(self.vm.name), + "", 0, 0) progress.setCancelButton(None) progress.setModal(True) progress.show() @@ -148,9 +162,11 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog): progress.hide() if not t_monitor.success: - QtGui.QMessageBox.warning(None, - self.tr("Error while changing settings for {0}!").format(self.vm.name), - self.tr("ERROR: {0}").format(t_monitor.error_msg)) + QtGui.QMessageBox.warning( + None, + self.tr("Error while changing settings for {0}!" + ).format(self.vm.name), + self.tr("ERROR: {0}").format(t_monitor.error_msg)) self.done(0) @@ -177,9 +193,10 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog): try: if self.policyAllowRadioButton.isEnabled(): - self.fw_model.apply_rules(self.policyAllowRadioButton.isChecked(), - self.tempFullAccess.isChecked(), - self.tempFullAccessTime.value()) + self.fw_model.apply_rules( + self.policyAllowRadioButton.isChecked(), + self.tempFullAccess.isChecked(), + self.tempFullAccessTime.value()) if self.fw_model.fw_changed: # might modified vm.services self.anything_changed = True @@ -203,10 +220,13 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog): if idx == self.tabs_indices["firewall"]: netvm = self.vm.netvm if netvm is not None and \ - not netvm.features.check_with_template('qubes-firewall', False): - QtGui.QMessageBox.warning(None, - self.tr("VM configuration problem!"), - self.tr("The '{vm}' AppVM is network connected to " + not netvm.features.check_with_template( + 'qubes-firewall', + False): + QtGui.QMessageBox.warning( + None, + self.tr("VM configuration problem!"), + self.tr("The '{vm}' AppVM is network connected to " "'{netvm}', which does not support firewall!
" "You may edit the '{vm}' VM firewall rules, but these " "will not take any effect until you connect it to " @@ -230,7 +250,10 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog): def __init_basic_tab__(self): self.vmname.setText(self.vm.name) - self.vmname.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp("[a-zA-Z0-9-]*", QtCore.Qt.CaseInsensitive), None)) + self.vmname.setValidator( + QtGui.QRegExpValidator( + QtCore.QRegExp("[a-zA-Z0-9-]*", + QtCore.Qt.CaseInsensitive), None)) self.vmname.setEnabled(False) self.rename_vm_button.setEnabled(not self.vm.is_running()) self.delete_vm_button.setEnabled(not self.vm.is_running()) @@ -341,7 +364,8 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog): #include in backups try: - if self.vm.include_in_backups != self.include_in_backups.isChecked(): + if self.vm.include_in_backups != \ + self.include_in_backups.isChecked(): self.vm.include_in_backups = self.include_in_backups.isChecked() self.anything_changed = True except Exception as ex: @@ -388,16 +412,20 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog): def check_mem_changes(self): if self.max_mem_size.value() < self.init_mem.value(): - QtGui.QMessageBox.warning(None, - self.tr("Warning!"), - self.tr("Max memory can not be less than initial memory.
" + QtGui.QMessageBox.warning( + None, + self.tr("Warning!"), + self.tr("Max memory can not be less than initial memory.
" "Setting max memory to equal initial memory.")) 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(): - QtGui.QMessageBox.warning(None, - self.tr("Warning!"), - self.tr("Initial memory can not be less than one tenth " + QtGui.QMessageBox.warning( + None, + self.tr("Warning!"), + self.tr("Initial memory can not be less than one tenth " "Max memory.
Setting initial memory to the minimum " "allowed value.")) self.init_mem.setValue(self.max_mem_size.value() / 10) @@ -432,10 +460,10 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog): def rename_vm(self): - new_vm_name, ok = QtGui.QInputDialog.getText(self, - self.tr('Rename VM'), - self.tr('New name: (WARNING: ' - 'all other changes will be discarded)')) + new_vm_name, ok = QtGui.QInputDialog.getText( + self, + self.tr('Rename VM'), + self.tr('New name: (WARNING: all other changes will be discarded)')) if ok: self._run_in_thread(self._rename_vm, new_vm_name) @@ -565,7 +593,8 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog): if hasattr(self.vm, "kernel") and self.kernel_groupbox.isVisible(): try: if self.kernel.currentIndex() != self.kernel_idx: - self.vm.kernel = self.kernel_list[self.kernel.currentIndex()] + self.vm.kernel = self.kernel_list[ + self.kernel.currentIndex()] self.anything_changed = True except Exception as ex: msg.append(str(ex)) @@ -613,7 +642,8 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog): self.dev_list.available_list.addItem( DevListWidgetItem(name, ident)) - if self.dev_list.selected_list.count() > 0 and self.include_in_balancing.isChecked(): + if self.dev_list.selected_list.count() > 0\ + and self.include_in_balancing.isChecked(): self.dmm_warning_adv.show() self.dmm_warning_dev.show() else: @@ -709,7 +739,9 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog): self.refresh_apps_button.setText(self.tr('Refresh in progress...')) t_monitor = thread_monitor.ThreadMonitor() - thread = threading.Thread(target=self.refresh_apps_in_vm, args=(t_monitor,)) + thread = threading.Thread( + target=self.refresh_apps_in_vm, + args=(t_monitor,)) thread.daemon = True thread.start() @@ -732,18 +764,24 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog): service = feature[len('service.'):] item = QtGui.QListWidgetItem(service) item.setCheckState(ui_settingsdlg.QtCore.Qt.Checked - if self.vm.features[feature] else ui_settingsdlg.QtCore.Qt.Unchecked) + if self.vm.features[feature] + else ui_settingsdlg.QtCore.Qt.Unchecked) self.services_list.addItem(item) self.new_srv_dict[service] = self.vm.features[feature] - self.connect(self.services_list, QtCore.SIGNAL("itemClicked(QListWidgetItem *)"), self.services_item_clicked) + self.connect( + self.services_list, + QtCore.SIGNAL("itemClicked(QListWidgetItem *)"), + self.services_item_clicked) def __add_service__(self): srv = str(self.service_line_edit.text()).strip() if srv != "": if srv in self.new_srv_dict: - QtGui.QMessageBox.information(None, '', - self.tr('Service already on the list!')) + QtGui.QMessageBox.information( + None, + '', + self.tr('Service already on the list!')) else: item = QtGui.QListWidgetItem(srv) item.setCheckState(ui_settingsdlg.QtCore.Qt.Checked) @@ -756,9 +794,11 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog): if not item: return if str(item.text()) == 'meminfo-writer': - QtGui.QMessageBox.information(None, - self.tr('Service can not be removed'), - self.tr('Service meminfo-writer can not be removed from the list.')) + QtGui.QMessageBox.information( + None, + self.tr('Service can not be removed'), + self.tr('Service meminfo-writer can not ' + 'be removed from the list.')) return row = self.services_list.currentRow() @@ -782,11 +822,14 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog): try: for r in range(self.services_list.count()): item = self.services_list.item(r) - self.new_srv_dict[str(item.text())] = (item.checkState() == ui_settingsdlg.QtCore.Qt.Checked) + self.new_srv_dict[str(item.text())] = \ + (item.checkState() == ui_settingsdlg.QtCore.Qt.Checked) - balancing_was_checked = self.vm.features.get('service.meminfo-writer', True) + balancing_was_checked = self.vm.features.get( + 'service.meminfo-writer', True) balancing_is_checked = self.include_in_balancing.isChecked() - meminfo_writer_checked = self.new_srv_dict.get('meminfo-writer', True) + meminfo_writer_checked = self.new_srv_dict.get( + 'meminfo-writer', True) if balancing_is_checked != meminfo_writer_checked: if balancing_is_checked != balancing_was_checked: @@ -815,7 +858,8 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog): def set_fw_model(self, model): self.fw_model = model self.rulesTreeView.setModel(model) - self.rulesTreeView.header().setResizeMode(QtGui.QHeaderView.ResizeToContents) + self.rulesTreeView.header().setResizeMode( + QtGui.QHeaderView.ResizeToContents) self.rulesTreeView.header().setResizeMode(0, QtGui.QHeaderView.Stretch) self.set_allow(model.allow) if model.tempFullAccessExpireTime: @@ -894,8 +938,8 @@ def handle_exception(exc_type, exc_value, exc_traceback): msg_box.setDetailedText(strace) msg_box.setIcon(QtGui.QMessageBox.Critical) msg_box.setWindowTitle("Houston, we have a problem...") - msg_box.setText("Whoops. A critical error has occured. This is most likely a bug " - "in Qubes Manager.

" + msg_box.setText("Whoops. A critical error has occured. " + "This is most likely a bug in Qubes Manager.

" "%s" % error + "
at line %d
of file %s.

" % ( line, filename ))