bimtester: move code into a package directory

This commit is contained in:
Bernd Hahnebach
2020-11-25 17:21:20 +01:00
committed by Dion Moult
parent acb518613b
commit 32f99428c3
19 changed files with 32 additions and 17 deletions
+3 -14
View File
@@ -1,26 +1,15 @@
#!/usr/bin/env python3
# Bernd: IMHO, this should go one lever up,
# or all other code should go one level down
# https://stackoverflow.com/questions/16981921/relative-imports-in-python-3
# ATM bimtester code is copied here for for the sake of convenience
# TODO bimtester should be installed in conjunction with ifcopenshell
# to /urs/local by make install
# Unix:
# $ pyinstaller --onefile --clean --icon=icon.ico --add-data "features:features" bimtester.py`
# Windows:
# $ pyinstaller --onefile --clean --icon=icon.ico --add-data "features;features" bimtester.py`
import argparse
import clean
import reports
import run
from bimtester import clean
from bimtester import reports
from bimtester import run
if __name__ == "__main__":
@@ -13,11 +13,15 @@ from .run import run_all
class GuiWidgetBimTester(QtWidgets.QWidget):
# get some initial values
this_path = os.path.join(os.path.dirname(__file__))
desktop_path = os.path.join(os.path.expanduser("~"), "Desktop")
initial_ifcfile = "/home/hugo/Documents/zeug_sort/z_some_ifc/example_model.ifc"
if not os.path.isfile(initial_ifcfile):
initial_ifcfile = os.path.join(os.path.expanduser("~"), "Desktop")
this_path = os.path.join(os.path.dirname(__file__))
initial_featurespath = os.path.join(this_path, "..", "features_bimtester", "fea_min")
initial_ifcfile = desktop_path
initial_featurespath = os.path.join(this_path, "..", "..", "features_bimtester", "fea_min")
if not os.path.isdir(initial_featurespath):
initial_featurespath = desktop_path
def __init__(self):
super(GuiWidgetBimTester, self).__init__()

Before

Width:  |  Height:  |  Size: 104 KiB

After

Width:  |  Height:  |  Size: 104 KiB

+22
View File
@@ -0,0 +1,22 @@
# TODO merge into bimtester module
import sys
from PySide2 import QtWidgets
from bimtester.guiwidget import GuiWidgetBimTester
def show_widget():
# Create the Qt Application
app = QtWidgets.QApplication(sys.argv)
# Create and show the form
form = GuiWidgetBimTester()
form.show()
# Run the main Qt loop
sys.exit(app.exec_())
if __name__ == '__main__':
show_widget()