[mythtv] Seeking comments on new method of customizing Myth menus
Joseph A. Caputo
jcaputo1 at comcast.net
Fri Oct 8 17:05:52 UTC 2004
I've had this idea rattling around in my head for a while, thought I
would see if there's any interest before I start coding...
Problem: Myth menus can be customized in 2 ways: (1) modify the XML
files in /usr/local/share/mythtv, and (2) place identically-named files
in ~/.mythtv. The problem with (1) is that the files get overwritten
with each new installation. The problem with (2) is that the entire
file must be overridden. This means that if a completely new version
of, say, mainmenu.xml is distributed, I will not see the change because
I'll still have my old copy in ~/.mythtv/mainmenu.xml. I might not
even know there are new buttons (or if buttons have been removed),
unless I keep up with the -dev or -commits list (which I do, but I'm
speaking generally).
Proposed solution:
What if, rather than specifying entire menu structures in an XML file,
we could specify only menu *elements*. Anyone who's ever customized a
CDE desktop might see where I'm coming from (probably the only feature
of CDE I ever liked). CDE allows you to create files specifying
individual panel controls. One of the elements in the control
specification is a container name, which specifies which 'drawer' on
the panel the control goes in. You could also specify 'DELETE', in
which case any existing control of the same name as the one you're
specifying will be removed from the panel.
I'm envisioning something like this: every menu structure specified in
XML will have a unique name (I think this is the case already; if not,
it must be enforced). Every control must also have a unique name
(separate from its 'text' or 'type' attributes). When the menu is
constructed, in addition to the contents of its main/complete XML tree,
additional files would be searched to determine if there are any other
controls that specify the current menu as their container, and if so,
it will add them to the menu (or remove controls if 'delete=true' was
specified).
Here is an example showing a before/after of the case where a user wants
to add a "Misc." button to the main Myth menu:
Current:
mainmenu.xml:
**************************************************
<mythmenu name="MAIN">
<button>
<type>TV_WATCH_TV</type>
<text>Watch TV</text>
<text lang="IT">Guarda la TV</text>
<text lang="ES">Ver la TV</text>
<text lang="CA">Veure la TV</text>
<text lang="NL">Kijk TV</text>
<text lang="FR">Regarder la TV</text>
<text lang="DE">Fernsehen</text>
<text lang="DK">Se TV</text>
<text lang="PT">Ver Televisão</text>
<text lang="SV">Se på TV</text>
<text lang="JA">TVæ¾é</text>
<action>TV_WATCH_LIVE</action>
</button>
[snip] (more controls from the default distributed file...)
<!-- Add my custom "Misc." button
"misc_menu.xml" lives in ~/.mythtv -->
<button>
<type>MENU</type>
<text>Misc</text>
<action>MENU misc_menu.xml</action>
</button>
</mythmenu>
**************************************************
Under the old scheme above, I won't pick up any changes to the
distributed mainmenu.xml unless I remove my copy in ~/.mythtv (thus
losing my "Misc." button), or merge the changes into my copy by hand.
Now, an example of how it might work the 'new' way:
**************************************************
mainmenu.xml:
unmodified, no copy exists in ~/.mythtv
~/.mythtv/misc.sub.xml
(assumes we're using the file pattern *.sub.xml for customizations)
<button name="Misc">
<! We can have the control show up in more than one menu
by specifying multiple <container/> tags -->
<container>MAIN</container>
<container>TV</container>
<type>MENU</type>
<text>Misc.</text>
<action>MENU misc_menu.xml</action>
</button>
<!-- We can specify multiple controls in a single file, even if they
belong to different containers -->
<!-- Here we forcibly remove the "News Feeds" button
from the "INFO" menu and add it to the main menu.
Since we don't specify the other attributes, the
type, text & action attributes will be pulled from
the existing control of the same name -->
<button name="News Feeds">
<container delete="true">INFO</container>
<container>MAIN</container>
</button>
**************************************************
Controls could also be specified without any container tags, allowing
them to be included in menus later, as:
<mythmenu>
...
<button name="Misc."/>
...
</mythmenu>
I haven't addressed the technical details here, just giving the basic
idea to see if this is a modification that would be accepted (Isaac?).
Note that the existing menu structure wouldn't need to be changed, with
the exception that a unique name attribute must be given to each
existing button.
Comments welcome!
-JAC
More information about the mythtv-dev
mailing list