-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
67 lines (53 loc) · 2.12 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Main.py
# Runs helper files to launch main window GUI
# In the main GUI contains the "About" window option and generation options
# Generating an image utilizes procgenmaps.py to procedural generate terrains with given user parameters
import sys
import os
from PySide6 import QtCore
from PySide6.QtGui import QColor
from PySide6.QtWidgets import *
# Import UI config from python file generated by QT Designer
from ui_PROCGENGUI import Ui_PROCGEN, Ui_ABOUT
# Won't open on MAC OS X Big Sur and newer without this
# FEBRUARY 2024 UPDATE; Pyside6 fixes this issue and layer-backing is always enabled, next line has no effect
# os.environ["QT_MAC_WANTS_LAYER"] = "1"
class MainGUI(QMainWindow):
def __init__(self):
"""Initializes main window"""
QMainWindow.__init__(self)
self.ui = Ui_PROCGEN()
self.ui.setupUi(self)
# Remove Frame & Title bar
self.setWindowFlag(QtCore.Qt.FramelessWindowHint)
self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
# Drop shadow effect
self.shadow = QGraphicsDropShadowEffect(self)
self.shadow.setBlurRadius(20)
self.shadow.setXOffset(0)
self.shadow.setYOffset(0)
self.shadow.setColor(QColor(0, 0, 0, 60))
self.ui.ui_frame.setGraphicsEffect(self.shadow)
# Show window
self.show()
class AboutGUI(QMainWindow):
def __init__(self):
"""Initializes about window"""
QMainWindow.__init__(self)
self.uia = Ui_ABOUT()
self.uia.setupUi(self)
# Remove Frame & Title bar
self.setWindowFlag(QtCore.Qt.FramelessWindowHint)
self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
# Drop shadow effect
self.shadow = QGraphicsDropShadowEffect(self)
self.shadow.setBlurRadius(20)
self.shadow.setXOffset(0)
self.shadow.setYOffset(0)
self.shadow.setColor(QColor(0, 0, 0, 60))
self.uia.ui_frame.setGraphicsEffect(self.shadow)
if __name__ == "__main__":
# Deploy app, open the main window, wait for system exit while running
app = QApplication()
window = MainGUI()
sys.exit(app.exec())