Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
Api for taskbar. Only for windows 7 or higher (filling up the icon while its progressing).
"""
__copyright__ = "Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License"
try:
import comtypes.client as cc
cc.GetModule('taskbarlib.tlb')
import comtypes.gen.TaskbarLib as tbl
ITaskbarList3 = cc.CreateObject("{56FDF344-FD6D-11d0-958A-006097C9A090}", interface=tbl.ITaskbarList3)
ITaskbarList3.HrInit()
#Stops displaying progress and returns the button to its normal state. Call this method with this flag to dismiss the progress bar when the operation is complete or canceled.
TBPF_NOPROGRESS = 0x00000000
#The progress indicator does not grow in size, but cycles repeatedly along the length of the taskbar button. This indicates activity without specifying what proportion of the progress is complete. Progress is taking place, but there is no prediction as to how long the operation will take.
TBPF_INDETERMINATE = 0x00000001
#The progress indicator grows in size from left to right in proportion to the estimated amount of the operation completed. This is a determinate progress indicator; a prediction is being made as to the duration of the operation.
TBPF_NORMAL = 0x00000002
#The progress indicator turns red to show that an error has occurred in one of the windows that is broadcasting progress. This is a determinate state. If the progress indicator is in the indeterminate state, it switches to a red determinate display of a generic percentage not indicative of actual progress.
TBPF_ERROR = 0x00000004
#The progress indicator turns yellow to show that progress is currently stopped in one of the windows but can be resumed by the user. No error condition exists and nothing is preventing the progress from continuing. This is a determinate state. If the progress indicator is in the indeterminate state, it switches to a yellow determinate display of a generic percentage not indicative of actual progress.
TBPF_PAUSED = 0x00000008
except:
#The taskbar API is only available for Windows7, on lower windows versions, linux or Mac it will cause an exception. Ignore the exception and don't use the API
ITaskbarList3 = None
def install(self):
with ZipFile(self._download_file, 'r') as archive:
for fname in archive.namelist():
name_parts = fname.split('/')
if name_parts[-2] == 'x64' and name_parts[-1].endswith('.dll'):
target_path = str(self._package_work_dir) + r'\\' + name_parts[-1]
with archive.open(fname, 'r') as cmpf, open(target_path, 'wb') as extf:
extf.write(cmpf.read())
self.__dll_file = Path(self._package_work_dir.as_posix() + '/SKCOM.dll')
# special case: if the path object "as_posix" method will return "/",
# but in powershell just can use "\",so using
# "expanduser" method instead of "as_posix" method
if not self._powershell_exec('regsvr32', [self.__dll_file.expanduser()], True):
raise WindowsError('Install Capital API failure!\n' + self.stderr)
comtypes.client.GetModule(self.__dll_file)
self._get_curr_ver()
def __init__(self):
mpSpeech = self._mpSpeech = comtypes.client.CreateObject(MPInterface, interface=IMathSpeech)
mpSpeechSettings = self._mpSpeechSettings = mpSpeech.QueryInterface(IMathSpeechSettings)
mpSpeechSettings.SetSpeechTags("SSML")
self._mpNavigation = mpSpeech.QueryInterface(IMathNavigation)
self._mpBraille = mpSpeech.QueryInterface(IMathBraille)
def init_msdia():
global msdia
try:
dia_obj = comtypes.client.CreateObject(msdia.DiaSource)
except:
os.system('regsvr32 /s msdia\\msdia90.dll')
dia_obj = comtypes.client.CreateObject(msdia.DiaSource)
return dia_obj
# POSSIBILITY OF SUCH DAMAGE.
# ----------------------------------------------------------------------------
# $Id:$
import atexit
import ctypes
import comtypes
from comtypes import client, GUID
from pyglet.gl import *
import pyglet.window.win32.types as wintypes
from pyglet import image
from pyglet.media import Sound, Video, Medium, Listener, MediaException
_qedit = client.GetModule('qedit.dll')
_quartz = client.GetModule('quartz.dll')
_dsound = client.GetModule('dx8vb.dll')
_qedit_c = ctypes.windll.LoadLibrary('qedit.dll')
_dsound_c = ctypes.windll.LoadLibrary('dsound.dll')
CLSID_FilterGraph = '{e436ebb3-524f-11ce-9f53-0020af0ba770}'
CLSID_SampleGrabber = '{c1f400a0-3f08-11d3-9f0b-006008039e37}'
CLSID_NullRenderer = '{c1f400a4-3f08-11d3-9f0b-006008039e37}'
CLSID_DSoundAudioRenderer = '{79376820-07D0-11CF-A24D-0020AFD79767}'
MEDIATYPE_Audio = GUID('{73647561-0000-0010-8000-00AA00389B71}')
MEDIATYPE_Video = GUID('{73646976-0000-0010-8000-00AA00389B71}')
MEDIASUBTYPE_PCM = GUID('{00000001-0000-0010-8000-00AA00389B71}')
MEDIASUBTYPE_RGB24 = GUID('{e436eb7d-524f-11ce-9f53-0020af0ba770}')
MEDIASUBTYPE_RGB32 = GUID('{e436eb7e-524f-11ce-9f53-0020af0ba770}')
return position
if position is None:
position=self.text_characterCount
info=self.fieldInfoTemplate.copy()
info["node"]=domNode
info['parent']=parentID
info['range']=[position,position]
children=[]
if isinstance(domNode,comInterfaces.MSHTML.DispHTMLFrameElement) or nodeName=="IFRAME":
try:
children.append(domNode.contentWindow.document)
except:
pass
elif isinstance(domNode,comInterfaces.MSHTML.DispHTMLDocument):
try:
comtypes.client.ReleaseEvents(domNode,self.domEventsObject,interface=comInterfaces.MSHTML.HTMLDocumentEvents2)
except:
pass
self._comEvents=comtypes.client.GetEvents(domNode,self.domEventsObject,interface=comInterfaces.MSHTML.HTMLDocumentEvents2)
children.append(domNode.body)
else:
child=domNode.firstChild
while child:
children.append(child)
try:
child=child.nextSibling
except:
child=None
info['children']=filter(lambda x: x,[self.getDomNodeID(x) for x in children])
text=""
if nodeName=="#text":
data=domNode.data
def _registerCOMWithFocusJuggle(self):
import wx
import gui
# Translators: A title for a dialog shown while Microsoft PowerPoint initializes
d=wx.Dialog(None,title=_("Waiting for Powerpoint..."))
d.CentreOnScreen()
gui.mainFrame.prePopup()
d.Show()
self.hasTriedPpAppSwitch=True
#Make sure NVDA detects and reports focus on the waiting dialog
api.processPendingEvents()
comtypes.client.PumpEvents(1)
d.Destroy()
gui.mainFrame.postPopup()
"""
#Force comtypes generated COM interfaces in to a local module
import comtypes_gen
comtypes_gen.setAsComtypesGenModule()
import os
import sys
from glob import glob
import comtypes.client
import compileall
COM_INTERFACES = (
("MS HTML", comtypes.client.GetModule, "mshtml.tlb"),
("IAccessible 2", comtypes.client.GetModule, "lib/ia2.tlb"),
("IService Provider library", comtypes.client.GetModule, "lib/servprov.tlb"),
("MS Active Accessibility", comtypes.client.GetModule, "oleacc.dll"),
("SAPI 5", comtypes.client.CreateObject, "Sapi.SPVoice"),
("SAPI 4", comtypes.client.CreateObject, "ActiveVoice.ActiveVoice"),
)
COMPILE_DIRS = ("appModules", "synthDrivers")
def main():
print "COM interfaces:"
for desc, func, interface in COM_INTERFACES:
print "%s:" % desc,
try:
func(interface)
print "done."
except:
print "not found."
print
def Dispatch(obj):
# Wrap an object in a Dispatch instance, exposing methods and properties
# via fully dynamic dispatch
if isinstance(obj, _Dispatch):
return obj
if isinstance(obj, ctypes.POINTER(comtypes.automation.IDispatch)):
try:
tinfo = obj.GetTypeInfo(0)
except (comtypes.COMError, WindowsError):
return _Dispatch(obj)
return comtypes.client.lazybind.Dispatch(obj, tinfo)
return obj