2
0
mirror of https://github.com/mbusb/multibootusb synced 2024-11-01 15:40:16 +00:00

reduce redundant usb.py:details() calls

from...
    usb.py:406:details() called from persistence.py:28:max_disk_persistence()
    usb.py:406:details() called from mbusb_gui.py:148:onComboChange()
    usb.py:406:details() called from uninstall_distro.py:24:install_distro_list()

...to
    usb.py:406:details() called from mbusb_gui.py:147:onComboChange()
This commit is contained in:
Alin Trăistaru 2017-04-29 10:49:15 +03:00
parent 79e88874b1
commit a64bf2402f
3 changed files with 11 additions and 21 deletions

View File

@ -143,28 +143,18 @@ Are you SURE you want to enable it?",
if config.usb_disk:
log("Selected device " + config.usb_disk)
config.persistence_max_size = persistence.max_disk_persistence(config.usb_disk)
self.usb_details = usb.details(config.usb_disk)
# print(self.usb_details)
config.usb_mount = self.usb_details.get('mount_point', "")
config.usb_details = usb.details(config.usb_disk)
config.persistence_max_size = persistence.max_disk_persistence(config.usb_disk)
config.usb_mount = config.usb_details.get('mount_point', "")
self.ui.usb_dev.setText(config.usb_disk)
# if platform.system() == 'Windows':
# self.ui.label_usb_vendor.setText("FileSystem:")
# self.ui.usb_vendor.setText(self.usb_details['file_system'])
# self.ui.label_usb_model.setText("Label: ")
# self.ui.usb_model.setText(self.usb_details['label'])
# else:
# self.ui.usb_vendor.setText(self.usb_details['vendor'])
# self.ui.usb_model.setText(self.usb_details['model'])
self.ui.usb_vendor.setText(self.usb_details.get('vendor', ""))
self.ui.usb_model.setText(self.usb_details.get('model', ""))
self.ui.usb_size.setText(str(usb.bytes2human(self.usb_details.get('size_total', ""))))
self.ui.usb_mount.setText(self.usb_details.get('mount_point', ""))
self.ui.usb_type.setText(self.usb_details.get('devtype', ""))
self.ui.usb_fs.setText(self.usb_details.get('file_system', ""))
self.ui.usb_vendor.setText(config.usb_details.get('vendor', ""))
self.ui.usb_model.setText(config.usb_details.get('model', ""))
self.ui.usb_size.setText(str(usb.bytes2human(config.usb_details.get('size_total', ""))))
self.ui.usb_mount.setText(config.usb_details.get('mount_point', ""))
self.ui.usb_type.setText(config.usb_details.get('devtype', ""))
self.ui.usb_fs.setText(config.usb_details.get('file_system', ""))
self.update_list_box(config.usb_disk)
self.ui_update_persistence()

View File

@ -25,7 +25,7 @@ def max_disk_persistence(usb_disk):
assert usb_disk is not None
fat_max_size = (4096 * 1024 * 1024)
usb_details = usb.details(usb_disk)
usb_details = config.usb_details
config.usb_uuid = usb_details['uuid']
config.usb_label = usb_details['label']

View File

@ -21,7 +21,7 @@ def install_distro_list():
List all distro names installed by previous install
:return: List of distro names as list
"""
usb_details = details(config.usb_disk)
usb_details = config.usb_details
config.usb_mount = usb_details['mount_point']
sys_cfg_file = os.path.join(config.usb_mount, "multibootusb", "syslinux.cfg")