mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-30 16:43:00 +00:00
bimtester: improve gui
This commit is contained in:
@@ -15,25 +15,30 @@ class GuiWidgetBimTester(QtWidgets.QWidget):
|
|||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
features="",
|
featurespath="",
|
||||||
ifcfile=""
|
ifcfile="",
|
||||||
|
get_featurepath_from_ifcpath=False
|
||||||
):
|
):
|
||||||
super(GuiWidgetBimTester, self).__init__()
|
super(GuiWidgetBimTester, self).__init__()
|
||||||
|
|
||||||
# get features dir
|
|
||||||
user_path = os.path.expanduser("~")
|
user_path = os.path.expanduser("~")
|
||||||
# print(features)
|
|
||||||
self.initial_featurespath = features
|
# get features dir
|
||||||
if not os.path.isdir(self.initial_featurespath):
|
# print(featurespath)
|
||||||
self.initial_featurespath = user_path
|
if not os.path.isdir(featurespath):
|
||||||
print(self.initial_featurespath)
|
featurespath = user_path
|
||||||
|
|
||||||
# get ifc file
|
# get ifc file
|
||||||
# print(ifcfile)
|
# print(ifcfile)
|
||||||
|
if not os.path.isfile(ifcfile):
|
||||||
|
ifcfile = user_path
|
||||||
|
|
||||||
|
self.initial_featurespath = featurespath
|
||||||
self.initial_ifcfile = ifcfile
|
self.initial_ifcfile = ifcfile
|
||||||
if not os.path.isfile(self.initial_ifcfile):
|
self.get_featurepath_from_ifcpath = get_featurepath_from_ifcpath
|
||||||
self.initial_ifcfile = user_path
|
# print(self.initial_featurespath)
|
||||||
print(self.initial_ifcfile)
|
# print(self.initial_ifcfile)
|
||||||
|
# print(self.get_featurepath_from_ifcpath)
|
||||||
|
|
||||||
# init ui
|
# init ui
|
||||||
self._setup_ui()
|
self._setup_ui()
|
||||||
@@ -143,6 +148,9 @@ class GuiWidgetBimTester(QtWidgets.QWidget):
|
|||||||
layout.setRowStretch(0, 10)
|
layout.setRowStretch(0, 10)
|
||||||
self.setLayout(layout)
|
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):
|
def select_ifcfile(self):
|
||||||
# print(self.get_ifcfile())
|
# print(self.get_ifcfile())
|
||||||
@@ -162,11 +170,8 @@ class GuiWidgetBimTester(QtWidgets.QWidget):
|
|||||||
def featuredirfromifc_clicked(self):
|
def featuredirfromifc_clicked(self):
|
||||||
if self.featuredirfromifc_cb.isChecked() is True:
|
if self.featuredirfromifc_cb.isChecked() is True:
|
||||||
self.set_featurefilesdir("")
|
self.set_featurefilesdir("")
|
||||||
# TODO
|
|
||||||
self.featurefilesdir_text.setEnabled(False)
|
self.featurefilesdir_text.setEnabled(False)
|
||||||
self.feafilesdir_browse_btn.setEnabled(False)
|
self.feafilesdir_browse_btn.setEnabled(False)
|
||||||
# deactivate feature path browser button
|
|
||||||
# deactivate lineedit text
|
|
||||||
else:
|
else:
|
||||||
self.set_featurefilesdir(self.initial_featurespath)
|
self.set_featurefilesdir(self.initial_featurespath)
|
||||||
self.featurefilesdir_text.setEnabled(True)
|
self.featurefilesdir_text.setEnabled(True)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from bimtester import reports
|
|||||||
from bimtester import run
|
from bimtester import run
|
||||||
|
|
||||||
|
|
||||||
def show_widget(features="", ifcfile=""):
|
def show_widget(features="", ifcfile="", get_featurepath_from_ifcpath=False):
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from PySide2 import QtWidgets
|
from PySide2 import QtWidgets
|
||||||
@@ -19,7 +19,7 @@ def show_widget(features="", ifcfile=""):
|
|||||||
app = QtWidgets.QApplication(sys.argv)
|
app = QtWidgets.QApplication(sys.argv)
|
||||||
|
|
||||||
# Create and show the form
|
# Create and show the form
|
||||||
form = GuiWidgetBimTester(features, ifcfile)
|
form = GuiWidgetBimTester(features, ifcfile, get_featurepath_from_ifcpath)
|
||||||
form.show()
|
form.show()
|
||||||
|
|
||||||
# Run the main Qt loop
|
# Run the main Qt loop
|
||||||
@@ -132,7 +132,12 @@ if __name__ == "__main__":
|
|||||||
elif args["report"]:
|
elif args["report"]:
|
||||||
reports.generate_report()
|
reports.generate_report()
|
||||||
elif args["gui"]:
|
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"]:
|
elif args["copyintemprun"]:
|
||||||
run.run_copyintmp_tests(args)
|
run.run_copyintmp_tests(args)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user