Enabled selecting paths for backup/restore without mounting a device.
This commit is contained in:
parent
41ba80d5c9
commit
b915d725bc
@ -178,7 +178,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QProgressBar" name="progress_bar">
|
<widget class="QProgressBar" name="progress_bar">
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<number>24</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignCenter</set>
|
||||||
|
@ -173,9 +173,17 @@ class BackupVMsWindow(Ui_Backup, QWizard):
|
|||||||
if not self.thread_monitor.success:
|
if not self.thread_monitor.success:
|
||||||
QMessageBox.warning (None, "Backup error!", "ERROR: {1}".format(self.vm.name, self.thread_monitor.error_msg))
|
QMessageBox.warning (None, "Backup error!", "ERROR: {1}".format(self.vm.name, self.thread_monitor.error_msg))
|
||||||
|
|
||||||
umount_device(self.dev_mount_path)
|
if self.dev_mount_path != None:
|
||||||
|
umount_device(self.dev_mount_path)
|
||||||
self.button(self.FinishButton).setEnabled(True)
|
self.button(self.FinishButton).setEnabled(True)
|
||||||
|
|
||||||
|
|
||||||
|
def reject(self):
|
||||||
|
if self.dev_mount_path != None:
|
||||||
|
umount_device(self.dev_mount_path)
|
||||||
|
self.done(0)
|
||||||
|
|
||||||
|
|
||||||
def has_selected_vms(self):
|
def has_selected_vms(self):
|
||||||
return self.select_vms_widget.selected_list.count() > 0
|
return self.select_vms_widget.selected_list.count() > 0
|
||||||
|
|
||||||
|
@ -81,8 +81,7 @@ def fill_devs_list(dialog):
|
|||||||
dialog.dev_combobox.setCurrentIndex(0) #current selected is null ""
|
dialog.dev_combobox.setCurrentIndex(0) #current selected is null ""
|
||||||
dialog.prev_dev_idx = 0
|
dialog.prev_dev_idx = 0
|
||||||
dialog.dir_line_edit.clear()
|
dialog.dir_line_edit.clear()
|
||||||
dialog.dir_line_edit.setEnabled(False)
|
enable_dir_line_edit(dialog, True)
|
||||||
dialog.select_path_button.setEnabled(False)
|
|
||||||
|
|
||||||
|
|
||||||
def enable_dir_line_edit(dialog, boolean):
|
def enable_dir_line_edit(dialog, boolean):
|
||||||
@ -100,12 +99,10 @@ def dev_combobox_activated(dialog, idx):
|
|||||||
|
|
||||||
if dialog.dev_mount_path != None:
|
if dialog.dev_mount_path != None:
|
||||||
dialog.dev_mount_path = umount_device(dialog.dev_mount_path)
|
dialog.dev_mount_path = umount_device(dialog.dev_mount_path)
|
||||||
if dialog_dev_mount_path != None:
|
if dialog.dev_mount_path != None:
|
||||||
dialog.dev_combobox.setCurrentIndex(dialog.prev_dev_idx)
|
dialog.dev_combobox.setCurrentIndex(dialog.prev_dev_idx)
|
||||||
return
|
return
|
||||||
|
|
||||||
enable_dir_line_edit(dialog, False)
|
|
||||||
|
|
||||||
if dialog.dev_combobox.currentText() != "None": #An existing device chosen
|
if dialog.dev_combobox.currentText() != "None": #An existing device chosen
|
||||||
dev_name = str(dialog.dev_combobox.itemData(idx).toString())
|
dev_name = str(dialog.dev_combobox.itemData(idx).toString())
|
||||||
|
|
||||||
@ -123,16 +120,13 @@ def dev_combobox_activated(dialog, idx):
|
|||||||
|
|
||||||
#check if device mounted
|
#check if device mounted
|
||||||
dialog.dev_mount_path = check_if_mounted(dev_path)
|
dialog.dev_mount_path = check_if_mounted(dev_path)
|
||||||
if dialog.dev_mount_path != None:
|
if dialog.dev_mount_path == None:
|
||||||
enable_dir_line_edit(dialog, True)
|
|
||||||
else:
|
|
||||||
dialog.dev_mount_path = mount_device(dev_path)
|
dialog.dev_mount_path = mount_device(dev_path)
|
||||||
if dialog.dev_mount_path != None:
|
if dialog.dev_mount_path == None:
|
||||||
enable_dir_line_edit(dialog, True)
|
|
||||||
else:
|
|
||||||
dialog.dev_combobox.setCurrentIndex(0) #if couldn't mount - set current device to "None"
|
dialog.dev_combobox.setCurrentIndex(0) #if couldn't mount - set current device to "None"
|
||||||
|
dialog.prev_dev_idx = 0
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
dialog.prev_dev_idx = idx
|
dialog.prev_dev_idx = idx
|
||||||
dialog.select_dir_page.emit(SIGNAL("completeChanged()"))
|
dialog.select_dir_page.emit(SIGNAL("completeChanged()"))
|
||||||
|
|
||||||
@ -141,7 +135,12 @@ def select_path_button_clicked(dialog):
|
|||||||
dialog.backup_dir = dialog.dir_line_edit.text()
|
dialog.backup_dir = dialog.dir_line_edit.text()
|
||||||
file_dialog = QFileDialog()
|
file_dialog = QFileDialog()
|
||||||
file_dialog.setReadOnly(True)
|
file_dialog.setReadOnly(True)
|
||||||
new_path = file_dialog.getExistingDirectory(dialog, "Select backup directory.", dialog.dev_mount_path)
|
|
||||||
|
if dialog.dev_mount_path != None:
|
||||||
|
new_path = file_dialog.getExistingDirectory(dialog, "Select backup directory.", dialog.dev_mount_path)
|
||||||
|
else:
|
||||||
|
new_path = file_dialog.getExistingDirectory(dialog, "Select backup directory.", "~")
|
||||||
|
|
||||||
if new_path:
|
if new_path:
|
||||||
dialog.dir_line_edit.setText(new_path)
|
dialog.dir_line_edit.setText(new_path)
|
||||||
dialog.backup_dir = new_path
|
dialog.backup_dir = new_path
|
||||||
|
@ -97,7 +97,6 @@ class RestoreVMsWindow(Ui_Restore, QWizard):
|
|||||||
def dev_combobox_activated(self, idx):
|
def dev_combobox_activated(self, idx):
|
||||||
dev_combobox_activated(self, idx)
|
dev_combobox_activated(self, idx)
|
||||||
|
|
||||||
|
|
||||||
@pyqtSlot(name='on_select_path_button_clicked')
|
@pyqtSlot(name='on_select_path_button_clicked')
|
||||||
def select_path_button_clicked(self):
|
def select_path_button_clicked(self):
|
||||||
select_path_button_clicked(self)
|
select_path_button_clicked(self)
|
||||||
@ -209,8 +208,14 @@ class RestoreVMsWindow(Ui_Restore, QWizard):
|
|||||||
#if not self.thread_monitor.success:
|
#if not self.thread_monitor.success:
|
||||||
#QMessageBox.warning (None, "Backup error!", "ERROR: {1}".format(self.vm.name, self.thread_monitor.error_msg))
|
#QMessageBox.warning (None, "Backup error!", "ERROR: {1}".format(self.vm.name, self.thread_monitor.error_msg))
|
||||||
|
|
||||||
umount_device(self.dev_mount_path)
|
if self.dev_mount_path != None:
|
||||||
|
umount_device(self.dev_mount_path)
|
||||||
self.button(self.FinishButton).setEnabled(True)
|
self.button(self.FinishButton).setEnabled(True)
|
||||||
|
|
||||||
|
def reject(self):
|
||||||
|
if self.dev_mount_path != None:
|
||||||
|
umount_device(self.dev_mount_path)
|
||||||
|
self.done(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user