-
Notifications
You must be signed in to change notification settings - Fork 0
/
importFileDialog.py
74 lines (63 loc) · 2.8 KB
/
importFileDialog.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# coding:utf-8
# 导入相关文件界面的逻辑功能函数
import sys,os
# import pandas as pd
from importFileUI import Ui_importFileDialog
import myLogging as mylogger
from PyQt5.QtWidgets import QDialog,QWidget,QFileDialog
from PyQt5.QtCore import Qt
# Ui_MainWindow
class importFileDialog(QDialog,Ui_importFileDialog):
def __init__(self,win,workPath,parent=None):
# mylogger.logger.debug("QuestionCheckDialog init")
super(importFileDialog,self).__init__(parent)
mylogger.logger.debug("importFileDialog init..")
self.workPath = workPath
self.win = win
self.res_path = {"A":"","B":"","住户":"","住宅":"","小区":"","账页表":""}
self.setupUi(self)
self.connectSlot()
mylogger.logger.debug("importFileDialog init ok")
# self.checkBox = ''
def connectSlot(self):
self.A_pushButton.clicked.connect(lambda :self.openFile("A"))
self.B_pushButton.clicked.connect(lambda :self.openFile("B"))
self.zhuhu_pushButton.clicked.connect(lambda :self.openFile("住户"))
self.zhuzhai_pushButton.clicked.connect(lambda :self.openFile("住宅"))
self.xiaoqu_pushButton.clicked.connect(lambda :self.openFile("小区"))
self.zy_pushButton.clicked.connect(lambda :self.openFile("账页表"))
# self.codes_pushButton.clicked.connect(lambda :self.openFile("编码手册"))
def openFile(self,info=""):
print("openFile")
# print(self.win)
# print(self.workPath)
filePath, filetype = QFileDialog.getOpenFileName(parent=self.win,caption=info,directory=self.workPath,filter="All Files (*);;Text Files (*.txt)") # 设置文件扩展名过滤,注意用双分号间隔
if filePath.strip() != "":
if info == "A":
self.A_path.setText(filePath)
self.res_path[info] = filePath
if info == "B":
self.B_path.setText(filePath)
self.res_path[info] = filePath
if info == "住户":
self.zhuhu_path.setText(filePath)
self.res_path[info] = filePath
if info == "住宅":
self.zhuzhai_path.setText(filePath)
self.res_path[info] = filePath
if info == "小区":
self.xiaoqu_path.setText(filePath)
self.res_path[info] = filePath
if info == "账页表":
self.zy_path.setText(filePath)
self.res_path[info] = filePath
# if info == "编码手册":
# self.codes_path.setText(filePath)
# self.res_path[info] = filePath
def getPath(self):
return self.res_path
if __name__ == '__main__':
app = QApplication(sys.argv)
qcd = QuestionCheckDialog()
qcd.show()
sys.exit(app.exec_())