def __init__(self): '''View Initialisation''' super(Ui, self).__init__() uic.loadUi('basic.ui', self) self.setWindowTitle('Photography Program') # Initalises the window from the .ui file self.OPTIONS = ["Lighting Condition", "ISO", "Shutter Speed", "Aperture"] self.setting1_type = self.findChild(QtWidgets.QComboBox, 'setting1_Combo') self.setting2_type = self.findChild(QtWidgets.QComboBox, 'setting2_Combo') self.setting1_type.addItems(self.OPTIONS) self.setting2_type.addItems(self.OPTIONS) self.setting1_type.currentTextChanged.connect(self.on_combobox_changed1) self.setting2_type.currentTextChanged.connect(self.on_combobox_changed2) self.setting2_type.setCurrentIndex(1) self.setting1_input = self.findChild(QtWidgets.QTextEdit, 'setting1_textEdit') self.setting2_input = self.findChild(QtWidgets.QTextEdit, 'setting2_textEdit') self.setting1_input.textChanged.connect(self.update) self.setting2_input.textChanged.connect(self.update) # Creates All the Inputs & Settings self.ReferenceHandler = ReferenceNumbers() # Creates the reference handler self.show()
def __init__(self): '''View Initialisation''' super(ProgramUi, self).__init__() uic.loadUi('app/auto_sports.ui', self) self.setWindowTitle('Photography Program') # Initalises the window from the .ui file self.OPTIONS = [ "Lighting Condition", "ISO", "Shutter Speed", "Aperture" ] self.setting_type = self.findChild(QtWidgets.QComboBox, 'setting1_Combo') self.setting_type.addItems(self.OPTIONS) self.setting_type.currentTextChanged.connect(self.update_combo) self.settings1_label = self.findChild(QtWidgets.QLabel, 'value1_Label') self.settings2_label = self.findChild(QtWidgets.QLabel, 'value2_Label') self.settings3_label = self.findChild(QtWidgets.QLabel, 'value3_Label') self.setting1_input = self.findChild(QtWidgets.QTextEdit, 'setting1_textEdit') self.setting2_input = self.findChild(QtWidgets.QTextEdit, 'setting2_textEdit') self.setting3_input = self.findChild(QtWidgets.QTextEdit, 'setting3_textEdit') self.setting1_input.textChanged.connect(self.update) self.setting2_input.textChanged.connect(self.update) self.setting3_input.textChanged.connect(self.update) self.CURRENT_LABELS = list(self.OPTIONS) self.CURRENT_LABELS.remove(self.setting_type.currentText()) # Creates All the Inputs & Settings self.ReferenceHandler = ReferenceNumbers() # Creates the reference handler self.result_lighting = self.findChild(QtWidgets.QLabel, 'answer_lighting') self.result_iso = self.findChild(QtWidgets.QLabel, 'answer_iso') self.result_shutter = self.findChild(QtWidgets.QLabel, 'answer_shutter') self.result_aperture = self.findChild(QtWidgets.QLabel, 'answer_aperture') self.show()
import os import sys import math import json # Standard Imports + Math Import from utils.main import ReferenceNumbers from utils.data import ref Lighting_Condition = "Lightly Cloudy" Selected_ISO = "400" Selected_ShutterSpeed = "1/30" Selected_Aperture = "" SelectedSettings = {"Lighting":Lighting_Condition, "ISO":Selected_ISO, "Shutter":Selected_ShutterSpeed, "Aperture":Selected_Aperture} ReferenceHandler = ReferenceNumbers() ReferenceValues = ReferenceHandler.getAllReferenceValues(SelectedSettings) CurrentAverage = sum(ReferenceValues.values()) RequiredAverage = 16 SelectedValue = RequiredAverage-CurrentAverage print(f"Required Aperture Value: f/{ref[str(SelectedValue)]['Aperture']}")