Inherited by objects.gui.displayer.applicationEntityDisplayer.applicationEntityDisplayer.
Public Member Functions | |
| def | __init__ |
| entityDisplayer constructor | |
| def | setDisplayConfigurator |
| Sets the display Configurator object. | |
| def | setScales |
| Sets the Scaling properties. | |
| def | getAttributesFromEntity |
| Returns a Dictionary of attributes given a networkEntity object. | |
| def | getAttributesFromList |
| Returns a Dictionary of attributes given a list of networkEntity objects This is necessary because sometimes Endpoints can share the same geographical locations. | |
| def | getEntLabelFromConfigValue |
| returns the actual label given the user friendly name in the display settings dialog dropdown menu | |
Public Attributes | |
| dispConfig | |
| displayTransferScale | |
| displayFadeTime | |
Derived classes will specialize the task of setting these attributes. Specifically, for each drawn Endpoint, this class will determine what label to use how thick connecting lines should be, etc.
Definition at line 26 of file entityDisplayer.py.
| def objects.gui.displayer.entityDisplayer.entityDisplayer.__init__ | ( | self, | ||
| dispConfigurator | ||||
| ) |
entityDisplayer constructor
Definition at line 29 of file entityDisplayer.py.
00029 : 00030 self.setDisplayConfigurator(dispConfigurator) 00031
| def objects.gui.displayer.entityDisplayer.entityDisplayer.getAttributesFromEntity | ( | self, | ||
| networkEntity | ||||
| ) |
Returns a Dictionary of attributes given a networkEntity object.
| networkEntity | networkEntity object (object representing an Endpoint) |
Definition at line 86 of file entityDisplayer.py.
00086 : 00087 00088 displayAttributes = dict() 00089 timeNow = time.time() 00090 00091 """ 00092 figure out the alpha value for the line 00093 based on how idle the peer is 00094 """ 00095 displayAttributes["lineAlpha"] = self._getAlpha(networkEntity) 00096 00097 displayAttributes["marker"] = "ro" 00098 00099 # set the line style 00100 if networkEntity.exactLocation == True: 00101 displayAttributes["lineStyle"] = "-" 00102 else: 00103 displayAttributes["lineStyle"] = ":" 00104 00105 # set the label 00106 displayAttributes["label"] = self.getEntLabelFromConfigValue(networkEntity, self.dispConfig.glb_getDisplayLabel()) 00107 00108 00109 displayAttributes["lineWidth"] = self._getLineWidth(networkEntity.totalBytes) 00110 00111 if networkEntity.totalBytes >= 0 and networkEntity.totalBytes < 1 * self.displayTransferScale: 00112 displayAttributes["markerSize"] = 4 00113 elif networkEntity.totalBytes >= 1 * self.displayTransferScale and networkEntity.totalBytes < 3 * self.displayTransferScale: 00114 displayAttributes["markerSize"] = 6 00115 elif networkEntity.totalBytes >= 3 * self.displayTransferScale and networkEntity.totalBytes < 5 * self.displayTransferScale: 00116 displayAttributes["markerSize"] = 8 00117 else: 00118 displayAttributes["markerSize"] = 10 00119 00120 return displayAttributes 00121 ## Returns a Dictionary of attributes given a list of networkEntity objects
| def objects.gui.displayer.entityDisplayer.entityDisplayer.getAttributesFromList | ( | self, | ||
| entityList | ||||
| ) |
Returns a Dictionary of attributes given a list of networkEntity objects This is necessary because sometimes Endpoints can share the same geographical locations.
| entityList | list of networkEntity objects (object representing an Endpoint) |
Definition at line 126 of file entityDisplayer.py.
00126 : 00127 00128 displayAttributes = dict() 00129 totBytes = 0 00130 totAlpha = 0 00131 atleastOneExactLocation = False 00132 atleastOneApproxLocation = False 00133 00134 for netEnt in entityList: 00135 totBytes += netEnt.totalBytes 00136 if netEnt.exactLocation == True: 00137 atleastOneExactLocation = True 00138 else: 00139 atleastOneApproxLocation = True 00140 00141 totAlpha += self._getAlpha(netEnt) 00142 00143 00144 00145 if atleastOneExactLocation == True and atleastOneApproxLocation == True: 00146 displayAttributes["lineStyle"] = "-." 00147 elif atleastOneExactLocation == True and atleastOneApproxLocation == False: 00148 displayAttributes["lineStyle"] = "-" 00149 else: 00150 displayAttributes["lineStyle"] = ":" 00151 00152 00153 displayAttributes["label"] = "(x%d)" % (len(entityList)) 00154 displayAttributes["markerSize"] = 10 00155 displayAttributes["marker"] = "r+" 00156 displayAttributes["lineWidth"] = self._getLineWidth(totBytes) 00157 00158 00159 00160 # alpha blending is just the average of all activity 00161 displayAttributes["lineAlpha"] = totAlpha/float(len(entityList)) 00162 00163 00164 return displayAttributes 00165 00166 ## returns the actual label given the user friendly name in the
| def objects.gui.displayer.entityDisplayer.entityDisplayer.getEntLabelFromConfigValue | ( | self, | ||
| ent, | ||||
| userFriendlyName | ||||
| ) |
returns the actual label given the user friendly name in the display settings dialog dropdown menu
| ent | networkEntity about to be displayed | |
| userFriendlyName | The user friendly name displayed in the display settings dialog |
Definition at line 172 of file entityDisplayer.py.
00172 : 00173 retValue = "" 00174 if userFriendlyName.upper() == "PROCESS NAME" or userFriendlyName.upper() == "_DEFAULT_": 00175 retValue = ent.processName 00176 elif userFriendlyName.upper() == "IP ADDRESS": 00177 retValue = ent.foreignIPAddress 00178 elif userFriendlyName.upper() == "SRC. PORT": 00179 retValue = str(ent.selfPort) 00180 elif userFriendlyName.upper() == "DEST. PORT": 00181 retValue = str(ent.foreignPort) 00182 elif userFriendlyName.upper() == "CONN. SINCE": 00183 retValue = timeUtil.formatDateTime(ent.since) 00184 elif userFriendlyName.upper() == "IDLE TIME": 00185 retValue = timeUtil.formatTimeDiff(time.time() - ent.lastUpdateTS) 00186 elif userFriendlyName.upper() == "KB TRANSFER": 00187 retValue = "%6.2f Kb" % (ent.totalBytes / 1000) 00188 elif userFriendlyName.upper() == "CITY": 00189 retValue = ent.foreignCity 00190 elif userFriendlyName.upper() == "ISP": 00191 retValue = ent.foreignISP 00192 elif userFriendlyName.upper() == "ORGANIZATION": 00193 retValue = ent.foreignOrganization 00194 else: 00195 retValue = "No Conversion" 00196 00197 if retValue == None or retValue == "": 00198 retValue = "Unknown" 00199 00200 return retValue 00201
| def objects.gui.displayer.entityDisplayer.entityDisplayer.setDisplayConfigurator | ( | self, | ||
| dispConfigurator | ||||
| ) |
Sets the display Configurator object.
| dispConfigurator | Configurator object used to determine how to set attributes. |
Reimplemented in objects.gui.displayer.applicationEntityDisplayer.applicationEntityDisplayer.
Definition at line 34 of file entityDisplayer.py.
00034 : 00035 self.dispConfig = dispConfigurator 00036 self.setScales() 00037 ## Sets the Scaling properties. I.e. scale transfer size to KB, MB or GB
| def objects.gui.displayer.entityDisplayer.entityDisplayer.setScales | ( | self | ) |
Sets the Scaling properties.
I.e. scale transfer size to KB, MB or GB This determines how quickly circles will grow, or how it will take for lines to fade.
Definition at line 41 of file entityDisplayer.py.
00041 : 00042 self.displayTransferScale = self.dispConfig.glb_getDisplayScale() 00043 self.displayFadeTime = self.dispConfig.glb_getFadeTime() 00044 00045 # no divide by 0 please 00046 if self.displayFadeTime <= 0: 00047 self.displayFadeTime = 1 00048 ## Determines the Alpha value (i.e. transparency) of a line connecting two Endpoints.
Definition at line 35 of file entityDisplayer.py.
Definition at line 43 of file entityDisplayer.py.
Definition at line 42 of file entityDisplayer.py.
1.5.8