1 Star 0 Fork 1

cnxd365 / PyMICAPS

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Title.py 1.31 KB
一键复制 编辑 原始数据 按行查看 历史
非对称 提交于 2017-04-13 10:30 . Ver 2.0 to master (#5)
# -*- coding: utf-8 -*-
#
# Author: Liu xianyao
# Email: flashlxy@qq.com
# Update: 2017-04-06
# Copyright: ©江西省气象台 2017
# Version: 1.1.20170406
from __future__ import print_function
from __future__ import print_function
from HeadDesc import HeadDesc
from Main import parseInt
from Projection import Projection
class Title:
def __init__(self, root):
p = root.find("Title")
# 是否按Micaps数据的标题写产品描述
self.mtitleposition = Projection.leaf_to_list(p, "MTitlePosition", None)
# 产品图片文字描述(可能多个)
descs = p.find("Descs").getchildren()
self.descs = []
for desc in descs:
txt = Projection.leaf_to_string(desc, 'Text', u'测试数据')
pos = Projection.leaf_to_list(desc, "Position", [113.2, 30.5])
fonts = desc.find("Font").text.strip().split(',')
font = {'family': 'monospace', 'weight': 'bold', 'fontsize': 12, 'color': 'k'}
if len(fonts) == 4:
font['fontsize'] = parseInt(fonts[0].strip())
font['family'] = fonts[1]
font['weight'] = fonts[2]
font['color'] = fonts[3]
self.descs.append(HeadDesc(txt, pos, font))
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/cnxd365/PyMICAPS.git
git@gitee.com:cnxd365/PyMICAPS.git
cnxd365
PyMICAPS
PyMICAPS
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891