CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Attributes
Vispa.Gui.VispaWidget.TextField Class Reference
Inheritance diagram for Vispa.Gui.VispaWidget.TextField:

Public Member Functions

def __init__ (self)
 
def autoscale (self)
 
def autosizeFont (self)
 
def calculateDimensions (self)
 
def empty (self)
 
def font (self)
 
def getDrawRect (self, scale=1)
 
def getFontHeight (self, fm=None)
 
def getFontSize (self)
 
def getHeight (self)
 
def getOutputFlags (self)
 
def getOutputText (self)
 
def getTextShort (self)
 
def getWidth (self)
 
def paint (self, painter, xPos, yPos, scale=1)
 
def penColor (self)
 
def setAutoscale (self, auto, keepAspectRatio)
 
def setAutosizeFont (self, auto)
 
def setAutotruncate (self, auto)
 
def setDefaultFontSize (self, fontSize)
 
def setDefaultHeight (self, height)
 
def setDefaultWidth (self, width)
 
def setFont (self, qfont)
 
def setFontSizeRange (self, minFontSize, maxFontSize)
 
def setOutputFlags (self, flags)
 
def setPenColor (self, color)
 
def setText (self, text)
 
def text (self)
 
def truncate (self)
 
def truncated (self)
 

Public Attributes

 ranbefore
 

Private Attributes

 _autoscaleFlag
 
 _autoscaleKeepAspectRatioFlag
 
 _autosizeFontFlag
 
 _autotruncateTextFlag
 
 _defaultFontSize
 
 _defaultHeight
 
 _defaultWidth
 
 _deletableFalg
 
 _font
 
 _fontSize
 
 _fontSizeHasChanged
 
 _height
 
 _maxFontSize
 
 _minFontSize
 
 _outputFlags
 
 _penColor
 
 _text
 
 _textShort
 
 _width
 
 _xPos
 
 _yPos
 

Detailed Description

TextField for VispaWidget.

Text and title shown in VispaWidget are TextField object.

Definition at line 13 of file VispaWidget.py.

Constructor & Destructor Documentation

def Vispa.Gui.VispaWidget.TextField.__init__ (   self)

Definition at line 24 of file VispaWidget.py.

24  def __init__(self):
25  self._text = ''
26  self._textShort = ''
27  self._font = None #needed for autosizeFont()
28  self._fontSize = self.FONT_SIZE
29  self._fontSizeHasChanged = True
30  self._penColor = QColor(Qt.black)
31  self._minFontSize = 1
32  self._maxFontSize = 30
33  self._outputFlags = Qt.AlignLeft
34 
35  self._defaultWidth = self.WIDTH
36  self._defaultHeight = self.HEIGHT
37  self._width = self._defaultWidth
38  self._height = self._defaultHeight
39 
40  self._deletableFalg = True
41  self._autosizeFontFlag = False
43  self._autoscaleFlag = False
45 
46  self._xPos = 0
47  self._yPos = 0
48 

Member Function Documentation

def Vispa.Gui.VispaWidget.TextField.autoscale (   self)
Adjusts values for getWidth() and getHeight() so whole text fits in.

Definition at line 228 of file VispaWidget.py.

References Vispa.Gui.VispaWidget.TextField._font.

Referenced by Vispa.Gui.VispaWidget.TextField.calculateDimensions().

228  def autoscale(self):
229  """ Adjusts values for getWidth() and getHeight() so whole text fits in.
230  """
231  #logging.debug("%s: autoscale() - %s" % (self.__class__.__name__, self._text))
232  fm = QFontMetrics(self._font)
233  self.ranbefore=True
234  self._width = 1
235  self._height = 1
236  widthFits = heightFits = False
237 
238  if not self._autoscaleKeepAspectRatioFlag:
239  # test for replacing else part in while-loop (2009-02-23)
240  neededRect = fm.boundingRect(0, 0, self._defaultWidth*100, self._defaultHeight*100, self._outputFlags, self._text)
241  self._width = neededRect.width()
242  self._height = neededRect.height()
243  return
244 
245  while not widthFits or not heightFits:
247  self._width += 1
248  self._height = 1.0 * self._width * (self._defaultHeight + 1) / self._defaultWidth
249  # 'defaultHeight' +1 prevents factor 0 --> infinite loop
250  else:
251  if not widthFits:
252  self._width += 1
253  if not heightFits:
254  self._height += 1
255  neededRect = fm.boundingRect(0, 0, self._width, self._height, self._outputFlags, self._text)
256  if neededRect.width() <= self._width:
257  widthFits = True
258  self._width += 1 # prevent slightly too small width (maybe due to rounding while zoooming)
259  if neededRect.height() <= self._height:
260  heightFits = True
261  #logging.debug(self.__class__.__name__ +": autoscale() - (width, height) = ("+ str(self._width) +", "+ str(self._height) +")")
262 
def Vispa.Gui.VispaWidget.TextField.autosizeFont (   self)
Decreases font so text fits in given widht and height.

Definition at line 263 of file VispaWidget.py.

References Vispa.Gui.VispaWidget.TextField._font, Vispa.Gui.VispaWidget.TextField._fontSize, Vispa.Gui.VispaWidget.TextField._maxFontSize, Vispa.Gui.VispaWidget.TextField._minFontSize, Vispa.Gui.VispaWidget.TextField._outputFlags, Vispa.Gui.VispaWidget.TextField._text, and Vispa.Gui.VispaWidget.TextField.getDrawRect().

Referenced by Vispa.Gui.VispaWidget.TextField.calculateDimensions().

263  def autosizeFont(self):
264  """ Decreases font so text fits in given widht and height.
265  """
266  if self._font == None:
267  logging.error("TextField.autosizeFont() - ERROR: 'font' not set, can't calculate font size")
268  return
269 
270  drawRect = self.getDrawRect()
271  font = self._font
272  decSize = 0
273  for size in range(self._minFontSize + 1, self._maxFontSize + 1):
274  font.setPointSizeF(size + 0.1 * decSize)
275  fm = QFontMetricsF(font)
276  neededRect = fm.boundingRect(drawRect, self._outputFlags, self._text)
277  if neededRect.width() > drawRect.width() or neededRect.height() > drawRect.height():
278  size -= 1
279  break
280 
281  for decSize in range(0, 10):
282  font.setPointSizeF(size + 0.1 * decSize)
283  fm = QFontMetricsF(font)
284  neededRect = fm.boundingRect(drawRect, self._outputFlags, self._text)
285  if neededRect.width() > drawRect.width() or neededRect.height() > drawRect.height():
286  decSize -= 1
287  break
288 
289  self._fontSize = size + 0.1 * decSize
290  #print "determineTextFieldSize(", self._fontSize, ")"
291 
def getDrawRect(self, scale=1)
Definition: VispaWidget.py:122
def Vispa.Gui.VispaWidget.TextField.calculateDimensions (   self)
Calculates the space (width and height) needed to display text.

Depending on the flags set the size will be greater than the default size,
or the font size will be adjusted,
or the text will be truncated.

See setAutosizeFont(), setAutotruncate(), setAutoscale(), setDefaultWidth(), setDefaultHeight().

Definition at line 140 of file VispaWidget.py.

References Vispa.Gui.VispaWidget.TextField._autoscaleFlag, Vispa.Gui.VispaWidget.TextField._autosizeFontFlag, Vispa.Gui.VispaWidget.TextField._autotruncateTextFlag, Vispa.Gui.VispaWidget.TextField._defaultHeight, Vispa.Gui.VispaWidget.TextField._fontSizeHasChanged, Vispa.Gui.VispaWidget.TextField.autoscale(), Vispa.Gui.VispaWidget.TextField.autosizeFont(), Vispa.Gui.VispaWidget.TextField.getFontHeight(), Vispa.Gui.VispaWidget.TextField.getFontSize(), Vispa.Gui.VispaWidget.TextField.setDefaultHeight(), and Vispa.Gui.VispaWidget.TextField.truncate().

Referenced by Vispa.Gui.VispaWidget.TextField.setAutosizeFont(), and Vispa.Gui.VispaWidget.TextField.setAutotruncate().

141  """ Calculates the space (width and height) needed to display text.
142 
143  Depending on the flags set the size will be greater than the default size,
144  or the font size will be adjusted,
145  or the text will be truncated.
146 
147  See setAutosizeFont(), setAutotruncate(), setAutoscale(), setDefaultWidth(), setDefaultHeight().
148  """
149  #self._width = self._defaultWidth
150  #self._height = self._defaultHeight
151 
152  if self._fontSizeHasChanged and (not self._autosizeFontFlag or self._autoscaleFlag):
153  self._font.setPointSize(self.getFontSize())
154  if self._defaultHeight == 0:
155  self.setDefaultHeight(self.getFontHeight())
156  self._fontSizeHasChanged = False
157 
158  if self._autoscaleFlag:
159  self.autoscale()
160 
161  elif self._autosizeFontFlag:
162  self.autosizeFont()
163 
164  if self._autotruncateTextFlag:
165  self.truncate()
166 
def getFontHeight(self, fm=None)
Definition: VispaWidget.py:99
def setDefaultHeight(self, height)
Definition: VispaWidget.py:135
def Vispa.Gui.VispaWidget.TextField.empty (   self)
Returns True if no text or empty string is set.

Definition at line 221 of file VispaWidget.py.

References Vispa.Gui.VispaWidget.TextField._text.

Referenced by Vispa.Gui.VispaWidget.TextField.setAutosizeFont(), and Vispa.Gui.VispaWidget.TextField.setAutotruncate().

221  def empty(self):
222  """ Returns True if no text or empty string is set.
223  """
224  if self._text == '' or self._text == None:
225  return True
226  return False
227 
def Vispa.Gui.VispaWidget.TextField.font (   self)
def Vispa.Gui.VispaWidget.TextField.getDrawRect (   self,
  scale = 1 
)
Returns QRect.

Width will be equal to getWidth() and height equal to getHeight().

Definition at line 122 of file VispaWidget.py.

References Vispa.Gui.VispaWidget.TextField._height, Vispa.Gui.VispaWidget.TextField._width, Vispa.Gui.VispaWidget.TextField._xPos, and Vispa.Gui.VispaWidget.TextField._yPos.

Referenced by Vispa.Gui.VispaWidget.TextField.autosizeFont(), Vispa.Gui.VispaWidget.TextField.paint(), and Vispa.Gui.VispaWidget.TextField.truncate().

122  def getDrawRect(self, scale=1):
123  """ Returns QRect.
124 
125  Width will be equal to getWidth() and height equal to getHeight().
126  """
127  return QRect(self._xPos, self._yPos, math.ceil(self._width * scale), math.ceil(self._height * scale))
128  #return QRectF(self._xPos, self._yPos, self._width, self._height)
129 
def getDrawRect(self, scale=1)
Definition: VispaWidget.py:122
def Vispa.Gui.VispaWidget.TextField.getFontHeight (   self,
  fm = None 
)
Calculates font height for given font metrics object.

If no font metrics object is given one will be created for the current TextField font.

Definition at line 99 of file VispaWidget.py.

References Vispa.Gui.VispaWidget.TextField._font.

Referenced by Vispa.Gui.VispaWidget.TextField.calculateDimensions().

99  def getFontHeight(self, fm=None):
100  """ Calculates font height for given font metrics object.
101 
102  If no font metrics object is given one will be created for the current TextField font.
103  """
104  if fm == None:
105  fm = QFontMetrics(self._font)
106  height = fm.height()
107  return height
108 
def getFontHeight(self, fm=None)
Definition: VispaWidget.py:99
def Vispa.Gui.VispaWidget.TextField.getFontSize (   self)
Returns the font size the text will be drawn in.

Definition at line 195 of file VispaWidget.py.

References Vispa.Gui.VispaWidget.TextField._autoscaleFlag, Vispa.Gui.VispaWidget.TextField._defaultFontSize, and Vispa.Gui.VispaWidget.TextField._fontSize.

Referenced by Vispa.Gui.VispaWidget.TextField.calculateDimensions(), and Vispa.Gui.VispaWidget.TextField.paint().

195  def getFontSize(self):
196  """ Returns the font size the text will be drawn in.
197  """
198  if self._autoscaleFlag:
199  return self._defaultFontSize
200  return self._fontSize
201 
def Vispa.Gui.VispaWidget.TextField.getHeight (   self)
Returns height calculated by calculateDimensions().

Definition at line 172 of file VispaWidget.py.

References Vispa.Gui.VispaWidget.TextField._height.

172  def getHeight(self):
173  """ Returns height calculated by calculateDimensions().
174  """
175  #logging.debug(self.__class__.__name__ + ": getHeight() "+ str(self._height) + " " + self.text())
176  return self._height
177 
def Vispa.Gui.VispaWidget.TextField.getOutputFlags (   self)
Returns set output flags.

Definition at line 183 of file VispaWidget.py.

References Vispa.Gui.VispaWidget.TextField._outputFlags.

Referenced by Vispa.Gui.VispaWidget.TextField.paint().

183  def getOutputFlags(self):
184  """ Returns set output flags.
185  """
186  return self._outputFlags
187 
def Vispa.Gui.VispaWidget.TextField.getOutputText (   self)
Evaluates whether the string was truncated or not.

If truncated it returns short version, else the whole text.

Definition at line 212 of file VispaWidget.py.

References Vispa.Gui.VispaWidget.TextField._text, Vispa.Gui.VispaWidget.TextField._textShort, and Vispa.Gui.VispaWidget.TextField.truncated().

Referenced by Vispa.Gui.VispaWidget.TextField.paint().

212  def getOutputText(self):
213  """ Evaluates whether the string was truncated or not.
214 
215  If truncated it returns short version, else the whole text.
216  """
217  if self.truncated():
218  return self._textShort
219  return self._text
220 
def Vispa.Gui.VispaWidget.TextField.getTextShort (   self)
Returns short version of text if it was truncated.

Definition at line 207 of file VispaWidget.py.

References Vispa.Gui.VispaWidget.TextField._textShort.

207  def getTextShort(self):
208  """ Returns short version of text if it was truncated.
209  """
210  return self._textShort
211 
def Vispa.Gui.VispaWidget.TextField.getWidth (   self)
Returns width calculated by calculateDimensions().

Definition at line 167 of file VispaWidget.py.

References Vispa.Gui.VispaWidget.TextField._width.

167  def getWidth(self):
168  """ Returns width calculated by calculateDimensions().
169  """
170  return self._width
171 
def Vispa.Gui.VispaWidget.TextField.paint (   self,
  painter,
  xPos,
  yPos,
  scale = 1 
)
Draws text on given painter at given position.

If scale is given the text will be scaled accordingly.

Definition at line 317 of file VispaWidget.py.

References Vispa.Gui.VispaWidget.TextField._font, Vispa.Gui.VispaWidget.TextField._penColor, Vispa.Gui.VispaWidget.TextField._xPos, Vispa.Gui.VispaWidget.TextField._yPos, Vispa.Gui.VispaWidget.TextField.getDrawRect(), Vispa.Gui.VispaWidget.TextField.getFontSize(), Vispa.Gui.VispaWidget.TextField.getOutputFlags(), Vispa.Gui.VispaWidget.TextField.getOutputText(), and SiStripPI.max.

Referenced by Vispa.Gui.VispaWidget.VispaWidget.paintEvent().

317  def paint(self, painter, xPos, yPos, scale=1):
318  """ Draws text on given painter at given position.
319 
320  If scale is given the text will be scaled accordingly.
321  """
322  self._xPos = xPos
323  self._yPos = yPos
324  drawRect = self.getDrawRect(scale)
325  painter.setBrush(Qt.NoBrush)
326  painter.setPen(QPen(self._penColor))
327  self._font.setPointSize(max(self.getFontSize() * scale, 1))
328  painter.setFont(self._font)
329  painter.drawText(drawRect, self.getOutputFlags(), self.getOutputText())
330 
331  ## debug
332  #painter.drawRect(drawRect)
333  #print " drawRect ", drawRect
334  #print " text", self.getOutputText()
335  #print "drawRect(width, height) = ", drawRect.width(), ",", drawRect.height(), ")"
336 
337 
def getDrawRect(self, scale=1)
Definition: VispaWidget.py:122
def paint(self, painter, xPos, yPos, scale=1)
Definition: VispaWidget.py:317
def Vispa.Gui.VispaWidget.TextField.penColor (   self)

Definition at line 96 of file VispaWidget.py.

References Vispa.Gui.VispaWidget.TextField._penColor.

96  def penColor(self):
97  return self._penColor
98 
def Vispa.Gui.VispaWidget.TextField.setAutoscale (   self,
  auto,
  keepAspectRatio 
)
Sets autoscale and autoscalKeepAspectRatio flags.

If autoscale flag is True the needed space is increased until text fits.
If keepAspectRatio flag is False the aspet ratio may change depending on output flags.
See setOutputFlags().

Definition at line 73 of file VispaWidget.py.

References Vispa.Gui.VispaWidget.TextField._autoscaleFlag, and Vispa.Gui.VispaWidget.TextField._autoscaleKeepAspectRatioFlag.

73  def setAutoscale(self, auto, keepAspectRatio):
74  """ Sets autoscale and autoscalKeepAspectRatio flags.
75 
76  If autoscale flag is True the needed space is increased until text fits.
77  If keepAspectRatio flag is False the aspet ratio may change depending on output flags.
78  See setOutputFlags().
79  """
80  self._autoscaleFlag = auto
81  self._autoscaleKeepAspectRatioFlag = keepAspectRatio
82 
def setAutoscale(self, auto, keepAspectRatio)
Definition: VispaWidget.py:73
def Vispa.Gui.VispaWidget.TextField.setAutosizeFont (   self,
  auto 
)
Sets autosizeFontFlag.

If flag is True and text does not fit in its given area the font size will be reduced to fit.

Definition at line 55 of file VispaWidget.py.

References Vispa.Gui.VispaWidget.TextField._autosizeFontFlag, electrons_cff.bool, Vispa.Gui.VispaWidget.TextField.calculateDimensions(), RPCDigiL1Link.empty(), AlignmentErrors.empty(), btagbtvdeep::DeepBoostedJetFeatures.empty(), AlignmentErrorsExtended.empty(), Alignments.empty(), omtf::RpcDataWord64.empty(), btagbtvdeep::DeepDoubleXFeatures.empty(), edm::reftobase::RefVectorHolderBase.empty(), OOTPileupCorrectionColl.empty(), L1GctCand.empty(), APVCyclePhaseCollection.empty, edm::reftobase::BaseVectorHolder< T >.empty(), StorableDoubleMap< T >.empty(), edm::reftobase::RefVectorHolder< REFV >.empty(), TRange< T >.empty(), KDTreeLinkerAlgo< DATA >.empty(), edm::EDCollection< T >.empty(), OOTPileupCorrectionBuffer.empty(), FFTJetCorrectorParameters.empty(), pathelpers::Record.empty, edm::reftobase::IndirectVectorHolder< T >.empty(), FQueue< T >.empty(), fwlite::EntryFinder.empty(), HcalItemColl< Item >.empty(), edm::reftobase::VectorHolder< T, REFV >.empty(), reco::formula::ArrayAdaptor.empty(), GenericMVAComputerCache.empty, L1GctEtHad.empty(), L1GctEtTotal.empty(), Book.empty(), AlignmentSurfaceDeformations.empty(), L1MonitorDigi.empty(), edm::ProcessHistory.empty(), L1DataEmulRecord.empty(), HcalIndexLookup.empty(), BeamSpotOnline.empty(), L1GctInternEmCand.empty(), FWInteractionList.empty(), DynArray< T >.empty(), L1MuRegionalCand.empty(), edm::InputFileCatalog.empty(), LumiScalers.empty(), L1GctJetCand.empty(), L1TriggerScalers.empty(), FKDTree< TYPE, numberOfDimensions >.empty(), HcalItemArrayColl< Item, N >.empty(), KDTreeNodes< DATA >.empty(), L1DataEmulDigi.empty(), Selection< C, Selector, StoreContainer >.empty(), Level1TriggerScalers.empty(), edm::math_private::ieee_long_double_shape_type.empty, L1GctEtMiss.empty(), L1GctJetCounts.empty(), L1GctHtMiss.empty(), L1RCTElectronIsolationCard.empty, edm::RefToBaseVector< T >.empty(), l1t::LUT.empty(), L1GctEmCand.empty(), L1TriggerRates.empty(), mayown_ptr< T, N >.empty(), Level1TriggerRates.empty(), L1GctHFRingEtSums.empty(), edm::Association< C >.empty(), L1MuGMTCand.empty(), edm::DetSet< T >.empty(), L1AcceptBunchCrossing.empty(), L1GctHFBitCounts.empty(), L1GctInternHFData.empty(), edm::PtrVectorBase.empty(), DcsStatus.empty(), edm::RefVectorBase< KEY >.empty(), SimpleL1MuGMTCand.empty(), L1CaloEmCand.empty(), edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >.empty(), PhysicsTools::Calibration::Histogram< Value_t, Axis_t >.empty(), L1CaloMipQuietRegion.empty(), L1MuBMTrackSegEta.empty(), edmNew::DetSet< T >.empty(), L1GctInternJetData.empty(), L1MuBMTrack.empty(), edm::helper::IndexRangeAssociation.empty(), CSCSPHeader.empty(), L1RCT.empty, PhysicsTools::Calibration::Histogram2D< Value_t, AxisX_t, AxisY_t >.empty(), edm::RefVector< C, T, F >.empty(), edm::MapOfVectors< K, T >.empty(), L1GctInternEtSum.empty(), L1MuBMTrackSegPhi.empty(), edm::FileIndex.empty(), edm::OwnArray< T, MAX_SIZE, P >.empty(), edm::SortedCollection< T, SORT >.empty(), edm::OwnVector< T, P >.empty(), PhysicsTools::Calibration::Histogram3D< Value_t, AxisX_t, AxisY_t, AxisZ_t >.empty(), SiStripFedCabling::ConnsRange.empty(), edm::View< T >.empty(), edm::DetSetVector< T >.empty(), edm::AssociationMap< Tag >.empty(), edm::ValueMap< T >.empty(), edm::DetSetRefVector< T, C >.empty(), edm::DataFrameContainer.empty(), L1CaloRegion.empty(), edm::MultiAssociation< C >.empty(), LHCInfo.empty(), Vispa.Gui.VispaWidget.TextField.empty(), Json::Value.empty(), edm::IndexIntoFile.empty(), edmNew::DetSetVector< T >::FastFiller.empty(), edmNew::DetSetVector< T >::TSFastFiller.empty(), edmNew::DetSetVector< T >.empty(), and tkal_create_file_lists._DasCache.empty().

55  def setAutosizeFont(self, auto):
56  """ Sets autosizeFontFlag.
57 
58  If flag is True and text does not fit in its given area the font size will be reduced to fit.
59  """
60  self._autosizeFontFlag = bool(auto)
61  if not self.empty():
62  self.calculateDimensions()
63 
def setAutosizeFont(self, auto)
Definition: VispaWidget.py:55
def Vispa.Gui.VispaWidget.TextField.setAutotruncate (   self,
  auto 
)
Sets autoTruncateTextFlag.

If flag is True the text will be truncated if it is too long to fit in given space.

Definition at line 64 of file VispaWidget.py.

References Vispa.Gui.VispaWidget.TextField._autotruncateTextFlag, electrons_cff.bool, Vispa.Gui.VispaWidget.TextField.calculateDimensions(), RPCDigiL1Link.empty(), AlignmentErrors.empty(), btagbtvdeep::DeepBoostedJetFeatures.empty(), AlignmentErrorsExtended.empty(), Alignments.empty(), omtf::RpcDataWord64.empty(), btagbtvdeep::DeepDoubleXFeatures.empty(), edm::reftobase::RefVectorHolderBase.empty(), OOTPileupCorrectionColl.empty(), L1GctCand.empty(), APVCyclePhaseCollection.empty, edm::reftobase::BaseVectorHolder< T >.empty(), StorableDoubleMap< T >.empty(), edm::reftobase::RefVectorHolder< REFV >.empty(), TRange< T >.empty(), KDTreeLinkerAlgo< DATA >.empty(), edm::EDCollection< T >.empty(), OOTPileupCorrectionBuffer.empty(), FFTJetCorrectorParameters.empty(), pathelpers::Record.empty, edm::reftobase::IndirectVectorHolder< T >.empty(), FQueue< T >.empty(), fwlite::EntryFinder.empty(), HcalItemColl< Item >.empty(), edm::reftobase::VectorHolder< T, REFV >.empty(), reco::formula::ArrayAdaptor.empty(), GenericMVAComputerCache.empty, L1GctEtHad.empty(), L1GctEtTotal.empty(), Book.empty(), AlignmentSurfaceDeformations.empty(), L1MonitorDigi.empty(), edm::ProcessHistory.empty(), L1DataEmulRecord.empty(), HcalIndexLookup.empty(), BeamSpotOnline.empty(), L1GctInternEmCand.empty(), FWInteractionList.empty(), DynArray< T >.empty(), L1MuRegionalCand.empty(), edm::InputFileCatalog.empty(), LumiScalers.empty(), L1GctJetCand.empty(), L1TriggerScalers.empty(), FKDTree< TYPE, numberOfDimensions >.empty(), HcalItemArrayColl< Item, N >.empty(), KDTreeNodes< DATA >.empty(), L1DataEmulDigi.empty(), Selection< C, Selector, StoreContainer >.empty(), Level1TriggerScalers.empty(), edm::math_private::ieee_long_double_shape_type.empty, L1GctEtMiss.empty(), L1GctJetCounts.empty(), L1GctHtMiss.empty(), L1RCTElectronIsolationCard.empty, edm::RefToBaseVector< T >.empty(), l1t::LUT.empty(), L1GctEmCand.empty(), L1TriggerRates.empty(), mayown_ptr< T, N >.empty(), Level1TriggerRates.empty(), L1GctHFRingEtSums.empty(), edm::Association< C >.empty(), L1MuGMTCand.empty(), edm::DetSet< T >.empty(), L1AcceptBunchCrossing.empty(), L1GctHFBitCounts.empty(), L1GctInternHFData.empty(), edm::PtrVectorBase.empty(), DcsStatus.empty(), edm::RefVectorBase< KEY >.empty(), SimpleL1MuGMTCand.empty(), L1CaloEmCand.empty(), edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >.empty(), PhysicsTools::Calibration::Histogram< Value_t, Axis_t >.empty(), L1CaloMipQuietRegion.empty(), L1MuBMTrackSegEta.empty(), edmNew::DetSet< T >.empty(), L1GctInternJetData.empty(), L1MuBMTrack.empty(), edm::helper::IndexRangeAssociation.empty(), CSCSPHeader.empty(), L1RCT.empty, PhysicsTools::Calibration::Histogram2D< Value_t, AxisX_t, AxisY_t >.empty(), edm::RefVector< C, T, F >.empty(), edm::MapOfVectors< K, T >.empty(), L1GctInternEtSum.empty(), L1MuBMTrackSegPhi.empty(), edm::FileIndex.empty(), edm::OwnArray< T, MAX_SIZE, P >.empty(), edm::SortedCollection< T, SORT >.empty(), edm::OwnVector< T, P >.empty(), PhysicsTools::Calibration::Histogram3D< Value_t, AxisX_t, AxisY_t, AxisZ_t >.empty(), SiStripFedCabling::ConnsRange.empty(), edm::View< T >.empty(), edm::DetSetVector< T >.empty(), edm::AssociationMap< Tag >.empty(), edm::ValueMap< T >.empty(), edm::DetSetRefVector< T, C >.empty(), edm::DataFrameContainer.empty(), L1CaloRegion.empty(), edm::MultiAssociation< C >.empty(), LHCInfo.empty(), Vispa.Gui.VispaWidget.TextField.empty(), Json::Value.empty(), edm::IndexIntoFile.empty(), edmNew::DetSetVector< T >::FastFiller.empty(), edmNew::DetSetVector< T >::TSFastFiller.empty(), edmNew::DetSetVector< T >.empty(), and tkal_create_file_lists._DasCache.empty().

64  def setAutotruncate(self, auto):
65  """ Sets autoTruncateTextFlag.
66 
67  If flag is True the text will be truncated if it is too long to fit in given space.
68  """
69  self._autotruncateTextFlag = bool(auto)
70  if not self.empty():
71  self.calculateDimensions()
72 
def setAutotruncate(self, auto)
Definition: VispaWidget.py:64
def Vispa.Gui.VispaWidget.TextField.setDefaultFontSize (   self,
  fontSize 
)
Sets preferred font size.

Definition at line 109 of file VispaWidget.py.

109  def setDefaultFontSize(self, fontSize):
110  """ Sets preferred font size.
111  """
112  self._defaultFontSize = fontSize
113 
def setDefaultFontSize(self, fontSize)
Definition: VispaWidget.py:109
def Vispa.Gui.VispaWidget.TextField.setDefaultHeight (   self,
  height 
)
Sets preferred height for text output.

Definition at line 135 of file VispaWidget.py.

References Vispa.Gui.VispaWidget.TextField._defaultHeight.

Referenced by Vispa.Gui.VispaWidget.TextField.calculateDimensions().

135  def setDefaultHeight(self, height):
136  """ Sets preferred height for text output.
137  """
138  self._defaultHeight = height
139 
def setDefaultHeight(self, height)
Definition: VispaWidget.py:135
def Vispa.Gui.VispaWidget.TextField.setDefaultWidth (   self,
  width 
)
Sets preferred width for text output.

Definition at line 130 of file VispaWidget.py.

References Vispa.Gui.VispaWidget.TextField._defaultWidth.

130  def setDefaultWidth(self, width):
131  """ Sets preferred width for text output.
132  """
133  self._defaultWidth = width
134 
def setDefaultWidth(self, width)
Definition: VispaWidget.py:130
def Vispa.Gui.VispaWidget.TextField.setFont (   self,
  qfont 
)
Sets font and if default height is not yet set default height will be set to font height.

Definition at line 83 of file VispaWidget.py.

References Vispa.Gui.VispaWidget.TextField._font, and Vispa.Gui.VispaWidget.TextField._fontSizeHasChanged.

83  def setFont(self, qfont):
84  """ Sets font and if default height is not yet set default height will be set to font height.
85  """
86  #self._font = QFont(qfont)
87  self._font = qfont
88  self._fontSizeHasChanged = True
89 
def Vispa.Gui.VispaWidget.TextField.setFontSizeRange (   self,
  minFontSize,
  maxFontSize 
)
Sets min and max font point size for autosize font capability.

See setAutosizeFont().

Definition at line 114 of file VispaWidget.py.

References Vispa.Gui.VispaWidget.TextField._maxFontSize, and Vispa.Gui.VispaWidget.TextField._minFontSize.

114  def setFontSizeRange(self, minFontSize, maxFontSize):
115  """ Sets min and max font point size for autosize font capability.
116 
117  See setAutosizeFont().
118  """
119  self._minFontSize = minFontSize
120  self._maxFontSize = maxFontSize
121 
def setFontSizeRange(self, minFontSize, maxFontSize)
Definition: VispaWidget.py:114
def Vispa.Gui.VispaWidget.TextField.setOutputFlags (   self,
  flags 
)
Set Qt output flags for drawing text.

Definition at line 178 of file VispaWidget.py.

References Vispa.Gui.VispaWidget.TextField._outputFlags.

178  def setOutputFlags(self, flags):
179  """ Set Qt output flags for drawing text.
180  """
181  self._outputFlags = flags
182 
def setOutputFlags(self, flags)
Definition: VispaWidget.py:178
def Vispa.Gui.VispaWidget.TextField.setPenColor (   self,
  color 
)

Definition at line 93 of file VispaWidget.py.

References Vispa.Gui.VispaWidget.TextField._penColor.

93  def setPenColor(self, color):
94  self._penColor = color
95 
def setPenColor(self, color)
Definition: VispaWidget.py:93
def Vispa.Gui.VispaWidget.TextField.setText (   self,
  text 
)
Sets text.

Definition at line 49 of file VispaWidget.py.

References Vispa.Gui.VispaWidget.TextField._text, and Vispa.Gui.VispaWidget.TextField._textShort.

Referenced by Vispa.Gui.PortWidget.PortWidget.setDescription().

49  def setText(self, text):
50  """ Sets text.
51  """
52  self._text = text
53  self._textShort = ''
54 
def Vispa.Gui.VispaWidget.TextField.text (   self)
Returns text.

Definition at line 202 of file VispaWidget.py.

References Vispa.Gui.VispaWidget.TextField._text.

Referenced by Vispa.Views.TableView.TableWidgetItem.__lt__().

202  def text(self):
203  """ Returns text.
204  """
205  return self._text
206 
def Vispa.Gui.VispaWidget.TextField.truncate (   self)
Truncates text if it does not fit in given space.

Definition at line 292 of file VispaWidget.py.

References Vispa.Gui.VispaWidget.TextField._font, Vispa.Gui.VispaWidget.TextField._outputFlags, Vispa.Gui.VispaWidget.TextField._text, Vispa.Gui.VispaWidget.TextField._textShort, mps_setup.append, and Vispa.Gui.VispaWidget.TextField.getDrawRect().

Referenced by Vispa.Gui.VispaWidget.TextField.calculateDimensions().

292  def truncate(self):
293  """ Truncates text if it does not fit in given space.
294  """
295  #logging.debug(self.__class__.__name__ + ": truncate()")
296  text = QString(self._text)
297  short = QString()
298  drawRect = QRectF(self.getDrawRect())
299  font = self._font
300  fm = QFontMetricsF(font)
301  counter = 0
302  patterns = text.split(QRegExp('\\b'))
303 
304  for pattern in patterns:
305  short.append(pattern)
306  neededRect = fm.boundingRect(drawRect, self._outputFlags, short)
307 
308  if neededRect.width() > drawRect.width() or neededRect.height() > drawRect.height():
309  break
310  counter += len(pattern)
311 
312  if counter < len(text):
313  self._textShort = text.left(counter)
314  self._textShort = text.left(counter).append("...")
315  #print "truncate() - short: ", self._textShort
316 
def getDrawRect(self, scale=1)
Definition: VispaWidget.py:122
def Vispa.Gui.VispaWidget.TextField.truncated (   self)
Returns True if text was truncated.

Definition at line 188 of file VispaWidget.py.

References Vispa.Gui.VispaWidget.TextField._textShort.

Referenced by Vispa.Gui.VispaWidget.TextField.getOutputText().

188  def truncated(self):
189  """ Returns True if text was truncated.
190  """
191  if self._textShort != '':
192  return True
193  return False
194 

Member Data Documentation

Vispa.Gui.VispaWidget.TextField._autoscaleFlag
private
Vispa.Gui.VispaWidget.TextField._autoscaleKeepAspectRatioFlag
private

Definition at line 44 of file VispaWidget.py.

Referenced by Vispa.Gui.VispaWidget.TextField.setAutoscale().

Vispa.Gui.VispaWidget.TextField._autosizeFontFlag
private
Vispa.Gui.VispaWidget.TextField._autotruncateTextFlag
private
Vispa.Gui.VispaWidget.TextField._defaultFontSize
private

Definition at line 112 of file VispaWidget.py.

Referenced by Vispa.Gui.VispaWidget.TextField.getFontSize().

Vispa.Gui.VispaWidget.TextField._defaultHeight
private
Vispa.Gui.VispaWidget.TextField._defaultWidth
private

Definition at line 35 of file VispaWidget.py.

Referenced by Vispa.Gui.VispaWidget.TextField.setDefaultWidth().

Vispa.Gui.VispaWidget.TextField._deletableFalg
private

Definition at line 40 of file VispaWidget.py.

Vispa.Gui.VispaWidget.TextField._font
private
Vispa.Gui.VispaWidget.TextField._fontSize
private
Vispa.Gui.VispaWidget.TextField._fontSizeHasChanged
private
Vispa.Gui.VispaWidget.TextField._height
private
Vispa.Gui.VispaWidget.TextField._maxFontSize
private
Vispa.Gui.VispaWidget.TextField._minFontSize
private
Vispa.Gui.VispaWidget.TextField._outputFlags
private
Vispa.Gui.VispaWidget.TextField._penColor
private
Vispa.Gui.VispaWidget.TextField._text
private
Vispa.Gui.VispaWidget.TextField._textShort
private
Vispa.Gui.VispaWidget.TextField._width
private
Vispa.Gui.VispaWidget.TextField._xPos
private
Vispa.Gui.VispaWidget.TextField._yPos
private
Vispa.Gui.VispaWidget.TextField.ranbefore

Definition at line 233 of file VispaWidget.py.