-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfiles_loader.py
47 lines (35 loc) · 1.68 KB
/
files_loader.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
from pathlib import Path
from PyQt5.QtWidgets import QFileDialog
from functools import partial
class FilesLoader:
def __init__(self, main_window):
self.main_window = main_window
self.files_select_layout = main_window.files_selection_Hlayout
self.blk_img_btn = main_window.blk_img_sel_btn
self.wht_img_btn = main_window.wht_img_sel_btn
self.test_img_btn = main_window.test_img_sel_btn
self.blk_img_path_label = main_window.blk_img_path_label
self.wht_img_path_label = main_window.wht_img_path_label
self.test_img_path_label = main_window.test_img_path_label
self.blk_pic_path = None
self.wht_pic_path = None
self.test_pic_path = None
self.connect_btns_events()
def connect_btns_events(self):
self.blk_img_btn.clicked.connect(partial(self.open_file_name_dialog, 'blk'))
self.wht_img_btn.clicked.connect(partial(self.open_file_name_dialog, 'wht'))
self.test_img_btn.clicked.connect(partial(self.open_file_name_dialog, 'test'))
def open_file_name_dialog(self, img_type):
file_name, _ = QFileDialog.getOpenFileName(self.main_window, "Select NEF file", "", "NEF(*.nef, *.NEF)")
file_name = Path(file_name)
if not file_name.exists():
return
if img_type == 'blk':
self.blk_pic_path = file_name
self.blk_img_path_label.setText(str(file_name))
elif img_type == 'wht':
self.wht_pic_path = file_name
self.wht_img_path_label.setText(str(file_name))
elif img_type == 'test':
self.test_pic_path = file_name
self.test_img_path_label.setText(str(file_name))