36 lines
1.3 KiB
Python
36 lines
1.3 KiB
Python
|
|
from ui.mainwindow import Ui_mainWindow
|
||
|
|
|
||
|
|
from PyQt6 import QtWidgets
|
||
|
|
from PyQt6.QtWidgets import QMainWindow, QFileDialog, QMessageBox, QStatusBar
|
||
|
|
from PyQt6.QtCore import QSettings, QFileInfo
|
||
|
|
import datetime
|
||
|
|
from PWFile import ControlFile
|
||
|
|
|
||
|
|
|
||
|
|
class MainWindow(QMainWindow, Ui_mainWindow):
|
||
|
|
def open_dialog(self):
|
||
|
|
z_control_file_paths = QFileDialog.getOpenFileNames(
|
||
|
|
self,
|
||
|
|
"打开Excel文件",
|
||
|
|
filter="Excel 文件(*.xlsx)",
|
||
|
|
directory=self._setting.value("last_working_directory"),
|
||
|
|
)[0]
|
||
|
|
for z_control_file_path in z_control_file_paths:
|
||
|
|
if z_control_file_path != "":
|
||
|
|
cf = ControlFile(z_control_file_path)
|
||
|
|
cf.draw()
|
||
|
|
self.statusBar().showMessage(
|
||
|
|
f"{datetime.datetime.now()} Finished.", 8000
|
||
|
|
)
|
||
|
|
file_info = QFileInfo(z_control_file_path)
|
||
|
|
self._setting.setValue(
|
||
|
|
"last_working_directory", file_info.absoluteDir().absolutePath()
|
||
|
|
)
|
||
|
|
|
||
|
|
def __init__(self, parent=None):
|
||
|
|
super().__init__(parent)
|
||
|
|
self.setupUi(self)
|
||
|
|
self.pBOpenControlZFile.clicked.connect(self.open_dialog)
|
||
|
|
self._setting = QSettings("NWEPDI", "Plate", self)
|
||
|
|
pass
|