From a872333458863bbcc64ae5bfa5bf40c08409fa7f Mon Sep 17 00:00:00 2001 From: Daniel Markstedt Date: Mon, 24 Nov 2025 01:39:48 +0100 Subject: [PATCH] Move python resources into the common package Reduces duplication of these binary files across multiple clients --- .../resources/DejaVu Fonts License.txt | 0 .../resources/DejaVuSansMono-Bold.ttf | Bin python/common/resources/README.md | 24 ++++++++++++++++++ .../resources/splash_start_32.bmp | Bin .../resources/splash_start_64.bmp | Bin .../resources/splash_stop_32.bmp | Bin .../resources/splash_stop_64.bmp | Bin .../resources/type_writer.ttf | Bin python/ctrlboard/README.md | 10 -------- .../ctrlboard/resources/splash_start_32.bmp | Bin 574 -> 0 bytes .../ctrlboard/resources/splash_start_64.bmp | Bin 1086 -> 0 bytes python/ctrlboard/src/main.py | 2 +- .../src/menu/menu_renderer_config.py | 2 +- python/oled/README.md | 10 -------- python/oled/src/piscsi_oled_monitor.py | 6 ++--- 15 files changed, 29 insertions(+), 25 deletions(-) rename python/{ctrlboard => common}/resources/DejaVu Fonts License.txt (100%) rename python/{ctrlboard => common}/resources/DejaVuSansMono-Bold.ttf (100%) create mode 100644 python/common/resources/README.md rename python/{oled => common}/resources/splash_start_32.bmp (100%) rename python/{oled => common}/resources/splash_start_64.bmp (100%) rename python/{oled => common}/resources/splash_stop_32.bmp (100%) rename python/{oled => common}/resources/splash_stop_64.bmp (100%) rename python/{oled => common}/resources/type_writer.ttf (100%) delete mode 100644 python/ctrlboard/resources/splash_start_32.bmp delete mode 100644 python/ctrlboard/resources/splash_start_64.bmp diff --git a/python/ctrlboard/resources/DejaVu Fonts License.txt b/python/common/resources/DejaVu Fonts License.txt similarity index 100% rename from python/ctrlboard/resources/DejaVu Fonts License.txt rename to python/common/resources/DejaVu Fonts License.txt diff --git a/python/ctrlboard/resources/DejaVuSansMono-Bold.ttf b/python/common/resources/DejaVuSansMono-Bold.ttf similarity index 100% rename from python/ctrlboard/resources/DejaVuSansMono-Bold.ttf rename to python/common/resources/DejaVuSansMono-Bold.ttf diff --git a/python/common/resources/README.md b/python/common/resources/README.md new file mode 100644 index 00000000..67d18f93 --- /dev/null +++ b/python/common/resources/README.md @@ -0,0 +1,24 @@ +# Common Resources + +This directory contains resources that are shared between multiple Python components in the PiSCSI project, +such as fonts and splash screen images used by both the OLED monitor and the CtrlBoard interface. + +## Credits + +### DejaVuSansMono-Bold.ttf + +* _DejaVu Sans Mono Bold_ TrueType font by the DejaVu fonts project +* Source: https://dejavu-fonts.github.io +* Distributed under DejaVu Fonts License (see DejaVu Fonts License.txt for full text) + +### type_writer.ttf + +* _Type Writer_ TrueType font by Mandy Smith (cutielou) +* Source: https://fontstruct.com/fontstructions/show/212255/type_writer +* Distributed under Creative Commons Attribution Share Alike license +(http://creativecommons.org/licenses/by-sa/3.0/) + +### splash_start_\*.bmp, splash_stop_\*.bmp + +* Drawn by Daniel Markstedt +* Distributed under BSD 3-Clause by permission from author (see LICENSE in project root for full text) diff --git a/python/oled/resources/splash_start_32.bmp b/python/common/resources/splash_start_32.bmp similarity index 100% rename from python/oled/resources/splash_start_32.bmp rename to python/common/resources/splash_start_32.bmp diff --git a/python/oled/resources/splash_start_64.bmp b/python/common/resources/splash_start_64.bmp similarity index 100% rename from python/oled/resources/splash_start_64.bmp rename to python/common/resources/splash_start_64.bmp diff --git a/python/oled/resources/splash_stop_32.bmp b/python/common/resources/splash_stop_32.bmp similarity index 100% rename from python/oled/resources/splash_stop_32.bmp rename to python/common/resources/splash_stop_32.bmp diff --git a/python/oled/resources/splash_stop_64.bmp b/python/common/resources/splash_stop_64.bmp similarity index 100% rename from python/oled/resources/splash_stop_64.bmp rename to python/common/resources/splash_stop_64.bmp diff --git a/python/oled/resources/type_writer.ttf b/python/common/resources/type_writer.ttf similarity index 100% rename from python/oled/resources/type_writer.ttf rename to python/common/resources/type_writer.ttf diff --git a/python/ctrlboard/README.md b/python/ctrlboard/README.md index 99599163..840b2965 100644 --- a/python/ctrlboard/README.md +++ b/python/ctrlboard/README.md @@ -45,13 +45,3 @@ the raspberry pi model and enable transitions only for the following pi models: - Raspberry Pi Zero 2 models The model detection can be overriden by adding a --transitions parameter to start.sh. - -## Credits - -### DejaVuSansMono-Bold.ttf -* Source: https://dejavu-fonts.github.io -* Distributed under DejaVu Fonts Lience (see DejaVu Fonts License.txt for full text) - -### splash_start_\*.bmp, splash_stop_\*.bmp -* Drawn by Daniel Markstedt -* Distributed under BSD 3-Clause by permission from author (see LICENSE for full text) diff --git a/python/ctrlboard/resources/splash_start_32.bmp b/python/ctrlboard/resources/splash_start_32.bmp deleted file mode 100644 index 5c7549ed3caea5432f1aec041655e862106ec5bd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 574 zcmZ?rwPRuc13Mt80mKbJtN_G}KnMdu+zbpL3{nch|A7ERtwIB#XaG%m6`FMDevm;( zpdN{hjoARS6bZ05AaQ_9iuwBwK9;dbOFkg+L9)M3PR4w*vanHFTAG6449S_34b{vy z8#5aK`3xX_vjH2B{~5?ne*ogQ8}I@7#vu6w!x{4YeFi}N#>OE1K)&R}IR+Nyn+<{H u*B?Gm0W@F2z`%U70W;VK1`Lu7l7>b|e0c^wp#4<#9~)Yj{v{MYgyaFr54c1C diff --git a/python/ctrlboard/resources/splash_start_64.bmp b/python/ctrlboard/resources/splash_start_64.bmp deleted file mode 100644 index 4448f28d249507d59f65b35b713bab70e5bee6e3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1086 zcmZ?rwPRrb13Mt80mKbJ>;S}!KnMdu+zbpL%mfqw;r~DYqE?}SP&9xhy$Ve_bfnAg z2L&V&s7GRBV>SQ-9SN{EAaQ_9iuwBwK9;dbOFkg+L9)M3PR4w*vanHFTAG6449S_3 z4b{vy8#5aK`3xX_vjH2B{~5?ne*ogQ8}I@7#vu6w!x{4YeFi}N#>OE1K)&R}IR+Ny zn+<{H*B?Gm0W@F2z`%U70W;VK1`Lu7l7>b|e0c^wp#4<#9~)Yj{vGM*k5c~w0R2?A AbpQYW diff --git a/python/ctrlboard/src/main.py b/python/ctrlboard/src/main.py index 2f164def..c8f3fa29 100644 --- a/python/ctrlboard/src/main.py +++ b/python/ctrlboard/src/main.py @@ -172,7 +172,7 @@ def main(): menu_controller.add(CtrlBoardMenuBuilder.SCSI_ID_MENU) menu_controller.add(CtrlBoardMenuBuilder.ACTION_MENU) - menu_controller.show_splash_screen("resources/splash_start_64.bmp") + menu_controller.show_splash_screen("../common/resources/splash_start_64.bmp") menu_update_event_handler = CtrlBoardMenuUpdateEventHandler( menu_controller, sock_cmd=sock_cmd, piscsi_cmd=piscsi_cmd diff --git a/python/ctrlboard/src/menu/menu_renderer_config.py b/python/ctrlboard/src/menu/menu_renderer_config.py index 6d44c866..693c5763 100644 --- a/python/ctrlboard/src/menu/menu_renderer_config.py +++ b/python/ctrlboard/src/menu/menu_renderer_config.py @@ -14,7 +14,7 @@ class MenuRendererConfig: self.i2c_address = 0x3C self.i2c_port = 1 self.display_type = "ssd1306" # luma-oled supported devices, "sh1106", "ssd1306", ... - self.font_path = "resources/DejaVuSansMono-Bold.ttf" + self.font_path = "../common/resources/DejaVuSansMono-Bold.ttf" self.font_size = 12 self.row_selection_pixel_extension = 2 self.scroll_behavior = "page" # "extend" or "page" diff --git a/python/oled/README.md b/python/oled/README.md index 987a265e..5d92b179 100644 --- a/python/oled/README.md +++ b/python/oled/README.md @@ -32,13 +32,3 @@ The start.sh script can also be run standalone, and will handle the venv creatio ``` $ ./start.sh --rotation=180 --height=64 ``` - -## Credits -### type_writer.ttf -* _Type Writer_ TrueType font by Mandy Smith -* Source: https://www.dafont.com/type-writer.font -* Distributed under BSD 3-Clause by permission from author (see LICENSE for full text) - -### splash_start_\*.bmp, splash_stop_\*.bmp -* Drawn by Daniel Markstedt -* Distributed under BSD 3-Clause by permission from author (see LICENSE for full text) diff --git a/python/oled/src/piscsi_oled_monitor.py b/python/oled/src/piscsi_oled_monitor.py index f02ca5db..3385bcdd 100644 --- a/python/oled/src/piscsi_oled_monitor.py +++ b/python/oled/src/piscsi_oled_monitor.py @@ -131,8 +131,8 @@ print("Will update the OLED display every " + str(args.refresh_interval) + "ms ( # Show a startup splash bitmap image before starting the main loop # Convert the image to mode '1' for 1-bit color (monochrome) # Make sure the splash bitmap image is in the same dir as this script -IMAGE_STOP = Image.open(f"resources/splash_stop_{HEIGHT}.bmp").convert("1") -IMAGE = Image.open(f"resources/splash_start_{HEIGHT}.bmp").convert("1") +IMAGE_STOP = Image.open(f"../common/resources/splash_stop_{HEIGHT}.bmp").convert("1") +IMAGE = Image.open(f"../common/resources/splash_start_{HEIGHT}.bmp").convert("1") OLED.image(IMAGE) OLED.show() @@ -156,7 +156,7 @@ LINE_SPACING = 8 # When using other fonts, you may need to adjust PADDING, FONT_SIZE, # LINE_SPACING, and LINES. # Some other nice fonts to try: http://www.dafont.com/bitmap.php -FONT = ImageFont.truetype("resources/type_writer.ttf", FONT_SIZE) +FONT = ImageFont.truetype("../common/resources/type_writer.ttf", FONT_SIZE) REMOVABLE_DEVICE_TYPES = piscsi_cmd.get_removable_device_types() PERIPHERAL_DEVICE_TYPES = piscsi_cmd.get_peripheral_device_types()