Skip to content

Commit

Permalink
Status criação
Browse files Browse the repository at this point in the history
  • Loading branch information
DankoCaboski committed Jun 13, 2024
1 parent e425e94 commit 1b70e7e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
13 changes: 9 additions & 4 deletions Core/Controller/OpennessController.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from System.IO import FileInfo # type: ignore
import tkinter as tk

RPA_status = ""
RPA_status = "Idle"
hardwareList = []
myproject = None

Expand Down Expand Up @@ -45,12 +45,13 @@ def create_project(project_path, project_name, hardware, rb_blocks_value, gp_blo

RPA_status = 'Project created successfully!'
print(RPA_status)
return

return True

except Exception as e:
RPA_status = f'Error: {e}'
print(RPA_status)
return
return False


def addHardware(hardware):
Expand All @@ -66,6 +67,7 @@ def addHardware(hardware):


def wire_profinet():
global RPA_status
ProfinetInterfaces = OpennessService.GetAllProfinetInterfaces(myproject)
print("N de interfaces PROFINET: ", len(ProfinetInterfaces))

Expand All @@ -76,7 +78,7 @@ def wire_profinet():
OpennessService.ConnectToSubnet(node, mysubnet)

myproject.Save()

RPA_status = "Rede PROFINET configurada com sucesso!"
print(RPA_status)

Expand All @@ -86,6 +88,7 @@ def wire_profinet():


def open_project(project_path):
global RPA_status
RPA_status = 'Opening project'
print(RPA_status)
try:
Expand All @@ -100,6 +103,7 @@ def open_project(project_path):
return

def export_Block(PlcSoftware):
global RPA_status
RPA_status = 'Exporting block'
print(RPA_status)
try:
Expand All @@ -110,6 +114,7 @@ def export_Block(PlcSoftware):
return

def export_data_type(cpu, data_type_name : str, data_type_path : str):
global RPA_status
RPA_status = 'Exporting data type'
print(RPA_status)

Expand Down
24 changes: 14 additions & 10 deletions Core/Screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,33 @@ def CreateProject():
project_name = project_name_var.get()
global selected_version, project_dir
if not UserConfig.CheckDll(selected_version):
label_status.config(text="Erro: Dll não configurada para esta versão do TIA")
label_status_projeto.config(text="Erro: Dll não configurada para esta versão do TIA")
return

if not validate_all_device_names():
label_status.config(text="Erro: Há nomes de dispositivos duplicados. Por favor, verifique.")
label_status_projeto.config(text="Erro: Há nomes de dispositivos duplicados. Por favor, verifique.")
return

if project_name and project_dir:
devices = []
for linha in InfoHardware:
devices.append({"HardwareType": linha["combobox"].get(), "Mlfb":linha["mlfb"].get(), "Name": linha["entry"].get()})
label_status.config(text="Criando projeto...")
OpennessController.create_project(project_dir, project_name, devices, rb_blocks_value, gp_blocks_value)

label_status_projeto.config(text="Criando projeto...")
status_criacao = OpennessController.create_project(project_dir, project_name, devices, rb_blocks_value, gp_blocks_value)
if status_criacao:
label_status_projeto.config(text="Projeto criado com sucesso!")
else:
label_status_projeto.config(text="Falha ao criar projeto")

else:
label_status.config(text="Erro: Nome do projeto ou diretório não informados")
label_status_projeto.config(text="Erro: Nome do projeto ou diretório não informados")

def opn_project():
project_path = open_file_dialog()
if project_path != None and project_path != '':
open_project(project_path)
else:
label_status.config(text="Erro: Projeto não selecionado")
label_status_projeto.config(text="Erro: Projeto não selecionado")

def open_directory_project_dialog():
global project_dir
Expand Down Expand Up @@ -237,9 +241,9 @@ def main_screen():
screen_frames.append(hardwareConfig)

global RAP_status_Tela
global label_status
label_status = tk.Label(root, text="Nome do projeto: " + RAP_status_Tela)
label_status.pack(padx=5, pady=5)
global label_status_projeto
label_status_projeto = tk.Label(root, text="Status: " + RAP_status_Tela)
label_status_projeto.pack(padx=5, pady=5)

# Carregar a imagem
load_image(root, r"./logo.png")
Expand Down

0 comments on commit 1b70e7e

Please sign in to comment.