Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
XGUI.py
Go to the documentation of this file.
1 import Base
2 import VS
3 import GUI
4 import XGUITypes
5 import XGUIDebug
6 
7 
8 XGUIRootSingleton = None
9 XGUIPythonScriptAPISingleton = None
10 
11 """----------------------------------------------------------------"""
12 """ """
13 """ XGUIRoot - root management interface for the XML-GUI framework."""
14 """ """
15 """----------------------------------------------------------------"""
16 
17 
18 class XGUIRoot:
19  def __init__(self):
20  self.templates = {}
21 
22  def getTemplate(self,type,name):
23  if type in self.templates and name in sefl.templates[type]:
24  return self.templates[type][name]
25  else:
26  return None
27 
28  def addTemplate(self,tpl):
29  type = tpl.getType()
30  name = tpl.getName()
31  if not type in self.templates:
32  XGUIDebug.trace(1,"XGUI: Initializing template category \"" + str(type) + "\"\n")
33  self.templates[type] = {}
34  XGUIDebug.trace(2,"XGUI: Loading template \"" + str(name) + "\" into category \"" + str(type) + "\"\n")
35  self.templates[type][name] = tpl
36 
38  def __init__(self,code,filename):
39  code = code.replace("\r\n","\n")
40  code += "\n"
41  self.code = compile(code,filename,'exec')
42 
43  def execute(self,context):
44  exec self.code in context
45  return context
46 
47 
48 """----------------------------------------------------------------"""
49 """ """
50 """ XGUIPythonScriptAPI - through this class, all PythonScript """
51 """ API calls are routed. """
52 """ """
53 """----------------------------------------------------------------"""
54 
56  def __init__(self,layout,room):
57  self.layout = layout
58  self.room = room
59 
60 
61 
62 """----------------------------------------------------------------"""
63 """ """
64 """ XGUI global initialization """
65 """ """
66 """----------------------------------------------------------------"""
67 
68 def XGUIInit():
69  XGUIRootSingleton = XGUIRoot()
70