-
Notifications
You must be signed in to change notification settings - Fork 84
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
PaPiRus Positional Text #68
PaPiRus Positional Text #68
Conversation
Making PapirusTextPos available in the __init.py__ Using text.py as the base of textpos.py, this class will allow positioning of text on the screen as needed. If an ID is given, each individual piece of text can be updated (only the text at the moment). Simple example: from papirus import PapirusTextPos text = PapirusTextPos() # Put "hello world%" at (20, 30), with the ID of "Line1" text.AddText("hello world", 20, 30, Id="Line1") # Add "Another line", at default coords of (0, 0). No id given so not easily updated text.AddText("More Items") # Write all text items to the screen text.WriteAll() # Update the item with the ID "Line1" with new text text.UpdateText("Line1", "It's a new world") # Redraw all the text to the screen text.WriteAll()
Added the ability to remove text from the collection (via Id)
Added section for the PaPiRusTextPos, with example code.
Overhauled to make use of "partial_update()". Also implemented "AutoUpdate" as part of the instantiation of the class, defaults to True, so any changes are written directly. Calling PaPiRusTextPos(False) will draw nothing automatically unless ".WriteAll()" is called (for more control over when updates are done). Removing text will now remove it from the image by overwriting the text with a white rectangle. May need a little work on the positioning/size of the rectangle.
Changed examples to show the two different ways of using PaPiRusTextPos, auto updating and manual screen push.
Just out of interest, does this allow for line breaks also? |
No, currently the code doesn't take line breaks in to account. |
Awesome :-)
…On 4 Jan 2017 6:04 am, "Ben" ***@***.***> wrote:
No, currently the code doesn't take line breaks in to account.
I'll take a look at that next.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#68 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ADNCugd9NnBtjXpErPnzazsAhB-HpqOSks5rOzZxgaJpZM4LYivZ>
.
|
PaPiRusTextPos will now drop any text following '\n' on to a new line. It will take the given X coordinate in to account and NOT reset to x=0
Added a note about the \n awareness in PaPiRusTextPos and information about .Clear() method
There we go, \n line breaks now supported :) |
Awesome. Do you think /r breaks are useful at all? Looks fantastic though.
…On 4 Jan 2017 10:06 pm, "Ben" ***@***.***> wrote:
There we go, \n line breaks now supported :)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#68 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ADNCumEjvhdfYuWb112X-c5RhsrsYuCMks5rPBfJgaJpZM4LYivZ>
.
|
Using splitlines() to take \n, \r and \r\n in to account for line breaks
Yes, probably worth taking in to account. Also \r\n. |
Awesome, looks great. Thanks so much :-)
…On 5 Jan 2017 7:57 am, "Ben" ***@***.***> wrote:
Yes, probably worth taking in to account. Also \r\n.
Using .splitlines() to do all three cases in one go :)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#68 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ADNCuhAs9-h01Mc3qBvXy5FQwbrpJTkpks5rPKJXgaJpZM4LYivZ>
.
|
@BenScarb is there a way we could refactor papirus-write to include this new feature but end up with only one write approach instead of two? |
I'll have a look, I thought papirus-write was a complied file! One question, does it need to run as root? I've been using it on the nearly latest OS and it seemed to be fine without sudo'ing anything. |
The main idea behind it was really not for speed but just so that it isn't
confusing.... Could have one write command, with optional X,Y and if you
don't put an X,Y it just defaults to normal.
That's kind of what we were thinking
…On 22 Jan 2017 9:46 pm, "Ben" ***@***.***> wrote:
I'll have a look, I thought papirus-write was a complied file!
Shouldn't be a problem to change it out, optional params for X and Y, then
pass it all to the existing routines.
There wouldn't be any speed updates as it would happen once and then exit.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#68 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ADNCuv7hPqWpJeSAfKdmHy1AjMh7__Bwks5rU84jgaJpZM4LYivZ>
.
|
@BenScarb realised I forgot to tag you in my last reply. Just wanted to check you saw it |
No worries, I'll be taking a look tomorrow :) Assuming I can find where I tidied my Pi away to! |
:-)
…On 1 Feb 2017 10:11 pm, "Ben" ***@***.***> wrote:
No worries, I'll be taking a look tomorrow :) Assuming I can find where I
tidied my Pi away to!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#68 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ADNCuvjMuoI3lMvOzALMZHAm3CGsMsZJks5rYQMZgaJpZM4LYivZ>
.
|
Unsure why but when used with Args are passed, the splitlines() wouldn't see the /n as a line break. Parsing it as encoded makes sure this does happen.
Updated papirus-write to accept x and y coordinates and re-used the existing code base.
Fixed the MarkDown coding (Whoops, rookie mistake!) Added information about paprirus-write positional arguments.
Found the Pi! Sorted the papirus-write to accept the X and Y coords and use the appropriate code. Not sure what I've done to the ReadMe.md file, thought I'd fixed it, looked all right on http://dillinger.io/ but not do good on GitHub! |
Ben I'll take a look at this next week, thanks for the effort, really appreciated and sorry it is taking so long to review this. Keep you posted. |
No worries, I know life happens :) If anything else needs updating or de-conflicting, just drop me a message. |
Hi, I have finally tested the code which works really nicely, thanks! Only one thing now could you redo the README.md changes using the current file. That should also help cleaning up that strange behaviour you saw caused by you removing the "Your python script must be running with root privileges ... " part but you left behind one ``` |
No worries, I'll see if I can get the changes done tonight. My "diffing skills" need working on me thinks, didn't see what I'd left behind! Read up on the "needing root" stuff, good call. I'll get the current ReadMe.MD updated and uploaded. |
Added changes for positional text, with any luck, the formatting won't be damaged this time.
Another attempt to fixing the formatting.
I have updated the README.md, I believe it's sorted but the conflict still exists. |
Me and @francesco-vannini can probably fix it next week.
I think basically you just need to do a git rebase but then I'm also pretty
awful at git so it's like the blind leading the blind :-)
Let's all have a go next week and see if we can fix it
…On 11 Mar 2017 4:22 pm, "Ben" ***@***.***> wrote:
I have updated the README.md, I believe it's sorted but the conflict still
exists.
Seems I need to research how to do that! I think just taking the version
from branch will do it :)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#68 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ADNCukJcITbDrSb2w6FdQWlHawCzmvFCks5rkspdgaJpZM4LYivZ>
.
|
Great stuff, sorry I can't give you a fully formed branch to pull in. Something for me to work on, every days a learning day :) |
No need to be sorry! It's awesome to have people like you contributing code
:-)
…On 12 Mar 2017 7:30 pm, "Ben" ***@***.***> wrote:
Great stuff, sorry I can't give you a fully formed branch to pull in.
Something for me to work on, every days a learning day :)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#68 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ADNCurPeJ47KjV7gLWrOasNJLRslJL2aks5rlEfsgaJpZM4LYivZ>
.
|
Once this is merged in, I'll take a look at inverting the colours, or at least having control over them :) |
Yeah definitely. Someone's just mentioned it in #80 actually
…On 12 Mar 2017 7:51 pm, "Ben" ***@***.***> wrote:
Once this is merged in, I'll take a look at inverting the colours, or at
least having control over them :)
The White on Black seems like a good idea!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#68 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ADNCusUyJztmLyTYc7Pee7JFGrhgJAcKks5rlEzIgaJpZM4LYivZ>
.
|
Thanks a lot @BenScarb - all sorted and merged now :-) Thanks so much for your contribution! |
Woohoo, my first proper submissions and completed PR! |
Yes indeed, we just copy pasted the readme as we couldn't be bothered to
fix it "the proper way" :-)
…On 15 Mar 2017 7:34 pm, "Ben" ***@***.***> wrote:
Woohoo, my first proper submissions and completed PR!
Glad it'll be useful :)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#68 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ADNCuh5sB4707ueD0OD7ySmTLeomU0Enks5rmD1JgaJpZM4LYivZ>
.
|
Simple class for doing positional text on the PaPiRus screen.