diff --git a/src/ifcbimtester/bimtester/guiwidget.py b/src/ifcbimtester/bimtester/guiwidget.py index e7697de051..08a212eee2 100644 --- a/src/ifcbimtester/bimtester/guiwidget.py +++ b/src/ifcbimtester/bimtester/guiwidget.py @@ -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) diff --git a/src/ifcbimtester/startbimtester.py b/src/ifcbimtester/startbimtester.py index 0e96af17ca..01c31f82f5 100644 --- a/src/ifcbimtester/startbimtester.py +++ b/src/ifcbimtester/startbimtester.py @@ -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: