05 Testing Your Theme

Introduction

In this lesson, I share some settings in mythfrontend that I find useful when testing themes. I also share some scripts that you may find useful when dealing with multiple versions of your theme. Then, you get to take your theme for its first test drive.

Mythfrontend Appearance Settings

I find that running mythfrontend in a window (instead of full-screen) makes testing much easier. Start the frontend as you normally would, and adjust some of the settings on the first screen of the Appearance settings. If you are using the default menu theme, from the main menu, navigate to Utilities / Setup > Setup > Appearance.

Set the GUI width and GUI height either to the size of your theme or, if that window would be too large for your desktop, to a size that is representative of the aspect ratio of your theme (the values shown, 1024x576, are a good 16:9 representation). If you are using a window manager with a menu bar at the top of the screen, set the GUI X offset and GUI Y offset to something like 100 pixels so that the frontend's window does not obstruct your menu bar.

Starting Mythfrontend and Reloading the Theme

When I am testing a theme, I start a terminal with two tabs (start two terminals if your terminal emulator does not leverage tabs). In one of the terminals, I start mythfrontend. In MythTV 0.24, I start it like this:

$ mythfrontend -v "gui,extra" > ~/mythfrontend.log 2>&1

The -v "gui,extra" flag changes the verbosity with which mythfrontend reports messages and errors. Instead of writing the messages and errors to the console, this command writes all of that information to a file called mythfrontend.log in your home directory. You can open that log file with any standard text editor. The equivalent command line in MythTV 0.25 and higher is this:

$ mythfrontend -loglevel debug -v "gui" > ~/mythfrontend.log 2>&1

I use the second terminal to quickly reload the theme. Instead of quitting the frontend and starting it again, you can request mythfrontend to reload the current theme by issuing the following command:

$ pkill -USR1 mythfrontend

When mythfrontend receives the USR1 signal (that is a numeral one, not a letter L), mythfrontend clears the cache that it has in memory and reloads the current theme from the files on disk.

Production and Development Versions

While I am writing a theme, I actually keep two versions of it. My production version is a version that is in a known-working state. My development version is my work-in-progress. I make all of my changes in the development version. When I know that the modification on which I am working is in a good state, I copy the development version into the production version. That way, if I make a really big mistake that I cannot undo, I just copy the production version back into development and try again.

The three scripts provided here update mythfrontend with the current development files (update_from_dev.sh), update mythfrontend with the current production files (update_from_prod.sh), and upgrades the production version with the files found in development (upgrade_prod.sh). Feel free to modify and use them as you wish.

Test Your Theme for the First Time

It is time to test your theme for the first time! Modify and run one of the update scripts to provide mythfrontend with a copy of your theme. (If you are not using the scripts that I provided, you will need to place a copy of your theme in ~/.mythtv/themes in order for mythfrontend to find it.) Start mythfrontend (preferably from the command line, as mentioned earlier in this lesson), and then point it to your theme. If you are using the default menu, navigate to Utilities / Setup > Setup > Theme Chooser.

If all goes well, mythfrontend will load with the first draft of your theme. If, instead, it simply reloads the previous theme, take a look at the log file that was generated to see what errors were produced.

Next Steps

In the next few lessons, we create the background for your theme. Then, we modify the layout of the menu to suit your needs. Finally, we add any additional elements that are missing from your menu UI.

Previous Lesson: 04 Main Menu XML