Comments (4)
In a previous version we had the opposite of this problem where the line could not end with a bracketed-character code, so this is likely something similar. I’ll take a look into this.
from vestaboard.
I noticed that the code for .convertLine is very different than .convert(), they might need more in common.
from vestaboard.
@coreyzev I dug into this a bit more! Upon looking, this is not actually a bug, the .convert()
method was always intended as a sort of "helper" to convert words and phrases more easily into the corresponding character codes. The thinking is that if you need a color character, you likely already know the number that the color maps to, so it doesn't need to be supported when converting.
Example: if I wanted to prefix a line with 3 blue bits, I would (most likely) already know that blue == 67, so I wouldn't really need to convert that part, I would only need to convert the letters that follow it, so I would do something like
finalText = [67, 67, 67] + Formatter().convert(" 5 mins")
# output = [67, 67, 67, 0, 31, 0, 13, 9, 14, 19]
This is one of those cases where at the very least there should be better documentation, but there are a few use cases where this would be useful to actually implement what you're suggesting:
- When converting multiple things on a single line - you likely won't want to use
convertLine
there, though it may be an option depending on the use case, or - When the color code has the potential to change as well as the letters based on a variable or condition. There's still a way to do it using the list join method above, but it would be nicer to just be able to pass in the already-supported bracketed numbers and have it parsed correctly, or
- As demonstrated in your use case, when colors surround a potentially changing text
In your example, you'd need to do something like the below, which just feels unnecessarily verbose to me:
finalText = text = [65] + Formatter.convert('n') + [65] + Formatter.convert(' 5 mins')
# output = [65, 14, 65, 0, 31, 0, 13, 9, 14, 19]
I think we could re-write the convert()
helper to accept character codes pretty easily since the logic already exists. I'll plan on implementing this in v1.1.0.
from vestaboard.
Released in v1.1.0!
from vestaboard.
Related Issues (15)
- Super interesting to know more HOT 2
- Allow passing in Installable and subscriptionId to Board HOT 1
- Remove redundant print statements
- Retreive current layout from board. HOT 2
- String index out of range when converting a line
- Set `Board.raw()` method to validate and add blank lines when necessary
- Update frequency HOT 1
- "pad = " format attribute error HOT 3
- passing sub_id via vestaboard.Board() is broken HOT 2
- Support Local API
- Support Read/Write Endpoint
- Creating a board with local ip/key and validateKey=True results in error HOT 1
- Support of vestaboard simulator HOT 9
- Vestaboard on Raspian PI OS HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vestaboard.