Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Cambios a la estrucutra de los boxes para el correcto render en Windows (solución temporal, el problema es un bug de toga) #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions 4 .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions 4 .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions 8 .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions 11 .idea/uPy_IDE.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions 6 .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

127 changes: 127 additions & 0 deletions 127 .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions 2 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ source venv/bin/activate
pip install --pre toga
pip install pyserial
pip install python-dotenv

pip install click
~~~~


Expand Down
Binary file added BIN +176 Bytes uPy_IDE/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file added BIN +248 Bytes uPy_IDE/__pycache__/__main__.cpython-37.pyc
Binary file not shown.
Binary file added BIN +7.72 KB uPy_IDE/__pycache__/app.cpython-37.pyc
Binary file not shown.
Binary file added BIN +10.9 KB uPy_IDE/__pycache__/cli.cpython-37.pyc
Binary file not shown.
Binary file added BIN +98.8 KB uPy_IDE/__pycache__/esptool.cpython-37.pyc
Binary file not shown.
Binary file added BIN +8.51 KB uPy_IDE/__pycache__/files.cpython-37.pyc
Binary file not shown.
Binary file added BIN +10.5 KB uPy_IDE/__pycache__/pyboard.cpython-37.pyc
Binary file not shown.
89 changes: 56 additions & 33 deletions 89 uPy_IDE/app.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
import toga
from toga.style import Pack
from toga.constants import COLUMN, ROW
import glob
import os
import sys
import glob
import serial
import time

import serial
import toga
import uPy_IDE.esptool as esptool
from toga.constants import COLUMN, ROW
from toga.style.pack import *

# TODO: Exportar un ejecutable de Windows

# Correr en un proceso aparte para que no se congele la UI
def run_in_process(self, button, code_to_run):
import timeit
elapsed_time = timeit.timeit(code_to_run, number=1) # just to save it somewhere
return elapsed_time


def serial_ports():
if sys.platform.startswith('win'):
Expand Down Expand Up @@ -55,29 +65,23 @@ def startup(self):
self.commandesp=toga.TextInput(style=Pack(flex=1,width=450))

#intento de terminal
self.textterminal=toga.MultilineTextInput(readonly=False,style=Pack(flex=1,width=600,height=600))
self.textterminal=toga.MultilineTextInput(id='terminal')

#textoutputs
self.textoutputs=toga.MultilineTextInput(readonly=True,style=Pack(flex=1,width=200,height=200))

#botones
self.btnport=toga.Button("Abrir puerto", on_press=self.open_port, style=Pack(padding=2))
self.textoutputs=toga.MultilineTextInput(id='output')


self.filelabel=toga.Label("No ha seleccionado ningun archivo", style=Pack(padding=2))
self.fname=None
self.main_window.content=toga.Box(
children=[
toga.Box(style=box_style_verti, children=[

toga.Box(style=Pack(direction=ROW,padding_left=25), children=[
# definir los hijos del main box afuera del main box
left_box = toga.Box(style=box_style_verti)
left_box.add(toga.Box(style=Pack(direction=ROW,padding_left=25), children=[
self.portselect,
self.chipselect,
self.verselect,
self.switchdio
]),

toga.Box(style=Pack(direction=COLUMN,padding_top=7), children=[
]))
left_box.add(toga.Box(style=Pack(direction=COLUMN,padding_top=7), children=[
toga.Button("Ver archivos en ESP", on_press=self.read_files, style=Pack(padding_top=15,padding_left=2)),
toga.Button("Seleccionar archivo", on_press=self.action_open_file_dialog, style=Pack(padding=2)),
self.filelabel,
Expand All @@ -87,27 +91,44 @@ def startup(self):
toga.Button("Borrar archivo de ESP", on_press=self.erase_from_esp, style=Pack(padding=2)),
toga.Button("Obtener archivo de ESP", on_press=self.get_file_esp, style=Pack(padding=2)),
self.textoutputs
])
]),
toga.Box(style=box_style_verti, children=[
toga.Button("Flashear",on_press=self.flash),
toga.Button("Borrar flash/firmware",on_press=self.eraseflash),
toga.Button("Actualizar puertos",on_press=self.update_ports),
self.btnport,
self.textterminal,

toga.Box(style=Pack(direction=ROW,padding_top=7), children=[
]))

# Cambio en la estructura de los boxes para que funcione el rendering de los hijos en Windows, el bug es propio de toga al momento de presentar los boxes
# Agregar hijos de right_box
# right_box = toga.Box(style=box_style_verti)
# right_box.add(toga.Button("Flashear",on_press=self.flash, style=Pack(padding=2)))
# right_box.add(toga.Button("Borrar flash/firmware",on_press=self.eraseflash, style=Pack(padding=2)))
# right_box.add(toga.Button("Actualizar puertos",on_press=self.update_ports, style=Pack(padding=2)))
# right_box.add(toga.Button("Abrir puerto", on_press=self.open_port, style=Pack(padding=2)))
# right_box.add(self.textterminal)
# right_box.add(toga.Box(style=Pack(direction=ROW,padding_top=7), children=[
# self.commandesp,
# toga.Button("Enviar comando", on_press=self.send_command, style=Pack(padding=2))
# ])
# )

left_box.add(toga.Button("Flashear",on_press=self.flash, style=Pack(padding=2)))
left_box.add(toga.Button("Borrar flash/firmware",on_press=self.eraseflash, style=Pack(padding=2)))
left_box.add(toga.Button("Actualizar puertos",on_press=self.update_ports, style=Pack(padding=2)))
left_box.add(toga.Button("Abrir puerto", on_press=self.open_port, style=Pack(padding=2)))
left_box.add(self.textterminal)
left_box.add(toga.Box(style=Pack(direction=ROW,padding_top=7), children=[
self.commandesp,
toga.Button("Enviar comando", on_press=self.send_command, style=Pack(padding=2))
])
)

container = toga.Box()
container.add(left_box)
# container.add(right_box)

])

])
self.main_window.content = container

self.main_window.show()

#metodos para la parte de ampy

# TODO: hacer que los metodos inernos sean multi-procesos
# metodos para la parte de ampy
def read_files(self,button):
from uPy_IDE.pyboard import Pyboard
from uPy_IDE import cli
Expand Down Expand Up @@ -163,7 +184,8 @@ def get_file_esp(self,button):
self.textterminal.value=fdata

#======================================SOLO MANEJO DE PUERTO========================================================



def open_port(self,button):
from uPy_IDE.pyboard import Pyboard
if not self.port_open:
Expand All @@ -177,6 +199,7 @@ def open_port(self,button):
self.btnport.label="Abrir puerto"
self.port_open=False
self.port.exit_raw_repl()


def send_command(self,button):
if self.port_open:
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.