python通用编码_Pyqt和通用python,这可以被认为是编码的正确方法吗?

classStartReport(QRunnable):def__init__(self,file_path):super(StartReport,self).__init__()# open the db connection in threaddb.open()self.signals=GeneralSignals()# self.simple_signal = SimpleSignal()# print self.signals.resultself.file_path=file_pathself.task="Starting Report"self.progress=1self.org_name=org_nameself.user=userself.report_title="Validation Report"print"instantiation of start report "defrun(self):self.signals.result.emit(self.task,self.progress)ifself.file_pathisNone:print"I started and found file none "returnelse:globalreport_file# create the file and prints the headerreport_file=open(self.file_path,'wb')report_file.write(str(self.report_title)+' for {0} \n'.format(self.org_name))report_file.write('Created on : {0} at {1} By : {2} \n'.format(datetime.today().strftime("%d/%m/%Y"),datetime.now().strftime("%H:%M"),str(self.user)))report_file.write("------------------------------------------------------------------------------------------ \n \n \n \n")report_file.flush()os.fsync(report_file.fileno())classEndReport(QRunnable):def__init__(self):super(EndReport,self).__init__()self.signals=GeneralSignals()self.task="Finishing report"self.progress=100defrun(self):self.signals.result.emit(self.task,self.progress)ifreport_fileisnotNone:# write footer and close filereport_file.write("\n \n \n")report_file.write("---------- End of Report -----------")report_file.flush()os.fsync(report_file.fileno())report_file.close()self.signals.finished.emit()# TODO: checking whether opening a db connection in thread might affect the db on the GUI# if db.isOpen():# db.close()else:returnclassDupStreetDesc(QRunnable):"""duplicate street description report section creation:return: void if the report is to textlist[string] if the report is to screen"""def__init__(self):super(DupStreetDesc,self).__init__()self.signals=GeneralSignals()self.task="Checking duplicate street descriptions..."self.progress=16.6defrun(self):self.signals.result.emit(self.task,self.progress)ifreport_fileisNone:print"report file is none "# items_list = write_content(0, 0, 0, 0)# for item in items_list:# self.signals.list.emit(item)else:write_content(0,0,0,0)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值