zoukankan      html  css  js  c++  java
  • 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()])
    昨日已逝正在输入···
    赞赏支持!!!
    分享到: 更多
  • 相关阅读:
    .NET网址集合(自己备用)
    在所有页面自动注册prefix
    ASP.NET里实现水晶报表的打印
    C#经典书籍推荐
    自定义file类型input框样式的方法
    安装VS2008后要做的事
    ASP.NET中使用Include的要点
    增加新记录时ObjectDataSoruce和FormViw中的相关事件使用总结
    兼容IE/FF的手动触发事件的函数 ( forward )
    ASP.NET 自定义的一个日期验证控件
  • 原文地址:https://www.cnblogs.com/rhxuza1993/p/9239647.html
Copyright © 2011-2022 走看看