Fixed Firewall rules errors handling

This commit is contained in:
Tomasz Sterna 2011-03-11 19:41:46 +01:00
parent d33be38889
commit 3684fd4002

View File

@ -348,6 +348,7 @@ class VmManagerWindow(QMainWindow):
row_height = 50 row_height = 50
max_visible_rows = 14 max_visible_rows = 14
update_interval = 1000 # in msec update_interval = 1000 # in msec
fw_rules_apply_check_interval = 5000
show_inactive_vms = True show_inactive_vms = True
columns_states = { 0: [0, 1], 1: [0, 2, 3] } columns_states = { 0: [0, 1], 1: [0, 2, 3] }
@ -443,6 +444,7 @@ class VmManagerWindow(QMainWindow):
self.counter = 0 self.counter = 0
self.shutdown_monitor = {} self.shutdown_monitor = {}
QTimer.singleShot (self.update_interval, self.update_table) QTimer.singleShot (self.update_interval, self.update_table)
QTimer.singleShot (self.fw_rules_apply_check_interval, self.check_apply_fw_rules)
def addActions(self, target, actions): def addActions(self, target, actions):
for action in actions: for action in actions:
@ -765,7 +767,6 @@ class VmManagerWindow(QMainWindow):
if dialog.exec_(): if dialog.exec_():
model.apply_rules() model.apply_rules()
QTimer.singleShot(5000, self.check_apply_fw_rules)
def check_apply_fw_rules(self): def check_apply_fw_rules(self):
qvm_collection = QubesVmCollection() qvm_collection = QubesVmCollection()
@ -780,6 +781,7 @@ class VmManagerWindow(QMainWindow):
error = subprocess.Popen( error = subprocess.Popen(
["/usr/bin/xenstore-read", error_file], ["/usr/bin/xenstore-read", error_file],
stdout=subprocess.PIPE).communicate()[0] stdout=subprocess.PIPE).communicate()[0]
error = error.strip(" \n\t")
if error != "": if error != "":
vm.rules_applied = False vm.rules_applied = False
trayIcon.showMessage ( trayIcon.showMessage (
@ -792,6 +794,8 @@ class VmManagerWindow(QMainWindow):
else: else:
vm.rules_applied = True vm.rules_applied = True
QTimer.singleShot(self.fw_rules_apply_check_interval, self.check_apply_fw_rules)
class QubesTrayIcon(QSystemTrayIcon): class QubesTrayIcon(QSystemTrayIcon):
def __init__(self, icon): def __init__(self, icon):
QSystemTrayIcon.__init__(self, icon) QSystemTrayIcon.__init__(self, icon)