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

Subversion Repositories phr

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /phr/trunk/codigo/gui/linux
    from Rev 213 to Rev 217
    Reverse comparison

Rev 213 → Rev 217

/phr-gui.py
6,6 → 6,7
# imports by maximiq
import os # se usa para el dialogo de abrir fichero
import subprocess # para interactuar con el shell
import thread # to prevent gui blocking
 
#####################################
# Para que funcione mejor en Linux
191,15 → 192,25
 
event.Skip()
 
def boton_conf_fpga(self, event): # wxGlade: MyFrame.<event_handler>
#funcion editada por maximiq
 
## preparar entorno
def before_run (self):
## preparar entorno para los eventos conf_fpga prog_prom comprobar_conexion
self.button_conf_fpga.Disable()
self.button_prog_prom.Disable()
self.button_conection.Disable()
self.button_empty.Disable()
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
# se copia el fichero de programacion al directorio local
208,48 → 219,43
# se ejecuta el xc3sprog
command = "./xc3sprog/xc3sprog -v -c ftdi -p 0 \""+ self.text_ctrl_file.GetValue() + "\":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)
 
for line in iter(process.stdout.readline, ''):
self.text_ctrl_console.AppendText(line)
wx.CallAfter(self.text_ctrl_console.AppendText, line)
process.stdout.close()
 
self.text_ctrl_console.AppendText("\nPHR>>> ")
wx.CallAfter(self.text_ctrl_console.AppendText, "\nPHR>>> ")
 
## 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"])
wx.CallAfter(self.after_run)
 
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()
 
def boton_prog_prom(self, event): # wxGlade: MyFrame.<event_handler>
def boton_prog_prom_thread(self):
#funcion editada por maximiq
 
## preparar entorno
self.button_conf_fpga.Disable()
self.button_prog_prom.Disable()
self.button_conection.Disable()
self.button_empty.Disable()
self.frame_1_statusbar.SetFields(["Espere ..."])
wx.CallAfter(self.before_run)
## accion
 
# se copia el fichero de programacion al directorio local
#subprocess.call ("copy \"" + self.text_ctrl_file.GetValue() + "\" fpgaFile", shell=True)
 
command = "./xc3sprog/xc3sprog -v -c ftdi -p 1 \"" + self.text_ctrl_file.GetValue() + "\":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)
 
for line in iter(process.stdout.readline, ''):
self.text_ctrl_console.AppendText(line)
wx.CallAfter(self.text_ctrl_console.AppendText, line)
process.stdout.close()
# line = ''
# while True:
262,47 → 268,41
# self.text_ctrl_console.AppendText(line)
# line = ''
self.text_ctrl_console.AppendText("\nPHR>>> ")
wx.CallAfter(self.text_ctrl_console.AppendText, "\nPHR>>> ")
 
## 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"])
event.Skip()
wx.CallAfter(self.after_run)
 
def boton_conexion(self, event): # wxGlade: MyFrame.<event_handler>
 
def boton_prog_prom(self, event): # wxGlade: MyFrame.<event_handler>
#funcion editada por maximiq
thread.start_new_thread(self.boton_prog_prom_thread, ())
event.Skip()
 
def boton_conexion_thread (self):
## preparar entorno
self.button_conf_fpga.Disable()
self.button_prog_prom.Disable()
self.button_conection.Disable()
self.button_empty.Disable()
self.frame_1_statusbar.SetFields(["Espere ..."])
wx.CallAfter(self.before_run, )
## accion
command = "./xc3sprog/xc3sprog -c ftdi" # 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)
 
for line in iter(process.stdout.readline, ''):
self.text_ctrl_console.AppendText(line)
wx.CallAfter(self.text_ctrl_console.AppendText, line)
process.stdout.close()
 
self.text_ctrl_console.AppendText("\nPHR>>> ")
wx.CallAfter(self.text_ctrl_console.AppendText, "\nPHR>>> ")
 
## 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"])
wx.CallAfter(self.after_run, )
 
 
def boton_conexion(self, event): # wxGlade: MyFrame.<event_handler>
#funcion editada por maximiq
thread.start_new_thread(self.boton_conexion_thread, ())
event.Skip()
 
def boton_borrar(self, event): # wxGlade: MyFrame.<event_handler>

powered by: WebSVN 2.1.0

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