mirror of
https://github.com/mbusb/multibootusb
synced 2024-11-01 15:40:16 +00:00
parent
9005fb3f52
commit
670cdbd4d1
@ -308,6 +308,21 @@ Are you SURE you want to enable it?",
|
|||||||
self.ui.label_persistence.setVisible(False)
|
self.ui.label_persistence.setVisible(False)
|
||||||
self.ui.slider_persistence.setVisible(False)
|
self.ui.slider_persistence.setVisible(False)
|
||||||
|
|
||||||
|
def ui_disable_controls(self):
|
||||||
|
self.ui.combo_drives.setEnabled(False)
|
||||||
|
self.ui.checkbox_all_drives.setEnabled(False)
|
||||||
|
self.ui.button_detect_drives.setEnabled(False)
|
||||||
|
self.ui.button_browse_image.setEnabled(False)
|
||||||
|
self.ui.image_path.setEnabled(False)
|
||||||
|
self.ui.tabWidget.setEnabled(False)
|
||||||
|
|
||||||
|
def ui_enable_controls(self):
|
||||||
|
self.ui.combo_drives.setEnabled(True)
|
||||||
|
self.ui.checkbox_all_drives.setEnabled(True)
|
||||||
|
self.ui.button_detect_drives.setEnabled(True)
|
||||||
|
self.ui.button_browse_image.setEnabled(True)
|
||||||
|
self.ui.image_path.setEnabled(True)
|
||||||
|
self.ui.tabWidget.setEnabled(True)
|
||||||
|
|
||||||
def update_slider_text(self):
|
def update_slider_text(self):
|
||||||
slide_value = self.ui.slider_persistence.value() * 1024 * 1024
|
slide_value = self.ui.slider_persistence.value() * 1024 * 1024
|
||||||
@ -332,12 +347,16 @@ Are you SURE you want to enable it?",
|
|||||||
log(iso_name(config.image_path) + ' has been successfully installed.')
|
log(iso_name(config.image_path) + ' has been successfully installed.')
|
||||||
QtWidgets.QMessageBox.information(self, 'Finished...', iso_name(config.image_path) + ' has been successfully installed.')
|
QtWidgets.QMessageBox.information(self, 'Finished...', iso_name(config.image_path) + ' has been successfully installed.')
|
||||||
config.process_exist = None
|
config.process_exist = None
|
||||||
|
self.ui_enable_controls()
|
||||||
|
|
||||||
def onInstall_syslinuxClick(self):
|
def onInstall_syslinuxClick(self):
|
||||||
"""
|
"""
|
||||||
Function to install syslinux/extlinux on selected USB disk.
|
Function to install syslinux/extlinux on selected USB disk.
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
self.ui_disable_controls()
|
||||||
|
|
||||||
if platform.system() == "Linux" or platform.system() == "Windows":
|
if platform.system() == "Linux" or platform.system() == "Windows":
|
||||||
|
|
||||||
if self.ui.install_sys_all.isChecked() or self.ui.install_sys_only.isChecked():
|
if self.ui.install_sys_all.isChecked() or self.ui.install_sys_only.isChecked():
|
||||||
@ -359,6 +378,8 @@ Are you SURE you want to enable it?",
|
|||||||
QtWidgets.QMessageBox.information(self, 'No selection...',
|
QtWidgets.QMessageBox.information(self, 'No selection...',
|
||||||
'Please select one of the option from above.')
|
'Please select one of the option from above.')
|
||||||
|
|
||||||
|
self.ui_enable_controls()
|
||||||
|
|
||||||
def onedit_syslinux(self):
|
def onedit_syslinux(self):
|
||||||
"""
|
"""
|
||||||
Function to edit main syslinux.cfg file.
|
Function to edit main syslinux.cfg file.
|
||||||
@ -403,9 +424,13 @@ Are you SURE you want to enable it?",
|
|||||||
Triggers a function to uninstall a selected distro.
|
Triggers a function to uninstall a selected distro.
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
self.ui_disable_controls()
|
||||||
|
|
||||||
if self.ui.installed_distros.currentItem() is None:
|
if self.ui.installed_distros.currentItem() is None:
|
||||||
log("Please select a distro from the list.")
|
log("Please select a distro from the list.")
|
||||||
QtWidgets.QMessageBox.information(self, 'No selection.', 'Please select a distro from the list.')
|
QtWidgets.QMessageBox.information(self, 'No selection.', 'Please select a distro from the list.')
|
||||||
|
self.ui_enable_controls()
|
||||||
else:
|
else:
|
||||||
config.uninstall_distro_dir_name = str(self.ui.installed_distros.currentItem().text()).strip()
|
config.uninstall_distro_dir_name = str(self.ui.installed_distros.currentItem().text()).strip()
|
||||||
reply = QtWidgets.QMessageBox.question(self, "Review selection...",
|
reply = QtWidgets.QMessageBox.question(self, "Review selection...",
|
||||||
@ -418,6 +443,7 @@ Are you SURE you want to enable it?",
|
|||||||
log("Distro install directory not found. Just updating syslinux.cfg file.")
|
log("Distro install directory not found. Just updating syslinux.cfg file.")
|
||||||
update_sys_cfg_file()
|
update_sys_cfg_file()
|
||||||
#self.uninstall.update_sys_cfg_file()
|
#self.uninstall.update_sys_cfg_file()
|
||||||
|
self.ui_enable_controls()
|
||||||
else:
|
else:
|
||||||
self.progress_thread_uninstall.start()
|
self.progress_thread_uninstall.start()
|
||||||
|
|
||||||
@ -434,6 +460,7 @@ Are you SURE you want to enable it?",
|
|||||||
self.ui.statusbar.showMessage("Status: Idle")
|
self.ui.statusbar.showMessage("Status: Idle")
|
||||||
QtWidgets.QMessageBox.information(self, 'Uninstall Complete...',
|
QtWidgets.QMessageBox.information(self, 'Uninstall Complete...',
|
||||||
config.uninstall_distro_dir_name + ' has been successfully removed.')
|
config.uninstall_distro_dir_name + ' has been successfully removed.')
|
||||||
|
self.ui_enable_controls()
|
||||||
|
|
||||||
def onCreateClick(self):
|
def onCreateClick(self):
|
||||||
"""
|
"""
|
||||||
@ -442,22 +469,29 @@ Are you SURE you want to enable it?",
|
|||||||
:param iso_link: LineEdit text as selected ISO link.
|
:param iso_link: LineEdit text as selected ISO link.
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
self.ui_disable_controls()
|
||||||
|
|
||||||
if not config.usb_disk:
|
if not config.usb_disk:
|
||||||
log("ERROR: No USB device found.")
|
log("ERROR: No USB device found.")
|
||||||
QtWidgets.QMessageBox.information(self, "No Device...",
|
QtWidgets.QMessageBox.information(self, "No Device...",
|
||||||
"No USB device found.\n\nInsert USB and use Refresh USB button to detect USB.")
|
"No USB device found.\n\nInsert USB and use Refresh USB button to detect USB.")
|
||||||
|
self.ui_enable_controls()
|
||||||
elif not config.image_path:
|
elif not config.image_path:
|
||||||
log("No ISO selected.")
|
log("No ISO selected.")
|
||||||
QtWidgets.QMessageBox.information(self, "No ISO...", "No ISO found.\n\nPlease select an ISO.")
|
QtWidgets.QMessageBox.information(self, "No ISO...", "No ISO found.\n\nPlease select an ISO.")
|
||||||
|
self.ui_enable_controls()
|
||||||
elif usb.details(config.usb_disk)['mount_point'] == 'No_Mount':
|
elif usb.details(config.usb_disk)['mount_point'] == 'No_Mount':
|
||||||
log("ERROR: USB disk is not mounted.")
|
log("ERROR: USB disk is not mounted.")
|
||||||
QtWidgets.QMessageBox.information(self, "No Mount...", "USB disk is not mounted.\n"
|
QtWidgets.QMessageBox.information(self, "No Mount...", "USB disk is not mounted.\n"
|
||||||
"Please mount USB disk and press refresh USB button.")
|
"Please mount USB disk and press refresh USB button.")
|
||||||
|
self.ui_enable_controls()
|
||||||
elif platform.system() == 'Linux' and config.usb_disk[-1].isdigit() is False:
|
elif platform.system() == 'Linux' and config.usb_disk[-1].isdigit() is False:
|
||||||
gen.log('Selected USB is a disk. Please select a disk partition from the drop down list')
|
gen.log('Selected USB is a disk. Please select a disk partition from the drop down list')
|
||||||
QtWidgets.QMessageBox.information(self, 'No Partition...!', 'USB disk selected doesn\'t contain a partition.\n'
|
QtWidgets.QMessageBox.information(self, 'No Partition...!', 'USB disk selected doesn\'t contain a partition.\n'
|
||||||
'Please select the partition (ending '
|
'Please select the partition (ending '
|
||||||
'with a digit eg. /dev/sdb1)\nfrom the drop down list.')
|
'with a digit eg. /dev/sdb1)\nfrom the drop down list.')
|
||||||
|
self.ui_enable_controls()
|
||||||
else:
|
else:
|
||||||
# clean_iso_cfg_ext_dir(os.path.join(multibootusb_host_dir(), "iso_cfg_ext_dir")) # Need to be cleaned.
|
# clean_iso_cfg_ext_dir(os.path.join(multibootusb_host_dir(), "iso_cfg_ext_dir")) # Need to be cleaned.
|
||||||
# extract_cfg_file(config.image_path) # Extract files from ISO
|
# extract_cfg_file(config.image_path) # Extract files from ISO
|
||||||
@ -476,7 +510,7 @@ Are you SURE you want to enable it?",
|
|||||||
log("MultiBoot Install: ISO file: " + iso_name(config.image_path))
|
log("MultiBoot Install: ISO file: " + iso_name(config.image_path))
|
||||||
|
|
||||||
if os.path.exists(config.image_path):
|
if os.path.exists(config.image_path):
|
||||||
self.ui.image_path.clear()
|
# self.ui.image_path.clear()
|
||||||
if config.distro:
|
if config.distro:
|
||||||
log("MultiBoot Install: Distro type detected: " + config.distro)
|
log("MultiBoot Install: Distro type detected: " + config.distro)
|
||||||
copy_mbusb_dir_usb(config.usb_disk)
|
copy_mbusb_dir_usb(config.usb_disk)
|
||||||
@ -487,6 +521,7 @@ Are you SURE you want to enable it?",
|
|||||||
if install_size >= disk_usage(config.usb_mount).free:
|
if install_size >= disk_usage(config.usb_mount).free:
|
||||||
log("ERROR: Not enough space available on " + config.usb_disk)
|
log("ERROR: Not enough space available on " + config.usb_disk)
|
||||||
QtWidgets.QMessageBox.information(self, "No Space.", "No space available on " + config.usb_disk)
|
QtWidgets.QMessageBox.information(self, "No Space.", "No space available on " + config.usb_disk)
|
||||||
|
self.ui_enable_controls()
|
||||||
else:
|
else:
|
||||||
reply = QtWidgets.QMessageBox.question(self, 'Review selection...',
|
reply = QtWidgets.QMessageBox.question(self, 'Review selection...',
|
||||||
'Selected USB disk: %s\n' % config.usb_disk +
|
'Selected USB disk: %s\n' % config.usb_disk +
|
||||||
@ -503,11 +538,13 @@ Are you SURE you want to enable it?",
|
|||||||
else:
|
else:
|
||||||
QtWidgets.QMessageBox.information(self, 'Already exists...',
|
QtWidgets.QMessageBox.information(self, 'Already exists...',
|
||||||
os.path.basename(config.image_path) + ' is already installed.')
|
os.path.basename(config.image_path) + ' is already installed.')
|
||||||
|
self.ui_enable_controls()
|
||||||
else:
|
else:
|
||||||
QtWidgets.QMessageBox.information(self, 'No support...',
|
QtWidgets.QMessageBox.information(self, 'No support...',
|
||||||
'Sorry.\n' + os.path.basename(config.image_path) +
|
'Sorry.\n' + os.path.basename(config.image_path) +
|
||||||
' is not supported at the moment.\n'
|
' is not supported at the moment.\n'
|
||||||
'Please email this issue to feedback.multibootusb@gmail.com')
|
'Please email this issue to feedback.multibootusb@gmail.com')
|
||||||
|
self.ui_enable_controls()
|
||||||
|
|
||||||
# Added to refresh usb disk remaining size after distro installation
|
# Added to refresh usb disk remaining size after distro installation
|
||||||
# self.update_gui_usb_info()
|
# self.update_gui_usb_info()
|
||||||
@ -519,11 +556,6 @@ Are you SURE you want to enable it?",
|
|||||||
"""
|
"""
|
||||||
self.ui.progressbar.setValue(0)
|
self.ui.progressbar.setValue(0)
|
||||||
self.ui.statusbar.showMessage("Status: Idle")
|
self.ui.statusbar.showMessage("Status: Idle")
|
||||||
self.ui.combo_drives.setEnabled(True)
|
|
||||||
self.ui.button_browse_image.setEnabled(True)
|
|
||||||
# self.ui.pushbtn_imager_refreshusb.setEnabled(True)
|
|
||||||
# self.ui.imager_bootable.setText("Bootable ISO: ")
|
|
||||||
# self.ui.imager_iso_size.setText("Image Size: ")
|
|
||||||
config.process_exist = None
|
config.process_exist = None
|
||||||
|
|
||||||
msgBox = QtWidgets.QMessageBox()
|
msgBox = QtWidgets.QMessageBox()
|
||||||
@ -533,6 +565,8 @@ Are you SURE you want to enable it?",
|
|||||||
msgBox.setIcon(QtWidgets.QMessageBox.Information)
|
msgBox.setIcon(QtWidgets.QMessageBox.Information)
|
||||||
msgBox.exec()
|
msgBox.exec()
|
||||||
|
|
||||||
|
self.ui_enable_controls()
|
||||||
|
|
||||||
def dd_start(self):
|
def dd_start(self):
|
||||||
"""
|
"""
|
||||||
Function to block the widgets under ISO Imager tab...
|
Function to block the widgets under ISO Imager tab...
|
||||||
@ -555,10 +589,14 @@ Are you SURE you want to enable it?",
|
|||||||
QtWidgets.QMessageBox.information(self, 'Failed!', 'Failed writing image.')
|
QtWidgets.QMessageBox.information(self, 'Failed!', 'Failed writing image.')
|
||||||
|
|
||||||
def dd_write(self):
|
def dd_write(self):
|
||||||
|
self.ui_disable_controls()
|
||||||
|
|
||||||
if not config.usb_disk:
|
if not config.usb_disk:
|
||||||
QtWidgets.QMessageBox.information(self, 'No USB...', 'Please Insert USB disk and rerun multibootusb.')
|
QtWidgets.QMessageBox.information(self, 'No USB...', 'Please Insert USB disk and rerun multibootusb.')
|
||||||
|
self.ui_enable_controls()
|
||||||
elif not config.image_path:
|
elif not config.image_path:
|
||||||
QtWidgets.QMessageBox.information(self, 'No ISO...', 'Please select an ISO.')
|
QtWidgets.QMessageBox.information(self, 'No ISO...', 'Please select an ISO.')
|
||||||
|
self.ui_enable_controls()
|
||||||
else:
|
else:
|
||||||
imager = Imager()
|
imager = Imager()
|
||||||
if platform.system() == 'Linux' and config.usb_disk[-1].isdigit() is True:
|
if platform.system() == 'Linux' and config.usb_disk[-1].isdigit() is True:
|
||||||
@ -566,12 +604,14 @@ Are you SURE you want to enable it?",
|
|||||||
QtWidgets.QMessageBox.information(self, 'Wrong Disk...!', 'Disk selected is a partition.\nISO is to '
|
QtWidgets.QMessageBox.information(self, 'Wrong Disk...!', 'Disk selected is a partition.\nISO is to '
|
||||||
'be written to whole disk for proper functioning'
|
'be written to whole disk for proper functioning'
|
||||||
'.\n\nPlease select the disk from the drop down list.')
|
'.\n\nPlease select the disk from the drop down list.')
|
||||||
|
self.ui_enable_controls()
|
||||||
else:
|
else:
|
||||||
usb_disk_size = int(imager.imager_usb_detail(config.usb_disk, partition=0).total_size)
|
usb_disk_size = int(imager.imager_usb_detail(config.usb_disk, partition=0).total_size)
|
||||||
self.iso_size = os.path.getsize(config.image_path)
|
self.iso_size = os.path.getsize(config.image_path)
|
||||||
if self.iso_size >= usb_disk_size:
|
if self.iso_size >= usb_disk_size:
|
||||||
QtWidgets.QMessageBox.information(self, "No enough space on disk.", os.path.basename(config.image_path) +
|
QtWidgets.QMessageBox.information(self, "No enough space on disk.", os.path.basename(config.image_path) +
|
||||||
" size is larger than the size of " + config.usb_disk)
|
" size is larger than the size of " + config.usb_disk)
|
||||||
|
self.ui_enable_controls()
|
||||||
#elif gen.process_exist('explorer.exe') is not False:
|
#elif gen.process_exist('explorer.exe') is not False:
|
||||||
# # Check if windows explorer is running and inform user to close it.
|
# # Check if windows explorer is running and inform user to close it.
|
||||||
# QtWidgets.QMessageBox.information(self, "Windows Explorer", "Windows Explorer is running\n"
|
# QtWidgets.QMessageBox.information(self, "Windows Explorer", "Windows Explorer is running\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user