Skip to content

Commit 7bb3af2

Browse files
committed
Works properly without PyQt5
1 parent 729a483 commit 7bb3af2

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

csg.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,13 @@
1919
# along with this program. If not, see <https://www.gnu.org/licenses/>.
2020
#
2121

22-
from core import main
23-
from ui import ui_main
2422
from sys import argv
2523

2624
VERSION = "v0.1-alpha"
2725

2826
def start_csg():
2927
if "--cli" in argv:
28+
from core import main
3029
main()
3130

3231
elif "--help" in argv or "-h" in argv:
@@ -36,10 +35,21 @@ def start_csg():
3635
version()
3736

3837
else:
39-
if len(argv) > 1:
40-
print("[!] Ignoring extra argument(s): ", ", ".join(argv[1:]))
38+
try:
39+
from ui import ui_main
40+
41+
if len(argv) > 1:
42+
print("[!] Ignoring extra argument(s): ", ", ".join(argv[1:]))
43+
44+
ui_main()
45+
46+
except ModuleNotFoundError:
47+
print("[!] PyQt5 needs to be installed to run the graphical front-end.")
48+
print(f"""[!] Try running '{argv[0]} --cli' to run CSG from the command-line
49+
or install PyQt5 by running 'pip install pyqt5'""")
50+
51+
exit()
4152

42-
ui_main()
4353

4454
def usage():
4555
print(f"Usage: {argv[0]} [OPTION]")

0 commit comments

Comments
 (0)