Fixed invalid names
Fixed camel case, too long and too short variable and function names.
This commit is contained in:
parent
d7fbacf0d7
commit
6e5d611f70
@ -85,7 +85,7 @@ variable-rgx=[a-z_][a-z0-9_]{2,30}$
|
|||||||
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
|
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
|
||||||
|
|
||||||
# Good variable names which should always be accepted, separated by a comma
|
# Good variable names which should always be accepted, separated by a comma
|
||||||
good-names=e,i,j,k,m,p,v,ex,Run,_,log,vm
|
good-names=e,i,j,k,m,p,v,ex,Run,_,log,vm,ok
|
||||||
|
|
||||||
# Bad variable names which should always be refused, separated by a comma
|
# Bad variable names which should always be refused, separated by a comma
|
||||||
bad-names=foo,bar,baz,toto,tutu,tata
|
bad-names=foo,bar,baz,toto,tutu,tata
|
||||||
|
@ -61,11 +61,11 @@ class AppmenuSelectManager:
|
|||||||
'--get-available', '--i-understand-format-is-unstable',
|
'--get-available', '--i-understand-format-is-unstable',
|
||||||
self.vm.name]).decode().splitlines()]
|
self.vm.name]).decode().splitlines()]
|
||||||
|
|
||||||
for a in available_appmenus:
|
for app in available_appmenus:
|
||||||
if a.ident in self.whitelisted:
|
if app.ident in self.whitelisted:
|
||||||
self.app_list.selected_list.addItem(a)
|
self.app_list.selected_list.addItem(app)
|
||||||
else:
|
else:
|
||||||
self.app_list.available_list.addItem(a)
|
self.app_list.available_list.addItem(app)
|
||||||
|
|
||||||
self.app_list.available_list.sortItems()
|
self.app_list.available_list.sortItems()
|
||||||
self.app_list.selected_list.sortItems()
|
self.app_list.selected_list.sortItems()
|
||||||
|
@ -74,7 +74,7 @@ class NewFwRuleDlg(QtGui.QDialog, ui_newfwruledlg.Ui_NewFwRuleDlg):
|
|||||||
super(NewFwRuleDlg, self).__init__(parent)
|
super(NewFwRuleDlg, self).__init__(parent)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
|
|
||||||
self.set_ok_enabled(False)
|
self.set_ok_state(False)
|
||||||
self.addressComboBox.setValidator(QIPAddressValidator())
|
self.addressComboBox.setValidator(QIPAddressValidator())
|
||||||
self.addressComboBox.editTextChanged.connect(
|
self.addressComboBox.editTextChanged.connect(
|
||||||
self.address_editing_finished)
|
self.address_editing_finished)
|
||||||
@ -117,12 +117,12 @@ class NewFwRuleDlg(QtGui.QDialog, ui_newfwruledlg.Ui_NewFwRuleDlg):
|
|||||||
self.serviceComboBox.addItem(service)
|
self.serviceComboBox.addItem(service)
|
||||||
|
|
||||||
def address_editing_finished(self):
|
def address_editing_finished(self):
|
||||||
self.set_ok_enabled(True)
|
self.set_ok_state(True)
|
||||||
|
|
||||||
def set_ok_enabled(self, on):
|
def set_ok_state(self, ok_state):
|
||||||
ok_button = self.buttonBox.button(QtGui.QDialogButtonBox.Ok)
|
ok_button = self.buttonBox.button(QtGui.QDialogButtonBox.Ok)
|
||||||
if ok_button is not None:
|
if ok_button is not None:
|
||||||
ok_button.setEnabled(on)
|
ok_button.setEnabled(ok_state)
|
||||||
|
|
||||||
def on_tcp_radio_toggled(self, checked):
|
def on_tcp_radio_toggled(self, checked):
|
||||||
if checked:
|
if checked:
|
||||||
@ -140,19 +140,19 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
|||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
QtCore.QAbstractItemModel.__init__(self, parent)
|
QtCore.QAbstractItemModel.__init__(self, parent)
|
||||||
|
|
||||||
self.__columnNames = {0: "Address", 1: "Service", 2: "Protocol", }
|
self.__column_names = {0: "Address", 1: "Service", 2: "Protocol", }
|
||||||
self.__services = list()
|
self.__services = list()
|
||||||
pattern = re.compile(
|
pattern = re.compile(
|
||||||
"(?P<name>[a-z][a-z0-9-]+)\s+(?P<port>[0-9]+)/(?P<protocol>[a-z]+)",
|
"(?P<name>[a-z][a-z0-9-]+)\s+(?P<port>[0-9]+)/(?P<protocol>[a-z]+)",
|
||||||
re.IGNORECASE)
|
re.IGNORECASE)
|
||||||
f = open('/etc/services', 'r')
|
file = open('/etc/services', 'r')
|
||||||
for line in f:
|
for line in file:
|
||||||
match = pattern.match(line)
|
match = pattern.match(line)
|
||||||
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()
|
file.close()
|
||||||
|
|
||||||
self.fw_changed = False
|
self.fw_changed = False
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
|||||||
, 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.__column_names) - 1)
|
||||||
self.dataChanged.emit(index1, index2)
|
self.dataChanged.emit(index1, index2)
|
||||||
|
|
||||||
|
|
||||||
@ -219,8 +219,8 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
|||||||
'rules': [],
|
'rules': [],
|
||||||
}
|
}
|
||||||
|
|
||||||
allowDns = False
|
allow_dns = False
|
||||||
allowIcmp = False
|
allow_icmp = False
|
||||||
common_action = None
|
common_action = None
|
||||||
|
|
||||||
reversed_rules = list(reversed(vm.firewall.rules))
|
reversed_rules = list(reversed(vm.firewall.rules))
|
||||||
@ -241,11 +241,11 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
|||||||
rule = reversed_rules.pop(0)
|
rule = reversed_rules.pop(0)
|
||||||
|
|
||||||
if rule == dns_rule:
|
if rule == dns_rule:
|
||||||
allowDns = True
|
allow_dns = True
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if rule.proto == icmp_rule:
|
if rule.proto == icmp_rule:
|
||||||
allowIcmp = True
|
allow_icmp = True
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if rule.specialtarget is not None or rule.icmptype is not None:
|
if rule.specialtarget is not None or rule.icmptype is not None:
|
||||||
@ -268,10 +268,10 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
|||||||
|
|
||||||
conf['allow'] = (common_action == 'accept')
|
conf['allow'] = (common_action == 'accept')
|
||||||
|
|
||||||
if not allowIcmp and not conf['allow']:
|
if not allow_icmp and not conf['allow']:
|
||||||
raise FirewallModifiedOutsideError('ICMP must be allowed.')
|
raise FirewallModifiedOutsideError('ICMP must be allowed.')
|
||||||
|
|
||||||
if not allowDns and not conf['allow']:
|
if not allow_dns and not conf['allow']:
|
||||||
raise FirewallModifiedOutsideError('DNS must be allowed')
|
raise FirewallModifiedOutsideError('DNS must be allowed')
|
||||||
|
|
||||||
return conf
|
return conf
|
||||||
@ -302,26 +302,26 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
|||||||
def set_vm(self, vm):
|
def set_vm(self, vm):
|
||||||
self.__vm = vm
|
self.__vm = vm
|
||||||
|
|
||||||
self.clearChildren()
|
self.clear_children()
|
||||||
|
|
||||||
conf = self.get_firewall_conf(vm)
|
conf = self.get_firewall_conf(vm)
|
||||||
|
|
||||||
self.allow = conf["allow"]
|
self.allow = conf["allow"]
|
||||||
|
|
||||||
self.tempFullAccessExpireTime = conf['expire']
|
self.temp_full_access_expire_time = conf['expire']
|
||||||
|
|
||||||
for rule in conf["rules"]:
|
for rule in conf["rules"]:
|
||||||
self.appendChild(rule)
|
self.append_child(rule)
|
||||||
|
|
||||||
def get_vm_name(self):
|
def get_vm_name(self):
|
||||||
return self.__vm.name
|
return self.__vm.name
|
||||||
|
|
||||||
def apply_rules(self, allow, tempFullAccess=False,
|
def apply_rules(self, allow, temp_full_access=False,
|
||||||
tempFullAccessTime=None):
|
temp_full_access_time=None):
|
||||||
assert self.__vm is not None
|
assert self.__vm is not None
|
||||||
|
|
||||||
if self.allow != allow or \
|
if self.allow != allow or \
|
||||||
(self.tempFullAccessExpireTime != 0) != tempFullAccess:
|
(self.temp_full_access_expire_time != 0) != temp_full_access:
|
||||||
self.fw_changed = True
|
self.fw_changed = True
|
||||||
|
|
||||||
conf = {"allow": allow,
|
conf = {"allow": allow,
|
||||||
@ -330,10 +330,12 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
|||||||
|
|
||||||
conf['rules'].extend(self.children)
|
conf['rules'].extend(self.children)
|
||||||
|
|
||||||
if tempFullAccess and not allow:
|
if temp_full_access and not allow:
|
||||||
conf["rules"].append(qubesadmin.firewall.Rule(None, action='accept'
|
conf["rules"].append(qubesadmin.firewall.Rule(
|
||||||
, expire=int(datetime.datetime.now().strftime("%s"))+\
|
None,
|
||||||
tempFullAccessTime*60))
|
action='accept',
|
||||||
|
expire=int(datetime.datetime.now().strftime("%s")) +
|
||||||
|
temp_full_access_time * 60))
|
||||||
|
|
||||||
if self.fw_changed:
|
if self.fw_changed:
|
||||||
self.write_firewall_conf(self.__vm, conf)
|
self.write_firewall_conf(self.__vm, conf)
|
||||||
@ -397,9 +399,9 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
|||||||
.format(service))
|
.format(service))
|
||||||
|
|
||||||
if row is not None:
|
if row is not None:
|
||||||
self.setChild(row, rule)
|
self.set_child(row, rule)
|
||||||
else:
|
else:
|
||||||
self.appendChild(rule)
|
self.append_child(rule)
|
||||||
|
|
||||||
def index(self, row, column, parent=QtCore.QModelIndex()):
|
def index(self, row, column, parent=QtCore.QModelIndex()):
|
||||||
if not self.hasIndex(row, column, parent):
|
if not self.hasIndex(row, column, parent):
|
||||||
@ -410,15 +412,18 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
|||||||
def parent(self, child):
|
def parent(self, child):
|
||||||
return QtCore.QModelIndex()
|
return QtCore.QModelIndex()
|
||||||
|
|
||||||
|
# pylint: disable=invalid-name
|
||||||
def rowCount(self, parent=QtCore.QModelIndex()):
|
def rowCount(self, parent=QtCore.QModelIndex()):
|
||||||
return len(self)
|
return len(self)
|
||||||
|
|
||||||
|
# pylint: disable=invalid-name
|
||||||
def columnCount(self, parent=QtCore.QModelIndex()):
|
def columnCount(self, parent=QtCore.QModelIndex()):
|
||||||
return len(self.__columnNames)
|
return len(self.__column_names)
|
||||||
|
|
||||||
|
# pylint: disable=invalid-name
|
||||||
def hasChildren(self, index=QtCore.QModelIndex()):
|
def hasChildren(self, index=QtCore.QModelIndex()):
|
||||||
parentItem = index.internalPointer()
|
parent_item = index.internalPointer()
|
||||||
if parentItem is not None:
|
if parent_item is not None:
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
@ -428,17 +433,18 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
|||||||
return self.get_column_string(index.column(),
|
return self.get_column_string(index.column(),
|
||||||
self.children[index.row()])
|
self.children[index.row()])
|
||||||
|
|
||||||
|
# pylint: disable=invalid-name
|
||||||
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.__column_names) \
|
||||||
and orientation == QtCore.Qt.Horizontal \
|
and orientation == QtCore.Qt.Horizontal \
|
||||||
and role == QtCore.Qt.DisplayRole:
|
and role == QtCore.Qt.DisplayRole:
|
||||||
return self.__columnNames[section]
|
return self.__column_names[section]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def children(self):
|
def children(self):
|
||||||
return self.__children
|
return self.__children
|
||||||
|
|
||||||
def appendChild(self, child):
|
def append_child(self, child):
|
||||||
row = len(self)
|
row = len(self)
|
||||||
self.beginInsertRows(QtCore.QModelIndex(), row, row)
|
self.beginInsertRows(QtCore.QModelIndex(), row, row)
|
||||||
self.children.append(child)
|
self.children.append(child)
|
||||||
@ -447,7 +453,7 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
|||||||
self.dataChanged.emit(index, index)
|
self.dataChanged.emit(index, index)
|
||||||
self.fw_changed = True
|
self.fw_changed = True
|
||||||
|
|
||||||
def removeChild(self, i):
|
def remove_child(self, i):
|
||||||
if i >= len(self):
|
if i >= len(self):
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -458,13 +464,13 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
|||||||
self.dataChanged.emit(index, index)
|
self.dataChanged.emit(index, index)
|
||||||
self.fw_changed = True
|
self.fw_changed = True
|
||||||
|
|
||||||
def setChild(self, i, child):
|
def set_child(self, i, child):
|
||||||
self.children[i] = child
|
self.children[i] = child
|
||||||
index = self.createIndex(i, 0, child)
|
index = self.createIndex(i, 0, child)
|
||||||
self.dataChanged.emit(index, index)
|
self.dataChanged.emit(index, index)
|
||||||
self.fw_changed = True
|
self.fw_changed = True
|
||||||
|
|
||||||
def clearChildren(self):
|
def clear_children(self):
|
||||||
self.__children = list()
|
self.__children = list()
|
||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
|
@ -240,20 +240,20 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
|
|||||||
config_lines = []
|
config_lines = []
|
||||||
|
|
||||||
qmemman_config_file = open(qmemman_config_path, 'r')
|
qmemman_config_file = open(qmemman_config_path, 'r')
|
||||||
for l in qmemman_config_file:
|
for line in qmemman_config_file:
|
||||||
if l.strip().startswith('vm-min-mem'):
|
if line.strip().startswith('vm-min-mem'):
|
||||||
config_lines.append(lines_to_add['vm-min-mem'])
|
config_lines.append(lines_to_add['vm-min-mem'])
|
||||||
del lines_to_add['vm-min-mem']
|
del lines_to_add['vm-min-mem']
|
||||||
elif l.strip().startswith('dom0-mem-boost'):
|
elif line.strip().startswith('dom0-mem-boost'):
|
||||||
config_lines.append(lines_to_add['dom0-mem-boost'])
|
config_lines.append(lines_to_add['dom0-mem-boost'])
|
||||||
del lines_to_add['dom0-mem-boost']
|
del lines_to_add['dom0-mem-boost']
|
||||||
else:
|
else:
|
||||||
config_lines.append(l)
|
config_lines.append(line)
|
||||||
|
|
||||||
qmemman_config_file.close()
|
qmemman_config_file.close()
|
||||||
|
|
||||||
for l in lines_to_add:
|
for line in lines_to_add:
|
||||||
config_lines.append(l)
|
config_lines.append(line)
|
||||||
|
|
||||||
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)
|
||||||
|
@ -24,8 +24,8 @@ class MultiSelectWidget(
|
|||||||
selected = src.selectedItems()
|
selected = src.selectedItems()
|
||||||
items = []
|
items = []
|
||||||
|
|
||||||
for s in selected:
|
for selected_item in selected:
|
||||||
row = src.indexFromItem(s).row()
|
row = src.indexFromItem(selected_item).row()
|
||||||
item = src.takeItem(row)
|
item = src.takeItem(row)
|
||||||
dst.addItem(item)
|
dst.addItem(item)
|
||||||
items.append(item)
|
items.append(item)
|
||||||
|
@ -89,14 +89,14 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
|
|||||||
###### advanced tab
|
###### advanced tab
|
||||||
self.__init_advanced_tab__()
|
self.__init_advanced_tab__()
|
||||||
self.include_in_balancing.stateChanged.connect(
|
self.include_in_balancing.stateChanged.connect(
|
||||||
self.include_in_balancing_state_changed)
|
self.include_in_balancing_changed)
|
||||||
self.connect(self.init_mem,
|
self.connect(self.init_mem,
|
||||||
QtCore.SIGNAL("editingFinished()"),
|
QtCore.SIGNAL("editingFinished()"),
|
||||||
self.check_mem_changes)
|
self.check_mem_changes)
|
||||||
self.connect(self.max_mem_size,
|
self.connect(self.max_mem_size,
|
||||||
QtCore.SIGNAL("editingFinished()"),
|
QtCore.SIGNAL("editingFinished()"),
|
||||||
self.check_mem_changes)
|
self.check_mem_changes)
|
||||||
self.bootFromDeviceButton.clicked.connect(
|
self.boot_from_device_button.clicked.connect(
|
||||||
self.boot_from_cdrom_button_pressed)
|
self.boot_from_cdrom_button_pressed)
|
||||||
|
|
||||||
###### firewall tab
|
###### firewall tab
|
||||||
@ -105,16 +105,16 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
|
|||||||
try:
|
try:
|
||||||
model.set_vm(vm)
|
model.set_vm(vm)
|
||||||
self.set_fw_model(model)
|
self.set_fw_model(model)
|
||||||
self.firewallModifiedOutsidelabel.setVisible(False)
|
self.firewall_modified_outside_label.setVisible(False)
|
||||||
except firewall.FirewallModifiedOutsideError as ex:
|
except firewall.FirewallModifiedOutsideError as ex:
|
||||||
self.disable_all_fw_conf()
|
self.disable_all_fw_conf()
|
||||||
|
|
||||||
self.newRuleButton.clicked.connect(self.new_rule_button_pressed)
|
self.new_rule_button.clicked.connect(self.new_rule_button_pressed)
|
||||||
self.editRuleButton.clicked.connect(self.edit_rule_button_pressed)
|
self.edit_rule_button.clicked.connect(self.edit_rule_button_pressed)
|
||||||
self.deleteRuleButton.clicked.connect(
|
self.delete_rule_button.clicked.connect(
|
||||||
self.delete_rule_button_pressed)
|
self.delete_rule_button_pressed)
|
||||||
self.policyDenyRadioButton.clicked.connect(self.policy_changed)
|
self.policy_deny_radio_button.clicked.connect(self.policy_changed)
|
||||||
self.policyAllowRadioButton.clicked.connect(self.policy_changed)
|
self.policy_allow_radio_button.clicked.connect(self.policy_changed)
|
||||||
|
|
||||||
####### devices tab
|
####### devices tab
|
||||||
self.__init_devices_tab__()
|
self.__init_devices_tab__()
|
||||||
@ -131,7 +131,7 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
|
|||||||
if self.tabWidget.isTabEnabled(self.tabs_indices["applications"]):
|
if self.tabWidget.isTabEnabled(self.tabs_indices["applications"]):
|
||||||
self.app_list = multiselectwidget.MultiSelectWidget(self)
|
self.app_list = multiselectwidget.MultiSelectWidget(self)
|
||||||
self.apps_layout.addWidget(self.app_list)
|
self.apps_layout.addWidget(self.app_list)
|
||||||
self.AppListManager = AppmenuSelectManager(self.vm, self.app_list)
|
self.app_list_manager = AppmenuSelectManager(self.vm, self.app_list)
|
||||||
self.refresh_apps_button.clicked.connect(
|
self.refresh_apps_button.clicked.connect(
|
||||||
self.refresh_apps_button_pressed)
|
self.refresh_apps_button_pressed)
|
||||||
|
|
||||||
@ -195,11 +195,11 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
|
|||||||
ret.append(repr(ex))
|
ret.append(repr(ex))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if self.policyAllowRadioButton.isEnabled():
|
if self.policy_allow_radio_button.isEnabled():
|
||||||
self.fw_model.apply_rules(
|
self.fw_model.apply_rules(
|
||||||
self.policyAllowRadioButton.isChecked(),
|
self.policy_allow_radio_button.isChecked(),
|
||||||
self.tempFullAccess.isChecked(),
|
self.temp_full_access.isChecked(),
|
||||||
self.tempFullAccessTime.value())
|
self.temp_full_access_time.value())
|
||||||
if self.fw_model.fw_changed:
|
if self.fw_model.fw_changed:
|
||||||
# might modified vm.services
|
# might modified vm.services
|
||||||
self.anything_changed = True
|
self.anything_changed = True
|
||||||
@ -210,7 +210,7 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
if self.tabWidget.isTabEnabled(self.tabs_indices["applications"]):
|
if self.tabWidget.isTabEnabled(self.tabs_indices["applications"]):
|
||||||
self.AppListManager.save_appmenu_select_changes()
|
self.app_list_manager.save_appmenu_select_changes()
|
||||||
except qubesadmin.exc.QubesException as qex:
|
except qubesadmin.exc.QubesException as qex:
|
||||||
ret += [self.tr("Applications tab:"), str(qex)]
|
ret += [self.tr("Applications tab:"), str(qex)]
|
||||||
except Exception as ex: # pylint: disable=broad-except
|
except Exception as ex: # pylint: disable=broad-except
|
||||||
@ -700,9 +700,9 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
|
|||||||
|
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
def include_in_balancing_state_changed(self, state):
|
def include_in_balancing_changed(self, state):
|
||||||
for r in range(self.services_list.count()):
|
for i in range(self.services_list.count()):
|
||||||
item = self.services_list.item(r)
|
item = self.services_list.item(i)
|
||||||
if str(item.text()) == 'meminfo-writer':
|
if str(item.text()) == 'meminfo-writer':
|
||||||
item.setCheckState(state)
|
item.setCheckState(state)
|
||||||
break
|
break
|
||||||
@ -762,7 +762,7 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
|
|||||||
self.qapp.processEvents()
|
self.qapp.processEvents()
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
self.AppListManager = AppmenuSelectManager(self.vm, self.app_list)
|
self.app_list_manager = AppmenuSelectManager(self.vm, self.app_list)
|
||||||
|
|
||||||
self.refresh_apps_button.setEnabled(True)
|
self.refresh_apps_button.setEnabled(True)
|
||||||
self.refresh_apps_button.setText(self.tr('Refresh Applications'))
|
self.refresh_apps_button.setText(self.tr('Refresh Applications'))
|
||||||
@ -833,8 +833,8 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
|
|||||||
msg = []
|
msg = []
|
||||||
|
|
||||||
try:
|
try:
|
||||||
for r in range(self.services_list.count()):
|
for i in range(self.services_list.count()):
|
||||||
item = self.services_list.item(r)
|
item = self.services_list.item(i)
|
||||||
self.new_srv_dict[str(item.text())] = \
|
self.new_srv_dict[str(item.text())] = \
|
||||||
(item.checkState() == ui_settingsdlg.QtCore.Qt.Checked)
|
(item.checkState() == ui_settingsdlg.QtCore.Qt.Checked)
|
||||||
|
|
||||||
@ -875,37 +875,41 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
|
|||||||
QtGui.QHeaderView.ResizeToContents)
|
QtGui.QHeaderView.ResizeToContents)
|
||||||
self.rulesTreeView.header().setResizeMode(0, QtGui.QHeaderView.Stretch)
|
self.rulesTreeView.header().setResizeMode(0, QtGui.QHeaderView.Stretch)
|
||||||
self.set_allow(model.allow)
|
self.set_allow(model.allow)
|
||||||
if model.tempFullAccessExpireTime:
|
if model.temp_full_access_expire_time:
|
||||||
self.tempFullAccess.setChecked(True)
|
self.temp_full_access.setChecked(True)
|
||||||
self.tempFullAccessTime.setValue(
|
self.temp_full_access_time.setValue(
|
||||||
(model.tempFullAccessExpireTime -
|
(model.temp_full_access_expire_time -
|
||||||
int(firewall.datetime.datetime.now().strftime("%s"))) / 60)
|
int(firewall.datetime.datetime.now().strftime("%s"))) / 60)
|
||||||
|
|
||||||
def disable_all_fw_conf(self):
|
def disable_all_fw_conf(self):
|
||||||
self.firewallModifiedOutsidelabel.setVisible(True)
|
self.firewall_modified_outside_label.setVisible(True)
|
||||||
self.policyAllowRadioButton.setEnabled(False)
|
self.policy_allow_radio_button.setEnabled(False)
|
||||||
self.policyDenyRadioButton.setEnabled(False)
|
self.policy_deny_radio_button.setEnabled(False)
|
||||||
self.rulesTreeView.setEnabled(False)
|
self.rulesTreeView.setEnabled(False)
|
||||||
self.newRuleButton.setEnabled(False)
|
self.new_rule_button.setEnabled(False)
|
||||||
self.editRuleButton.setEnabled(False)
|
self.edit_rule_button.setEnabled(False)
|
||||||
self.deleteRuleButton.setEnabled(False)
|
self.delete_rule_button.setEnabled(False)
|
||||||
self.firewalRulesLabel.setEnabled(False)
|
self.firewal_rules_label.setEnabled(False)
|
||||||
self.tempFullAccessWidget.setEnabled(False)
|
self.tempFullAccessWidget.setEnabled(False)
|
||||||
|
|
||||||
def set_allow(self, allow):
|
def set_allow(self, allow):
|
||||||
self.policyAllowRadioButton.setChecked(allow)
|
self.policy_allow_radio_button.setChecked(allow)
|
||||||
self.policyDenyRadioButton.setChecked(not allow)
|
self.policy_deny_radio_button.setChecked(not allow)
|
||||||
self.policy_changed(allow)
|
self.policy_changed(allow)
|
||||||
|
|
||||||
def policy_changed(self, checked):
|
def policy_changed(self):
|
||||||
self.rulesTreeView.setEnabled(self.policyDenyRadioButton.isChecked())
|
self.rulesTreeView.setEnabled(
|
||||||
self.newRuleButton.setEnabled(self.policyDenyRadioButton.isChecked())
|
self.policy_deny_radio_button.isChecked())
|
||||||
self.editRuleButton.setEnabled(self.policyDenyRadioButton.isChecked())
|
self.new_rule_button.setEnabled(
|
||||||
self.deleteRuleButton.setEnabled(self.policyDenyRadioButton.isChecked())
|
self.policy_deny_radio_button.isChecked())
|
||||||
self.firewalRulesLabel.setEnabled(
|
self.edit_rule_button.setEnabled(
|
||||||
self.policyDenyRadioButton.isChecked())
|
self.policy_deny_radio_button.isChecked())
|
||||||
|
self.delete_rule_button.setEnabled(
|
||||||
|
self.policy_deny_radio_button.isChecked())
|
||||||
|
self.firewal_rules_label.setEnabled(
|
||||||
|
self.policy_deny_radio_button.isChecked())
|
||||||
self.tempFullAccessWidget.setEnabled(
|
self.tempFullAccessWidget.setEnabled(
|
||||||
self.policyDenyRadioButton.isChecked())
|
self.policy_deny_radio_button.isChecked())
|
||||||
|
|
||||||
def new_rule_button_pressed(self):
|
def new_rule_button_pressed(self):
|
||||||
dialog = firewall.NewFwRuleDlg()
|
dialog = firewall.NewFwRuleDlg()
|
||||||
@ -917,7 +921,7 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
|
|||||||
|
|
||||||
if len(selected) > 0:
|
if len(selected) > 0:
|
||||||
dialog = firewall.NewFwRuleDlg()
|
dialog = firewall.NewFwRuleDlg()
|
||||||
dialog.set_ok_enabled(True)
|
dialog.set_ok_state(True)
|
||||||
row = self.rulesTreeView.selectedIndexes().pop().row()
|
row = self.rulesTreeView.selectedIndexes().pop().row()
|
||||||
self.fw_model.populate_edit_dialog(dialog, row)
|
self.fw_model.populate_edit_dialog(dialog, row)
|
||||||
self.fw_model.run_rule_dialog(dialog, row)
|
self.fw_model.run_rule_dialog(dialog, row)
|
||||||
@ -925,7 +929,7 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
|
|||||||
def delete_rule_button_pressed(self):
|
def delete_rule_button_pressed(self):
|
||||||
for i in set([index.row() for index
|
for i in set([index.row() for index
|
||||||
in self.rulesTreeView.selectedIndexes()]):
|
in self.rulesTreeView.selectedIndexes()]):
|
||||||
self.fw_model.removeChild(i)
|
self.fw_model.remove_child(i)
|
||||||
|
|
||||||
|
|
||||||
# Bases on the original code by:
|
# Bases on the original code by:
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>773</width>
|
<width>773</width>
|
||||||
<height>581</height>
|
<height>609</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -29,7 +29,7 @@
|
|||||||
<locale language="English" country="UnitedStates"/>
|
<locale language="English" country="UnitedStates"/>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="basic_tab">
|
<widget class="QWidget" name="basic_tab">
|
||||||
<property name="locale">
|
<property name="locale">
|
||||||
@ -487,7 +487,7 @@ border-width: 1px;</string>
|
|||||||
<widget class="QComboBox" name="default_dispvm"/>
|
<widget class="QComboBox" name="default_dispvm"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" colspan="2">
|
<item row="2" column="0" colspan="2">
|
||||||
<widget class="QPushButton" name="bootFromDeviceButton">
|
<widget class="QPushButton" name="boot_from_device_button">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Boot qube from CDROM</string>
|
<string>Boot qube from CDROM</string>
|
||||||
</property>
|
</property>
|
||||||
@ -678,14 +678,14 @@ border-width: 1px;</string>
|
|||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="policyAllowRadioButton">
|
<widget class="QRadioButton" name="policy_allow_radio_button">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Allow all outgoing Internet connections</string>
|
<string>Allow all outgoing Internet connections</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="policyDenyRadioButton">
|
<widget class="QRadioButton" name="policy_deny_radio_button">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Limit outgoing Internet connections to ...</string>
|
<string>Limit outgoing Internet connections to ...</string>
|
||||||
</property>
|
</property>
|
||||||
@ -714,7 +714,7 @@ border-width: 1px;</string>
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QLabel" name="firewalRulesLabel">
|
<widget class="QLabel" name="firewal_rules_label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>List of allowed (whitelisted) addresses:</string>
|
<string>List of allowed (whitelisted) addresses:</string>
|
||||||
</property>
|
</property>
|
||||||
@ -736,14 +736,14 @@ border-width: 1px;</string>
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QCheckBox" name="tempFullAccess">
|
<widget class="QCheckBox" name="temp_full_access">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Allow full access for </string>
|
<string>Allow full access for </string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QSpinBox" name="tempFullAccessTime">
|
<widget class="QSpinBox" name="temp_full_access_time">
|
||||||
<property name="suffix">
|
<property name="suffix">
|
||||||
<string> min</string>
|
<string> min</string>
|
||||||
</property>
|
</property>
|
||||||
@ -811,7 +811,7 @@ border-width: 1px;</string>
|
|||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="newRuleButton">
|
<widget class="QPushButton" name="new_rule_button">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@ -828,7 +828,7 @@ border-width: 1px;</string>
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="editRuleButton">
|
<widget class="QPushButton" name="edit_rule_button">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@ -845,7 +845,7 @@ border-width: 1px;</string>
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="deleteRuleButton">
|
<widget class="QPushButton" name="delete_rule_button">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@ -879,7 +879,7 @@ border-width: 1px;</string>
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="firewallModifiedOutsidelabel">
|
<widget class="QLabel" name="firewall_modified_outside_label">
|
||||||
<property name="palette">
|
<property name="palette">
|
||||||
<palette>
|
<palette>
|
||||||
<active>
|
<active>
|
||||||
@ -1117,10 +1117,10 @@ border-width: 1px;</string>
|
|||||||
<tabstop>vcpus</tabstop>
|
<tabstop>vcpus</tabstop>
|
||||||
<tabstop>include_in_balancing</tabstop>
|
<tabstop>include_in_balancing</tabstop>
|
||||||
<tabstop>kernel</tabstop>
|
<tabstop>kernel</tabstop>
|
||||||
<tabstop>newRuleButton</tabstop>
|
<tabstop>new_rule_button</tabstop>
|
||||||
<tabstop>rulesTreeView</tabstop>
|
<tabstop>rulesTreeView</tabstop>
|
||||||
<tabstop>editRuleButton</tabstop>
|
<tabstop>edit_rule_button</tabstop>
|
||||||
<tabstop>deleteRuleButton</tabstop>
|
<tabstop>delete_rule_button</tabstop>
|
||||||
<tabstop>service_line_edit</tabstop>
|
<tabstop>service_line_edit</tabstop>
|
||||||
<tabstop>add_srv_button</tabstop>
|
<tabstop>add_srv_button</tabstop>
|
||||||
<tabstop>services_list</tabstop>
|
<tabstop>services_list</tabstop>
|
||||||
|
Loading…
Reference in New Issue
Block a user