-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDisplaySettings.py
54 lines (40 loc) · 1.7 KB
/
DisplaySettings.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
from PyQt5.QtCore import * # core Qt functionality
from PyQt5.QtWidgets import *
from PyQt5.QtGui import * # extends QtCore with GUI functionality
from PyQt5.QtOpenGL import * # provides QGLWidget, a special OpenGL QWidget
from PyQt5 import uic
from Model import *
from Message import *
import resources # For icons and UIs
import sys # We need sys so that we can pass argv to QApplication
import os
class DisplaySettingsUI(QDialog):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Load the UI Page
fileh = QFile(':/UI/autobuilder_displaysettings_v1.ui')
fileh.open(QFile.ReadOnly)
uic.loadUi(fileh, self)
fileh.close()
# Reference to existing tower for cache
self.displaySettingsRef = args[0].tower.displaySettings
# Set UI Elements
self.setOkandCancelButtons()
self.populate()
def setOkandCancelButtons(self):
self.OkButton = self.displaySettings_buttonBox.button(QDialogButtonBox.Ok)
self.OkButton.clicked.connect(self.save)
self.CancelButton = self.displaySettings_buttonBox.button(QDialogButtonBox.Cancel)
self.CancelButton.clicked.connect(lambda signal: self.close())
def populate(self):
self.pName_checkBox.setChecked(self.displaySettingsRef.pName)
self.pLength_checkBox.setChecked(self.displaySettingsRef.pLength)
def save(self):
self.displaySettingsRef.pName = self.pName_checkBox.isChecked()
self.displaySettingsRef.pLength = self.pLength_checkBox.isChecked()
# Struct for display settings
class DisplaySettings:
def __init__(self):
# 2D view
self.pName = True
self.pLength = False