Creating/Editing a Titan-Like Gui

WORK IN PROGRESS

This guide is for people who are interested in creating a GUI for a command line tool. We assume that you have access to the code for either Titan or Puffin, and are planning on using it to create a similar gui.

Alternatively, this guide also goes through how to modify the GUIs for Puffin or Titan (since Puffin was built off Titan). Note that in some places there a series of xs as to specify the name of the program (since this applies to both Titan and Puffin).

Code structure

The code is broken up into four folders:

graphics – The code for the different entry boxes we can add into our code. To add a different kind of entry box, you will probably have to copy and modify one of this files.

io – Handles how data is stored and collected. You probably won’t need to modify this code.

jobs – For code related to running jobs, creating files, and other such activities.

gui – Stores the code that makes up the gui, importing from io and graphics. If you want to add tabs or add lines to tabs, the files you want to edit are here.

How it works

When a job is ran, the following things happen:

1. All the information from the tabs is collected into a NamePairValueGroup. (Using a subclass from the main class.)

2. We check to see if any needed information is missing (using the CheckRequired class from jobs, which checks for the files specified in xxxGUIConstants).

3. We create an output folder if we haven’t created one for this run already (using MakeDirectory class from jobs).

4. We create a shell script of the command we want to run (using the MakeFiles class from jobs).

5. We create a process to run the shell script without freezing the gui (using the RunProcess class from jobs).

6. Our process can update various displays while running and upon completion.

Adding an new input to the Gui

Suppose that your backend code has recently added a new feature that allows putting in a date. You want to ask the user to input a date.

1. In the class xxxGUIConstants, add the name of your field. Also in xxxGUIConstants you can specify whether you want this field to default to something when the program starts up, and whether it is required for the run.

2. Choose one of the classes from the “graphics” folder as the way to input the date. You will most likely want a TextInput for something like a date. However, some entries will work better with checkboxes, filesearches, or a custom made input class.

3. In the class for the tab you want to add the entry on. Add the entry class as a private variable. Increase the size of the values array.

4. Initiate your entry class. Add it to the values array. Then add it to the panel (with the add function).

5. Edit the MakeFiles class to include your option in the run shell script.

Adding a New Tab to the Gui

Suppose you want to add a whole new tab of entries to the Gui.

1. Extend the class MayaGuiTab to create a class for your tab. Add in all your inputs onto your tab.

2. In the main class, add a private variable for your tab. Then initiate your tab and add it. In the FetchData subclass, add in your class to the getData function.

Created on , Last modified on