Merge remote-tracking branch 'qubesos/pr/54'

* qubesos/pr/54:
  Fixed minor error in VM Settings
This commit is contained in:
Marek Marczykowski-Górecki 2018-01-12 04:39:31 +01:00
commit 90f7f8474d
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -114,6 +114,8 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
self.delete_rule_button_pressed) self.delete_rule_button_pressed)
self.policy_deny_radio_button.clicked.connect(self.policy_changed) self.policy_deny_radio_button.clicked.connect(self.policy_changed)
self.policy_allow_radio_button.clicked.connect(self.policy_changed) self.policy_allow_radio_button.clicked.connect(self.policy_changed)
if init_page == 'firewall':
self.check_network_availability()
####### devices tab ####### devices tab
self.__init_devices_tab__() self.__init_devices_tab__()
@ -217,36 +219,38 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
t_monitor.set_finished() t_monitor.set_finished()
def current_tab_changed(self, idx): def check_network_availability(self):
if idx == self.tabs_indices["firewall"]: netvm = self.vm.netvm
netvm = self.vm.netvm self.no_netvm_label.setVisible(netvm is None)
self.no_netvm_label.setVisible(netvm is None) self.netvm_no_firewall_label.setVisible(
self.netvm_no_firewall_label.setVisible( netvm is not None and
netvm is not None and not netvm.features.check_with_template('qubes-firewall', False))
not netvm.features.check_with_template('qubes-firewall', False)) if netvm is None:
if netvm is None: QtGui.QMessageBox.warning(
QtGui.QMessageBox.warning( None,
None, self.tr("Qube configuration problem!"),
self.tr("Qube configuration problem!"), self.tr('This qube has networking disabled '
self.tr('This qube has networking disabled ' '(Basic -> Networking) - network will be disabled. '
'(Basic -> Networking) - network will be disabled. ' 'If you want to use firewall, '
'If you want to use firewall, ' 'please enable networking.')
'please enable networking.') )
) if netvm is not None and \
if netvm is not None and \ not netvm.features.check_with_template(
not netvm.features.check_with_template( 'qubes-firewall',
'qubes-firewall', False):
False): QtGui.QMessageBox.warning(
QtGui.QMessageBox.warning( None,
None, self.tr("Qube configuration problem!"),
self.tr("Qube configuration problem!"), self.tr("The '{vm}' AppVM is network connected to "
self.tr("The '{vm}' AppVM is network connected to "
"'{netvm}', which does not support firewall!<br/>" "'{netvm}', which does not support firewall!<br/>"
"You may edit the '{vm}' VM firewall rules, but these " "You may edit the '{vm}' VM firewall rules, but these "
"will not take any effect until you connect it to " "will not take any effect until you connect it to "
"a working Firewall VM.").format( "a working Firewall VM.").format(
vm=self.vm.name, netvm=netvm.name)) vm=self.vm.name, netvm=netvm.name))
def current_tab_changed(self, idx):
if idx == self.tabs_indices["firewall"]:
self.check_network_availability()
######### basic tab ######### basic tab