Exemplo n.º 1
0
	def _getColumnContent(self, column):
		superContent = super(TorrentContentsListItem, self)._getColumnContent(column)
		if superContent or column != 1:
			return superContent
		# We need to use the display model to retrieve the Name column.
		try:
			left, top, width, height = self._getColumnLocation(column)
			return displayModel.DisplayModelTextInfo(self, locationHelper.RectLTRB(
				left, top, left + width, top + height)).text
		except:
			log.debugWarning("Error retrieving name using display model", exc_info=True)
			return superContent
Exemplo n.º 2
0
 def _getColumnContentRaw(self, index):
     if controlTypes.STATE_INVISIBLE not in self.states and index == 3:
         # This is the date column.
         # Its content is overridden on screen,
         # so use display model.
         left, top, width, height = self._getColumnLocationRaw(index)
         content = displayModel.DisplayModelTextInfo(
             self,
             locationHelper.RectLTRB(left, top, left + width,
                                     top + height)).text
         if content:
             return content
     return super(TweetListItem, self)._getColumnContentRaw(index)
Exemplo n.º 3
0
 def _getEmbeddedObjectLabel(self, embedRangeObj):
     label = None
     try:
         o = embedRangeObj.GetEmbeddedObject()
     except comtypes.COMError:
         o = None
     if not o:
         return None
     # Outlook >=2007 exposes MSAA on its embedded objects thus we can use accName as the label
     import oleacc
     try:
         label = o.QueryInterface(oleacc.IAccessible).accName(0)
     except comtypes.COMError:
         pass
     if label:
         return label
     # Outlook 2003 and Outlook Express write the embedded object text to the display with GDI thus we can use display model
     left, top = embedRangeObj.GetPoint(comInterfaces.tom.tomStart)
     right, bottom = embedRangeObj.GetPoint(comInterfaces.tom.tomEnd
                                            | TA_BOTTOM)
     # Outlook Express bug: when expanding to the first embedded object on lines after the first, the range's start coordinates are the start coordinates of the previous character (on the line above)
     # Therefore if we detect this, collapse the range and try getting left and top again
     if left >= right:
         r = embedRangeObj.duplicate
         r.collapse(1)
         left, top = r.GetPoint(comInterfaces.tom.tomStart)
     import displayModel
     label = displayModel.DisplayModelTextInfo(
         self.obj, locationHelper.RectLTRB(left, top, right, bottom)).text
     if label and not label.isspace():
         return label
     # Windows Live Mail exposes the label via the embedded object's data (IDataObject)
     try:
         dataObj = o.QueryInterface(oleTypes.IDataObject)
     except comtypes.COMError:
         dataObj = None
     if dataObj:
         text = comtypes.BSTR()
         res = NVDAHelper.localLib.getOleClipboardText(
             dataObj, ctypes.byref(text))
         label = text.value
     if label:
         return label
     # As a final fallback (e.g. could not get display  model text for Outlook Express), use the embedded object's user type (e.g. "recipient").
     try:
         oleObj = o.QueryInterface(oleTypes.IOleObject)
         label = oleObj.GetUserType(1)
     except comtypes.COMError:
         pass
     return label