00001 #!/usr/local/bin/python
00002 #
00003 # Copyright 2003
00004 # by
00005 # The Board of Trustees of the
00006 # Leland Stanford Junior University.
00007 # All rights reserved.
00008 #
00009
00010 __facility__ = "Online"
00011 __abstract__ = "GLAST Online Single Event Display Painter"
00012 __author__ = "A. Kavelaars <aliciak@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__ = "11/20/2003"
00014 __version__ = "$Revision: 1.18 $"
00015 __credits__ = "SLAC"
00016
00017
00018 import LATTE.copyright_SLAC
00019
00020 from qt import *
00021
00022 import GOSED_LDF
00023 import colorScale
00024
00025
00026 # Important Constants
00027 NUM_XY_TKR = 24
00028 NUM_Z_TKR = 36
00029 NUM_Z_CAL = 8
00030 NUM_XY_CAL = 12
00031
00032 RANGE_TKR_X = [1,2,5,6,9,10,13,14,17,18,21,22,25,26,29,30,33,34]
00033 RANGE1_TKR_X = [1, 5, 9, 13, 17, 21, 25, 29, 33]
00034 RANGE2_TKR_X = [2, 6, 10, 14, 18, 22, 26, 30, 34]
00035 RANGE_TKR_Y = [0,3,4,7,8,11,12,15,16,19,20,23,24,27,28,31,32,35]
00036 RANGE1_TKR_Y = [4, 8, 12, 16, 20, 24, 28, 32, 35]
00037 RANGE2_TKR_Y = [0, 3, 7, 11, 15, 19, 23, 27, 31]
00038
00039
00040 class drawSide1ACD(QWidget):
00041 """ Draws background Pixmap for the ACD Side 1 projection and updates
00042 the custom widget with the final pixmap processed by GOSED_LDF.
00043 """
00044
00045 def __init__(self, gui, parent = None,name = None,fl = 0):
00046 """ drawSide1ACD contructor
00047
00048 \param parent None
00049 \param name None
00050 \param fl 0
00051 """
00052
00053 # Initialize custom widget
00054 QWidget.__init__(self,parent,name,fl)
00055 self.__gui = gui
00056 custWidLayout = QGridLayout(self,1,1,0,6,"custWidLayout")
00057 self.clearWState(Qt.WState_Polished)
00058 self.setMinimumWidth(241)
00059 self.setMinimumHeight(81)
00060 self.setMaximumWidth(241)
00061 self.setMaximumHeight(81)
00062 #~ self.setSizePolicy(QSizePolicy(QSizePolicy(7,7,0,0,self.sizePolicy().hasHeightForWidth())))
00063
00064 tileWidth = (self.width() - 1)/5
00065 tileHeight = (self.height() - 1)/4
00066 towerWidth = self.width()/4
00067 towerHeight = self.height()/4
00068
00069 # Create a null final Pixmap that will indicate if there is
00070 # filtered ACD Side 1 data when it is filled in GOSED_LDF
00071 self.final = QPixmap(241, 81)
00072 self.background = QPixmap(241, 81)#self.width(), self.height())
00073
00074 pACD = QPainter(self.background)
00075 pACD.setBrush(QColor("gray"))
00076 pACD.setPen(QColor(140, 140, 140))
00077 pACD.drawRect(0, 0, self.width(), self.height())
00078
00079 # Draw tile boundaries
00080 pACD.setPen(QColor(100, 100, 100))
00081
00082 for j in range(3):
00083 for i in range(5):
00084 pACD.drawRect(tileWidth * i, tileHeight * j,
00085 tileWidth + 1, tileHeight + 1
00086 )
00087
00088 pACD.drawRect(0, tileHeight * 3, tileWidth * 5 + 1, tileHeight + 1)
00089
00090 # Draw tower boundaries
00091 pACD.setPen(QColor(166, 163, 157))
00092
00093 for i in range(1,4):
00094 pACD.drawLine((towerWidth)*i, 1,(towerWidth)*i, self.height() - 1)
00095
00096 pACD.end()
00097
00098 # ATK-051110: Load the names in the background pixmap as default
00099 self.drawNames(self.background)
00100
00101 self.paintFace()
00102
00103 def drawNames(self, pixmap):
00104 tileWidth = (self.width() - 1)/5
00105 tileHeight = (self.height() - 1)/4
00106
00107 pACD = QPainter(pixmap)
00108
00109 # Draw tile names
00110 pACD.setPen(QColor(50, 50, 50))
00111
00112 lookupTile = GOSED_LDF.LOOKUP_ACD_TILE
00113 width = tileWidth
00114 for tile in GOSED_LDF.LOOKUP_ACD_YZM:
00115 tileSide = lookupTile[tile]
00116 if tileSide[2] == 3: width = self.width()
00117 pACD.drawText(width * tileSide[1], tileHeight * tileSide[2],
00118 width, tileHeight, Qt.AlignCenter, tile)
00119
00120 pACD.end()
00121
00122 def clear(self):
00123 # Pass the background to the final Pixmap
00124 self.final.fill()
00125 bitBlt(self.final, 0, 0, self.background, 0, 0)
00126
00127 def showEvent(self, se):
00128 self.__gui.replot()
00129
00130 def paintEvent(self, pe):
00131 """ Paint Event function for the Side 1 projection, paints its
00132 background and updates it with the current event pixmap (final)
00133 created in GOSED_LDF. If no data passed the filter for ACD, final
00134 will be updated as the background.
00135
00136 \param pe paint event
00137 """
00138 self.paintFace()
00139
00140 def paintFace(self):
00141 # Load the custom widget with the final pixmap
00142 #~ self.drawNames(self.final)# ATK-051110: See comment on drawHatACD
00143 bitBlt(self, 0, 0, self.final, 0, 0)
00144
00145 class drawSide2ACD(QWidget):
00146 """ Draws background Pixmap for the ACD Side 2 projection and updates
00147 the custom widget with the final pixmap processed by GOSED_LDF.
00148 """
00149
00150 def __init__(self, gui, parent = None,name = None,fl = 0):
00151 """ drawSide2ACD contructor
00152
00153 \param parent None
00154 \param name None
00155 \param fl 0
00156 """
00157
00158 # Initialize custom widget
00159 QWidget.__init__(self,parent,name,fl)
00160 self.__gui = gui
00161 custWidLayout = QGridLayout(self,1,1,0,6,"custWidLayout")
00162 #~ self.setSizePolicy(QSizePolicy(QSizePolicy(7,7,0,0,self.sizePolicy().hasHeightForWidth())))
00163 self.clearWState(Qt.WState_Polished)
00164 self.setMinimumWidth(81)
00165 self.setMinimumHeight(241)
00166 self.setMaximumWidth(81)
00167 self.setMaximumHeight(241)
00168
00169 tileWidth = (self.width() - 1)/4
00170 tileHeight = (self.height()- 1)/5
00171 towerWidth = self.width()/4
00172 towerHeight = self.height()/4
00173
00174 # Create a null final Pixmap that will indicate if there is
00175 # filtered ACD Side 2 data when it is filled in GOSED_LDF
00176 self.final = QPixmap(81, 241)#self.width(), self.height())
00177 self.background = QPixmap(81, 241)#self.width(), self.height())
00178
00179 pACD = QPainter(self.background)
00180 pACD.setBrush(QColor("gray"))
00181 pACD.setPen(QColor(140, 140, 140))
00182 pACD.drawRect(0, 0, self.width(), self.height())
00183
00184 # Draw tile boundaries
00185 pACD.setPen(QColor(100, 100, 100))
00186
00187 for i in range(3):
00188 for j in range(5):
00189 pACD.drawRect(tileWidth * i, tileHeight * j,
00190 tileWidth + 1, tileHeight + 1
00191 )
00192 pACD.drawRect(tileWidth * 3, 0, tileWidth + 1, self.height())
00193
00194 # Draw tower boundaries
00195 pACD.setPen(QColor(166, 163, 157))
00196
00197 for i in range(1,4):
00198 pACD.drawLine(1, (towerHeight)*i, self.width() - 1, (towerHeight)*i)
00199
00200 pACD.end()
00201
00202 # ATK-051110: Load the names in the background pixmap as default
00203 self.drawNames(self.background)
00204
00205 self.paintFace()
00206
00207 def drawNames(self, pixmap):
00208 tileWidth = (self.width() - 1)/4
00209 tileHeight = (self.height()- 1)/5
00210
00211 pACD = QPainter(pixmap)
00212
00213 # Draw tile name
00214 pACD.setPen(QColor(50, 50, 50))
00215
00216 lookupTile = GOSED_LDF.LOOKUP_ACD_TILE
00217 height = tileHeight
00218 for tile in GOSED_LDF.LOOKUP_ACD_XZM:
00219 tileSide = lookupTile[tile]
00220 if tileSide[1] == 3: height = self.height()
00221 x = tileWidth * tileSide[1] + (tileWidth/2 - 5) # I don't understand ...
00222 y = height * tileSide[2] + (height/2 + 10) # ...these offsets
00223 pACD.translate(x, y)
00224 pACD.rotate(-90.0)
00225 pACD.drawText(0, 0, tileWidth, height, Qt.AlignAuto, tile)
00226 pACD.rotate(90.0)
00227 pACD.translate(-x, -y)
00228
00229 pACD.end()
00230
00231 def clear(self):
00232 # Pass the background to the final Pixmap
00233 self.final.fill()
00234 bitBlt(self.final, 0, 0, self.background, 0, 0)
00235
00236 def showEvent(self, se):
00237 self.__gui.replot()
00238
00239 def paintEvent(self, pe):
00240 """ Paint Event function for the Side 2 projection, paints its
00241 background and updates it with the current event pixmap (final)
00242 created in GOSED_LDF. If no data passed the filter for ACD, final
00243 will be updated as the background.
00244
00245 \param pe paint event
00246 """
00247
00248 self.paintFace()
00249
00250 def paintFace(self):
00251 # Load the custom widget with the final pixmap
00252 #~ self.drawNames(self.final)# ATK-051110: See comment on drawHatACD
00253 bitBlt(self, 0, 0, self.final, 0, 0)
00254
00255
00256 class drawSide3ACD(QWidget):
00257 """ Draws background Pixmap for the ACD Side 3 projection and updates
00258 the custom widget with the final pixmap processed by GOSED_LDF.
00259 """
00260
00261 def __init__(self, gui, parent = None,name = None,fl = 0):
00262 """ drawSide3ACD contructor
00263
00264 \param parent None
00265 \param name None
00266 \param fl 0
00267 """
00268
00269 # Initialize custom widget
00270 QWidget.__init__(self,parent,name,fl)
00271 self.__gui = gui
00272 custWidLayout = QGridLayout(self,1,1,0,6,"custWidLayout")
00273 #~ self.setSizePolicy(QSizePolicy(QSizePolicy(7,7,0,0,self.sizePolicy().hasHeightForWidth())))
00274 self.clearWState(Qt.WState_Polished)
00275 self.setMinimumWidth(241)
00276 self.setMinimumHeight(81)
00277 self.setMaximumWidth(241)
00278 self.setMaximumHeight(81)
00279
00280 tileWidth = (self.width() - 1)/5
00281 tileHeight = (self.height() - 1)/4
00282 towerWidth = self.width()/4
00283 towerHeight = self.height()/4
00284
00285 # Create a null final Pixmap that will indicate if there is
00286 # filtered ACD Side 3 data when it is filled in GOSED_LDF
00287 self.final = QPixmap(241, 81)#self.width(), self.height())
00288 self.background = QPixmap(241, 81)#self.width(), self.height())
00289
00290 pACD = QPainter(self.background)
00291 pACD.setBrush(QColor("gray"))
00292 pACD.setPen(QColor(140, 140, 140))
00293 pACD.drawRect(0, 0, self.width(), self.height())
00294
00295 # Draw tile boundaries
00296 pACD.setPen(QColor(100, 100, 100))
00297
00298 for i in range(5):
00299 for j in range(1, 4):
00300 pACD.drawRect(tileWidth *i, tileHeight * j,
00301 tileWidth + 1, tileHeight + 1
00302 )
00303 pACD.drawRect(0, 0, self.width(), tileHeight + 1)
00304
00305 # Draw tower boundaries
00306 pACD.setPen(QColor(166, 163, 157))
00307
00308 for i in range(1,4):
00309 pACD.drawLine((towerWidth)*i, 1, (towerWidth)*i, self.height() - 1)
00310
00311 pACD.end()
00312
00313 # ATK-051110: Load the names in the background pixmap as default
00314 self.drawNames(self.background)
00315
00316 self.paintFace()
00317
00318 def drawNames(self, pixmap):
00319 tileWidth = (self.width() - 1)/5
00320 tileHeight = (self.height() - 1)/4
00321
00322 pACD = QPainter(pixmap)
00323
00324 # Draw tile name
00325 pACD.setPen(QColor(50, 50, 50))
00326
00327 lookupTile = GOSED_LDF.LOOKUP_ACD_TILE
00328 width = tileWidth
00329 for tile in GOSED_LDF.LOOKUP_ACD_YZP:
00330 tileSide = lookupTile[tile]
00331 if tileSide[2] == 0: width = self.width()
00332 pACD.drawText(width * tileSide[1], tileHeight * tileSide[2],
00333 width, tileHeight, Qt.AlignCenter, tile)
00334
00335 pACD.end()
00336
00337 def clear(self):
00338 # Pass the background to the final Pixmap
00339 self.final.fill()
00340 bitBlt(self.final, 0, 0, self.background, 0, 0)
00341
00342 def showEvent(self, se):
00343 self.__gui.replot()
00344
00345 def paintEvent(self, pe):
00346 """ Paint Event function for the Side 3 projection, paints its
00347 background and updates it with the current event pixmap (final)
00348 created in GOSED_LDF. If no data passed the filter for ACD, final
00349 will be updated as the background.
00350
00351 \param pe paint event
00352 """
00353
00354 self.paintFace()
00355
00356 def paintFace(self):
00357 # Load the custom widget with the final pixmap
00358 #~ self.drawNames(self.final) # ATK-051110: See comment on drawHatACD
00359 bitBlt(self, 0, 0, self.final, 0, 0)
00360
00361
00362 class drawSide4ACD(QWidget):
00363 """ Draws background Pixmap for the ACD Side 4 projection and updates
00364 the custom widget with the final pixmap processed by GOSED_LDF.
00365 """
00366
00367 def __init__(self, gui, parent = None,name = None,fl = 0):
00368 """ drawSide4ACD contructor
00369
00370 \param parent None
00371 \param name None
00372 \param fl 0
00373 """
00374
00375 # Initialize custom widget
00376 QWidget.__init__(self,parent,name,fl)
00377 self.__gui = gui
00378 custWidLayout = QGridLayout(self,1,1,0,6,"custWidLayout")
00379 #~ self.setSizePolicy(QSizePolicy(QSizePolicy(7,7,0,0,self.sizePolicy().hasHeightForWidth())))
00380 self.clearWState(Qt.WState_Polished)
00381 self.setMinimumWidth(81)
00382 self.setMinimumHeight(241)
00383 self.setMaximumWidth(81)
00384 self.setMaximumHeight(241)
00385
00386 tileWidth = (self.width() - 1)/4
00387 tileHeight = (self.height() - 1)/5
00388 towerWidth = self.width()/4
00389 towerHeight = self.height()/4
00390
00391 # Create a null final Pixmap that will indicate if there is
00392 # filtered ACD Side 4 data when it is filled in GOSED_LDF
00393 self.final = QPixmap(self.width(), self.height())
00394 self.background = QPixmap(self.width(), self.height())
00395
00396 pACD = QPainter(self.background)
00397 pACD.setBrush(QColor("gray"))
00398 pACD.setPen(QColor(140, 140, 140))
00399 pACD.drawRect(0, 0, self.width(), self.height())
00400
00401 # Draw tile boundaries
00402 pACD.setPen(QColor(100, 100, 100))
00403
00404 for i in range(1,4):
00405 for j in range(5):
00406 pACD.drawRect(tileWidth * i, tileHeight * j,
00407 tileWidth + 1, tileHeight + 1
00408 )
00409 pACD.drawRect(0, 0, tileWidth + 1, self.height())
00410
00411 # Draw tower boundaries
00412 pACD.setPen(QColor(166, 163, 157))
00413
00414 for i in range(1,4):
00415 pACD.drawLine(1, (towerHeight)*i, self.width() - 1, (towerHeight)*i)
00416
00417 pACD.end()
00418
00419 # ATK-051110: Load the names in the background pixmap as default
00420 self.drawNames(self.background)
00421
00422 self.paintFace()
00423
00424 def drawNames(self, pixmap):
00425 tileWidth = (self.width() - 1)/4
00426 tileHeight = (self.height() - 1)/5
00427
00428 pACD = QPainter(pixmap)
00429 #pACD.setRasterOp(Qt.XorROP) # Set pen color to background...
00430
00431 # Draw tile name
00432 #pACD.setPen(QColor("gray")) # Same as brush color for background
00433 pACD.setPen(QColor(50, 50, 50))
00434
00435 lookupTile = GOSED_LDF.LOOKUP_ACD_TILE
00436 height = tileHeight
00437 for tile in GOSED_LDF.LOOKUP_ACD_XZP:
00438 tileSide = lookupTile[tile]
00439 if tileSide[1] == 0: height = self.height()
00440 x = tileWidth * tileSide[1] + (tileWidth - 2) # I don't understand ...
00441 y = height * tileSide[2] + (height/2 - 9) # ...these offsets
00442 pACD.translate(x, y)
00443 pACD.rotate(90.0)
00444 pACD.drawText(0, 0, tileWidth, height, Qt.AlignAuto, tile)
00445 pACD.rotate(-90.0)
00446 pACD.translate(-x, -y)
00447
00448 pACD.end()
00449
00450 def clear(self):
00451 # Pass the background to the final Pixmap
00452 self.final.fill()
00453 bitBlt(self.final, 0, 0, self.background, 0, 0)
00454
00455 def showEvent(self, se):
00456 self.__gui.replot()
00457
00458 def paintEvent(self, pe):
00459 """ Paint Event function for the Side 4 projection, paints its
00460 background and updates it with the current event pixmap (final)
00461 created in GOSED_LDF. If no data passed the filter for ACD, final
00462 will be updated as the background.
00463
00464 \param pe paint event
00465 """
00466
00467 self.paintFace()
00468
00469 def paintFace(self):
00470 # Load the custom widget with the final pixmap
00471 #~ self.drawNames(self.final) # ATK-051110: See comment on drawHatACD
00472 bitBlt(self, 0, 0, self.final, 0, 0)
00473
00474
00475 class drawHatACD(QWidget):
00476 """ Draws background Pixmap for the ACD Hat projection and updates
00477 the custom widget with the final pixmap processed by GOSED_LDF.
00478 """
00479
00480 def __init__(self, gui, parent = None,name = None,fl = 0):
00481 """ drawHatACD contructor
00482
00483 \param parent None
00484 \param name None
00485 \param fl 0
00486 """
00487
00488 # Initialize custom widget
00489 QWidget.__init__(self,parent,name,fl)
00490 self.__gui = gui
00491 custWidLayout = QGridLayout(self,1,1,0,6,"custWidLayout")
00492 #~ self.setSizePolicy(QSizePolicy(QSizePolicy(7,7,0,0,self.sizePolicy().hasHeightForWidth())))
00493 self.clearWState(Qt.WState_Polished)
00494 self.setMinimumWidth(241)
00495 self.setMinimumHeight(241)
00496 self.setMaximumWidth(241)
00497 self.setMaximumHeight(241)
00498
00499 tileWidth = (self.width() - 1)/5
00500 tileHeight = (self.height() - 1)/5
00501 towerWidth = self.width()/4
00502 towerHeight = self.height()/4
00503
00504 # Create a null final Pixmap that will indicate if there is
00505 # filtered ACD Hat (top) data when it is filled in GOSED_LDF
00506 self.final = QPixmap(self.width(), self.height())
00507 self.background = QPixmap(self.width(), self.height())
00508
00509
00510 pACD = QPainter(self.background)
00511 pACD.setBrush(QColor("gray"))
00512 pACD.setPen(QColor(140, 140, 140))
00513 pACD.drawRect(0, 0, self.width(), self.height())
00514
00515 # Draw tile boundaries
00516 pACD.setPen(QColor(100, 100, 100))
00517
00518 for j in range(5):
00519 for i in range(5):
00520 pACD.drawRect(tileWidth * i, tileHeight * j,
00521 tileWidth + 1, tileHeight + 1
00522 )
00523
00524 # Draw tower boundaries
00525 pACD.setPen(QColor(166, 163, 157))
00526
00527 for i in range(1,4):
00528 pACD.drawLine((towerWidth)*i, 1,
00529 (towerWidth)*i, self.height() - 1
00530 )
00531 pACD.drawLine(1, (towerHeight)*i,
00532 self.width() - 1, (towerHeight)*i
00533 )
00534
00535 pACD.end()
00536
00537 # ATK-051110: Load the names in the background pixmap as default
00538 self.drawNames(self.background)
00539
00540 self.paintFace()
00541
00542 def drawNames(self, pixmap):
00543 tileWidth = (self.width() - 1)/5
00544 tileHeight = (self.height() - 1)/5
00545
00546 pACD = QPainter(pixmap)
00547
00548 # Draw tile name
00549 pACD.setPen(QColor(50, 50, 50))
00550
00551 lookupTile = GOSED_LDF.LOOKUP_ACD_TILE
00552 for tile in GOSED_LDF.LOOKUP_ACD_XY:
00553 tileSide = lookupTile[tile]
00554 pACD.drawText(tileWidth * tileSide[1], tileHeight * tileSide[2],
00555 tileWidth, tileHeight, Qt.AlignCenter, tile)
00556
00557 pACD.end()
00558
00559 def clear(self):
00560 # Pass the background to the final Pixmap
00561 self.final.fill()
00562 bitBlt(self.final, 0, 0, self.background, 0, 0)
00563
00564 def showEvent(self, se):
00565 self.__gui.replot()
00566
00567 def paintEvent(self, pe):
00568 """ Paint Event function for the Hat projection, paints its
00569 background and updates it with the current event pixmap (final)
00570 created in GOSED_LDF. If no data passed the filter for ACD, final
00571 will be updated as the background.
00572
00573 \param pe paint event
00574 """
00575 self.paintFace()
00576
00577 def paintFace(self):
00578 # Load the custom widget with the final pixmap
00579 # ATK-051110: The names can't be loaded here. The operation takes
00580 # time and makes the display flicker. Instead 1. drawNames to the
00581 # background pixmap as default.
00582 # If the pixmap gets populated in GOSED_LDF, drawNames to the final
00583 # pixmap there as part of the iteration process.
00584 #~ self.drawNames(self.final)
00585 bitBlt(self, 0 , 0, self.final, 0, 0)
00586
00587
00588 class drawXZ_TKR(QWidget):
00589 """ Draws background Pixmap for the XZ TKR projection and updates
00590 the custom widget with the final pixmap processed by GOSED_LDF.
00591 """
00592
00593 def __init__(self, gui, parent = None,name = None,fl = 0):
00594 """ drawXZ_TKR contructor
00595
00596 \param parent None
00597 \param name None
00598 \param fl 0
00599 """
00600
00601 # Initialize custom widget
00602 QWidget.__init__(self,parent,name,fl)
00603 self.__gui = gui
00604 custWidLayout = QGridLayout(self,1,1,0,6,"custWidLayout")
00605 self.clearWState(Qt.WState_Polished)
00606
00607 # Create a null final Pixmap that will indicate if there is
00608 # filtered TKR data when it is filled in GOSED_LDF
00609 self.final = QPixmap(145, 254)
00610 self.background = QPixmap(145, 254)
00611
00612 # Initialize painter
00613 pTKR = QPainter(self.background)
00614 pTKR.setBrush(QColor("gray"))#110, 110, 110)) #"white"))
00615 pTKR.setPen(QColor(170, 170, 160))
00616 #~ pTKR.setPen(QColor("lightgray"))
00617
00618 # Draw background
00619 pTKR.drawRect(0, 0, 145, 254)
00620 for y in range(36):
00621 if y in RANGE1_TKR_X:
00622 pTKR.setPen(QColor(140,140,150))
00623 pTKR.drawRect( 0, y*7, 145, 8)
00624
00625 elif y in RANGE2_TKR_X:
00626 pTKR.setPen(QColor(140,140,150))
00627 pTKR.drawRect(0, y*7 + 1, 145, 8)
00628
00629 elif y != 0 and y in range (0, 36, 2):
00630 pTKR.setPen(QColor("lightgray"))
00631 pTKR.drawLine( 0, y*7 + 1, 145, y*7 + 1)
00632 #~ pTKR.drawRect( 1, y*7 - 8, 145, 9)
00633
00634 pTKR.end() # TBErased if implemented directly in frame
00635
00636 self.paintFace()
00637
00638 def clear(self):
00639 # Pass the background to the final Pixmap
00640 self.final.fill()
00641 bitBlt(self.final, 0, 0, self.background)
00642 #~ self.paintFace()
00643
00644 def showEvent(self, se):
00645 self.__gui.replot()
00646
00647 def paintEvent(self, pe):
00648 """ Paint Event function for the XZ TKR projection, paints its
00649 background and updates it with the current event pixmap (final)
00650 created in GOSED_LDF. If no data passed the filter for TKR, final
00651 will be updated as the background.
00652
00653 \param pe paint event
00654 """
00655
00656 self.paintFace()
00657
00658 def paintFace(self):
00659 # Load the custom widget with the final pixmap
00660 bitBlt(self, 0, 0, self.final)
00661
00662
00663 class drawYZ_TKR(QWidget):
00664 """ Draws background Pixmap for the YZ TKR projection and updates
00665 the custom widget with the final pixmap processed by GOSED_LDF.
00666 """
00667
00668 def __init__(self, gui, parent = None,name = None,fl = 0):
00669 """ drawYZ_TKR constructor
00670
00671 \param parent None
00672 \param name None
00673 \param fl 0
00674 """
00675
00676 # Initialize custom widget
00677 QWidget.__init__(self,parent,name,fl)
00678 self.__gui = gui
00679 custWidLayout = QGridLayout(self,1,1,0,6,"custWidLayout")
00680 self.clearWState(Qt.WState_Polished)
00681
00682 # Initialize pixmaps
00683 self.final = QPixmap(145, 254)
00684 self.background = QPixmap(145, 254)
00685
00686 # Initialize painter
00687 pTKR = QPainter(self.background)
00688 pTKR.setBrush(QColor("gray"))#110, 110, 110)) #"white"))
00689 pTKR.setPen(QColor(170, 170, 160))
00690 #~ pTKR.setBrush(QColor(110, 110, 110)) #"white"))
00691 #~ pTKR.setPen(QColor("lightgray"))
00692
00693 # Draw background
00694 pTKR.drawRect(0, 0, 145, 254)
00695 for y in range(36):
00696 if y in RANGE1_TKR_Y:
00697 pTKR.setPen(QColor(140,140,150))
00698 pTKR.drawRect( 0, y*7 + 1, 145, 8)
00699 #~ pTKR.drawRect( 0, y*7 + 2, 145, 8) #more symm but taller map
00700
00701 elif y in RANGE2_TKR_Y:
00702 pTKR.setPen(QColor(140,140,150))
00703 pTKR.drawRect(0, y*7, 145, 8)
00704 #~ pTKR.drawRect(0, y*7 + 1, 145, 8)
00705
00706 #~ elif y == 2:
00707 #~ pTKR.setPen(QColor("lightgray"))
00708 #~ pTKR.drawLine( 1, y*7, 145, y*7)
00709
00710 elif y in range (0, 36, 2):
00711 pTKR.setPen(QColor("lightgray"))
00712 if y == 2:
00713 pTKR.drawLine( 0, y*7, 145, y*7)
00714 else:
00715 pTKR.drawLine( 0, y*7 + 1, 145, y*7 + 1)
00716
00717 pTKR.end()
00718
00719 self.paintFace()
00720
00721 def clear(self):
00722 # Pass the background to the final Pixmap
00723 self.final.fill()
00724 bitBlt(self.final, 0, 0, self.background)
00725 #~ self.paintFace()
00726
00727 def showEvent(self, se):
00728 self.__gui.replot()
00729
00730 def paintEvent(self, pe):
00731 """ Paint Event function for the YZ TKR projection, paints its
00732 background and updates it with the current event pixmap (final)
00733 created in GOSED_LDF. If no data passed the filter for TKR, final
00734 will be updated as the background.
00735
00736 \param pe paint event
00737 """
00738
00739 self.paintFace()
00740
00741 def paintFace(self):
00742 # Load the custom widget with the final pixmap
00743 bitBlt(self, 0, 0, self.final)
00744
00745
00746 class drawXZ_CAL(QWidget):
00747 """ Draws background Pixmap for the XZ CAL projection and updates
00748 the custom widget with the final pixmap processed by GOSED_LDF.
00749 """
00750
00751 def __init__(self, gui, parent = None,name = None,fl = 0):
00752 """ drawXZ_CAL constructor
00753
00754 \param parent None
00755 \param name None
00756 \param fl 0
00757 """
00758
00759 # Initialize custom widget
00760 QWidget.__init__(self,parent,name,fl)
00761 self.__gui = gui
00762 custWidLayout = QGridLayout(self,1,1,0,6,"custWidLayout")
00763 self.clearWState(Qt.WState_Polished)
00764
00765 # Initialize pixmaps
00766 self.final = QPixmap(145, 80)
00767 self.background = QPixmap(145, 80)
00768
00769 # Initialize painter
00770 pXZ_CAL = QPainter(self.background)
00771 r, g, b = colorScale.colorScale(0.0)
00772 #~ pXZ_CAL.setBrush(QColor(r, g, b)) #"white"))
00773 #~ pXZ_CAL.setBrush(QColor(110, 110, 110))
00774 #~ pXZ_CAL.setPen(QColor(160,160,170))
00775 pXZ_CAL.setBrush(QColor("gray"))#110, 110, 110)) #"white"))
00776 pXZ_CAL.setPen(QColor(140,140,150))
00777
00778 # Paint background
00779 for y in range(NUM_Z_CAL):
00780 if y in range(0, NUM_Z_CAL, 2):
00781 pXZ_CAL.drawRect(0, y*10, 145, 10)
00782 else:
00783 for x in range(NUM_XY_CAL):
00784 pXZ_CAL.drawRect(x*12, y*10, 13, 10)
00785
00786 pXZ_CAL.end()
00787
00788 self.paintFace()
00789
00790 def clear(self):
00791 # Pass the background to the final Pixmap
00792 self.final.fill()
00793 bitBlt(self.final, 0, 0, self.background)
00794 #~ self.paintFace()
00795
00796 def showEvent(self, se):
00797 self.__gui.replot()
00798
00799 def paintEvent(self, pe):
00800 """ Paint Event function for the XZ CAL projection, paints its
00801 background and updates it with the current event pixmap (final)
00802 created in GOSED_LDF. If no data passed the filter for TKR, final
00803 will be updated as the background.
00804
00805 \param pe paint event
00806 """
00807
00808 self.paintFace()
00809
00810 def paintFace(self):
00811 # Load the custom widget with the final pixmap
00812 bitBlt(self, 0, 0, self.final)
00813
00814
00815 class drawYZ_CAL(QWidget):
00816 """ Draws background Pixmap for the YZ TKR projection and updates
00817 the custom widget with the final pixmap processed by GOSED_LDF.
00818 """
00819
00820 def __init__(self, gui, parent = None,name = None,fl = 0):
00821 """ drawYZ_CAL constructor
00822
00823 \param parent None
00824 \param name None
00825 \param fl 0
00826 """
00827
00828 # Custom Widget setup
00829 QWidget.__init__(self,parent,name,fl)
00830 self.__gui = gui
00831 custWidLayout = QGridLayout(self,1,1,0,6,"custWidLayout")
00832 self.clearWState(Qt.WState_Polished)
00833
00834 # Create a null final Pixmap that will indicate if there is
00835 # filtered CAL data when it is filled in GOSED_LDF
00836 #CELLVERTPITCH = int( 21.35 / 2.0)
00837 #CELLHORPITCH = int( 27.84 / 2.0)
00838 #CSILENGTH = int(326.00 / 2.0)
00839 #CSIWIDTH = int( 26.70 / 2.0)
00840 #CSIHEIGHT = int( 19.90 / 2.0)
00841
00842 self.final = QPixmap(145, 80)
00843 self.background = QPixmap(145, 80)
00844 #self.setMinimumWidth(NUM_XY_CAL * CELLHORPITCH)
00845 #self.setMinimumHeight(NUM_Z_CAL * CELLVERTPITCH)
00846 #self.setMaximumWidth(NUM_XY_CAL * CELLHORPITCH)
00847 #self.setMaximumHeight(NUM_Z_CAL * CELLVERTPITCH)
00848
00849 #self.final = QPixmap(NUM_XY_CAL * CELLHORPITCH, NUM_Z_CAL * CELLVERTPITCH)
00850 #self.background = QPixmap(NUM_XY_CAL * CELLHORPITCH, NUM_Z_CAL * CELLVERTPITCH)
00851
00852 # Start painter
00853 pYZ_CAL = QPainter(self.background)
00854 r, g, b = colorScale.colorScale(0.0)
00855 #~ pYZ_CAL.setBrush(QColor(r, g, b)) #"white"))
00856 #~ pYZ_CAL.setBrush(QColor(110, 110, 110))
00857 #~ pYZ_CAL.setPen(QColor(160,160,170))
00858 pYZ_CAL.setBrush(QColor("gray"))#110, 110, 110)) #"white"))
00859 pYZ_CAL.setPen(QColor(140,140,150))
00860
00861 # Paint background in background Pixmap
00862 for y in range(NUM_Z_CAL):
00863 if y in range(1, NUM_Z_CAL, 2):
00864 pYZ_CAL.drawRect(0, y*10, 145, 10)
00865 #pYZ_CAL.drawRect(0, y*CELLVERTPITCH, NUM_XY_CAL * CELLHORPITCH, CELLVERTPITCH)
00866 else:
00867 for x in range(NUM_XY_CAL):
00868 pYZ_CAL.drawRect(x*12, y*10, 13, 10)
00869 #pYZ_CAL.drawRect(x*CELLHORPITCH, y*CELLVERTPITCH, CELLHORPITCH, CELLVERTPITCH)
00870
00871 pYZ_CAL.end()
00872
00873 self.paintFace()
00874
00875 def clear(self):
00876 # Pass the background to the final Pixmap
00877 self.final.fill()
00878 bitBlt(self.final, 0, 0, self.background)
00879 #~ self.paintFace()
00880
00881 def showEvent(self, se):
00882 self.__gui.replot()
00883
00884 def paintEvent(self, pe):
00885 """ Paint Event function for the YZ CAL projection, paints its
00886 background and updates it with the current event pixmap (final)
00887 created in GOSED_LDF. If no data passed the filter for TKR, final
00888 will be updated as the background.
00889
00890 \param pe paint event
00891 """
00892
00893 self.paintFace()
00894
00895 def paintFace(self):
00896 # Load the custom widget with the final pixmap
00897 bitBlt(self, 0, 0, self.final)
00898
00899 class drawRainbowACD(QWidget):
00900 """ Draws background Pixmap for the ACD Rainbow and updates
00901 the custom widget with the final pixmap.
00902 """
00903
00904 def __init__(self, gui, parent = None,name = None,fl = 0):
00905 """ drawRainbowACD constructor
00906
00907 \param parent None
00908 \param name None
00909 \param fl 0
00910 """
00911
00912 # Custom Widget setup
00913 QWidget.__init__(self,parent,name,fl)
00914 self.__gui = gui
00915 custWidLayout = QGridLayout(self,1,1,0,6,"custWidLayout")
00916 self.clearWState(Qt.WState_Polished)
00917
00918 self.rainbowACD = QPixmap(440, 15)
00919 p = QPainter(self.rainbowACD)
00920
00921 minV = 1.0e-15
00922 maxV = 1.0 - minV
00923 value = minV
00924
00925 # Divide length of the frame (440) in intervals of 1
00926 dV = (maxV - minV) / float(440)
00927 tileWidth = 1
00928 tileHeight = 15
00929 for i in range(0, 440):
00930 r, g, b = colorScale.colorScale(value)
00931 p.setBrush(QColor(r, g, b))
00932 p.setPen(QColor(r, g, b))
00933 p.drawRect(i*tileWidth, 0,
00934 (i + 1)*tileWidth, tileHeight
00935 )
00936 value += dV
00937 p.end()
00938
00939 self.paintRainbowACD()
00940
00941 def paintEvent(self, pe):
00942 """ Paint Event function for the ACD rainbow.
00943
00944 \param pe paint event
00945 """
00946
00947 self.paintRainbowACD()
00948
00949 def paintRainbowACD(self):
00950 # Load the custom widget with the final pixmap
00951 bitBlt(self, 0, 0, self.rainbowACD)
00952
00953 class drawRainbowCAL(QWidget):
00954 """ Draws background Pixmap for the CAL Rainbow and updates
00955 the custom widget with the final pixmap.
00956 """
00957
00958 def __init__(self, gui, parent = None,name = None,fl = 0):
00959 """ drawRainbowCAL constructor
00960
00961 \param parent None
00962 \param name None
00963 \param fl 0
00964 """
00965
00966 # Custom Widget setup
00967 QWidget.__init__(self,parent,name,fl)
00968 self.__gui = gui
00969 custWidLayout = QGridLayout(self,1,1,0,6,"custWidLayout")
00970 self.clearWState(Qt.WState_Polished)
00971
00972 self.rainbowCAL = QPixmap(410, 15)
00973 p = QPainter(self.rainbowCAL)
00974
00975 minV = 1.0e-15
00976 maxV = 1.0 - minV
00977 value = minV
00978
00979 # Divide length of the frame (410) in intervals of 1
00980 dV = (maxV - minV) / float(410)
00981 tileWidth = 1
00982 tileHeight = 15
00983 for i in range(0, 410):
00984 r, g, b = colorScale.colorScale(value)
00985 p.setBrush(QColor(r, g, b))
00986 p.setPen(QColor(r, g, b))
00987 p.drawRect(i*tileWidth, 0,
00988 (i + 1)*tileWidth, tileHeight
00989 )
00990 value += dV
00991 p.end()
00992
00993 self.paintRainbowCAL()
00994
00995 def paintEvent(self, pe):
00996 """ Paint Event function for the CAL rainbow.
00997
00998 \param pe paint event
00999 """
01000
01001 self.paintRainbowCAL()
01002
01003 def paintRainbowCAL(self):
01004 # Load the custom widget with the final pixmap
01005 bitBlt(self, 0, 0, self.rainbowCAL)