[4] | 1 | ############################################################################ |
---|
| 2 | # |
---|
| 3 | # Copyright (C) 2005 Electronic Visualization Laboratory, |
---|
| 4 | # University of Illinois at Chicago |
---|
| 5 | # |
---|
| 6 | # All rights reserved. |
---|
| 7 | # |
---|
| 8 | # Redistribution and use in source and binary forms, with or without |
---|
| 9 | # modification, are permitted provided that the following conditions are met: |
---|
| 10 | # |
---|
| 11 | # * Redistributions of source code must retain the above copyright |
---|
| 12 | # notice, this list of conditions and the following disclaimer. |
---|
| 13 | # * Redistributions in binary form must reproduce the above |
---|
| 14 | # copyright notice, this list of conditions and the following disclaimer |
---|
| 15 | # in the documentation and/or other materials provided with the distribution. |
---|
| 16 | # * Neither the name of the University of Illinois at Chicago nor |
---|
| 17 | # the names of its contributors may be used to endorse or promote |
---|
| 18 | # products derived from this software without specific prior written permission. |
---|
| 19 | # |
---|
| 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
---|
| 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
---|
| 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
---|
| 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
---|
| 24 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
---|
| 25 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
---|
| 26 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
---|
| 27 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
---|
| 28 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
---|
| 29 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
---|
| 30 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 31 | # |
---|
| 32 | # Direct questions, comments etc about SAGE UI to www.evl.uic.edu/cavern/forum |
---|
| 33 | # |
---|
| 34 | # Author: Ratko Jagodic |
---|
| 35 | # |
---|
| 36 | ############################################################################ |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | |
---|
| 40 | |
---|
| 41 | import sys, string |
---|
| 42 | |
---|
| 43 | ### Class to hold sage application info |
---|
| 44 | ### An instance of this class should exist for every app Id on SAGE |
---|
| 45 | class SAGEApp : |
---|
| 46 | |
---|
| 47 | |
---|
| 48 | def __init__(self, name, id, left=0, right=0, bottom=0, top=0, sailID=0, zValue=0, configNum=1, title="untitled"): |
---|
| 49 | self.left = left |
---|
| 50 | self.right = right |
---|
| 51 | self.top = top |
---|
| 52 | self.bottom = bottom |
---|
| 53 | self.sailID = sailID |
---|
| 54 | self.appName = name |
---|
| 55 | self.id = id |
---|
| 56 | self.zValue = zValue |
---|
| 57 | self.configNum = configNum |
---|
| 58 | self.title = title |
---|
| 59 | |
---|
| 60 | def setAll(self, name, id, left, right, bottom, top, sailID, zValue):#, configNum, title): |
---|
| 61 | self.appName = name |
---|
| 62 | self.id = id |
---|
| 63 | self.left = left |
---|
| 64 | self.right = right |
---|
| 65 | self.bottom = bottom |
---|
| 66 | self.top = top |
---|
| 67 | self.sailID = sailID |
---|
| 68 | self.zValue = zValue |
---|
| 69 | #self.configNum = configNum |
---|
| 70 | #self.title = title |
---|
| 71 | |
---|
| 72 | def getAll(self): |
---|
| 73 | return [self.appName, self.id, self.left, self.right, |
---|
| 74 | self.bottom, self.top, self.sailID, self.zValue, |
---|
| 75 | self.configNum, self.title] |
---|
| 76 | |
---|
| 77 | #### Set the values of the application |
---|
| 78 | #### @arg left Left position of the window |
---|
| 79 | #### @arg right right position of the window |
---|
| 80 | #### @arg top top position of the window |
---|
| 81 | #### @arg bottom bottom position of the window |
---|
| 82 | #### @arg sailID sailID of the app |
---|
| 83 | def setValues(self, id, left, right, top, bottom, sailID, zValue) : |
---|
| 84 | self.id = id |
---|
| 85 | self.left = left |
---|
| 86 | self.right = right |
---|
| 87 | self.top = top |
---|
| 88 | self.bottom = bottom |
---|
| 89 | self.sailID = sailID |
---|
| 90 | self.zValue = zValue |
---|
| 91 | |
---|
| 92 | def getLeft(self): |
---|
| 93 | return self.left |
---|
| 94 | |
---|
| 95 | def getRight(self): |
---|
| 96 | return self.right |
---|
| 97 | |
---|
| 98 | def getTop(self): |
---|
| 99 | return self.top |
---|
| 100 | |
---|
| 101 | def getBottom(self): |
---|
| 102 | return self.bottom |
---|
| 103 | |
---|
| 104 | def getId(self): |
---|
| 105 | return self.id |
---|
| 106 | |
---|
| 107 | def getConfigNum(self): |
---|
| 108 | return self.configNum |
---|
| 109 | |
---|
| 110 | def getTitle(self): |
---|
| 111 | return self.title |
---|
| 112 | |
---|
| 113 | def setTitle(self, newTitle): |
---|
| 114 | self.title = newTitle |
---|
| 115 | |
---|
| 116 | # Set the app name |
---|
| 117 | # @arg appName Name of the app |
---|
| 118 | def setName(self, appName): |
---|
| 119 | self.appName = appName |
---|
| 120 | |
---|
| 121 | # Get the app name |
---|
| 122 | # @return Returns the app name |
---|
| 123 | def getName(self): |
---|
| 124 | return self.appName |
---|
| 125 | |
---|
| 126 | #### Get the application window values |
---|
| 127 | #### @return Returns a list Format: [<left>, <right>, <top>, <bottom>] |
---|
| 128 | def getValues(self) : |
---|
| 129 | return [self.left, self.right, self.top, self.bottom] |
---|
| 130 | |
---|
| 131 | #### Get the app's sailID |
---|
| 132 | def getSailID(self): |
---|
| 133 | return self.sailID |
---|
| 134 | |
---|
| 135 | # Set the Z value of the app |
---|
| 136 | # @arg value Z value of the app |
---|
| 137 | def setZvalue(self, value): |
---|
| 138 | self.zValue = value |
---|
| 139 | |
---|
| 140 | # get the Z value of the app |
---|
| 141 | def getZvalue(self): |
---|
| 142 | return self.zValue |
---|
| 143 | |
---|
| 144 | def getWidth(self): |
---|
| 145 | return self.right - self.left |
---|
| 146 | |
---|
| 147 | def getHeight(self): |
---|
| 148 | return self.top - self.bottom |
---|
| 149 | |
---|
| 150 | |
---|
| 151 | |
---|
| 152 | |
---|
| 153 | ### a class to hold the information about all the available apps that SAGE supports |
---|
| 154 | class SAGEAppInitial: |
---|
| 155 | |
---|
| 156 | def __init__ (self, name, configNames): |
---|
| 157 | self._name = name |
---|
| 158 | self._configNames = configNames |
---|
| 159 | |
---|
| 160 | def GetName (self): |
---|
| 161 | return self._name |
---|
| 162 | |
---|
| 163 | def SetName (self, name): |
---|
| 164 | self._name = name |
---|
| 165 | |
---|
| 166 | def GetConfigNames(self): |
---|
| 167 | return self._configNames |
---|
| 168 | |
---|
| 169 | ## # execution configurations |
---|
| 170 | ## def AddConfig (self, name, stConfig): |
---|
| 171 | ## self._execConfigs[ len(self._execConfigs)+1 ] = (name, string.strip(stConfig)) |
---|
| 172 | |
---|
| 173 | ## def GetNumConfigs(self): |
---|
| 174 | ## return self._numConfigs |
---|
| 175 | |
---|
| 176 | ## def GetConfigHash (self): |
---|
| 177 | ## return self._execConfigs |
---|
| 178 | |
---|
| 179 | ## def GetConfig (self, configNum): |
---|
| 180 | ## if self._execConfigs.has_key( configNum ): |
---|
| 181 | ## return self._execConfigs[ configNum ] |
---|
| 182 | ## else: |
---|
| 183 | ## print "Error: No configuration number ", configNum |
---|
| 184 | ## return "No Configuration" |
---|
| 185 | |
---|
| 186 | ## # instances already started |
---|
| 187 | ## def AddInstanceId (self, instanceId): |
---|
| 188 | ## self._appInstanceIds.append( instanceId ) |
---|
| 189 | |
---|
| 190 | ## def GetInstanceIds (self): |
---|
| 191 | ## return self._appInstanceIds |
---|
| 192 | |
---|
| 193 | |
---|