Пример #1
0
def _printTplMsg(tplFileName):
    """
	打印模板信息
	"""
    Printer.printNewline()
    Printer.printBlockHead(
        None, [Printer.dtext("theme", "tipsTplFile", file=tplFileName)])
Пример #2
0
def onAppExit(exitCode):
    """
	程序退出时调用
	"""
    if exitCode == 0:
        Printer.dout("theme", "tipsExportSuccess")
    else:
        Printer.printNewline()
        Printer.dout("theme", "tipsExportFail")
Пример #3
0
def onBeginWriteConfigItem(writeTracer):
    """
	写入配置选项
	"""
    Printer.printNewline()
    name = writeTracer.owner.outItemInfo.name
    Printer.dout("export", "tipsWriteOut", name=name)
    if CustomConfig().query("custom/showProgress", bool):
        global _cappedPrint
        _cappedPrint = Printer.capPrinter(False)
Пример #4
0
def onEndScanDataSource(dsrcTracer):
    """
	结束一个数据源的扫描
	"""
    if CustomConfig().query("custom/showProgress", bool):
        Printer.uncapPrinter()
        global _cappedPrint
        _cappedPrint = None

    # 打印空行(键)
    if len(dsrcTracer.emptyRows):
        Printer.printNewline()
        Printer.dout("export", "warnEmptyRows", rows=dsrcTracer.emptyRows)
Пример #5
0
def onBeginScanDataSource(dsrcTracer):
    """
	开始扫描数据源
	"""
    global _firstScanData
    if _firstScanData:
        _firstScanData = False
    else:
        Printer.printNewline()

    srcText = dsrcTracer.dsrc.getSrcText()
    Printer.dout("export", "tipsScanSrcData", path=srcText)
    if CustomConfig().query("custom/showProgress", bool):
        global _cappedPrint
        _cappedPrint = Printer.capPrinter(False)
Пример #6
0
def onBeginExportConfig(exportTracer):
    """
	开始导出一个模板中的其中一个配置
	"""
    # 数据源信息
    outInfo = exportTracer.outInfo
    srcMsgs = [Printer.dtext("export", "tipsSrcData")]
    for outItemInfo in outInfo.outItemInfos:
        for text in outItemInfo.dsrcTextList:
            text = "  " + text
            if text not in srcMsgs:
                srcMsgs.append(text)
    # 导出配置信息
    dstMsgs = [Printer.dtext("export", "tipsDstFile", file=outInfo.dstFile)]

    Printer.printNewline()
    Printer.printBlockHead(Printer.dtext("export", "tipsExporedInfo"),
                           srcMsgs + dstMsgs)
Пример #7
0
def onEndExportConfigItem(exportItemTracer):
    """
	结束一个配置的导出
	"""
    # 打印重复键
    if len(exportItemTracer.dbKeys):
        Printer.printNewline()
        s = ""
        for key, count in exportItemTracer.dbKeys.iteritems():
            s += "[%s(%i)] " % (key, count)
        Printer.dout("export", "warnDBKey", keys=s)

    # 打印记录数
    Printer.printNewline()
    Printer.dout("export",
                 "tipsRowCount",
                 count=exportItemTracer.outItemInfo.rowCount)  # 记录总数
    Printer.dout("export",
                 "tipsEmptyRowCount",
                 count=exportItemTracer.emptyCount)  # 空行数(包括空键)
    Printer.dout("export",
                 "tipsDBRowCount",
                 count=len(exportItemTracer.dbKeys))  # 重复键的行数
    Printer.dout("export", "tipsIgnorCount",
                 count=exportItemTracer.ignorCount)  # 忽略的行数
    Printer.dout("export", "tipsValidCount",
                 count=len(exportItemTracer.datas))  # 有效行数

    # 打印导出时间
    writeTracer = exportItemTracer.writeTracer
    Printer.dout("theme",
                 "tipsReadTableWaste",
                 v=exportItemTracer.loadDSrcsTime)  # 加载数据耗时
    Printer.dout("theme", "tipsExplainWaste",
                 v=exportItemTracer.scanDSrcsTime)  # 扫描数据耗时
    Printer.dout("theme", "tipsWriteOutWaste",
                 v=exportItemTracer.writeTime)  # 写入配置耗时
    Printer.dout("theme", "tipsTotalWaste",
                 v=exportItemTracer.wasteTime)  # 总耗时
    Printer.printNewline()