Created
November 29, 2023 06:38
-
-
Save Mau5trakt/af98e8799a9ec5f88c74b34558ff8c80 to your computer and use it in GitHub Desktop.
NORMAR BEAM GUI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# Form implementation generated from reading ui file 'jjj.ui' | |
# | |
# Created by: PyQt5 UI code generator 5.15.9 | |
# | |
# WARNING: Any manual changes made to this file will be lost when pyuic5 is | |
# run again. Do not edit this file unless you know what you are doing. | |
from PyQt5 import QtCore, QtGui, QtWidgets | |
class Ui_MainWindow(object): | |
def setupUi(self, MainWindow): | |
MainWindow.setObjectName("MainWindow") | |
MainWindow.resize(502, 552) | |
self.centralwidget = QtWidgets.QWidget(MainWindow) | |
self.centralwidget.setObjectName("centralwidget") | |
self.resultado = QtWidgets.QLabel(self.centralwidget) | |
self.resultado.setGeometry(QtCore.QRect(130, 370, 300, 200)) | |
self.resultado.setAutoFillBackground(False) | |
self.resultado.setObjectName("resultado") | |
self.label = QtWidgets.QLabel(self.centralwidget) | |
self.label.setGeometry(QtCore.QRect(150, 20, 211, 16)) | |
self.label.setObjectName("label") | |
self.widget = QtWidgets.QWidget(self.centralwidget) | |
self.widget.setGeometry(QtCore.QRect(150, 220, 131, 115)) | |
self.widget.setObjectName("widget") | |
self.verticalLayout = QtWidgets.QVBoxLayout(self.widget) | |
self.verticalLayout.setContentsMargins(0, 0, 0, 0) | |
self.verticalLayout.setObjectName("verticalLayout") | |
self.label_longitud = QtWidgets.QLabel(self.widget) | |
self.label_longitud.setObjectName("label_longitud") | |
self.verticalLayout.addWidget(self.label_longitud) | |
self.longitud = QtWidgets.QLineEdit(self.widget) | |
self.longitud.setObjectName("longitud") | |
self.verticalLayout.addWidget(self.longitud) | |
self.label_carga_propuesta = QtWidgets.QLabel(self.widget) | |
self.label_carga_propuesta.setObjectName("label_carga_propuesta") | |
self.verticalLayout.addWidget(self.label_carga_propuesta) | |
self.carga_propuesta = QtWidgets.QLineEdit(self.widget) | |
self.carga_propuesta.setObjectName("carga_propuesta") | |
self.verticalLayout.addWidget(self.carga_propuesta) | |
self.enviar = QtWidgets.QPushButton(self.widget) | |
self.enviar.setObjectName("enviar") | |
self.verticalLayout.addWidget(self.enviar) | |
self.enviar.clicked.connect(self.mostrar_material_seleccionado) | |
self.lista_materiales = ["Material 1", "Material 2", "Material 3", "Material 4", "Material 5", "a", "b", "d"] | |
self.modelo_materiales = QtGui.QStandardItemModel() | |
for material in self.lista_materiales: | |
item = QtGui.QStandardItem(material) | |
self.modelo_materiales.appendRow(item) | |
self.materiales = QtWidgets.QListView(self.centralwidget) | |
self.materiales.setGeometry(QtCore.QRect(130, 90, 181, 101)) | |
self.materiales.setObjectName("materiales") | |
self.materiales.setModel(self.modelo_materiales) | |
#self.materiales.selectionModel().selectionChanged.connect(self.mostrar_material_seleccionado) | |
self.label_2 = QtWidgets.QLabel(self.centralwidget) | |
self.label_2.setGeometry(QtCore.QRect(190, 60, 81, 16)) | |
self.label_2.setObjectName("label_2") | |
MainWindow.setCentralWidget(self.centralwidget) | |
self.menubar = QtWidgets.QMenuBar(MainWindow) | |
self.menubar.setGeometry(QtCore.QRect(0, 0, 502, 21)) | |
self.menubar.setObjectName("menubar") | |
MainWindow.setMenuBar(self.menubar) | |
self.statusbar = QtWidgets.QStatusBar(MainWindow) | |
self.statusbar.setObjectName("statusbar") | |
MainWindow.setStatusBar(self.statusbar) | |
self.resultado.setVisible(False) | |
self.retranslateUi(MainWindow) | |
QtCore.QMetaObject.connectSlotsByName(MainWindow) | |
def retranslateUi(self, MainWindow): | |
_translate = QtCore.QCoreApplication.translate | |
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) | |
self.resultado.setText(_translate("MainWindow", "El esfuerzo es de:")) | |
self.label.setText(_translate("MainWindow", "Calculo de la carga actuante")) | |
self.label_longitud.setText(_translate("MainWindow", "Longitud")) | |
self.label_carga_propuesta.setText(_translate("MainWindow", "Carga Propuesta")) | |
self.enviar.setText(_translate("MainWindow", "Calcular")) | |
self.label_2.setText(_translate("MainWindow", "Material")) | |
def mostrar_material_seleccionado(self): | |
indices_seleccionados = self.materiales.selectedIndexes() | |
if indices_seleccionados: | |
indice = indices_seleccionados[0] | |
material_seleccionado = self.modelo_materiales.itemFromIndex(indice).text() | |
longitud = self.longitud.text() | |
self.statusbar.showMessage(f'Material seleccionado: {material_seleccionado}') | |
self.resultado.setText(f"Material seleccionado: {material_seleccionado} la longitud es de: {longitud}") | |
self.resultado.setVisible(True) | |
if __name__ == "__main__": | |
import sys | |
app = QtWidgets.QApplication(sys.argv) | |
MainWindow = QtWidgets.QMainWindow() | |
ui = Ui_MainWindow() | |
ui.setupUi(MainWindow) | |
MainWindow.show() | |
sys.exit(app.exec_()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment