def __getDynmText(self, section): """ Get dynamic text info. """ try: print '--> 解析动态文本设置', section dynmText = DynamicText() dynmText.title = section fontStyle = self.__getFontStyle(section, 'font_style') if fontStyle: dynmText.font = fontStyle.get('font') dynmText.size = fontStyle.get('size') dynmText.color = fontStyle.get('color') dynmText.fromExcel = int(self.get(section, 'from_excel')) - 1 position = self.__getPos(section, 'position') if len(position) == 2: dynmText.position = position else: print '----> 文本位置未设置,使用默认设置' if 'decimal' in self.options(section): dynmText.decimal = int(self.get(section, 'decimal')) return dynmText except ValueError: raise Exception, 'E-014: Excel所属列或位置数值设置错误' except NoOptionError: raise Exception, 'E-002: ' + section + ' 下没有该项属性 from_excel' except Exception, e: raise e
def __getStatText(self, section): """ Get dynamic text info. """ try: print '--> 解析静态文本设置', section statText = DynamicText() statText.title = section statText.text = unicode(self.get(section, 'text_value'), 'utf8') fontStyle = self.__getFontStyle(section, 'font_style') if fontStyle: statText.font = fontStyle.get('font') statText.size = fontStyle.get('size') statText.color = fontStyle.get('color') position = self.__getPos(section, 'position') if len(position) == 2: statText.position = position else: print '----> 文本位置未设置,使用默认设置' return statText except NoOptionError: raise Exception, 'E-002: ' + section + ' 下没有该项属性 text_value' except Exception, e: raise e