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
- from Rev 330 to Rev 331
- ↔ Reverse comparison
Rev 330 → Rev 331
/gui/phr-gui-linux.tar.gz
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/gui/xin/guiparent.py
0,0 → 1,125
#!/usr/bin/env python |
# -*- coding: utf-8 -*- |
# generated by wxGlade 0.6.5 on Sun Jun 8 15:52:19 2014 |
|
import wx |
|
# begin wxGlade: extracode |
# some extra code appended by maximiq |
# end wxGlade |
|
|
class guiParent(wx.Frame): |
def __init__(self, *args, **kwds): |
# begin wxGlade: guiParent.__init__ |
kwds["style"] = wx.DEFAULT_FRAME_STYLE |
wx.Frame.__init__(self, *args, **kwds) |
|
# Menu Bar |
self.menubar = wx.MenuBar() |
wxglade_tmp_menu = wx.Menu() |
self.menu_item_ayuda_hint = wx.MenuItem(wxglade_tmp_menu, wx.NewId(), "&Hint", "", wx.ITEM_NORMAL) |
wxglade_tmp_menu.AppendItem(self.menu_item_ayuda_hint) |
self.menu_item_ayuda_acerca_de = wx.MenuItem(wxglade_tmp_menu, wx.NewId(), "Acerca &de", "", wx.ITEM_NORMAL) |
wxglade_tmp_menu.AppendItem(self.menu_item_ayuda_acerca_de) |
self.menubar.Append(wxglade_tmp_menu, "&Ayuda") |
self.SetMenuBar(self.menubar) |
# Menu Bar end |
self.statusbar = self.CreateStatusBar(1, 0) |
self.label_1 = wx.StaticText(self, -1, "Dispositivos conectados") |
self.boton_detectar = wx.Button(self, -1, "&Detectar") |
self.list_box_dispositivos_conectados = wx.ListBox(self, -1, choices=[]) |
self.label_2 = wx.StaticText(self, -1, "Fichero de configuracion/programacion") |
self.boton_elegir_fichero = wx.Button(self, -1, "&Elegir") |
self.text_ctrl_fichero = wx.TextCtrl(self, -1, "") |
self.boton_transferir = wx.Button(self, -1, "&Transferir") |
self.text_ctrl_console = wx.TextCtrl(self, -1, "PHR>>>", style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL) |
self.boton_borrar_salida = wx.Button(self, -1, "&Borrar salida") |
|
self.__set_properties() |
self.__do_layout() |
|
self.Bind(wx.EVT_MENU, self.menu_item_ayuda_hint_handler, self.menu_item_ayuda_hint) |
self.Bind(wx.EVT_MENU, self.menu_item_ayuda_acerca_de_handler, self.menu_item_ayuda_acerca_de) |
self.Bind(wx.EVT_BUTTON, self.boton_detectar_handler, self.boton_detectar) |
self.Bind(wx.EVT_BUTTON, self.boton_elegir_fichero_handler, self.boton_elegir_fichero) |
self.Bind(wx.EVT_BUTTON, self.boton_transferir_handler, self.boton_transferir) |
self.Bind(wx.EVT_BUTTON, self.boton_borrar_salida_handler, self.boton_borrar_salida) |
# end wxGlade |
|
def __set_properties(self): |
# begin wxGlade: guiParent.__set_properties |
self.SetTitle("PHR GUI") |
_icon = wx.EmptyIcon() |
_icon.CopyFromBitmap(wx.Bitmap("grafica/phr-gui.ico", wx.BITMAP_TYPE_ANY)) |
self.SetIcon(_icon) |
self.statusbar.SetStatusWidths([-1]) |
# statusbar fields |
statusbar_fields = ["Listo"] |
for i in range(len(statusbar_fields)): |
self.statusbar.SetStatusText(statusbar_fields[i], i) |
self.label_2.SetMinSize((300, 21)) |
self.text_ctrl_console.SetMinSize((0,120)) |
# end wxGlade |
|
def __do_layout(self): |
# begin wxGlade: guiParent.__do_layout |
sizer_1 = wx.BoxSizer(wx.VERTICAL) |
grid_sizer_1 = wx.FlexGridSizer(7, 1, 0, 0) |
grid_sizer_3 = wx.FlexGridSizer(1, 2, 0, 0) |
grid_sizer_2 = wx.FlexGridSizer(1, 2, 0, 0) |
grid_sizer_2.Add(self.label_1, 0, 0, 0) |
grid_sizer_2.Add(self.boton_detectar, 0, wx.BOTTOM, 5) |
grid_sizer_2.AddGrowableCol(0) |
grid_sizer_1.Add(grid_sizer_2, 1, wx.EXPAND, 0) |
grid_sizer_1.Add(self.list_box_dispositivos_conectados, 0, wx.BOTTOM | wx.EXPAND, 15) |
grid_sizer_3.Add(self.label_2, 0, 0, 0) |
grid_sizer_3.Add(self.boton_elegir_fichero, 0, 0, 0) |
grid_sizer_3.AddGrowableCol(0) |
grid_sizer_1.Add(grid_sizer_3, 1, wx.EXPAND, 0) |
grid_sizer_1.Add(self.text_ctrl_fichero, 0, wx.TOP | wx.BOTTOM | wx.EXPAND, 5) |
grid_sizer_1.Add(self.boton_transferir, 0, wx.TOP | wx.EXPAND, 10) |
grid_sizer_1.Add(self.text_ctrl_console, 0, wx.TOP | wx.BOTTOM | wx.EXPAND, 5) |
grid_sizer_1.Add(self.boton_borrar_salida, 0, wx.ALIGN_RIGHT, 0) |
grid_sizer_1.AddGrowableRow(5) |
grid_sizer_1.AddGrowableCol(0) |
sizer_1.Add(grid_sizer_1, 1, wx.ALL | wx.EXPAND, 5) |
self.SetSizer(sizer_1) |
sizer_1.Fit(self) |
sizer_1.SetSizeHints(self) |
self.Layout() |
self.Centre() |
# end wxGlade |
|
def menu_item_ayuda_hint_handler(self, event): # wxGlade: guiParent.<event_handler> |
print "Event handler `menu_item_ayuda_hint_handler' not implemented!" |
event.Skip() |
|
def menu_item_ayuda_acerca_de_handler(self, event): # wxGlade: guiParent.<event_handler> |
print "Event handler `menu_item_ayuda_acerca_de_handler' not implemented!" |
event.Skip() |
|
def boton_detectar_handler(self, event): # wxGlade: guiParent.<event_handler> |
print "Event handler `boton_detectar_handler' not implemented!" |
event.Skip() |
|
def boton_elegir_fichero_handler(self, event): # wxGlade: guiParent.<event_handler> |
print "Event handler `boton_elegir_fichero_handler' not implemented!" |
event.Skip() |
|
def boton_transferir_handler(self, event): # wxGlade: guiParent.<event_handler> |
print "Event handler `boton_transferir_handler' not implemented!" |
event.Skip() |
|
def boton_borrar_salida_handler(self, event): # wxGlade: guiParent.<event_handler> |
print "Event handler `boton_borrar_salida_handler' not implemented!" |
event.Skip() |
|
# end of class guiParent |
if __name__ == "__main__": |
app = wx.PySimpleApp(0) |
wx.InitAllImageHandlers() |
main_frame = guiParent(None, -1, "") |
app.SetTopWindow(main_frame) |
main_frame.Show() |
app.MainLoop() |
gui/xin/guiparent.py
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: gui/xin/phrgui.py
===================================================================
--- gui/xin/phrgui.py (nonexistent)
+++ gui/xin/phrgui.py (revision 331)
@@ -0,0 +1,203 @@
+#!/usr/bin/env python
+
+import wx
+import guiparent
+
+import os # se usa para el dialogo de abrir fichero
+import subprocess # para interactuar con el shell
+import thread # to prevent gui blocking
+
+
+class phrgui (guiparent.guiParent):
+ def __init__(self, *args, **kwds):
+ guiparent.guiParent.__init__(self, *args, **kwds)
+ self.__set_extra_properties()
+
+
+ def __set_extra_properties(self):
+ # Definicion de la fuente monospace
+ font1 = self.text_ctrl_console.GetFont()
+ font1 = wx.Font(font1.GetPointSize(), wx.TELETYPE,
+ font1.GetStyle(),
+ font1.GetWeight(), font1.GetUnderlined())
+
+ # Propiedades de la consola
+ self.text_ctrl_console.SetFont(font1)
+ self.text_ctrl_console.SetValue("PHR>>> ")
+
+ # Propiedades de la la lista de dispositivos detectados
+ self.list_box_dispositivos_conectados.SetFont(font1)
+
+
+ def menu_item_ayuda_acerca_de_handler(self, event): # wxGlade: wg_parent_class.
+ description = """
+PHR GUI es una interfaz grafica que permite interactuar con
+la Plataforma de Hardware Reconfigurable (desarrollada en el
+CUDAR) a traves del software xc3sprog.
+
+Revision (SVN) xxx.
+"""
+ licence = """
+PHR GUI is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+PHR GUI is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+See the GNU General Public License for more details. You should have
+received a copy of the GNU General Public License along with
+PHR GUI; if not, write to the Free Software Foundation, Inc.,
+59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+"""
+ info = wx.AboutDialogInfo()
+
+ info.SetIcon(wx.Icon('grafica/phr-gui-96.png', wx.BITMAP_TYPE_PNG))
+ info.SetName('PHR GUI')
+ info.SetVersion('0.1.1')
+ info.SetDescription(description)
+ #info.SetCopyright('(C) 2014 CUDAR (UTN-FRC)')
+ info.SetCopyright('2014, CUDAR (UTN-FRC)')
+ info.SetWebSite('http://opencores.org/project,phr')
+ #info.SetLicence(licence)
+ info.AddDeveloper('Luis Guanuco, Maximiliano Quinteros.')
+
+ wx.AboutBox(info)
+ event.Skip()
+
+
+ def menu_item_ayuda_hint_handler(self, event): # wxGlade: guiParent.
+ mensaje = """
+Procedimiento para usar este programa:
+
+?
+"""
+ wx.MessageBox(mensaje, 'Info', wx.OK | wx.ICON_INFORMATION)
+ event.Skip()
+
+
+ def boton_elegir_fichero_handler(self, event): # wxGlade: wg_parent_class.
+ wildcard = "Archivo BIT de Xilinx (*.bit)|*.bit|" \
+ "Todos los archivos (*.*)|*.*"
+ dialog = wx.FileDialog(None, "Elija un archivo", os.getcwd(), "", wildcard, wx.OPEN)
+ if dialog.ShowModal() == wx.ID_OK:
+ self.text_ctrl_fichero.SetValue(dialog.GetPath())
+ print "New file to transfer: " + dialog.GetPath()
+
+ dialog.Destroy()
+ event.Skip()
+
+
+ def boton_borrar_salida_handler(self, event): # wxGlade: wg_parent_class.
+ self.text_ctrl_console.SetValue("PHR>>> ") # borra el contenido de la consola
+ print "Console cleared"
+ event.Skip()
+
+
+ def before_run (self):
+ # preparar entorno para los eventos de transferencia y deteccion de dispositivos
+ self.boton_transferir.Disable()
+ self.boton_elegir_fichero.Disable()
+ self.boton_detectar.Disable()
+ self.boton_borrar_salida.Disable()
+ self.statusbar.SetFields(["Espere ..."])
+
+
+ def after_run (self):
+ # restaurar entorno
+ self.boton_transferir.Enable()
+ self.boton_elegir_fichero.Enable()
+ self.boton_detectar.Enable()
+ self.boton_borrar_salida.Enable()
+ self.statusbar.SetFields(["Listo"])
+
+
+ def boton_transferir_thread(self):
+ ## preparar entorno
+ wx.CallAfter(self.before_run)
+
+ device_list_selection = self.list_box_dispositivos_conectados.GetSelections()
+ if len (device_list_selection) > 0:
+ position = str(device_list_selection[0])
+ else:
+ position = ""
+
+ ## accion
+ # se copia el fichero de programacion al directorio local
+ #subprocess.call ("copy \"" + self.text_ctrl_file.GetValue() + "\" fpgaFile", shell=True)
+
+ # se ejecuta el xc3sprog
+ command = "./xc3sprog/xc3sprog -v -c ftdi -p " + position + " \""+ self.text_ctrl_fichero.GetValue() + "\""
+
+ 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, ''):
+ wx.CallAfter(self.text_ctrl_console.AppendText, line)
+ process.stdout.close()
+
+ wx.CallAfter(self.text_ctrl_console.AppendText, "\nPHR>>> ")
+
+ ## restaurar entorno
+ wx.CallAfter(self.after_run)
+
+
+ def boton_transferir_handler(self, event): # wxGlade: wg_parent_class.
+ thread.start_new_thread(self.boton_transferir_thread, ())
+ event.Skip()
+
+
+ def boton_detectar_thread (self):
+ ## preparar entorno
+ wx.CallAfter(self.before_run, )
+ wx.CallAfter(self.list_box_dispositivos_conectados.Clear)
+
+ ## accion
+ command = "./xc3sprog/xc3sprog -c ftdi" # the shell command
+
+ 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, ''):
+ # Append output to console
+ wx.CallAfter(self.text_ctrl_console.AppendText, line)
+
+ # If it is a JTAG device append it in list box as well
+ if line.lower()[0:10] == "jtag loc.:":
+ deviceStr = line.split ()
+ appendStr = deviceStr[0] + " " + deviceStr[2] + ": "
+
+ if deviceStr[5] == "Desc:":
+ appendStr += deviceStr[6] + " (ID:" + deviceStr[4] + ")"
+ else:
+ appendStr += "Unknown" + " (ID:" + deviceStr[4] + ")"
+
+ wx.CallAfter(self.list_box_dispositivos_conectados.Append, appendStr)
+
+ process.stdout.close()
+
+ wx.CallAfter(self.list_box_dispositivos_conectados.SetSelection, 0)
+
+ wx.CallAfter(self.text_ctrl_console.AppendText, "\nPHR>>> ")
+
+ ## restaurar entorno
+ wx.CallAfter(self.after_run, )
+
+
+ def boton_detectar_handler(self, event): # wxGlade: wg_parent_class.
+ thread.start_new_thread(self.boton_detectar_thread, ())
+ event.Skip()
+
+# end of class phrgui
+
+if __name__ == "__main__":
+ app = wx.PySimpleApp(0)
+ wx.InitAllImageHandlers()
+ frame = phrgui(None, -1, "")
+ app.SetTopWindow(frame)
+ frame.Show()
+ app.MainLoop()
+
gui/xin/phrgui.py
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: gui/xin/interfaz.wxg
===================================================================
--- gui/xin/interfaz.wxg (nonexistent)
+++ gui/xin/interfaz.wxg (revision 331)
@@ -0,0 +1,163 @@
+
+
+
+
+
+
Index: gui/xin/grafica/banner.jpg
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: gui/xin/grafica/banner.jpg
===================================================================
--- gui/xin/grafica/banner.jpg (nonexistent)
+++ gui/xin/grafica/banner.jpg (revision 331)
gui/xin/grafica/banner.jpg
Property changes :
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: gui/xin/grafica/phr-gui.ico
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: gui/xin/grafica/phr-gui.ico
===================================================================
--- gui/xin/grafica/phr-gui.ico (nonexistent)
+++ gui/xin/grafica/phr-gui.ico (revision 331)
gui/xin/grafica/phr-gui.ico
Property changes :
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: gui/xin/grafica/phr-gui ico.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: gui/xin/grafica/phr-gui ico.png
===================================================================
--- gui/xin/grafica/phr-gui ico.png (nonexistent)
+++ gui/xin/grafica/phr-gui ico.png (revision 331)
gui/xin/grafica/phr-gui ico.png
Property changes :
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: gui/xin/grafica/phr-gui-96.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: gui/xin/grafica/phr-gui-96.png
===================================================================
--- gui/xin/grafica/phr-gui-96.png (nonexistent)
+++ gui/xin/grafica/phr-gui-96.png (revision 331)
gui/xin/grafica/phr-gui-96.png
Property changes :
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property