Deluge Firmware 1.3.0
Build date: 2025.04.16
Loading...
Searching...
No Matches
generate Directory Reference

Directories

 dmenus
 
 dmui
 
 gendoc
 

Files

 g_menus.inc
 

Detailed Description

This directory contains 2 python modules:

Unless you're adding new capabilities to the menu compiler, you should only need to add or change files in the dmenu module.

High-Level Guidance

To add a new menu item, we recommend the "monkey see, monkey do" approach - find a menu item that behaves similar to the one you want to add, and copy-paste code until it works. For those who prefer a more principled approach, the dmui module can be processed by the Sphinx documentation generator via the config and makefile in src/deluge/gui/menu_item/generate/gendoc. What follows is a quick-reference version of that documentation.

The Python DSL does not map 1:1 to C++ menus – instead, each Python class encompasses the broad-strokes behavior of the menu item. To select the appropriate Python class for your new menu item, consider the following factors:

Implementation Details

The DSL is composed of Python objects that do some amount of sanity checking to ensure the generated menu hierarchy and documentation is well-formed. To actually generate the various output types (C++ and documentation), we apply the visitor pattern with visitor implementations for each supported output type.