File diff 71854a68aa1c → d1a9a47788f8
floppyemu/__init__.py
Show inline comments
 
@@ -20,15 +20,21 @@ def get_or_create_empty_image(index, tem
 
    return filename
 

	
 

	
 
def format_images(device, indexes, temp_path, size=1440):
 
def format_images(device, indexes, temp_path, size=1440, callback=None):
 
    for ipair in indexes:
 
        if isinstance(ipair, int):
 
            image = get_or_create_empty_image(ipair, temp_path, size)
 
            write_image(device, image, ipair)
 
            os.remove(image)
 
            if callback:
 
                callback(indexes, ipair)
 
        else:
 
            for i in range(ipair[0], ipair[1]):
 
                image = get_or_create_empty_image(i, temp_path, size)
 
                write_image(device, image, i)
 
                os.remove(image)
 
                if callback:
 
                    callback(ipair, i)
 

	
 

	
 
def write_image(device, path, index=0):