|
|
@@ -16,6 +16,7 @@ from extraer_comb import *
|
|
|
import threading
|
|
|
import time
|
|
|
|
|
|
+entry_nombre_carga_widgets = {}
|
|
|
|
|
|
|
|
|
# Códigos ANSI de color
|
|
|
@@ -1057,7 +1058,7 @@ def crear_ventana_cargas(parent):
|
|
|
"""Crea una ventana gráfica para definición de cargas"""
|
|
|
ventana_cargas = tk.Toplevel(parent)
|
|
|
ventana_cargas.title("Definición de Cargas")
|
|
|
- ventana_cargas.geometry("500x400")
|
|
|
+ ventana_cargas.geometry("1000x400")
|
|
|
ventana_cargas.attributes('-topmost', True)
|
|
|
ventana_cargas.attributes('-topmost', False)
|
|
|
script_dir = os.path.dirname(os.path.abspath(__file__))
|
|
|
@@ -1079,14 +1080,102 @@ def crear_ventana_cargas(parent):
|
|
|
scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
|
|
|
hscrollbar.pack(side=tk.BOTTOM, fill=tk.X)
|
|
|
label_lista_cargas.pack(side =tk.LEFT, padx=5, pady=5)
|
|
|
- frame.pack()
|
|
|
+ frame.pack(side=tk.LEFT, anchor=tk.N)
|
|
|
+
|
|
|
+ frame_derecha = tk.Frame(ventana_cargas)
|
|
|
+ frame_derecha.pack(side=tk.LEFT, anchor=tk.N, padx=20, pady=10, fill = tk.Y)
|
|
|
+
|
|
|
+ frame_creacion = tk.Frame(frame_derecha)
|
|
|
+ frame_creacion.pack(side=tk.TOP, anchor=tk.N)
|
|
|
+
|
|
|
+ frame_texto_nombre = tk.Frame(frame_creacion)
|
|
|
+ frame_texto_nombre.pack(side=tk.LEFT, anchor=tk.N, padx=20)
|
|
|
+ tk.Label(frame_texto_nombre, text = 'Nombre del caso de carga:').pack()
|
|
|
+ entry_nombre_carga = tk.Entry(frame_texto_nombre, width=25)
|
|
|
+ entry_nombre_carga.insert(0, "H1. PP")
|
|
|
+ entry_nombre_carga.pack()
|
|
|
+ entry_nombre_carga_widgets[0] = entry_nombre_carga
|
|
|
+
|
|
|
+ frame_texto_Accion = tk.Frame(frame_creacion)
|
|
|
+ frame_texto_Accion.pack(side=tk.LEFT, anchor=tk.N, padx=5)
|
|
|
+ tk.Label(frame_texto_Accion, text = 'Acción:').pack()
|
|
|
+ var_Accion = tk.StringVar(value="Resto")
|
|
|
+ combo_Accion = tk.ttk.Combobox(frame_texto_Accion, textvariable=var_Accion,
|
|
|
+ values=["Resto", "Trafico", "Sismo"], state="readonly", width=15)
|
|
|
+ combo_Accion.pack(side=tk.LEFT)
|
|
|
+ entry_nombre_carga_widgets[1] = var_Accion
|
|
|
+
|
|
|
+ frame_texto_Direccion = tk.Frame(frame_creacion)
|
|
|
+ frame_texto_Direccion.pack(side=tk.LEFT, anchor=tk.N, padx=5)
|
|
|
+ tk.Label(frame_texto_Direccion, text = 'Dirección:').pack()
|
|
|
+ var_Direccion = tk.StringVar(value="Desfavorable")
|
|
|
+ combo_Direccion = tk.ttk.Combobox(frame_texto_Direccion, textvariable=var_Direccion,
|
|
|
+ values=["Favorable", "Desfavorable"], state="readonly", width=15)
|
|
|
+ combo_Direccion.pack(side=tk.LEFT)
|
|
|
+ entry_nombre_carga_widgets[2] = var_Direccion
|
|
|
+
|
|
|
+
|
|
|
+ frame_texto_Tipo = tk.Frame(frame_creacion)
|
|
|
+ frame_texto_Tipo.pack(side=tk.LEFT, anchor=tk.N, padx=5)
|
|
|
+ tk.Label(frame_texto_Tipo, text = 'Tipo:').pack()
|
|
|
+ var_Tipo = tk.StringVar(value="Constante")
|
|
|
+ combo_Tipo = tk.ttk.Combobox(frame_texto_Tipo, textvariable=var_Tipo,
|
|
|
+ values=["Constante", "No constante", "Variable", "Accidental"],
|
|
|
+ state="readonly", width=15)
|
|
|
+ combo_Tipo.pack(side=tk.LEFT)
|
|
|
+ entry_nombre_carga_widgets[3] = var_Tipo
|
|
|
+
|
|
|
+
|
|
|
+ frame_texto_Permanente = tk.Frame(frame_creacion)
|
|
|
+ frame_texto_Permanente.pack(side=tk.LEFT, anchor=tk.N, padx=5)
|
|
|
+ tk.Label(frame_texto_Permanente, text = 'Permanente:').pack()
|
|
|
+ var_Permanente = tk.BooleanVar(value=False)
|
|
|
+ check_Permanente = tk.Checkbutton(frame_texto_Permanente, variable=var_Permanente)
|
|
|
+ check_Permanente.pack(side=tk.LEFT)
|
|
|
+ entry_nombre_carga_widgets[4] = var_Permanente
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ frame_texto_Bidireccional = tk.Frame(frame_creacion)
|
|
|
+ frame_texto_Bidireccional.pack(side=tk.LEFT, anchor=tk.N, padx=5)
|
|
|
+ tk.Label(frame_texto_Bidireccional, text = 'Bidireccional:').pack()
|
|
|
+ var_Bidireccional = tk.BooleanVar(value=False)
|
|
|
+ check_Bidireccional = tk.Checkbutton(frame_texto_Bidireccional, variable=var_Bidireccional)
|
|
|
+ check_Bidireccional.pack(side=tk.LEFT)
|
|
|
+ entry_nombre_carga_widgets[5] = var_Bidireccional
|
|
|
+
|
|
|
+
|
|
|
+ def on_crear_carga():
|
|
|
+ nombre_carga = entry_nombre_carga.get()
|
|
|
+ accion = var_Accion.get()
|
|
|
+ direccion = var_Direccion.get()
|
|
|
+ tipo = var_Tipo.get()
|
|
|
+ permanente = var_Permanente.get()
|
|
|
+ bidireccional = var_Bidireccional.get()
|
|
|
+ if not nombre_carga:
|
|
|
+ tk.messagebox.showerror("Error", "El nombre del caso de carga no puede estar vacío.")
|
|
|
+ return
|
|
|
+ if nombre_carga in label_lista_cargas.get(0, tk.END):
|
|
|
+ tk.messagebox.showerror("Error", "Ya existe un caso de carga con ese nombre.")
|
|
|
+ return
|
|
|
+ # Aquí se pueden añadir más validaciones según sea necesario
|
|
|
+ label_lista_cargas.insert(tk.END, nombre_carga)
|
|
|
+ # Aquí se pueden guardar los detalles de la carga en una estructura de datos si es necesario
|
|
|
+
|
|
|
+ frame_boton = tk.Frame(frame_derecha)
|
|
|
+ frame_boton.pack(side=tk.TOP, padx = 20, pady=20, fill=tk.X)
|
|
|
+ boton_crear_carga = tk.Button(frame_boton, text="Crear caso de carga", command=on_crear_carga, font=("Arial", 11), bg="#3DD800", fg="white", padx=10, pady=5)
|
|
|
+ boton_crear_carga.pack(pady=20)
|
|
|
+
|
|
|
+
|
|
|
|
|
|
ruta_excel = "C:/Users/Daniel.p/Documents/2. Petrucco/114. A 1472 R1 Campo de Criptana/3. Calculo/2. Cajon/SAP/Comb_acciones.xlsx"
|
|
|
compatibilidades_df, restricciones_df =extraer_datos_excel(ruta_excel)
|
|
|
label_lista_cargas.insert(tk.END, *restricciones_df.loc[:, "Definición de 'Load Cases'"])
|
|
|
|
|
|
def on_double_click(event):
|
|
|
- print("hola")
|
|
|
+ indices = label_lista_cargas.curselection()
|
|
|
+ print(label_lista_cargas.get(indices))
|
|
|
|
|
|
label_lista_cargas.bind('<Double-Button-1>', on_double_click)
|
|
|
|