backups: allow only one of "block device" and "VM"

Block device can be pointed only when source VM is "dom0".
This commit is contained in:
Marek Marczykowski-Górecki 2014-01-12 05:20:48 +01:00
parent d8a6e4a4b1
commit 5f7113e11e
3 changed files with 18 additions and 0 deletions

View File

@ -91,6 +91,10 @@ class BackupVMsWindow(Ui_Backup, QWizard):
self.connect(self.dev_combobox, SIGNAL("activated(int)"), self.dev_combobox_activated)
self.connect(self, SIGNAL("backup_progress(int)"), self.progress_bar.setValue)
self.dir_line_edit.connect(self.dir_line_edit, SIGNAL("textChanged(QString)"), self.backup_location_changed)
self.connect(self.dev_combobox, SIGNAL("activated(int)"),
self.update_device_appvm_enabled)
self.connect(self.appvm_combobox, SIGNAL("activated(int)"),
self.update_device_appvm_enabled)
self.select_vms_page.isComplete = self.has_selected_vms
self.select_dir_page.isComplete = self.has_selected_dir_and_pass
@ -235,6 +239,9 @@ class BackupVMsWindow(Ui_Backup, QWizard):
def dev_combobox_activated(self, idx):
dev_combobox_activated(self, idx)
def update_device_appvm_enabled(self, idx):
update_device_appvm_enabled(self, idx)
@pyqtSlot(name='on_select_path_button_clicked')
def select_path_button_clicked(self):
select_path_button_clicked(self)

View File

@ -114,6 +114,10 @@ def enable_dir_line_edit(dialog, boolean):
dialog.dir_line_edit.setEnabled(boolean)
dialog.select_path_button.setEnabled(boolean)
def update_device_appvm_enabled(dialog, idx):
# Only one of those can be used
dialog.dev_combobox.setEnabled(dialog.appvm_combobox.currentIndex() == 0)
dialog.appvm_combobox.setEnabled(dialog.dev_combobox.currentIndex() == 0)
def dev_combobox_activated(dialog, idx):
if idx == dialog.prev_dev_idx: #nothing has changed

View File

@ -84,6 +84,10 @@ class RestoreVMsWindow(Ui_Restore, QWizard):
self.connect(self, SIGNAL("restore_progress(QString)"), self.commit_text_edit.append)
self.connect(self, SIGNAL("backup_progress(int)"), self.progress_bar.setValue)
self.dir_line_edit.connect(self.dir_line_edit, SIGNAL("textChanged(QString)"), self.backup_location_changed)
self.connect(self.dev_combobox, SIGNAL("activated(int)"),
self.update_device_appvm_enabled)
self.connect(self.appvm_combobox, SIGNAL("activated(int)"),
self.update_device_appvm_enabled)
self.select_dir_page.isComplete = self.has_selected_dir
self.select_vms_page.isComplete = self.has_selected_vms
@ -100,6 +104,9 @@ class RestoreVMsWindow(Ui_Restore, QWizard):
def dev_combobox_activated(self, idx):
dev_combobox_activated(self, idx)
def update_device_appvm_enabled(self, idx):
update_device_appvm_enabled(self, idx)
@pyqtSlot(name='on_select_path_button_clicked')
def select_path_button_clicked(self):
select_path_button_clicked(self, True)