Ejemplo n.º 1
0
 def __init__(self):
     CoInitialize()
     devices = AudioUtilities.GetSpeakers()
     interface = devices.Activate(IAudioEndpointVolume._iid_, CLSCTX_ALL,
                                  None)
     self.volume = cast(interface, POINTER(IAudioEndpointVolume))
     self.current_vol = self.volume.GetMasterVolumeLevelScalar()
     CoUninitialize()
Ejemplo n.º 2
0
 def __init__(self, username, password):
     CoInitialize()
     self._pcm_users_dll = client.GetModule(PCM_USERS_DLL_PATH)
     self._pcm_dll = client.GetModule(PCM_DLL_PATH)
     self._pcm_sp_version = get_pcm_10_service_pack(PCM_DLL_PATH)
     self._username = username
     self._password = password
     self._login(self._username, self._password)
Ejemplo n.º 3
0
def get_interface_info(_fd, iface):
    log = logger()
    from xpra.platform.win32.comtypes_util import QuietenLogging
    with QuietenLogging():
        try:
            from comtypes import CoInitialize  #@UnresolvedImport
            CoInitialize()
            from comtypes.client import CreateObject  #@UnresolvedImport
            o = CreateObject("WbemScripting.SWbemLocator")
            s = o.ConnectServer(".", "root\\cimv2")
            query = "SELECT * FROM Win32_NetworkAdapter WHERE GUID='%s'" % iface
            res = s.ExecQuery(query)
            log("ExecQuery(%s) returned %i rows", query, res.Count)
            if res.Count == 1:
                for r in res:
                    props = {}
                    for k, ik, conv in (
                        ("AdapterType", "adapter-type", str),
                        ("Caption", "caption", str),
                        ("Description", "description", str),
                        ("DeviceID", "id", int),
                        ("GUID", "GUID", str),
                        ("Index", "index", int),
                        ("Name", "name", str),
                        ("ProductName", "product-name", str),
                        ("Speed", "speed", int),
                    ):
                        try:
                            v = conv(r.Properties_[k].Value)
                        except Exception as e:
                            log.error(
                                "Error retrieving '%s' from network adapter record:",
                                k)
                            log.error(" %s", e)
                        else:
                            props[ik] = v
                    log("get_interface_info(%s)=%s" % (iface, props))
                    return props
        except Exception as e:
            log("get_interface_info(%s)", iface, exc_info=True)
            from xpra.util import first_time
            if first_time("win32-network-query"):
                log.error("Error: failed to query network interface:")
                log.error(" %s", e)
        return {}
 def run(self):
     
             
         for file_location in self.list_file_name:
             
             CoInitialize()
             
             self.thermo_Library = CreateObject('MSFileReader.XRawfile')
             
             self.thermo_Library.open(file_location) 
             
             self.res = self.thermo_Library.SetCurrentController(0,1)
             
             if self.check_load_sucess():
                 
                 self.get_mass_spectrums(file_location)
                 
             else:
                 
                 self.break_it = True
             
             del self.thermo_Library      
Ejemplo n.º 5
0
 def performOpen(self, options={}):
     """Perform the operation of opening the instrument connection. Initializes a measurement param dictionary
     and calls the generic VISA_Driver open
     Calls an IVI-COM driver. importing of library is delayed"""
     
     CoInitialize()
     self.VNA=CreateObject('AgilentNA.AgilentNA')
     self.log("VNA object created")
     self.VNA.Initialize( "TCPIP::129.16.115.134::5025::SOCKET", False, False, "")
     self.log("VNA Initialized")
     
     self.ch1=self.VNA.Channels["Channel1"]
     self.VNAabort()
     #self.needs_abort=False
     self.measDict=dict(S11=self.ch1.Measurements["Measurement1"],
                        S21=self.ch1.Measurements["Measurement2"],
                        S12=self.ch1.Measurements["Measurement3"],
                        S22=self.ch1.Measurements["Measurement4"])
     #sAll=self.askVNA("CALC:PAR:CAT:EXT?")
     #t=sAll[1:-1].split(",")
     #self.log({t[i]:t[i+1] for i in range(0, len(t), 2)})  
     #
     #self.ch1.TriggerMode=TriggerModeDict['Hold']                       
     #self.prop_dict={}
     self.Averaging=Prop(self.ch1, 'Averaging')
     self.IFBandwidth=Prop(self.ch1, 'IFBandwidth')
     self.Points=Prop(self.ch1, "Points", coercer=int)
     self.AveragingFactor=Prop(self.ch1, "AveragingFactor", coercer=int)
     self.StopFrequency=Prop(self.ch1.StimulusRange, "Stop")
     self.StartFrequency=Prop(self.ch1.StimulusRange, "Start")
     self.Span=Prop(self.ch1.StimulusRange, "Span")
     self.CenterFrequency=Prop(self.ch1.StimulusRange, "Center")
     self.OutputPower=Prop(self.ch1.SourcePower, "Level", 1)
     #self.OutputPower2=Prop(self.ch1.SourcePower, "Level", 2)
     self.prop_dict=get_prop_dict(self)
     for key in self.prop_dict:
         getattr(self, key).value=self.getValue(key)
Ejemplo n.º 6
0
 def __init__(self, ip, port):
     CoInitialize()
     handler = AccessibleRequestHandler
     self.server = TCPServer((ip, port), handler)
     print '.............SERVICE RUNNING...............'
     self.server.serve_forever()