Skip to content

Commit

Permalink
Estructura finalizada
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian-Martinez-Rincon committed Dec 29, 2023
1 parent d8286a5 commit 46e3aac
Show file tree
Hide file tree
Showing 32 changed files with 84 additions and 1,622 deletions.
File renamed without changes.
Binary file added assets/Fortuna.xlsx
Binary file not shown.
File renamed without changes.
File renamed without changes.
37 changes: 37 additions & 0 deletions assets/data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import pandas as pd
import re
from tkinter import filedialog
import os

SIMBOLS_REGEX = re.compile(r'^SIMBOLO\.?\d*$')
ROLLER_REGEX = re.compile(r'^R\d+$')

def process_excel(file_name):
try:
DATOS = pd.read_excel(file_name, sheet_name=1)

SIMBOLS = list(filter(SIMBOLS_REGEX.match, DATOS.columns.values))
ROLLERS = list(filter(ROLLER_REGEX.match, DATOS.columns.values))

except FileNotFoundError:
print(f"La ruta del archivo no existe: {file_name}")
except Exception as e:
print(f"Error al procesar {file_name}: {str(e)}")
else:
print(f"Procesado {file_name} correctamente")

# Define file paths to save the JSON files
simbols_path = os.path.splitext(file_name)[0] + '_simbols.json'
rollers_path = os.path.splitext(file_name)[0] + '_rollers.json'

# Save JSON files
DATOS.loc[:, SIMBOLS].to_json(simbols_path, orient='records', indent=4)
DATOS.loc[:, ROLLERS].to_json(rollers_path, orient='records', indent=4)

return simbols_path, rollers_path

file_path = filedialog.askopenfilename(title="Seleccionar archivo", filetypes=[("Archivos de texto", "*.xlsx")])
simbols, rollers = process_excel(file_path)

print(f"Simbols saved to: {simbols}")
print(f"Rollers saved to: {rollers}")
File renamed without changes.
74 changes: 47 additions & 27 deletions gui_app/main_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import pandas as pd
import pygetwindow as gw
import pyautogui
import time
from tkinter import messagebox


Expand All @@ -24,6 +23,17 @@ def search_window(window):

ventana.activate()
return True


def actual_data(result_label_rollers, result_label_simbol, indice, simbols, rollers):

rollers = eval(rollers)
values = ",".join(str(value) for value in rollers[indice].values())
result_label_rollers.config(text=f"{values}")

simbols = eval(simbols)
simbols = ",".join(str(value) for value in simbols[indice].values())
result_label_simbol.config(text=f"{simbols}")

def actions(result_label_rollers, result_label_simbol, indice, simbols, rollers):

Expand Down Expand Up @@ -115,11 +125,11 @@ def press_button_manual(self, next_button):
"""

if not self.rollers:
self.mostrar_error_temporal("Seleccione un archivo")
messagebox.showinfo("Error", "Seleccione un archivo")
return

if not self.window_current:
self.mostrar_error_temporal("Ingrese una ventana")
messagebox.showinfo("Error","Ingrese una ventana")
return

if not search_window(self.window_current):
Expand Down Expand Up @@ -160,52 +170,61 @@ def create_widgets(self):
button_style = {"font": ("Helvetica", 10), "bd": 2, "relief": tk.GROOVE}

self.file_button = tk.Button(self, text="SELECCIONAR ARCHIVO", command=self.open_file_dialog, **button_style)
self.file_button.grid(row=0, column=2, pady=10, padx=10, columnspan=2)
self.file_button.grid(row=0, column=0, pady=10, padx=10, columnspan=5)

self.auto_title_label = tk.Label(self, text="AUTOMATICO", font=("Helvetica", 12, "bold"), bg="#add8e6")
self.auto_title_label.grid(row=1, column=2, pady=10, padx=10, columnspan=2)
self.auto_title_label = tk.Label(self, text="AUTO", font=("Helvetica", 10, "bold"), bg="#add8e6")
self.auto_title_label.grid(row=1, column=0, pady=10, padx=10, columnspan=2)

self.auto_on_button = tk.Checkbutton(self, text="Activar", command=self.toggle_auto)
self.auto_on_button.grid(row=2, column=3, pady=10, padx=10)

self.auto_title_label = tk.Label(self, text="Tradicional", font=("Helvetica", 12, "bold"), bg="#add8e6")
self.auto_title_label.grid(row=3, column=2, pady=10, padx=10, columnspan=2)
self.auto_on_button = tk.Checkbutton(self, text="ACTIVAR", command=self.toggle_auto)
self.auto_on_button.grid(row=2, column=0, pady=10, padx=10, columnspan=2)

self.next_button = tk.Button(self, text="SIGUIENTE", command=lambda: self.press_button_manual(self.next_button), **button_style)
self.next_button.grid(row=4, column=2, pady=10, padx=10, columnspan=2)
self.auto_title_label = tk.Label(self, text="MANUAL", font=("Helvetica", 10, "bold"), bg="#add8e6")
self.auto_title_label.grid(row=1, column=2, pady=10, padx=10, columnspan=2)

self.next_button = tk.Button(self, text="INGRESAR", command=lambda: self.press_button_manual(self.next_button), **button_style)
self.next_button.grid(row=2, column=2, pady=10, padx=10, columnspan=2)

self.window_label = tk.Label(self, text="VENTANA:", bg="#add8e6")
self.window_label.grid(row=5, column=0, pady=10, padx=10, columnspan=2)
self.window_label = tk.Label(self, text="VENTANA", bg="#add8e6")
self.window_label.grid(row=3, column=0, pady=10, padx=10, columnspan=2)

self.window_entry = tk.Entry(self)
self.window_entry.grid(row=5, column=2, pady=10, padx=10 , columnspan=2)
self.window_entry.grid(row=4, column=0, pady=10, padx=10 , columnspan=2)

self.show_window_button = tk.Button(self, text="Confirmar", command=self.update_window_index, **button_style)
self.show_window_button.grid(row=5, column=4, pady=10, padx=10, columnspan=2)
self.show_window_button.grid(row=5, column=0, pady=10, padx=10, columnspan=2)

self.custom_index_label = tk.Label(self, text="INDICE NUEVO:", bg="#add8e6")
self.custom_index_label.grid(row=6, column=0, pady=10, padx=10 , columnspan=2)
self.custom_index_label = tk.Label(self, text="INDICE NUEVO", bg="#add8e6")
self.custom_index_label.grid(row=3, column=2, pady=10, padx=10 , columnspan=2)

self.custom_index_entry = tk.Entry(self)
self.custom_index_entry.grid(row=6, column=2, pady=10, padx=10, columnspan=2)
self.custom_index_entry.grid(row=4, column=2, pady=10, padx=10, columnspan=2)

self.update_custom_index_button = tk.Button(self, text="ACTUALIZAR", command=self.update_custom_index, **button_style)
self.update_custom_index_button.grid(row=6, column=4, pady=10, padx=10 , columnspan=2)
self.update_custom_index_button.grid(row=5, column=2, pady=10, padx=10 , columnspan=2)

self.auto_title_label = tk.Label(self, text="DATOS CONFIRMADOS", font=("Helvetica", 12, "bold"), bg="#add8e6")
self.auto_title_label.grid(row=7, column=2, pady=10, padx=10, columnspan=2)
self.auto_title_label = tk.Label(self, text="DATOS INGRESADOS", bg="#add8e6")
self.auto_title_label.grid(row=6, column=0, pady=10, padx=10, columnspan=2)

self.result_label_simbol = tk.Label(self, text="W, W, W, W, W")
self.result_label_simbol.grid(row=8, column=1, pady=10, padx=10, columnspan=2)
self.result_label_simbol.grid(row=7, column=0, pady=10, padx=10, columnspan=2)

self.result_label_rollers = tk.Label(self, text="1, 1, 1, 1, 1")
self.result_label_rollers.grid(row=8, column=3, pady=10, padx=10, columnspan=2)
self.result_label_rollers.grid(row=8, column=0, pady=10, padx=10, columnspan=2)

self.auto_title_label = tk.Label(self, text="INDICE DATOS", bg="#add8e6")
self.auto_title_label.grid(row=6, column=2, pady=10, padx=10, columnspan=2)

self.result_label_simbol2 = tk.Label(self, text="W, W, W, W, W")
self.result_label_simbol2.grid(row=7, column=2, pady=10, padx=10, columnspan=2)

self.result_label_rollers2 = tk.Label(self, text="1, 1, 1, 1, 1")
self.result_label_rollers2.grid(row=8, column=2, pady=10, padx=10, columnspan=2)

self.index_label = tk.Label(self, text=f"INDICE : {self.index_current}")
self.index_label.grid(row=9, column=2, pady=10, padx=10, columnspan=2)
self.index_label.grid(row=9, column=0, pady=10, padx=10, columnspan=5)

self.close_button = tk.Button(self, text="Cerrar", command=self.master.destroy, **button_style)
self.close_button.grid(row=10, column=2, pady=10, padx=10, columnspan=2)
self.close_button.grid(row=10, column=0, pady=10, padx=10, columnspan=5)

def update_window_label(self):
self.window_label.config(text=f"{self.window_current}")
Expand All @@ -225,6 +244,7 @@ def update_custom_index(self):
try:
new_index = int(self.custom_index_entry.get())
self.index_current = new_index
actual_data(self.result_label_rollers2, self.result_label_simbol2, self.index_current, self.simbols, self.rollers)
self.update_index_label()
except ValueError:
print("Ingrese un valor numérico para el índice personalizado.")
22 changes: 0 additions & 22 deletions otros.py/app.py

This file was deleted.

99 changes: 0 additions & 99 deletions otros.py/app2.py

This file was deleted.

Loading

0 comments on commit 46e3aac

Please sign in to comment.