There are right now two base computers
One is written in C++, in src/cmd/basecomputer.cpp using the GUI libraries in src/gui/. This one is distinguishable because it has a computer-y background and clicky buttons (that depress as you click them).
The other base computer system (though not as fully-featured) was written for privateer gemini gold, a mod, and is currently used for the main menu (Load,Campaign). The heart of it lies in modules/GUI.py, which wraps around a system designed for use with bases in src/cmd/base_interface.cpp.
If you are interested in the Python code that is used in Gemini Gold, you can find it here:
http://privateer.svn.sourceforge.net/vi ... unk/bases/
under weapons_lib.py and also a few other things.
Now if that wasn't enough already, I am going to commit a new set of code *tonight*, called "dialog_box.py" which is basically a wrapper around GUI.py.
It will allow you to in very simple terms create a dialog box with lists, text inputs and buttons, and by defining a single callback function you can do what you want.
I intend to use that dialog box code to allow the server to ask questions to the user without needing special code to handle each specific thing.
Since this is what I'm working on right now, I'll paste a code fragment for your own enjoyment
Code: Select all
def runComputer(local,cmd,args,id,cp=-1):
def callback(dialog,result):
print 'id is: ',id
action,inputs = dialog_box.fromValues(result)
if action=='Test':
print 'test clicked!!!!'
...
items=['width', 1.0,
'text', 'Public Computer Menu',0.,
'textinput','callsign','',
'height', .1,
'button', 'Test',
'button', 'Exit Menu']
id = dialog_box.dialog(items,callback)
I am also going to add a simple "alert" or "confirm" question that will allow you to ask a question... though unfortunately due to the nature of Python code this is done asynchronously, so you will need to pass a callback function. However this is true for all of the GUI procedures.
Hopefully this didn't confuse you too much more.
Also, indeed you can call the quit function from Python. The function is "Base.ExitGame()" (a very simple name). Just for future reference, the Base functions you are allowed to call all exist within src/cmd/base_util.h