At work I use a commercial program for radiation therapy planning. This program has an extensive built-in, proprietary scripting language that is accessible to the user. The scripting files are all text-based. The OS that we are running the commercial software on is Solaris 10. The scripting language has commands to execute commands external to the software such as shell scripts, Perl scripts, Python scripts, etc. However, in order to make anything happen within the planning software, one must in the end be running a file from within the software that contains only the proprietary scripting commands.
The proprietary scripting language has significant limitations; for instance, it has no provision for looping constructs, text manipulation, function creation, subprograms, etc. To date I have been using external Perl scripts to generate text files that have the needed proprietary scripting commands to force the planning software to do the useful things I desire. Recently I have discovered it is possible to use the proprietary scripting language to generate GUI's that allow for user interaction. However, to do so one must laboriously create the desired window in top-down fashion. Every widget must be hand-coded and placed using appropriate coordinates. My latest effort at entering the GUI world in this planning software required six files, four of which were ~ 4000 lines of code each, most of which was to create the elements of the window that was created. However, the end result is quite useful and user friendly for my colleagues and saves them a lot of work. Previously I had been using a built-in interface that is not very user friendly when I required user interaction with my scripts. However, if every time I have to generate thousands of lines of code by hand to just get a window that is friendly for the user, then I am not inclined to do this very often. So I finally am coming to the Python point: I would like to write a program in Python to more easily build these windows and their elements. Whenever I need to construct a windowed interface, I want to be able to call this program and have it generate the needed proprietary scripting commands in a text file that I can run from within the planning software. I have Python 2.4.6 and 2.4.4 available to me, both running on Solaris 10. The way these windows are formed are 1) There must be a top-level construct, TempWindow; 2) Next there must be a FORM or DrawingArea element; 3) Then a variety of GUI elements can be added such as buttons, labels, scrolled windows, etc. I can almost visualize how I might do this, but am currently stumped on how to automatically generate the various parent-child naming relationships that must exist between these elements. For instance if my top level construct is TempWindow, in which everything is placed, my next level might be DrawingArea, whose ParentName would be TempWindow. But if I added two scrolled windows to DrawingArea, then ScrolledWindow1 and ScrolledWindow2 would have a ParentName of DrawingArea. Et cetera. A further difficulty is that as these things get added, some of them have attachment commands, such as AttachTop, AttachRight, etc. But some don't. And all elements have (x,y) positioning coordinates as well as heights and widths. BTW, the (x,y) coordinates are relative to the type of parent containing them. For instance, ScrolledWindow1 and ScrolledWindow2 would have coordinates relative to within TempWindow, but TempWindow would have coordinates placing it on the monitor display. Elements within ScrolledWindow1 would have coordinates relative to the top left corner of ScrolledWindow1. What I am currently visualizing is ProprietaryScript calls external PythonScript. This Python script is doing lots of things, but along the way it will need to generate an overall window and then place various widgets inside that window. It order to do these things it would import PythonWindowModule, enabling PythonScript to use various methods to generate the needed window elements. PythonScript would pass needed information (such as x,y coordinates) to the appropriate method in PythonWindowModule and PythonWindowModule would write the appropriate proprietary scripting commands to the end of a designated text file, that would later be run from within the planning software to do what I need. So, thinking about this I cannot see how to handle this parent-child naming relationships between the different levels of GUI elements and I do not see how to handle the attachment points when they are needed. I have not delved into the OOP aspects of Python yet, but from my current general understanding of OOP I am hopeful that it can handle these issues. And, yes, I realize that I am jumping into the deep end of the pool before even knowing how to swim, but this approach has yielded many valuable Perl scripts at work, so I am willing to take this plunge willy-nilly! Any thoughts on how to approach this will, as always, be greatly appreciated! Cheers! boB _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
