OpenCores
URL https://opencores.org/ocsvn/phr/phr/trunk

Subversion Repositories phr

[/] [phr/] [trunk/] [codigo/] [gui/] [windows/] [gui/] [phr-gui.py] - Diff between revs 211 and 217

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 211 Rev 217
Line 4... Line 4...
 
 
import wx
import wx
# imports by maximiq
# imports by maximiq
import os          # se usa para el dialogo de abrir fichero
import os          # se usa para el dialogo de abrir fichero
import subprocess  # para interactuar con el shell
import subprocess  # para interactuar con el shell
 
import thread      # to prevent gui blocking
 
 
#####################################
#####################################
# Para que funcione mejor en Linux
# Para que funcione mejor en Linux
#import os
#import os
 
 
Line 112... Line 113...
        description = """
        description = """
PHR GUI es una interfaz grafica que permite interactuar con
PHR GUI es una interfaz grafica que permite interactuar con
la Plataforma de Hardware Reconfigurable (desarrollada en el
la Plataforma de Hardware Reconfigurable (desarrollada en el
CUDAR) a traves del software xc3sprog.
CUDAR) a traves del software xc3sprog.
 
 
Revision (SVN) 209.
Revision (SVN) 217.
 
(EN DESARROLLO)
"""
"""
 
 
        licence = """
        licence = """
PHR GUI is free software; you can redistribute it and/or modify
PHR GUI is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as
it under the terms of the GNU General Public License as
Line 189... Line 191...
 
 
        dialog.Destroy()
        dialog.Destroy()
 
 
        event.Skip()
        event.Skip()
 
 
    def boton_conf_fpga(self, event): # wxGlade: MyFrame.<event_handler>
    def before_run (self):
        #funcion editada por maximiq
        ## preparar entorno para los eventos conf_fpga prog_prom comprobar_conexion
 
 
        ## preparar entorno
 
        self.button_conf_fpga.Disable()
        self.button_conf_fpga.Disable()
        self.button_prog_prom.Disable()
        self.button_prog_prom.Disable()
        self.button_conection.Disable()
        self.button_conection.Disable()
        self.button_empty.Disable()
        self.button_empty.Disable()
        self.frame_1_statusbar.SetFields(["Espere ..."])
        self.frame_1_statusbar.SetFields(["Espere ..."])
 
 
 
    def after_run (self):
 
        ## restaurar entorno 
 
        self.button_conf_fpga.Enable()
 
        self.button_prog_prom.Enable()
 
        self.button_conection.Enable()
 
        self.button_empty.Enable()
 
        self.frame_1_statusbar.SetFields(["Listo"])
 
 
 
    def boton_conf_fpga_thread(self):
 
        ## preparar entorno
 
        wx.CallAfter(self.before_run)
 
 
        ## accion
        ## accion
        # se copia el fichero de programacion al directorio local
        # se copia el fichero de programacion al directorio local
        subprocess.call ("copy \"" + self.text_ctrl_file.GetValue() + "\" fpgaFile", shell=True)
        subprocess.call ("copy \"" + self.text_ctrl_file.GetValue() + "\" fpgaFile", shell=True)
 
 
        # se ejecuta el xc3sprog
        # se ejecuta el xc3sprog
        command = "xc3sprog\\xc3sprog -v -L -c ftdi -p 0 fpgaFile:w:0:BIT"
        command = "xc3sprog\\xc3sprog -v -L -c ftdi -p 0 fpgaFile:w:0:BIT"
 
 
        self.text_ctrl_console.AppendText(command + "\n")
        wx.CallAfter(self.text_ctrl_console.AppendText, command + "\n")
 
 
        process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
        process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
 
        for line in iter(process.stdout.readline, ''):
        for line in iter(process.stdout.readline, ''):
            self.text_ctrl_console.AppendText(line)
            wx.CallAfter(self.text_ctrl_console.AppendText, line)
        process.stdout.close()
        process.stdout.close()
 
 
        self.text_ctrl_console.AppendText("\nPHR>>> ")
        wx.CallAfter(self.text_ctrl_console.AppendText, "\nPHR>>> ")
 
 
        ## restaurar entorno 
        ## restaurar entorno 
        self.button_conf_fpga.Enable()
        wx.CallAfter(self.after_run)
        self.button_prog_prom.Enable()
 
        self.button_conection.Enable()
 
        self.button_empty.Enable()
 
        self.frame_1_statusbar.SetFields(["Listo"])
 
 
 
 
    def boton_conf_fpga(self, event): # wxGlade: MyFrame.<event_handler>
 
        #funcion editada por maximiq
 
        thread.start_new_thread(self.boton_conf_fpga_thread, ())
        event.Skip()
        event.Skip()
 
 
    def boton_prog_prom(self, event): # wxGlade: MyFrame.<event_handler>
    def boton_prog_prom_thread(self):
        #funcion editada por maximiq
        #funcion editada por maximiq
 
 
        ## preparar entorno
        ## preparar entorno
        self.button_conf_fpga.Disable()
        wx.CallAfter(self.before_run)
        self.button_prog_prom.Disable()
 
        self.button_conection.Disable()
 
        self.button_empty.Disable()
 
        self.frame_1_statusbar.SetFields(["Espere ..."])
 
 
 
        ## accion
        ## accion
 
 
        # se copia el fichero de programacion al directorio local
        # se copia el fichero de programacion al directorio local
        subprocess.call ("copy \"" + self.text_ctrl_file.GetValue() + "\" fpgaFile", shell=True)
        subprocess.call ("copy \"" + self.text_ctrl_file.GetValue() + "\" fpgaFile", shell=True)
 
 
        command = "xc3sprog\\xc3sprog.exe -v -L -c ftdi -p 1 fpgaFile:w:0:BIT"
        command = "xc3sprog\\xc3sprog.exe -v -L -c ftdi -p 1 fpgaFile:w:0:BIT"
 
 
        self.text_ctrl_console.AppendText(command + "\n")
        wx.CallAfter(self.text_ctrl_console.AppendText, command + "\n")
 
 
        process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
        process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
 
        line = ''
        line = ''
        while True:
        while True:
Line 254... Line 262...
            if out == '' and process.poll() != None:
            if out == '' and process.poll() != None:
                break
                break
            if out != '' and out != '\x0a':
            if out != '' and out != '\x0a':
                line = line + out
                line = line + out
                if out == '\x0d':
                if out == '\x0d':
                    self.text_ctrl_console.AppendText(line)
                    wx.CallAfter(self.text_ctrl_console.AppendText, line)
                    line = ''
                    line = ''
 
 
        self.text_ctrl_console.AppendText("\nPHR>>> ")
        wx.CallAfter(self.text_ctrl_console.AppendText, "\nPHR>>> ")
 
 
        ## restaurar entorno 
        ## restaurar entorno 
        self.button_conf_fpga.Enable()
        wx.CallAfter(self.after_run)
        self.button_prog_prom.Enable()
 
        self.button_conection.Enable()
 
        self.button_empty.Enable()
 
        self.frame_1_statusbar.SetFields(["Listo"])
 
 
 
        event.Skip()
 
 
 
    def boton_conexion(self, event): # wxGlade: MyFrame.<event_handler>
    def boton_prog_prom(self, event): # wxGlade: MyFrame.<event_handler>
        #funcion editada por maximiq
        #funcion editada por maximiq
 
        thread.start_new_thread(self.boton_prog_prom_thread, ())
 
        event.Skip()
 
 
 
    def boton_conexion_thread (self):
        ## preparar entorno
        ## preparar entorno
        self.button_conf_fpga.Disable()
        wx.CallAfter(self.before_run, )
        self.button_prog_prom.Disable()
 
        self.button_conection.Disable()
 
        self.button_empty.Disable()
 
        self.frame_1_statusbar.SetFields(["Espere ..."])
 
 
 
        ## accion
        ## accion
        command = "xc3sprog\\xc3sprog -c ftdi -L -j -v"  # the shell command
        command = "xc3sprog\\xc3sprog -c ftdi -L -j -v"  # the shell command
 
 
        self.text_ctrl_console.AppendText(command + "\n")
        wx.CallAfter(self.text_ctrl_console.AppendText, command + "\n")
 
 
        process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
        process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
 
        for line in iter(process.stdout.readline, ''):
        for line in iter(process.stdout.readline, ''):
            self.text_ctrl_console.AppendText(line)
            wx.CallAfter(self.text_ctrl_console.AppendText, line)
        process.stdout.close()
        process.stdout.close()
 
 
        self.text_ctrl_console.AppendText("\nPHR>>> ")
        wx.CallAfter(self.text_ctrl_console.AppendText, "\nPHR>>> ")
 
 
        ## restaurar entorno 
        ## restaurar entorno 
        self.button_conf_fpga.Enable()
        wx.CallAfter(self.after_run, )
        self.button_prog_prom.Enable()
 
        self.button_conection.Enable()
 
        self.button_empty.Enable()
 
        self.frame_1_statusbar.SetFields(["Listo"])
 
 
 
 
    def boton_conexion(self, event): # wxGlade: MyFrame.<event_handler>
 
        #funcion editada por maximiq
 
        thread.start_new_thread(self.boton_conexion_thread, ())
        event.Skip()
        event.Skip()
 
 
    def boton_borrar(self, event): # wxGlade: MyFrame.<event_handler>
    def boton_borrar(self, event): # wxGlade: MyFrame.<event_handler>
        #funcion editada por maximiq
        #funcion editada por maximiq
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.