Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Dynamic menus

Help
2014-02-20
2014-02-20
  • I am building a media player using mpd, that is controlled by LCDproc, a HD44780 and some buttons connected via I2C (still waiting for the expander chip in the mail).

    I am using the menu extensively in this project, for choosing which song to play. During the on time of the player, things could happen (like inserting an USB stick with music), that would need a possible rather extensive menu update. I have the browsing and selection working through the menu, by generating a sub menu the first time it is visited. I have an internal Python dictionary of all items to keep from sending them twice.The menu structure is like this:
    root-> Music -> some directory -> a sub directory -> a music file
    What I would like is, under certain circumstances, to clear the menu completely, and start generating it from scratch again. I am a little uncertain as to how to do this though. If I understand the documentation correctly, if I remove all items from a menu it will be removed. This is also the behaviour I have observed.
    The first question is, what happen if I delete just all items in the root menu (""), is LCDproc clever enough to free all the dangling items?
    The second, if I cannot just delete the root menus, it seems to me I will have to sort my dictionary, according to depth in the menu system, and run through it skipping all menus, as LCDproc deletes them automaticly when empty, does this seem right?

    Kind Regards
    Martin Grønholdt