[Tutor] Long post: How to design a Python program to generate GUI elements in a proprietary scripting language.

boB Stepp robertvstepp at gmail.com
Mon Apr 29 16:49:40 CEST 2013


Alan,

I am at work now, so I will try to reply to those things I can answer
quickly. Today is a full planning day, not a programming day!

On Mon, Apr 29, 2013 at 4:08 AM, Alan Gauld <alan.gauld at btinternet.com> wrote:

>> my situations, it would have to result in the proper window generation
>> with no tweaking.
>
>
> Thats going to be really hard given the limits of your Proprietary Scripting
> Language(PSL). How do you link actions to widgets? For example when you
> create a button how do you define what that button does? A short example of
> that would be helpful to understand the limits.
>

The following is a typical example. Note that the Pinnacle scripting
language uses the "Store" for user defined variables. They can hold
any kind of object, whether a number or a window, etc.:

Store.At.TempWindow.AddChild = "";
Store.At.TempWindow.WidgetList.Last = {
   ParentName = "ParallelTissueScrolledArea;
   Name = "ActualVolumeLungs_Minus_PTV1350ValueLabel";
   WidgetClass = "Label";
   X = 660;
   Y = 20;
   Width = 75;
   Height = 10;
   UseQueryForLabel = 1;   # Turns on the ability to pull information
from the plan and stuff it into this label field.
   QueryValueKey = "Store.At.Lungs_Minus_PTV1350.Value";    # Makes
the label field display the value of this variable.
   QueryColorKey = "Store.At.Lungs_Minus_PTV1350Color.String";    #
Changes the color of the label field to the stored value resulting
from an earlier comparison check.
   AddBorder = 1;
};

If one wants to click a button and cause an action to occur, here is
an example from a different script:

Store.At.SBRT_Window.AddChild = "";
Store.At.SBRT_Window.WidgetList.Last = {
   WidgetClass = "PushButton";
   ParentName = "ButtonArea";
   Name = "DismissButton";
   AddAction = "";
   ReplaceCurrentAction = "Store.At.SBRT_Window.Unrealize";    #
Closes the window.
   Label = "Dismiss";
   AddAction = "";
   ReplaceCurrentAction = "Store.FreeAt.SBRT_Window";   # Clears the
contents of the variable holding the window object.
};

The above is pretty much the pattern Pinnacle scripting uses for GUI
element creation. Of course many don't have actions or queries
associated with them, so those would be omitted.

There are only two data types that I can use: floating point and
string. There is an integer function, but it only truncates the
decimal places that always exist. Further, I can use any variable as
either a string or a float by using ".String" or ".Value" on the end
of the variable name. If I wanted to execute


>> Alas, there is no GOTO within a script capability. The best that can
>> be done is to conditionally run another script file and then return to
>> the calling script.
>
>
> OK  So we can name a script as the action to be executed.
> Can you retrieve the results of the called script?(via a file maybe?)
>

In the Pinnacle environment all variables are global for the opened
plan that first started running a HotScript. So if we had the
variable, "Store.At.TempVariable.String", then it would maintain the
most recent value for the most recently run script until
"Store.FreeAt.TempVariable" is run to clear it.

I will have to look at the rest later. Hope this helps make things a
bit more understandable.

boB


More information about the Tutor mailing list