예제 #1
0
import xlwt
import Codes.Tools.writeLog as writeLog
import Codes.Script.getRootPath as getRootPath
import Codes.Script.getRelPath as getRelPath
import Codes.Script.globalTime as globalTime

rootpath = getRootPath.getRootPath().getPath()
relpath = getRelPath.getRelPath('Results').getPath() + getRelPath.getRelPath(
    'Result').getPath()


class writeExcel:
    reportname = ''
    workbook = ''
    logger = ''
    time = ''

    def __init__(self):
        self.workbook = xlwt.Workbook()
        self.time = globalTime.getGlobalTime()
        self.reportname = rootpath + relpath + self.time + '.xls'
        self.logger = writeLog.writeLogger(loglevel=4, logger="writeExcel")

    def initsheet(self, sheetname, rowhead):
        self.worksheet = self.workbook.add_sheet(sheetname)
        for i in range(0, len(rowhead)):
            self.worksheet.write(0, i, rowhead[i])

    @staticmethod
    def set_font_style(name='Arial', color=0, height=200):
        style = xlwt.XFStyle()
예제 #2
0
import threading
import Codes.Tools.writeLog as writeLog
import Codes.Script.getRootPath as getRootPath
import Codes.Script.getRelPath as getRelPath
import Codes.Tools.mainClass as mainClass
import Codes.Tools.writeTxt as writeTxt
import Codes.Script.sendMail as sendMail
import Codes.Script.globalTime as globalTime
import Codes.Tools.getTime as getTime

globalTime.setGlobalTime(getTime.getTime().getToHour())
rootpath = getRootPath.getRootPath().getPath()
logger = writeLog.writeLogger(loglevel=4, logger="singleThread")
relpath = getRelPath.getRelPath('Codes').getPath() + getRelPath.getRelPath(
    'Config').getPath()
mailconf = rootpath + relpath + 'mailInfo.conf'
threadLock = threading.Lock()


class singleThread(threading.Thread):
    threadID = ''
    name = ''
    logger = ''

    def __init__(self, threadID, name):
        threading.Thread.__init__(self)
        self.threadID = threadID
        self.name = name

    def run(self):
        logger.info("开启线程: " + self.name)