当前位置: 首页>>代码示例>>Python>>正文


Python PutGetXML.get_text_from_xml方法代码示例

本文整理汇总了Python中Modules.Core.Utilities.xml_tools.PutGetXML.get_text_from_xml方法的典型用法代码示例。如果您正苦于以下问题:Python PutGetXML.get_text_from_xml方法的具体用法?Python PutGetXML.get_text_from_xml怎么用?Python PutGetXML.get_text_from_xml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Modules.Core.Utilities.xml_tools.PutGetXML的用法示例。


在下文中一共展示了PutGetXML.get_text_from_xml方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: read_internet_xml

# 需要导入模块: from Modules.Core.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Core.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
 def read_internet_xml(self, p_house_obj, p_house_xml):
     """
     """
     p_house_obj.Internet = InternetData()
     l_sect = p_house_xml.find('Internet')
     try:
         self.m_external_ip = PutGetXML.get_text_from_xml(p_house_xml, 'ExternalIP')
         self.m_external_delay = PutGetXML.get_int_from_xml(l_sect, 'ExternalDelay')
     except AttributeError:
         LOG.error('internet section missing - using defaults.')
         self.m_external_ip = None
         self.m_external_url = None
         self.m_external_delay = 600
     # Design change - one of these two should work
     try:
         self.m_external_url = PutGetXML.get_text_from_xml(l_sect, 'ExternalUrl')
     except:
         self.m_external_url = PutGetXML.get_text_from_xml(l_sect, 'UrlExternalIP')
     p_house_obj.Internet.ExternalIP = self.m_external_ip
     p_house_obj.Internet.ExternalUrl = self.m_external_url
     p_house_obj.Internet.ExternalDelay = self.m_external_delay
     LOG.debug("Got external IP params.  URL:{}, Delay:{}".format(self.m_external_url, self.m_external_delay))
     try:
         l_list = l_sect.iterfind('DynamicDNS')
     except AttributeError:
         l_list = []
     l_count = 0
     for l_entry in l_list:
         l_dyndns = self.extract_dyn_dns(l_entry)
         l_dyndns.Key = l_count  # Renumber
         p_house_obj.Internet.DynDns[l_count] = l_dyndns
         l_count += 1
     LOG.info('Loaded UpdateUrl:{}, Delay:{}'.format(self.m_external_url, self.m_external_delay))
     return p_house_obj.Internet
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:36,代码来源:upnp.py

示例2: _read_one_interface_xml

# 需要导入模块: from Modules.Core.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Core.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
 def _read_one_interface_xml(p_interface_element):
     l_interface_obj = NodeInterfaceData()
     XmlConfigTools.read_base_UUID_object_xml(l_interface_obj, p_interface_element)
     l_interface_obj.MacAddress = PutGetXML.get_text_from_xml(p_interface_element, 'MacAddress')
     l_interface_obj.V4Address = PutGetXML.get_text_from_xml(p_interface_element, 'IPv4Address')
     l_interface_obj.V6Address = PutGetXML.get_text_from_xml(p_interface_element, 'IPv6Address')
     l_interface_obj.NodeInterfaceType = PutGetXML.get_text_from_xml(p_interface_element, 'InterfaceType')
     return l_interface_obj
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:10,代码来源:nodes_xml.py

示例3: _read_controller_data

# 需要导入模块: from Modules.Core.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Core.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
 def _read_controller_data(_p_pyhouse_obj, p_obj, p_xml):
     """
     There are extra fields for controllers - get them.
     See ControllerData()
     """
     p_obj.InterfaceType = PutGetXML.get_text_from_xml(p_xml, 'InterfaceType')
     p_obj.Port = PutGetXML.get_text_from_xml(p_xml, 'Port')
     return p_obj  # for testing
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:10,代码来源:lighting_controllers.py

示例4: _read_thermostat_data

# 需要导入模块: from Modules.Core.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Core.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
 def _read_thermostat_data(_p_pyhouse_obj, p_obj, p_xml):
     """
     @return: a ThermostatData object.
     """
     p_obj.CoolSetPoint = PutGetXML.get_float_from_xml(p_xml, 'CoolSetPoint', p_default=76.0)
     p_obj.HeatSetPoint = PutGetXML.get_float_from_xml(p_xml, 'HeatSetPoint', 68.0)
     p_obj.ThermostatMode = PutGetXML.get_text_from_xml(p_xml, 'ThermostatMode', 'Cool')
     p_obj.ThermostatScale = PutGetXML.get_text_from_xml(p_xml, 'ThermostatScale', 'F')
     #
     p_obj.CurrentTemperature = PutGetXML.get_float_from_xml(p_xml, 'CurrentTemperature')
     return p_obj
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:13,代码来源:hvac_xml.py

示例5: _read_one_login

# 需要导入模块: from Modules.Core.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Core.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
 def _read_one_login(p_xml):
     """
     @param p_xml: is the element of one login
     """
     l_obj = LoginData()
     XmlConfigTools.read_base_UUID_object_xml(l_obj, p_xml)
     l_obj.LoginFullName = PutGetXML.get_text_from_xml(p_xml, 'FullName')
     l_obj.LoginPasswordCurrent = PutGetXML.get_text_from_xml(p_xml, 'Password')
     l_obj.LoginRole = PutGetXML.get_text_from_xml(p_xml, 'Role')
     LOG.info('Loaded login "{}"'.format(l_obj.LoginFullName))
     return l_obj
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:13,代码来源:web_xml.py

示例6: _read_one_lighting_schedule

# 需要导入模块: from Modules.Core.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Core.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
 def _read_one_lighting_schedule(p_schedule_element):
     """Extract schedule information from a schedule xml element.
     """
     l_obj = ScheduleLightData()
     l_obj.Level = PutGetXML.get_int_from_xml(p_schedule_element, 'Level')
     l_obj.LightName = PutGetXML.get_text_from_xml(p_schedule_element, 'LightName')
     l_obj.LightUUID = PutGetXML.get_uuid_from_xml(p_schedule_element, 'LightUUID')
     l_obj.Rate = PutGetXML.get_int_from_xml(p_schedule_element, 'Rate')
     l_obj.RoomName = PutGetXML.get_text_from_xml(p_schedule_element, 'RoomName')
     l_obj.RoomUUID = PutGetXML.get_uuid_from_xml(p_schedule_element, 'RoomUUID')
     return l_obj
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:13,代码来源:schedule_xml.py

示例7: _read_device

# 需要导入模块: from Modules.Core.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Core.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
 def _read_device(p_xml):
     l_device = SamsungDeviceData()
     XmlConfigTools.read_base_UUID_object_xml(l_device, p_xml)
     l_device.Installed = PutGetXML.get_text_from_xml(p_xml, 'Installed')
     l_device.IPv4 = PutGetXML.get_ip_from_xml(p_xml, 'IPv4')
     # l_device.Model = PutGetXML.get_text_from_xml(p_xml, 'Model')
     l_device.Port = PutGetXML.get_int_from_xml(p_xml, 'Port', 55000)
     l_device.RoomName = PutGetXML.get_text_from_xml(p_xml, 'RoomName')
     l_device.RoomUUID = PutGetXML.get_uuid_from_xml(p_xml, 'RoomUUID')
     l_device.Type = PutGetXML.get_text_from_xml(p_xml, 'Type')
     l_device.Volume = PutGetXML.get_int_from_xml(p_xml, 'Volume')
     return l_device
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:14,代码来源:samsung.py

示例8: read_one_room

# 需要导入模块: from Modules.Core.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Core.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
 def read_one_room(p_room_element):
     l_room_obj = RoomData()
     try:
         XmlConfigTools.read_base_UUID_object_xml(l_room_obj, p_room_element)
         l_room_obj.Comment = PutGetXML.get_text_from_xml(p_room_element, 'Comment')
         l_room_obj.Corner = PutGetXML.get_coords_from_xml(p_room_element, 'Corner')
         l_room_obj.Floor = PutGetXML.get_text_from_xml(p_room_element, 'Floor', '1')
         l_room_obj.LastUpdate = PutGetXML.get_date_time_from_xml(p_room_element, 'LastUpdate')
         l_room_obj.Size = PutGetXML.get_coords_from_xml(p_room_element, 'Size')
         l_room_obj.RoomType = PutGetXML.get_text_from_xml(p_room_element, 'RoomType')
     except:
         LOG.warn('Incomplete data for room {}'.format(l_room_obj.Name))
     return l_room_obj
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:15,代码来源:rooms.py

示例9: _read_light_data

# 需要导入模块: from Modules.Core.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Core.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
 def _read_light_data(_p_pyhouse_obj, p_obj, p_xml):
     p_obj.Comment = PutGetXML.get_text_from_xml(p_xml, 'Comment')
     if (p_xml.find('Brightness') != None):
         p_obj.BrightnessPct = PutGetXML.get_int_from_xml(p_xml, 'Brightness', 44)
     else:
         p_obj.BrightnessPct = PutGetXML.get_int_from_xml(p_xml, 'CurLevel', 45)
     p_obj.IsDimmable = PutGetXML.get_bool_from_xml(p_xml, 'IsDimmable', False)
     p_obj.DeviceType = PutGetXML.get_int_from_xml(p_xml, 'DeviceType', 41)
     p_obj.DeviceSubType = PutGetXML.get_int_from_xml(p_xml, 'DeviceSubType', 43)
     p_obj.RoomName = PutGetXML.get_text_from_xml(p_xml, 'RoomName')
     p_obj.RoomUUID = PutGetXML.get_uuid_from_xml(p_xml, 'RoomUUID')
     p_obj.RoomCoords = PutGetXML.get_coords_from_xml(p_xml, 'RoomCoords')
     return p_obj  # for testing
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:15,代码来源:lighting_lights.py

示例10: _read_device

# 需要导入模块: from Modules.Core.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Core.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
    def _read_device(p_xml):
        """ Read an entire <Device> section of XML and fill in the OnkyoDeviceData Object

        @return: a completed OnkyoDeviceData object
        """
        l_device = OnkyoDeviceData()
        XmlConfigTools.read_base_UUID_object_xml(l_device, p_xml)
        l_device.IPv4 = PutGetXML.get_ip_from_xml(p_xml, 'IPv4')
        l_device.Port = PutGetXML.get_int_from_xml(p_xml, 'Port')
        l_device.RoomName = PutGetXML.get_text_from_xml(p_xml, 'RoomName')
        l_device.RoomUUID = PutGetXML.get_uuid_from_xml(p_xml, 'RoomUUID')
        l_device.Type = PutGetXML.get_text_from_xml(p_xml, 'Type')
        l_device.Volume = PutGetXML.get_int_from_xml(p_xml, 'Volume')
        return l_device
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:16,代码来源:onkyo.py

示例11: _read_one_base_schedule

# 需要导入模块: from Modules.Core.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Core.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
    def _read_one_base_schedule(p_schedule_element):
        """Extract schedule information from a Base schedule xml element.

        ScheduleBaseData()
        """
        l_obj = ScheduleBaseData()
        XmlConfigTools.read_base_UUID_object_xml(l_obj, p_schedule_element)
        l_obj.DOW = PutGetXML.get_int_from_xml(p_schedule_element, 'DayOfWeek', '127')
        l_obj.ScheduleMode = PutGetXML.get_text_from_xml(p_schedule_element, 'ScheduleMode', 'Default Mode')
        l_obj.ScheduleType = PutGetXML.get_text_from_xml(p_schedule_element, 'ScheduleType')
        l_obj.Time = PutGetXML.get_text_from_xml(p_schedule_element, 'Time')
        # if l_obj.ScheduleType == 'LightingDevice':
        #    l_obj.ScheduleType = 'Lighting'
        return l_obj
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:16,代码来源:schedule_xml.py

示例12: read_onkyo_section_xml

# 需要导入模块: from Modules.Core.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Core.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
 def read_onkyo_section_xml(p_pyhouse_obj):
     """ Get the entire OnkyoDeviceData object from the xml.
     """
     # Clear out the data sections
     l_xml = XmlConfigTools.find_section(p_pyhouse_obj, 'HouseDivision/EntertainmentSection/OnkyoSection')
     l_entry_obj = p_pyhouse_obj.House.Entertainment.Plugins[SECTION]
     l_entry_obj.Name = SECTION
     l_device_obj = OnkyoDeviceData()
     l_count = 0
     if l_xml is None:
         l_entry_obj.Name = 'Did not find xml section '
         return l_entry_obj
     try:
         l_entry_obj.Type = PutGetXML.get_text_from_xml(l_xml, 'Type')
         for l_device_xml in l_xml.iterfind('Device'):
             l_device_obj = XML._read_device(l_device_xml)
             l_device_obj.Key = l_count
             l_entry_obj.Devices[l_count] = l_device_obj
             l_entry_obj.Count += 1
             LOG.info('Loaded Onkyo Device {}'.format(l_entry_obj.Name))
             l_count += 1
     except AttributeError as e_err:
         LOG.error('ERROR if getting Onkyo Device Data - {}'.format(e_err))
     if l_count > 0:
         l_entry_obj.Active = True
     LOG.info('Loaded {} Onkyo Devices.'.format(l_count))
     return l_entry_obj
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:29,代码来源:onkyo.py

示例13: read_pandora_section_xml

# 需要导入模块: from Modules.Core.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Core.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
    def read_pandora_section_xml(p_pyhouse_obj):
        """
        This has to:
            Fill in an entry in Entertainment Plugins

        @param p_pyhouse_obj: containing an XML Element for the <PandoraSection>
        @return: a EntertainmentPluginData object filled in.
        """
        l_plugin_obj = p_pyhouse_obj.House.Entertainment.Plugins[SECTION]
        l_plugin_obj.Name = SECTION
        l_xml = XmlConfigTools.find_section(p_pyhouse_obj, 'HouseDivision/EntertainmentSection/PandoraSection')
        if l_xml is None:
            return l_plugin_obj
        l_count = 0
        try:
            l_plugin_obj.Active = PutGetXML.get_bool_from_xml(l_xml, 'Active')
            l_plugin_obj.Type = PutGetXML.get_text_from_xml(l_xml, 'Type')
            for l_device_xml in l_xml.iterfind('Device'):
                l_device_obj = XML._read_device(l_device_xml)
                l_device_obj.Key = l_count
                l_plugin_obj.Devices[l_count] = l_device_obj
                LOG.info('Loaded {} Device {}'.format(SECTION, l_plugin_obj.Name))
                l_count += 1
                l_plugin_obj.Count = l_count
        except AttributeError as e_err:
            LOG.error('ERROR if getting {} Device Data - {}'.format(SECTION, e_err))
        p_pyhouse_obj.House.Entertainment.Plugins[SECTION] = l_plugin_obj
        LOG.info('Loaded {} {} Devices.'.format(l_count, SECTION))
        return l_plugin_obj
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:31,代码来源:pandora.py

示例14: _read_device

# 需要导入模块: from Modules.Core.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Core.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
 def _read_device(p_entry_xml):
     """
     @param p_entry_xml: Element <Device> within <PandoraSection>
     @return: a PandoraDeviceData object
     """
     l_obj = PandoraDeviceData()
     XmlConfigTools.read_base_object_xml(l_obj, p_entry_xml)
     l_obj.Host = PutGetXML.get_ip_from_xml(p_entry_xml, 'Host')
     l_obj.ConnectionFamily = PutGetXML.get_text_from_xml(p_entry_xml, 'ConnectionFamily')
     l_obj.ConnectionName = PutGetXML.get_text_from_xml(p_entry_xml, 'ConnectionName').lower()
     l_obj.InputName = PutGetXML.get_text_from_xml(p_entry_xml, 'InputName')
     l_obj.InputCode = PutGetXML.get_text_from_xml(p_entry_xml, 'InputCode')
     l_obj.MaxPlayTime = PutGetXML.get_int_from_xml(p_entry_xml, 'MaxPlayTime')
     l_obj.Type = PutGetXML.get_text_from_xml(p_entry_xml, 'Type')
     l_obj.Volume = PutGetXML.get_int_from_xml(p_entry_xml, 'Volume')
     return l_obj
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:18,代码来源:pandora.py

示例15: read_base_device_object_xml

# 需要导入模块: from Modules.Core.Utilities.xml_tools import PutGetXML [as 别名]
# 或者: from Modules.Core.Utilities.xml_tools.PutGetXML import get_text_from_xml [as 别名]
 def read_base_device_object_xml(p_pyhouse_obj, p_obj, p_xml):
     """
     Get the BaseUUIDObject entries from the XML element.
     @param p_obj: is the object we wish to populate with data
     @param p_xml: is the element we will extract data from (including children).
     """
     XmlConfigTools.read_base_UUID_object_xml(p_obj, p_xml)
     try:
         p_obj.Comment = PutGetXML.get_text_from_xml(p_xml, 'Comment')
         p_obj.DeviceFamily = PutGetXML.get_text_from_xml(p_xml, 'DeviceFamily')
         p_obj.DeviceType = PutGetXML.get_int_from_xml(p_xml, 'DeviceType')
         p_obj.DeviceSubType = PutGetXML.get_int_from_xml(p_xml, 'DeviceSubType')
         utils.read_room_reference_xml(p_obj, p_xml)
     except Exception as e_err:
         LOG.error('ERROR in xml_tools.read_base_obj_xml() - {}'.format(e_err))
     return p_obj
开发者ID:DBrianKimmel,项目名称:PyHouse,代码行数:18,代码来源:device_tools.py


注:本文中的Modules.Core.Utilities.xml_tools.PutGetXML.get_text_from_xml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。