Fixed trailing and bad whitespaces
Fixed trailing and bad whitespaces
This commit is contained in:
parent
91572eea2d
commit
2b24abb8c8
@ -38,7 +38,7 @@ from .thread_monitor import ThreadMonitor
|
|||||||
|
|
||||||
|
|
||||||
class NewVmDlg(QtGui.QDialog, Ui_NewVMDlg):
|
class NewVmDlg(QtGui.QDialog, Ui_NewVMDlg):
|
||||||
def __init__(self, qtapp, app, parent = None):
|
def __init__(self, qtapp, app, parent=None):
|
||||||
super(NewVmDlg, self).__init__(parent)
|
super(NewVmDlg, self).__init__(parent)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ class NewVmDlg(QtGui.QDialog, Ui_NewVMDlg):
|
|||||||
|
|
||||||
while not thread_monitor.is_finished():
|
while not thread_monitor.is_finished():
|
||||||
self.qtapp.processEvents()
|
self.qtapp.processEvents()
|
||||||
time.sleep (0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
progress.hide()
|
progress.hide()
|
||||||
|
|
||||||
|
@ -31,8 +31,8 @@ class FirewallModifiedOutsideError(ValueError):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
class QIPAddressValidator(QtGui.QValidator):
|
class QIPAddressValidator(QtGui.QValidator):
|
||||||
def __init__(self, parent = None):
|
def __init__(self, parent=None):
|
||||||
super (QIPAddressValidator, self).__init__(parent)
|
super(QIPAddressValidator, self).__init__(parent)
|
||||||
|
|
||||||
def validate(self, input, pos):
|
def validate(self, input, pos):
|
||||||
hostname = str(input)
|
hostname = str(input)
|
||||||
@ -69,9 +69,9 @@ class QIPAddressValidator(QtGui.QValidator):
|
|||||||
|
|
||||||
return (QtGui.QValidator.Invalid, input, pos)
|
return (QtGui.QValidator.Invalid, input, pos)
|
||||||
|
|
||||||
class NewFwRuleDlg (QtGui.QDialog, ui_newfwruledlg.Ui_NewFwRuleDlg):
|
class NewFwRuleDlg(QtGui.QDialog, ui_newfwruledlg.Ui_NewFwRuleDlg):
|
||||||
def __init__(self, parent = None):
|
def __init__(self, parent=None):
|
||||||
super (NewFwRuleDlg, self).__init__(parent)
|
super(NewFwRuleDlg, self).__init__(parent)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
|
|
||||||
self.set_ok_enabled(False)
|
self.set_ok_enabled(False)
|
||||||
@ -151,7 +151,7 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
|||||||
if match is not None:
|
if match is not None:
|
||||||
service = match.groupdict()
|
service = match.groupdict()
|
||||||
self.__services.append(
|
self.__services.append(
|
||||||
(service["name"], int(service["port"]),) )
|
(service["name"], int(service["port"]),))
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
self.fw_changed = False
|
self.fw_changed = False
|
||||||
@ -160,8 +160,8 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
|||||||
from operator import attrgetter
|
from operator import attrgetter
|
||||||
|
|
||||||
rev = (order == QtCore.Qt.AscendingOrder)
|
rev = (order == QtCore.Qt.AscendingOrder)
|
||||||
self.children.sort(key = lambda x: self.get_column_string(idx, x)
|
self.children.sort(key=lambda x: self.get_column_string(idx, x)
|
||||||
, reverse = rev)
|
, reverse=rev)
|
||||||
|
|
||||||
index1 = self.createIndex(0, 0)
|
index1 = self.createIndex(0, 0)
|
||||||
index2 = self.createIndex(len(self)-1, len(self.__columnNames)-1)
|
index2 = self.createIndex(len(self)-1, len(self.__columnNames)-1)
|
||||||
@ -295,7 +295,7 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
|||||||
action='accept'))
|
action='accept'))
|
||||||
else:
|
else:
|
||||||
rules.append(qubesadmin.firewall.Rule(None,
|
rules.append(qubesadmin.firewall.Rule(None,
|
||||||
action = 'drop'))
|
action='drop'))
|
||||||
|
|
||||||
vm.firewall.rules = rules
|
vm.firewall.rules = rules
|
||||||
|
|
||||||
@ -324,14 +324,14 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
|||||||
(self.tempFullAccessExpireTime != 0) != tempFullAccess:
|
(self.tempFullAccessExpireTime != 0) != tempFullAccess:
|
||||||
self.fw_changed = True
|
self.fw_changed = True
|
||||||
|
|
||||||
conf = { "allow": allow,
|
conf = {"allow": allow,
|
||||||
"rules": list()
|
"rules": list()
|
||||||
}
|
}
|
||||||
|
|
||||||
conf['rules'].extend(self.children)
|
conf['rules'].extend(self.children)
|
||||||
|
|
||||||
if tempFullAccess and not allow:
|
if tempFullAccess and not allow:
|
||||||
conf["rules"].append(qubesadmin.firewall.Rule(None,action='accept'
|
conf["rules"].append(qubesadmin.firewall.Rule(None, action='accept'
|
||||||
, expire=int(datetime.datetime.now().strftime("%s"))+\
|
, expire=int(datetime.datetime.now().strftime("%s"))+\
|
||||||
tempFullAccessTime*60))
|
tempFullAccessTime*60))
|
||||||
|
|
||||||
@ -355,13 +355,13 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
|||||||
else:
|
else:
|
||||||
dialog.any_radio.setChecked(True)
|
dialog.any_radio.setChecked(True)
|
||||||
|
|
||||||
def run_rule_dialog(self, dialog, row = None):
|
def run_rule_dialog(self, dialog, row=None):
|
||||||
if dialog.exec_():
|
if dialog.exec_():
|
||||||
|
|
||||||
address = str(dialog.addressComboBox.currentText())
|
address = str(dialog.addressComboBox.currentText())
|
||||||
service = str(dialog.serviceComboBox.currentText())
|
service = str(dialog.serviceComboBox.currentText())
|
||||||
|
|
||||||
rule = qubesadmin.firewall.Rule(None,action='accept')
|
rule = qubesadmin.firewall.Rule(None, action='accept')
|
||||||
|
|
||||||
if address is not None and address != "*":
|
if address is not None and address != "*":
|
||||||
try:
|
try:
|
||||||
@ -425,8 +425,8 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
|||||||
|
|
||||||
def data(self, index, role=QtCore.Qt.DisplayRole):
|
def data(self, index, role=QtCore.Qt.DisplayRole):
|
||||||
if index.isValid() and role == QtCore.Qt.DisplayRole:
|
if index.isValid() and role == QtCore.Qt.DisplayRole:
|
||||||
return self.get_column_string(index.column()
|
return self.get_column_string(index.column(),
|
||||||
,self.children[index.row()])
|
self.children[index.row()])
|
||||||
|
|
||||||
def headerData(self, section, orientation, role=QtCore.Qt.DisplayRole):
|
def headerData(self, section, orientation, role=QtCore.Qt.DisplayRole):
|
||||||
if section < len(self.__columnNames) \
|
if section < len(self.__columnNames) \
|
||||||
|
@ -182,7 +182,7 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
|
|||||||
|
|
||||||
#qmemman settings
|
#qmemman settings
|
||||||
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)
|
self.dom0_mem_boost_val = '350MiB' #str(qmemman_algo.DOM0_MEM_BOOST)
|
||||||
|
|
||||||
self.qmemman_config.read(qmemman_config_path)
|
self.qmemman_config.read(qmemman_config_path)
|
||||||
@ -296,13 +296,13 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
|
|||||||
# Bases on the original code by:
|
# Bases on the original code by:
|
||||||
# Copyright (c) 2002-2007 Pascal Varet <p.varet@gmail.com>
|
# Copyright (c) 2002-2007 Pascal Varet <p.varet@gmail.com>
|
||||||
|
|
||||||
def handle_exception( exc_type, exc_value, exc_traceback ):
|
def handle_exception(exc_type, exc_value, exc_traceback):
|
||||||
import os.path
|
import os.path
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
filename, line, dummy, dummy = traceback.extract_tb( exc_traceback ).pop()
|
filename, line, dummy, dummy = traceback.extract_tb(exc_traceback).pop()
|
||||||
filename = os.path.basename( filename )
|
filename = os.path.basename(filename)
|
||||||
error = "%s: %s" % ( exc_type.__name__, exc_value )
|
error = "%s: %s" % (exc_type.__name__, exc_value)
|
||||||
|
|
||||||
QtGui.QMessageBox.critical(
|
QtGui.QMessageBox.critical(
|
||||||
None,
|
None,
|
||||||
@ -310,7 +310,7 @@ def handle_exception( exc_type, exc_value, exc_traceback ):
|
|||||||
"Whoops. A critical error has occured. This is most likely a bug "
|
"Whoops. A critical error has occured. This is most likely a bug "
|
||||||
"in Qubes Global Settings application.<br><br><b><i>%s</i></b>" %
|
"in Qubes Global Settings application.<br><br><b><i>%s</i></b>" %
|
||||||
error + "at <b>line %d</b> of file <b>%s</b>.<br/><br/>"
|
error + "at <b>line %d</b> of file <b>%s</b>.<br/><br/>"
|
||||||
% ( line, filename ))
|
% (line, filename))
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
@ -157,7 +157,7 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
|
|||||||
|
|
||||||
while not t_monitor.is_finished():
|
while not t_monitor.is_finished():
|
||||||
self.qapp.processEvents()
|
self.qapp.processEvents()
|
||||||
time.sleep (0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
progress.hide()
|
progress.hide()
|
||||||
|
|
||||||
@ -209,7 +209,7 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
|
|||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
ret += [self.tr("Applications tab:"), str(ex)]
|
ret += [self.tr("Applications tab:"), str(ex)]
|
||||||
|
|
||||||
if len(ret) > 0 :
|
if len(ret) > 0:
|
||||||
t_monitor.set_error_msg('\n'.join(ret))
|
t_monitor.set_error_msg('\n'.join(ret))
|
||||||
|
|
||||||
utils.debug('\n'.join(ret))
|
utils.debug('\n'.join(ret))
|
||||||
@ -626,7 +626,7 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
|
|||||||
devs.append((dev.rstrip(), dev.split(' ')[0]))
|
devs.append((dev.rstrip(), dev.split(' ')[0]))
|
||||||
|
|
||||||
class DevListWidgetItem(QtGui.QListWidgetItem):
|
class DevListWidgetItem(QtGui.QListWidgetItem):
|
||||||
def __init__(self, name, ident, parent = None):
|
def __init__(self, name, ident, parent=None):
|
||||||
super(DevListWidgetItem, self).__init__(name, parent)
|
super(DevListWidgetItem, self).__init__(name, parent)
|
||||||
self.ident = ident
|
self.ident = ident
|
||||||
self.Type
|
self.Type
|
||||||
@ -688,7 +688,7 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
|
|||||||
return msg
|
return msg
|
||||||
|
|
||||||
def include_in_balancing_state_changed(self, state):
|
def include_in_balancing_state_changed(self, state):
|
||||||
for r in range (self.services_list.count()):
|
for r in range(self.services_list.count()):
|
||||||
item = self.services_list.item(r)
|
item = self.services_list.item(r)
|
||||||
if str(item.text()) == 'meminfo-writer':
|
if str(item.text()) == 'meminfo-writer':
|
||||||
item.setCheckState(state)
|
item.setCheckState(state)
|
||||||
@ -705,7 +705,7 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
|
|||||||
|
|
||||||
def devices_selection_changed(self):
|
def devices_selection_changed(self):
|
||||||
if self.include_in_balancing.isChecked():
|
if self.include_in_balancing.isChecked():
|
||||||
if self.dev_list.selected_list.count() > 0 :
|
if self.dev_list.selected_list.count() > 0:
|
||||||
self.dmm_warning_adv.show()
|
self.dmm_warning_adv.show()
|
||||||
self.dmm_warning_dev.show()
|
self.dmm_warning_dev.show()
|
||||||
else:
|
else:
|
||||||
@ -747,7 +747,7 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
|
|||||||
|
|
||||||
while not t_monitor.is_finished():
|
while not t_monitor.is_finished():
|
||||||
self.qapp.processEvents()
|
self.qapp.processEvents()
|
||||||
time.sleep (0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
self.AppListManager = AppmenuSelectManager(self.vm, self.app_list)
|
self.AppListManager = AppmenuSelectManager(self.vm, self.app_list)
|
||||||
|
|
||||||
@ -942,7 +942,7 @@ def handle_exception(exc_type, exc_value, exc_traceback):
|
|||||||
"This is most likely a bug in Qubes Manager.<br><br>"
|
"This is most likely a bug in Qubes Manager.<br><br>"
|
||||||
"<b><i>%s</i></b>" % error +
|
"<b><i>%s</i></b>" % error +
|
||||||
"<br/>at line <b>%d</b><br/>of file %s.<br/><br/>"
|
"<br/>at line <b>%d</b><br/>of file %s.<br/><br/>"
|
||||||
% ( line, filename ))
|
% (line, filename))
|
||||||
|
|
||||||
msg_box.exec_()
|
msg_box.exec_()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user