Skip to content
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

[Feature] Next steps for Pybricks Code editor #173

Closed
23 of 31 tasks
laurensvalk opened this issue Dec 11, 2020 · 9 comments
Closed
23 of 31 tasks

[Feature] Next steps for Pybricks Code editor #173

laurensvalk opened this issue Dec 11, 2020 · 9 comments
Labels
enhancement New feature or request software: pybricks-code Issues with https://code.pybricks.com application

Comments

@laurensvalk
Copy link
Member

laurensvalk commented Dec 11, 2020

We've been keeping Pybricks Code very simple so far. This post is to collect some ideas for next steps. This can be split up into dedicated issues as we go along.

  • Progress indicator (v3.0):
    • Firmware download progress
    • Program download progress (only needed for scripts greater than certain size)
    • Either as pop up, or built-in as we have today, just more visible.
  • Connection status:
    • Connection type (already indicated by Bluetooth icon)
    • Hub Info:
      • Hub type
      • Name
      • Color (LED light color selected when flashing firmware)
      • Battery level
      • Firmware version
      • Pybricks protocol version?
  • Regroup buttons by function and add settings context menu (v3.0).
  • Code Tabs:
    • More than one tab will make it much easier to code and test out different snippets and experiments.
    • To keep things simple, there's no file manager; closing the tab discards the script.
    • Save downloads current tab.
    • Open creates new tab.
    • Doc samples can have a button "open in tab" for easy experimentation
  • Firmware dialog when you click flash button.
    • Toggle to include current script or not (v3.0 just has it in the settings menu for now)
    • Selection of hub bluetooth name
    • Selection of hub status light color so you can easily distinguish hubs (defaults to h=240).
  • Dark mode
  • Python code completion engine
    • Syntax error highlighting
    • Ships with pybricks-api
  • Extra menu
    • About / Licensing (v3.0)
    • Various links to Github / Pybricks (see screenshot) (v3.0)

image

@laurensvalk laurensvalk added enhancement New feature or request triage Issues that have not been triaged yet software: pybricks-code Issues with https://code.pybricks.com application and removed triage Issues that have not been triaged yet labels Dec 11, 2020
@BertLindeman
Copy link

@laurensvalk Might well be that I misread the features, but ...
Does the "save" of a tab rewrite the file that was opened into that tab?

Rationale:
At the moment I have a separate editor (notepad++) with the python code I am using in pybricks.
Do numerous "select-all copy" followed by "select-all paste"
then run flake8 this-python.py
etc...
With the risk that I do the copy/paste the wrong way.
The sources now are bare small snippets, but later . . . . . ;-)

@laurensvalk
Copy link
Member Author

Thanks for the input. I think it’s important to keep in mind that we do not intend to make Pybricks Code a fully fledged editor. It’s designed to make programming very accessible for beginning users.

We might possibly reserve more advanced use cases for a future Visual Studio Code extension similar to the ev3dev extension. That way, we don’t have to reinvent the wheel as far as file management, linting, etc are concerned.

We’re still a bit more focused on the firmware side for now, but this may change towards editors and extensions once the firmwares are fairly complete.

@BertLindeman
Copy link

We’re still a bit more focused on the firmware side for now, but this may change towards editors and extensions once the firmwares are fairly complete.

Understood @laurensvalk No intention to push. Just wanted to offer my input before it's too late ;-) .

@laurensvalk
Copy link
Member Author

No worries. The more you ask, the faster they get done, so please keep asking 😄

@BertLindeman
Copy link

No worries. The more you ask, the faster they get done, so please keep asking 😄

Oke, here goes ;-)

  1. built-in flake8
  2. pre-compile verification for the movehub

Just mildly kidding
You guys are so helpful

@dlech dlech closed this as completed Jan 11, 2021
@dlech dlech reopened this Jan 11, 2021
@BertLindeman
Copy link

Looks like dark mode is implemented via and works.

Added issue #213 (linked here as code completion is in this item)

@dlech
Copy link
Member

dlech commented Apr 2, 2021

Suggested in #278, show compiled size of user program.

@dlech
Copy link
Member

dlech commented Apr 2, 2021

Suggested improved firmware flash experience:

  1. User clicks flash button in IDE or drops custom firmware on the button.
  2. If this is custom firmware, checks are done first to ensure it is "good" firmware.
  3. Opens Web Bluetooth selection dialog and start scanning. Currently, this only shows hubs in bootloader mode. Improved will show hubs not in bootloader mode as well running Pybicks firmware or official LEGO firmware. TODO: also need to consider USB for SPIKE Prime/MINDSTORMS Inventor.
  4. User selects hub.
  5. Connects to hub.
  6. If hub is not supported (e.g. Duplo train), show appropriate "sorry" message.
  7. If this is custom firmware, additional checks are done to ensure the hub is compatible.
  8. If the firmware version is already the latest, ask if they really want to continue. The only reason to do this is to change the name or the user program. There is a common belief that flashing the same firmware again can fix bugs (probably comes from NXT days where this was actually true since critical files could accidentally be deleted from the NXT) but this is not true for Pybricks since it resides in read-only flash memory (unless a cosmic ray flipped a bit).
  9. If hub is supported, show the firmware flash dialog.
  • Has text box to enter hub name (If the hub is not in bootloader mode, the current hub name will be filled in here, otherwise the default "Pybricks Hub" is used. We could potentially also keep a table of hub serial number to names to "remember" the name in bootloader mode in the browser local storage)
  • Has widget to select LED color. (Like the name, this should be the current color, if possible, otherwise default to blue)
  • Has switch to select including the current user program when flashing the firmware or not.
  • Explains that Pybricks is 3rd party firmware.
  • Has text expressing that by flashing firmware you are agreeing to license agreements with link/button to show full firmware license text.
  1. User can cancel or continue
  2. The user program is compiled, if needed. An error message is shown if it fails.
  3. If the hub was not already in bootloader mode, it reboots into bootloader mode. (Due to technical restrictions in Web Bluetooth, this means showing the Bluetooth scan dialog again and the user has to select the "LEGO Bootloader" from the list.
  4. If the hub is a City hub, instruct the user to unplug all sensors and motors before continuing.
  5. Firmware is flashed to the hub.
  6. Hub restarts.
  7. User must manually click the Bluetooth button to connect.

Additional changes to Bluetooth connection:

  1. User clicks Bluetooth button to connect to hub.
  2. Scan dialog pops up and shows hubs running Pybricks firmware or official LEGO firmware.
  3. User selects hub and clicks OK
  4. Connect to Hub.
  5. If hub is official LEGO firmware, explain that Pybricks is 3rd party firmware. Use the same flash firmware button in the dialog box and suggest to user to click it to flash Pybricks. This way they will know what button to look for later. This jumps to the step in the firmware flash sequence where the hub is already connected.
  6. If hub is Pybricks firmware, check if it is out of date. If Pybricks protocol version is too old (or new), require firmware update. If Firmware version is old, suggest, but don't require update. If the user opts to update the firmware, jump to the step in the firmware update where the hub is already connected.

@dlech
Copy link
Member

dlech commented Jul 28, 2022

This is mostly complete now, so we can probably open new issues for the few remaining features that are still relevant and close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request software: pybricks-code Issues with https://code.pybricks.com application
Projects
None yet
Development

No branches or pull requests

3 participants