bimtester: improve gui

This commit is contained in:
Bernd Hahnebach
2021-01-12 18:33:32 +01:00
parent 91773e8fc6
commit 2d04d988e7
2 changed files with 27 additions and 17 deletions
+19 -14
View File
@@ -15,25 +15,30 @@ class GuiWidgetBimTester(QtWidgets.QWidget):
def __init__(
self,
features="",
ifcfile=""
featurespath="",
ifcfile="",
get_featurepath_from_ifcpath=False
):
super(GuiWidgetBimTester, self).__init__()
# get features dir
user_path = os.path.expanduser("~")
# print(features)
self.initial_featurespath = features
if not os.path.isdir(self.initial_featurespath):
self.initial_featurespath = user_path
print(self.initial_featurespath)
# get features dir
# print(featurespath)
if not os.path.isdir(featurespath):
featurespath = user_path
# get ifc file
# print(ifcfile)
if not os.path.isfile(ifcfile):
ifcfile = user_path
self.initial_featurespath = featurespath
self.initial_ifcfile = ifcfile
if not os.path.isfile(self.initial_ifcfile):
self.initial_ifcfile = user_path
print(self.initial_ifcfile)
self.get_featurepath_from_ifcpath = get_featurepath_from_ifcpath
# print(self.initial_featurespath)
# print(self.initial_ifcfile)
# print(self.get_featurepath_from_ifcpath)
# init ui
self._setup_ui()
@@ -143,6 +148,9 @@ class GuiWidgetBimTester(QtWidgets.QWidget):
layout.setRowStretch(0, 10)
self.setLayout(layout)
# set button state, needs to be here after gui has beed set up
self.featuredirfromifc_cb.setChecked(self.get_featurepath_from_ifcpath)
# **********************************************************
def select_ifcfile(self):
# print(self.get_ifcfile())
@@ -162,11 +170,8 @@ class GuiWidgetBimTester(QtWidgets.QWidget):
def featuredirfromifc_clicked(self):
if self.featuredirfromifc_cb.isChecked() is True:
self.set_featurefilesdir("")
# TODO
self.featurefilesdir_text.setEnabled(False)
self.feafilesdir_browse_btn.setEnabled(False)
# deactivate feature path browser button
# deactivate lineedit text
else:
self.set_featurefilesdir(self.initial_featurespath)
self.featurefilesdir_text.setEnabled(True)
+8 -3
View File
@@ -8,7 +8,7 @@ from bimtester import reports
from bimtester import run
def show_widget(features="", ifcfile=""):
def show_widget(features="", ifcfile="", get_featurepath_from_ifcpath=False):
import sys
from PySide2 import QtWidgets
@@ -19,7 +19,7 @@ def show_widget(features="", ifcfile=""):
app = QtWidgets.QApplication(sys.argv)
# Create and show the form
form = GuiWidgetBimTester(features, ifcfile)
form = GuiWidgetBimTester(features, ifcfile, get_featurepath_from_ifcpath)
form.show()
# Run the main Qt loop
@@ -132,7 +132,12 @@ if __name__ == "__main__":
elif args["report"]:
reports.generate_report()
elif args["gui"]:
show_widget(args["featuresdir"], args["ifcfile"])
fea = args["featuresdir"]
ifc = args["ifcfile"]
if fea != "" and ifc != "":
show_widget(fea, ifc, False)
elif fea == "" and ifc != "":
show_widget(fea, ifc, True)
elif args["copyintemprun"]:
run.run_copyintmp_tests(args)
else: