From d969fbdcce778e1cdded73dc8c18987a777fbdc4 Mon Sep 17 00:00:00 2001 From: Daniel Markstedt Date: Sat, 1 Oct 2022 16:51:30 -0700 Subject: [PATCH] Attach empty removable drives in the Web UI (#877) * Read the drive properties file once and store it in the Flask app config. Spin out the drive properties formatting to a helper method. * Add empty removable disk drives to the attach peripherals UI * Refinement of UI labels and help text, moving some context to the wiki --- python/web/src/drive_properties.json | 6 +- python/web/src/templates/drives.html | 14 ++--- python/web/src/templates/index.html | 67 +++++++++++++++------ python/web/src/web.py | 87 +++++++++++++++------------- python/web/src/web_utils.py | 45 ++++++++++++-- python/web/tests/api/test_devices.py | 42 ++++++++++++-- python/web/tests/api/test_files.py | 6 +- python/web/tests/api/test_misc.py | 4 +- 8 files changed, 187 insertions(+), 84 deletions(-) diff --git a/python/web/src/drive_properties.json b/python/web/src/drive_properties.json index 39300742..b1644ad5 100644 --- a/python/web/src/drive_properties.json +++ b/python/web/src/drive_properties.json @@ -426,9 +426,9 @@ "revision": "1.0k", "block_size": 2048, "size": null, - "name": "Apple CD 600e", + "name": "AppleCD 600e (Matsushita CR-8005)", "file_type": null, - "description": "Emulates Apple CD ROM drive for use with Macintosh computers.", + "description": "Emulates an Apple CD-ROM drive for use with Macintosh computers.", "url": "" }, { @@ -438,7 +438,7 @@ "revision": null, "block_size": 512, "size": null, - "name": "Generic CD-ROM 512 block size", + "name": "Generic CD-ROM block size 512", "file_type": null, "description": "For use with host systems that expect the non-standard 512 byte block size for CD-ROM drives, such as Akai samplers.", "url": "" diff --git a/python/web/src/templates/drives.html b/python/web/src/templates/drives.html index f49699a8..e1bf9f40 100644 --- a/python/web/src/templates/drives.html +++ b/python/web/src/templates/drives.html @@ -3,7 +3,7 @@ {% block content %}

{{ _("Disclaimer") }}

{{ _("These device profiles are provided as-is with no guarantee to work equally to the actual physical device they are named after. You may need to provide appropirate device drivers and/or configuration parameters for them to function properly. If you would like to see data modified, or have additional devices to add to the list, please raise an issue ticket at GitHub.", url="https://github.com/akuker/RASCSI/issues") }}

-

{{ _("Hard Drives") }}

+

{{ _("Hard Disk Drives") }}

@@ -14,7 +14,7 @@ -{% for hd in hd_conf|sort(attribute='name') %} +{% for hd in drive_properties['hd_conf']|sort(attribute='name') %} @@ -47,8 +47,8 @@
-

{{ _("CD-ROM Drives") }}

-

{{ _("This will create a properties file for the given CD-ROM image. No new image file will be created.") }}

+

{{ _("CD/DVD Drives") }}

+

{{ _("This will create a properties file for the given CD-ROM or DVD image. No new image file will be created.") }}

{{ _("Ref.") }} {{ _("Action") }}
{{ hd.name }} {{ hd.size_mb }}
@@ -58,7 +58,7 @@ -{% for cd in cd_conf|sort(attribute='name') %} +{% for cd in drive_properties['cd_conf']|sort(attribute='name') %} @@ -94,7 +94,7 @@
-

{{ _("Removable Drives") }}

+

{{ _("Removable Disk Drives") }}

{{ _("Ref.") }} {{ _("Action") }}
{{ cd.name }} {{ cd.size_mb }}
@@ -104,7 +104,7 @@ -{% for rm in rm_conf|sort(attribute='name') %} +{% for rm in drive_properties['rm_conf']|sort(attribute='name') %} diff --git a/python/web/src/templates/index.html b/python/web/src/templates/index.html index cb874cab..4bef6a7b 100644 --- a/python/web/src/templates/index.html +++ b/python/web/src/templates/index.html @@ -138,15 +138,15 @@
{{ _("Ref.") }} {{ _("Action") }}
{{ rm.name }} {{ rm.size_mb }}
+ + + +
-
+ -
-
-
+ -
-
@@ -326,31 +326,36 @@ {{ _("Attach Peripheral Device") }} - + + - {% for type in PERIPHERAL_DEVICE_TYPES %} + {% for type in REMOVABLE_DEVICE_TYPES + PERIPHERAL_DEVICE_TYPES %} +
{{ _("Peripheral") }}{{ _("Device") }}{{ _("Code") }} {{ _("Parameters and Actions") }}
{{ device_types[type]["name"] }}
+
{{ type }}
+
@@ -370,6 +375,35 @@ {% endif %} {% endfor %} + {% if type in REMOVABLE_DEVICE_TYPES %} + + + {% endif %}

-
+
@@ -459,7 +493,7 @@
- +