Skip to content

Commit

Permalink
fied an error with file browsing
Browse files Browse the repository at this point in the history
  • Loading branch information
KylieGong committed Sep 7, 2023
1 parent f338f93 commit 980d746
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions qtrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ def __init__(self, parameters, input_file, filetype):
super(MainWindow, self).__init__()

self.groups = parameters
self.radio_groups = []
self.input_file = input_file
self.input_file_type = filetype
self.radio_groups = []
self.slider_multiplier = []
self.sliders = []

Expand Down Expand Up @@ -135,7 +135,7 @@ def createWidgetsFromGroups(self):
group_type, group_name, options, default_option, help = group

if group_type == "RADIO":
print("radio button created")
# print("radio button created")
new_group = QtWidgets.QButtonGroup()
self.radio_groups.append(new_group)
group_layout = QtWidgets.QHBoxLayout()
Expand Down Expand Up @@ -165,15 +165,16 @@ def createWidgetsFromGroups(self):
txt.setText(default_option)
txt.setObjectName(group_name)
if group_type == "OFILE" or group_type == "IFILE":
btn.clicked.connect(lambda edit=txt: self.browse("FILE", edit))
self.ofile = group_name
btn.clicked.connect(lambda _, edit=txt: self.browse("FILE", edit))
else:
btn.clicked.connect(lambda edit=txt: self.browse("DIR", edit))
btn.clicked.connect(lambda _, edit=txt: self.browse("DIR", edit))
group_layout.addWidget(btn)
group_layout.addWidget(txt)
self.pagelayout.addLayout(group_layout)

elif group_type == "CHECK":
print("checkbox created")
# print("checkbox created")
group_layout = QtWidgets.QHBoxLayout()
label = QtWidgets.QLabel(group_name+":")
label.setToolTip(help)
Expand All @@ -188,7 +189,7 @@ def createWidgetsFromGroups(self):
self.pagelayout.addLayout(group_layout)

elif group_type == "ENTRY":
print("textbox created")
# print("textbox created")
group_layout = QtWidgets.QHBoxLayout()
label = QtWidgets.QLabel(group_name+":")
label.setToolTip(help)
Expand All @@ -207,7 +208,7 @@ def createWidgetsFromGroups(self):
options = ''.join(options)
options = options.split(':')

print("slider created")
# print("slider created")
#creates a horizontal decimal slider
decimals = len(str(options[2]).split('.')[1]) if '.' in str(options[2]) else 0
multiplier = 10**decimals
Expand Down Expand Up @@ -243,7 +244,6 @@ def browse(self, gtype, txt):
options = QtWidgets.QFileDialog.Options()
file = None
dir = None

if gtype == 'FILE':
file, _ = QtWidgets.QFileDialog.getOpenFileName(self, "Choose a File", "", "All Files (*)", options=options)
if gtype == 'DIR':
Expand All @@ -252,8 +252,9 @@ def browse(self, gtype, txt):
txt.setText(file)
print(file + " selected")
if dir:
print(f"{dir} selected")

txt.setText(dir)
print(dir + " selected")

def gather_data(self):
layout_data = []

Expand Down

0 comments on commit 980d746

Please sign in to comment.