Exemplo n.º 1
0
	def _get_isBold(self):
		info=displayModel.DisplayModelTextInfo(self,position=textInfos.POSITION_FIRST)
		info.expand(textInfos.UNIT_CHARACTER)
		fields=info.getTextWithFields()
		try:
			return fields[0].field['bold']
		except:
			return False
Exemplo n.º 2
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, textInfos.Rect(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:
         try:
             dataObj = pythoncom._univgw.interface(
                 hash(dataObj), pythoncom.IID_IDataObject)
             format = (win32clipboard.CF_UNICODETEXT, None,
                       pythoncom.DVASPECT_CONTENT, -1,
                       pythoncom.TYMED_HGLOBAL)
             medium = dataObj.GetData(format)
             buf = ctypes.create_string_buffer(medium.data)
             buf = ctypes.cast(buf, ctypes.c_wchar_p)
             label = buf.value
         except:
             pass
     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
Exemplo n.º 3
0
	def _get_isUnread(self):
		info=displayModel.DisplayModelTextInfo(self,textInfos.POSITION_FIRST)
		info.expand(textInfos.UNIT_CHARACTER)
		fields=info.getTextWithFields()
		try:
			isUnread=fields[0].field['bold']
		except:
			isUnread=False
		return isUnread
Exemplo n.º 4
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.º 5
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, textInfos.Rect(left, top, left + width,
                                  top + height)).text
         if content:
             return content
     return super(TweetListItem, self)._getColumnContentRaw(index)
Exemplo n.º 6
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
Exemplo n.º 7
0
	def _get_displayText(self):
		"""The text at this object's location according to the display model for this object's window."""
		import displayModel
		import textInfos
		return displayModel.DisplayModelTextInfo(self,textInfos.POSITION_ALL).text