Display Hat Mini adopt screen symbols in PirateAudio display.py

I am trying to use Display Hat Mini with PirateRadio by modifying display.py. So far successful but symbols for dropdown ( button X ) and volume loudspeaker need repositioning . Unfortunately I cannot find the parameters location in display.py. Any help appreciated.My testbed is running on PiZeroW and volumio v3.179.

Best Regards
Carl Blyh in Helsinki

1 Like

It’s in the def f_content(field, fontsize, top, shadowoffset=1) part of the display.py script, specifically lines 389-399:

        # paste button symbol overlay in light/dark mode
        if status == 'play':
            # draw.text((4, 53), u"\uf04C", font=font_fas, fill=txt_col)  # Fontawesome symbol pause
            f_drawtext(4, 53, u"\uf04C", font_fas, txt_col)
            # draw.text((4, 53), u"\uf04b", font=font_fas, fill=txt_col)  # Fontawesome symbol play
            f_drawtext(4, 53, u"\uf04b", font_fas, txt_col)
        # draw.text((210, 53), u"\uf0c9", font=font_fas, fill=txt_col)  # Fontawesome symbol menu
        f_drawtext(210, 53, u"\uf0c9", font_fas, txt_col)
        # draw.text((210, 174), u"\uf028", font=font_fas, fill=txt_col)  # Fontawesome symbol speaker
        f_drawtext(210, 174, u"\uf028", font_fas, txt_col)

The first two numbers are the X and Y co-ordinates of the fontawesome icon, and the menu and speaker ones that you need are the last two. As you can see, they are currently using a fixed position which is wrong for the displayhat as it’s a wider screen than the pirate audio one.

What I did for mine was to make the position variable, depending on the screen width:

        f_drawtext((WIDTH-30), 53, u"\uf0c9", font_fas, txt_col)
        f_drawtext((WIDTH-30), 174, u"\uf028", font_fas, txt_col)

It’s in the script I shared with you in the Pimoroni forum (this one). Alternatively you can just set the new fixed positions if you want - the width is 320 pixels so the X co-ord would be 290 rather than the original 210.

1 Like

Thanks Darren, changes implemented, works great. Easy job when you know howto…

1 Like

If it’s fulfilled everything, you can mark is as the solution.

Glad to hear it’s working though, and yes, once you know where to look and how to do, the job’s not that tricky. Even an idiot like me could do it :wink:

This Diy Tweak is now fulfilled

Thanks Darren for your contribution