• py QScrollArea


    # -*- coding: utf-8 -*-
    import json
    import logging
    import sys

    import requests
    from PyQt5 import QtWidgets
    from ReqSendXXX import *

    '''===== [logg] .xu =============================================='''
    # -*- coding: utf-8 -*-
    import logging
    import sys
    import os
    from myUtil import Properties


    print('########[agreementSign]################ * start')

    properties = Properties("./myglobal.properties").getProperties()

    # 获取logger实例,如果参数为空则返回root logger
    log = logging.getLogger("AppName")
    # 指定logger输出格式
    formatter = logging.Formatter('%(asctime)s %(levelname)-8s: %(message)s')
    # 文件日志
    file_handler = logging.FileHandler(os.path.basename(__file__)+".log")
    file_handler.setFormatter(formatter) # 可以通过setFormatter指定输出格式
    # 控制台日志
    console_handler = logging.StreamHandler(sys.stdout)
    console_handler.formatter = formatter # 也可以直接给formatter赋值
    # 为logger添加的日志处理器
    log.addHandler(file_handler)
    log.addHandler(console_handler)
    # 指定日志的最低输出级别,默认为WARN级别
    log.setLevel(logging.DEBUG)


    class MyClass:
    # 初始化
    def __init__(self):
    print("=====>def: " , "def")


    myClass = MyClass()


    # def data1():
    # with open('./Tes1FormRun.json', encoding='utf-8') as json_file:
    # data = json.load(json_file)
    # return data

    from PyQt5.QtWidgets import QFileDialog


    from Tes1Form2 import Ui_ScrollArea # 导入生成form.py里生成的类
    class mywindow(QtWidgets.QScrollArea, Ui_ScrollArea):

    def __init__(self):
    super(mywindow,self).__init__()
    self.setupUi(self)

    def tes1(self):
    print("=====>self: " , "self")
    try:
    fileName1, filetype = QFileDialog.getOpenFileName(self,
    "选取文件",
    "./",
    "All Files (*.json);;Text Files (*.txt)") # 设置文件扩展名过滤,注意用双分号间隔
    print(fileName1, filetype)
    log.warn(filetype)
    log.warn(fileName1)

    def data1():
    with open(fileName1, encoding='utf-8') as json_file:
    data = json.load(json_file)
    return data

    log.warn(data1())


    # self.textEdit.setText("")

    myClassVVVV = MyClass()
    myClassJsonVVV = json.dumps(data1(), sort_keys=True, indent=2, ensure_ascii=False)
    log.warn(myClassJsonVVV)
    log.warn("myClassJsonVVV")

    self.textEdit.setText(myClassJsonVVV)
    # self.textEdit.setPlainText(myClassJsonVVV)
    textEditV=self.textEdit.toPlainText()
    log.warn(textEditV)
    # tesSaveJson()
    # urlv=properties['addRenewalInfo']
    # print("=====>urlv: " , urlv)
    #
    # myClassDict = myClassnew.__dict__
    myClassJsonMV = json.dumps(textEditV)
    log.warn("myClassJsonMV2222222222")
    log.warn(myClassJsonMV)

    myClassJson = json.dumps(myClassJsonMV, sort_keys=True, indent=2, ensure_ascii=False)
    myClassLoads = json.loads(myClassJson)
    log.warn(myClassLoads)
    log.warn("========================")
    log.warn(myClassJsonVVV)
    r1 = requests.post("http://www.nbybt.cn:8080/ybquery/medicare/getMedicareCard", data=myClassLoads, headers=headers)
    r1.encoding = 'utf-8'
    r1Text = json.dumps(json.loads(r1.text), sort_keys=True, indent=2, ensure_ascii=False)
    log.debug('【响应】 ' + r1Text)



    # r1Texvt = reqSend(data1(), "http://www.nbybt.cn:8080/ybquery/medicare/getMedicareCard",log)
    # log.warn(r1Texvt)

    # r1Text = reqSend(myClassJsonMV, "http://www.nbybt.cn:8080/ybquery/medicare/getMedicareCard",log)
    # log.warn(r1Text)
    # myClassDict = myClassnew.__dict__
    # myClassJson = json.dumps(myClassDict, sort_keys=True, indent=2, ensure_ascii=False)
    # self.textEdit_2.setText(r1Text)
    except:
    log.warn("except")
    pass

    def tesSaveJson(self):
    print("=====>self: " , "self")
    try:
    log.warn("tesSaveJson")
    # tesSaveJson()
    # urlv=properties['addRenewalInfo']
    # print("=====>urlv: " , urlv)
    #
    # r1Text = reqSend("", "http://www.nbybt.cn:8080/ybquery/medicare/getMedicareCard",log)
    # log.warn(r1Text)
    # myClassDict = myClassnew.__dict__
    # myClassJson = json.dumps(myClassDict, sort_keys=True, indent=2, ensure_ascii=False)
    # self.textEdit_2.setText(r1Text)
    except:
    pass


    def fileUrl(self):
    print("=====>self: " , "self")
    try:
    # tesSaveJson()
    log.warn("tesSaveJson")
    # urlv=properties['addRenewalInfo']
    # print("=====>urlv: " , urlv)
    #
    # r1Text = reqSend("", "http://www.nbybt.cn:8080/ybquery/medicare/getMedicareCard",log)
    # log.warn(r1Text)
    # myClassDict = myClassnew.__dict__
    # myClassJson = json.dumps(myClassDict, sort_keys=True, indent=2, ensure_ascii=False)
    # self.textEdit_2.setText(r1Text)
    except:
    pass


    app = QtWidgets.QApplication(sys.argv)
    window = mywindow()
    window.show()
    sys.exit(app.exec_())

    ================

    # -*- coding: utf-8 -*-
    import json
    import logging
    import sys

    import requests
    from PyQt5 import QtWidgets
    from ReqSendXXX import *

    '''===== [logg] .xu =============================================='''
    # -*- coding: utf-8 -*-
    import logging
    import sys
    import os
    # 获取logger实例,如果参数为空则返回root logger
    log = logging.getLogger("AppName")
    # 指定logger输出格式
    formatter = logging.Formatter('%(asctime)s %(levelname)-8s: %(message)s')
    # 文件日志
    file_handler = logging.FileHandler(os.path.basename(__file__)+".log")
    file_handler.setFormatter(formatter) # 可以通过setFormatter指定输出格式
    # 控制台日志
    console_handler = logging.StreamHandler(sys.stdout)
    console_handler.formatter = formatter # 也可以直接给formatter赋值
    # 为logger添加的日志处理器
    log.addHandler(file_handler)
    log.addHandler(console_handler)
    # 指定日志的最低输出级别,默认为WARN级别
    log.setLevel(logging.DEBUG)


    class MyClass:
    # 初始化
    def __init__(self):
    print("=====>def: " , "def")


    myClass = MyClass()

    from aztemplate import Ui_AzScrollArea # 导入生成form.py里生成的类
    class mywindow(QtWidgets.QScrollArea, Ui_AzScrollArea):

    def __init__(self):
    super(mywindow,self).__init__()
    self.setupUi(self)

    def p1local(self):
    print("=====>self: " , "self")
    try:
    url=self.lineEdit.text()
    myClassnew=self.textEdit.
    myClassnew=self.textEdit.text()
    log.warn(myClassnew)
    r1Text = reqSend(myClassnew, url,log)
    log.warn(r1Text)
    # myClassDict = myClassnew.__dict__
    # myClassJson = json.dumps(myClassDict, sort_keys=True, indent=2, ensure_ascii=False)
    # self.textEdit_2.setText(r1Text)
    except:

    pass


    app = QtWidgets.QApplication(sys.argv)
    window = mywindow()
    window.show()
    sys.exit(app.exec_())
    def bcs(params):
    return ';'.join(['%s=%s' % (k,v) for k,v in params.items()])
    昨日已逝正在输入···
    赞赏支持!!!
    分享到: 更多
  • 相关阅读:
    SAP CDS view单元测试框架中的访问者(Visitor)设计模式使用介绍
    如何用SAP CRM中间件从ERP下载material division到CRM
    SAP CRM中间件Material Sales Organization和distribution channel的映射逻辑
    SAP CRM 中间件Request download里,遇到/SAPPSPRO/S_MAT_ENHANC_COMM 错误的解决办法
    SAP 数据库表CRMD_ORDERADM_I字段OBJECT_TYPE的计算逻辑
    一文带你了解数据中心大二层网络演进之路
    分布式身份:重新定义你的“身份”管理
    18篇文章系统解读:中台规划如何撬动企业IT基础设施转型升级
    案例展示自定义C函数的实现过程
    云原生2.0时代,华为云DevOps立体运维实践
  • 原文地址:https://www.cnblogs.com/rhxuza1993/p/9239647.html
Copyright © 2020-2023  润新知