def _parse(self, reader): settings = XmlReaderSettings(ProhibitDtd=False) reader = XmlReader.Create(reader, settings) self._reader = reader while reader.Read(): nodetype = reader.NodeType typename = Enum.GetName(XmlNodeType, nodetype) handler = getattr(self, '_handle_' + typename, None) if handler is not None: handler()
comp.HDDEnabled = False comp.Open() for hw in comp.Hardware: print(hw.Identifier, hardware) if str(hw.Identifier) in hardware: __hw.append(hw) hw.Update() for sensor in hw.Sensors: if str(sensor.Identifier) in sensors: __sensors.append(sensor) while True: try: for hw in __hw: hw.Update() for sensor in __sensors: typeName = Enum.GetName(SensorType, sensor.SensorType) print("name: %s - sensor: %s - type: %s - value: %s" % (sensor.Name, sensor.Identifier, typeName, sensor.Value)) print('---') time.sleep(1) except KeyboardInterrupt: break comp.Close()
def get_type_name(type): typeName = Enum.GetName(SensorType, type) return typeName
def _window_state_to_str(state): return Enum.GetName(DisplayState, state)