From 800e07aa9618fc90bfd0b589d596cf2b0fcc469f Mon Sep 17 00:00:00 2001 From: Alan Moore Date: Mon, 2 Oct 2017 19:55:42 -0500 Subject: [PATCH 1/2] Fix crash when fdisk fails on usb disk device In the event that `fdisk -l` fails on a partition or device (e.g., a usb card reader has no media), don't crash the program. Just return None, since this is just a partition that the program can't use. Fixes #180. --- scripts/usb.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/usb.py b/scripts/usb.py index 36969e9..dbd90b1 100644 --- a/scripts/usb.py +++ b/scripts/usb.py @@ -219,7 +219,11 @@ def details_udev(usb_disk_part): gen.log("ERROR: Unknown disk/partition (%s)" % str(usb_disk_part)) return None - fdisk_cmd_out = subprocess.check_output('fdisk -l ' + usb_disk_part, shell=True) + try: + fdisk_cmd_out = subprocess.check_output('fdisk -l ' + usb_disk_part, shell=True) + except subprocess.CalledProcessError: + gen.log("ERROR: fdisk failed on disk/partition (%s)" % str(usb_disk_part)) + return None if b'Extended' in fdisk_cmd_out: mount_point = '' From 6d91c5d882602d3d732762bca5052585ea56316d Mon Sep 17 00:00:00 2001 From: Alan Moore Date: Mon, 2 Oct 2017 23:29:13 -0500 Subject: [PATCH 2/2] Fix hyperlinks in about dialog Correct the hyperlinks in the about dialog and make them open a web browser tab to the link when clicked. Fixes. #193. --- scripts/gui/about.ui | 2 +- scripts/gui/ui_about.py | 3 +-- scripts/mbusb_gui.py | 3 ++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/gui/about.ui b/scripts/gui/about.ui index 2d92633..be6770e 100644 --- a/scripts/gui/about.ui +++ b/scripts/gui/about.ui @@ -25,7 +25,7 @@ - <html><head/><body><p align="center">An advanced bootable usb creator with option to install/uninstall multiple distros.</p><p align="center">This software is written in Python and PyQt. </p><p align="center">Copyright 2010-2017 Sundar</p><p align="center"><span style=" font-weight:600;">Author(s)</span>: Sundar, Ian Bruce, LiQiong Lee and Alin Trăistaru (alindt)</p><p align="center"><span style=" font-weight:600;">Licence</span>: GPL version 2 or later</p><p align="center"><span style=" font-weight:600;">Home page</span>: <a href=" http://multibootusb.org"><span style=" text-decoration: underline; color:#0000ff;">http://multibootusb.org</span></a></p><p align="center"><span style=" font-weight:600;">Help/Email</span>: feedback.multibootusb@gmail.com</p><p align="center"><span style=" font-weight:600;">Source Code</span>: <a href="https://github.com/mbusb/multibootusb"><span style=" text-decoration: underline; color:#0000ff;">https://github.com/mbusb/multibootusb</span></a></p><p><br/></p></body></html> + <html><head/><body><p align="center">An advanced bootable usb creator with option to install/uninstall multiple distros.</p><p align="center">This software is written in Python and PyQt. </p><p align="center">Copyright 2010-2017 Sundar</p><p align="center"><span style=" font-weight:600;">Author(s)</span>: Sundar, Ian Bruce, LiQiong Lee and Alin Trăistaru (alindt)</p><p align="center"><span style=" font-weight:600;">Licence</span>: GPL version 2 or later</p><p align="center"><span style=" font-weight:600;">Home page</span>: <a href="http://multibootusb.org"><span style=" text-decoration: underline; color:#0000ff;">http://multibootusb.org</span></a></p><p align="center"><span style=" font-weight:600;">Help/Email</span>: feedback.multibootusb@gmail.com</p><p align="center"><span style=" font-weight:600;">Source Code</span>: <a href="https://github.com/mbusb/multibootusb"><span style=" text-decoration: underline; color:#0000ff;">https://github.com/mbusb/multibootusb</span></a></p><p><br/></p></body></html> diff --git a/scripts/gui/ui_about.py b/scripts/gui/ui_about.py index 4f8246f..c16b68d 100644 --- a/scripts/gui/ui_about.py +++ b/scripts/gui/ui_about.py @@ -48,7 +48,7 @@ class Ui_About(object): def retranslateUi(self, About): _translate = QtCore.QCoreApplication.translate About.setWindowTitle(_translate("About", "Dialog")) - self.label_6.setText(_translate("About", "

An advanced bootable usb creator with option to install/uninstall multiple distros.

This software is written in Python and PyQt.

Copyright 2010-2017 Sundar

Author(s): Sundar, Ian Bruce, LiQiong Lee and Alin Trăistaru (alindt)

Licence: GPL version 2 or later

Home page: http://multibootusb.org

Help/Email: feedback.multibootusb@gmail.com

Source Code: https://github.com/mbusb/multibootusb


")) + self.label_6.setText(_translate("About", "

An advanced bootable usb creator with option to install/uninstall multiple distros.

This software is written in Python and PyQt.

Copyright 2010-2017 Sundar

Author(s): Sundar, Ian Bruce, LiQiong Lee and Alin Trăistaru (alindt)

Licence: GPL version 2 or later

Home page: http://multibootusb.org

Help/Email: feedback.multibootusb@gmail.com

Source Code: https://github.com/mbusb/multibootusb


")) self.button_close.setText(_translate("About", "Close")) @@ -60,4 +60,3 @@ if __name__ == "__main__": ui.setupUi(About) About.show() sys.exit(app.exec_()) - diff --git a/scripts/mbusb_gui.py b/scripts/mbusb_gui.py index ad4cf4f..1248d30 100644 --- a/scripts/mbusb_gui.py +++ b/scripts/mbusb_gui.py @@ -13,6 +13,7 @@ import signal from PyQt5 import QtCore, QtGui, QtWidgets import subprocess import time +import webbrowser from scripts.gui.ui_multibootusb import Ui_MainWindow from scripts.gui.ui_about import Ui_About from . import usb @@ -130,7 +131,7 @@ Are you SURE you want to enable it?", about.setWindowTitle("About MultiBootUSB - " + mbusb_version()) about.setWindowIcon(QtGui.QIcon(resource_path(os.path.join("data", "tools", "multibootusb.png")))) about.ui.button_close.clicked.connect(about.close) - + about.ui.label_6.linkActivated.connect(webbrowser.open_new_tab) about.exec_() def onComboChange(self):