Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI-Nspire => Topic started by: Vogtinator on October 12, 2014, 07:38:59 am

Title: pyWrite - python script editor
Post by: Vogtinator on October 12, 2014, 07:38:59 am
Well, I haven't got much time to develop this much further than this right now, so I'll publish the current state.
It was intended to be in between nTxt and Jens' script editor.

Features:
- Mouse cursor (DMZ theme, author unknown)
- "Save&Run": micropython must be at "/documents/ndless/micropython.tns" for it to work.
- Multiple fonts (but you can't switch :P)
- Saving isn't implemented (;D)

If there is enough interest, I may release the source code and develop it further when I have time again.

(http://img.ourl.ca/pywrite.png)
Title: Re: pyWrite - python script editor
Post by: torito3112 on October 15, 2014, 05:44:02 am
nice work bro...i like it :hyper: :crazy:
Title: Re: pyWrite - python script editor
Post by: Ivoah on October 23, 2014, 07:29:11 pm
Are you going to add syntax highlighting?
Title: Re: pyWrite - python script editor
Post by: Adriweb on October 23, 2014, 07:39:52 pm
Ooh nice, how come I didn't see this ...

You should have posted it on TI-Planet too, Bisam (and his students, by extension) particularly would have probably tested it 101%, given feedback and such :P

Obviously it needs some more work (because, well, we want to be able to save :D) but congrats on the good start already...

Your "Save&Run" feature is quite cool, it was a question some time ago if it was possible from an ndless program to open another ndless program...

Anyway, I guess it would be great if you put it on a GitHub repo so that anyone willing ( / that has free time :P) could help you on it :)
Title: Re: pyWrite - python script editor
Post by: Vogtinator on October 24, 2014, 02:50:16 pm
Quote
Are you going to add syntax highlighting?
It's definitely planned, if I'll be working on it again.

Quote
Your "Save&Run" feature is quite cool, it was a question some time ago if it was possible from an ndless program to open another ndless program...
There's a syscall for that: nl_exec :P

Anyway, I guess it would be great if you put it on a GitHub repo so that anyone willing ( / that has free time :P) could help you on it :)
Yeah, there are somee issues I would have to get rid of first. It's kind of onion code currently (If you open it, you start crying) :-/
Next week is no school, so I'll have some time to do this, actually :-)

BTW: How do you like the (mouse) cursor movement? I really dislike the OS cursor and with send_pad_event it should be possible to replace it.
Title: Re: pyWrite - python script editor
Post by: Adriweb on October 25, 2014, 09:32:58 pm
Hey I do like your mouse ! :)

Also, yeah, I forgot about your "micropython must be at "/documents/ndless/micropython.tns" for it to work." so I had to reset the calc :P
(the calc was stuck at the error popup window the screen and the screen was kind of twinkling/blinking very fast)
Title: Re: pyWrite - python script editor
Post by: bisam on October 27, 2014, 03:29:30 pm
Great work !
Hope it will be continued... even if you can't do it by yourself, Vogtinator.

A pity I didn't see that sooner so that my students would know about it. I didn't tell them about Omnimaga yet (you know, english speaking, french maths students... does not match).
Title: Re: pyWrite - python script editor
Post by: Ivoah on October 28, 2014, 03:53:05 pm
I didn't tell them about Omnimaga yet (you know, english speaking, french maths students... does not match).


I think TI-Planet is a french calculator community
Title: Re: pyWrite - python script editor
Post by: LDStudios on October 28, 2014, 03:55:05 pm
I didn't tell them about Omnimaga yet (you know, english speaking, french maths students... does not match).


I think TI-Planet is a french calculator community

Yes, Bisam is quite active on tiplanet. He was referring to the fact that Voginator's project is on Omnimaga, but not tiplanet.
Title: Re: pyWrite - python script editor
Post by: Vogtinator on October 28, 2014, 03:58:55 pm
I didn't tell them about Omnimaga yet (you know, english speaking, french maths students... does not match).


I think TI-Planet is a french calculator community

Yes, Bisam is quite active on tiplanet. He was referring to the fact that Voginator's project is on Omnimaga, but not tiplanet.
No, he's referring to the fact that he didn't tell his students about omnimaga, as they're french and omnimaga isn't. (Although the reasoning isn't quite clear to me).

Edit: Edited wrong post *facepalm*
Title: Re: pyWrite - python script editor
Post by: LDStudios on October 28, 2014, 04:01:21 pm
I didn't tell them about Omnimaga yet (you know, english speaking, french maths students... does not match).


I think TI-Planet is a french calculator community

Yes, Bisam is quite active on tiplanet. He was referring to the fact that Voginator's project is on Omnimaga, but not tiplanet.
No, he's referring to the fact that he didn't tell his students about omnimaga, as they're french and omnimaga isn't. (Although the reasoning isn't quite clear to me)

I think he was saying both that  he didn't tell his students about omnimaga, and that your project is only omnimaga. (therefore his students never I saw it).
Title: Re: pyWrite - python script editor
Post by: TIfanx1999 on October 28, 2014, 04:22:45 pm
Great work !
Hope it will be continued... even if you can't do it by yourself, Vogtinator.

A pity I didn't see that sooner so that my students would know about it. I didn't tell them about Omnimaga yet (you know, english speaking, french maths students... does not match).

Well, despite that we do have a french section, and quite a few members that are bilingual. :)
Title: Re: pyWrite - python script editor
Post by: DJ Omnimaga on October 28, 2014, 04:47:00 pm
People in France are usually very bad at English (unlike french-speaking people located in Canada) so Omnimaga would probably not be convenient for them. Yes there is a French section, but it was mainly because of the demand at the time plus the Omni interface is in English by default, which is enough to scare someone not speaking the language away.

Also I think Bisam knows very well about TI-Planet, considering he's global moderator there. :P
Title: Re: pyWrite - python script editor
Post by: Adriweb on October 28, 2014, 04:52:03 pm
People in France are usually very bad at English (unlike french-speaking people located in Canada)
That. Sadly.

Also I think Bisam knows very well about TI-Planet, considering he's global moderator there. :P
Yep
Title: Re: pyWrite - python script editor
Post by: TIfanx1999 on October 28, 2014, 07:35:07 pm
I guess that's true. The site navigation is all in English as you say as well. However, of the French people we have had that joined, many of them say "Sorry for my bad English". I usually find this to be a false statement, as many of them speak decently well. I guess the overall population doesn't as much though. :/ I'd still encourage people to join if they have basic English skills. We try to be accommodating and open, and programming itself is somewhat universal. :) Google translate has also improved quite a bit in recent years. French to English translation is usually pretty decent these days, though I'm unsure about the other way around.
Title: Re: pyWrite - python script editor
Post by: SpiroH on October 29, 2014, 10:08:24 am
I guess that's true. The site navigation is all in English as you say as well. However, of the French people we have had that joined, many of them say "Sorry for my bad English". I usually find this to be a false statement, as many of them speak decently well. I guess the overall population doesn't as much though. :/ I'd still encourage people to join if they have basic English skills. We try to be accommodating and open, and programming itself is somewhat universal. :) Google translate has also improved quite a bit in recent years. French to English translation is usually pretty decent these days, though I'm unsure about the other way around.
C'mon guys, that's a non-problem really. IMO, they should just join in and start participating using simple sentences. I'm pretty sure the average french student can read English quite well nowadays (speaking might be another matter, though). Especially when they do some sort of programming studies. Yeah, a bit off-topic  :P .
Title: Re: pyWrite - python script editor
Post by: Adriweb on October 29, 2014, 08:41:08 pm
C'mon guys, that's a non-problem really. IMO, they should just join in and start participating using simple sentences. I'm pretty sure the average french student can read English quite well nowadays (speaking might be another matter, though). Especially when they do some sort of programming studies. Yeah, a bit off-topic  :P .
Oh, you'd be (negatively) surprised... :P
And yeah, let alone speaking, that's for sure.

It is better (generally) after the baccalaureate, but there aren't really "programming studies" before, so it's all the same "high school english level", and a lot are just bad at it. But it's not really all the student's fault : the way languages are taught is just bad (too much theory, not enough actual practice) : simply look at other countries, people are as smart/dumb as in any other countries yet some are much better at learning/teaching them.

But anyway, we're going off-topic...
Title: Re: pyWrite - python script editor
Post by: DJ Omnimaga on October 29, 2014, 10:57:08 pm
I think it is more because of the fact the only official language in France is French, while in Canada, both English and French are official languages (although Quebec doesn't recognize English as one) and most populated Quebec areas are close to USA border. In Quebec, you start learning English in school in 4th grade and beforehand there are english-speaking TV channels on which popular kid shows like Sesame's Street air.

But yeah, back on pyWrite now :P
Title: Re: pyWrite - python script editor
Post by: Vogtinator on October 31, 2014, 05:12:09 pm
Quote
But anyway, we're going off-topic...
The topic can still be changed :P

In the meantime I could implement some UI stuff and saving. I also removed the "Save&Run" menu in favor of a simple "Run" item. Only difference is, that it doesn't save.

Editing a file:
(http://img.ourl.ca/pywrite1.png)

Selecting a location to save to:
(http://img.ourl.ca/pywrite2.png)

File is attached. Shold run on all calc models, but not very usable on clickpad without cursor movement.Please report if you find it useful!
If anyone wants to help: http://github.com/Vogtinator/pyWrite (http://github.com/Vogtinator/pyWrite)
Todo-list:
-Syntax highligting
-Horizontal scrolling (partially implemented)
-Settings dialog (font and location of micropython)
Title: Re: pyWrite - python script editor
Post by: bisam on October 31, 2014, 07:15:50 pm
Well, I made this post very active with only one off-topic sentence...

So let's get rid of any misunderstanding and stop talking about it.

I just wanted to specify that :
1) If I want my students to know something about their calculators I get them first to TI-Planet,
2) If they want a little more, I talk about Omnimaga too... but a bunch of my students are afraid about writing... even in french, not considering english writing as a possibility. Their abilities are maths, physics and a bit on computer science... that's it.


To get back on topic, I'm pretty impressed by this new release.
I just wanted to know if it is planned to :
1) use UTF8 encoding ?
2) let users choose the place for MicroPython run ?
Title: Re: pyWrite - python script editor
Post by: Vogtinator on October 31, 2014, 07:29:09 pm
Well, I made this post very active with only one off-topic sentence...

So let's get rid of any misunderstanding and stop talking about it.

I just wanted to specify that :
1) If I want my students to know something about their calculators I get them first to TI-Planet,
2) If they want a little more, I talk about Omnimaga too... but a bunch of my students are afraid about writing... even in french, not considering english writing as a possibility. Their abilities are maths, physics and a bit on computer science... that's it.
They are afraid of writing?  :o  I can't think of a single reason why. Everybody can be anonymous here, it's just the Internet.

Quote
To get back on topic, I'm pretty impressed by this new release.
I just wanted to know if it is planned to :
1) use UTF8 encoding ?
Yes, if you can suggest an input method. Latin-1 or ISO-8859-15 would be easier though and it contains most of the needed characters.

Quote
2) let users choose the place for MicroPython run ?
Yes, third item of the Todo-list. Not a very high priority, though.
Title: Re: pyWrite - python script editor
Post by: Adriweb on October 31, 2014, 10:32:17 pm
I guess ISO 8859 would already be enough, yeah. Covers 99.9% of the cases I suppose.
Title: Re: pyWrite - python script editor
Post by: Vogtinator on November 05, 2014, 05:01:19 pm
So, this time I posted the update on ti-planet and a cross-post lands here.

pyWrite 0.2:
Some screenshots:
(http://img.ourl.ca/pywrite3.png)
(http://img.ourl.ca/pywrite4.png)

Please report any bugs you can find!

Download: here (http://tiplanet.org/forum/archives_voir.php?id=106886)
Concerning inputting characters not accessible via the usual keys, I'll probably implement a sidebar that appears if you press Var.
Title: Re: pyWrite - python script editor
Post by: aeTIos on November 09, 2014, 06:16:32 am
I tried this last night, and I must say I'm impressed. It's really smooth and responsive, and the run-from-editor function is really useful. One very silly thing that could be improved (in my arrogant and honest opinion) is the mouse pointer; IMO it doesn't really fit in with the rest of the program.

But put that at the bottom of your todo list :P
Title: Re: pyWrite - python script editor
Post by: Vogtinator on November 09, 2014, 07:42:02 am
Quote
I tried this last night, and I must say I'm impressed. It's really smooth and responsive,
I wrote it like a game, with a main game loop, so the screen is always redrawn completely. It will drain your battery even quicker than the OS, but that's the only issue.

Quote
and the run-from-editor function is really useful. One very silly thing that could be improved (in my arrogant and honest opinion) is the mouse pointer; IMO it doesn't really fit in with the rest of the program.

But put that at the bottom of your todo list
What would you change? Behavior, appearance?
Title: Re: pyWrite - python script editor
Post by: Ivoah on November 09, 2014, 08:26:29 am
What would you change? Behavior, appearance?


I think the mouse cursor is a little too large
Title: Re: pyWrite - python script editor
Post by: aeTIos on November 09, 2014, 08:28:25 am
The mouse behavior is good. But like Ivoah said, it's a little bit too large, and IMO it could just be a 2-color sprite instead of all this anti-aliased fancyness. Yes, I'm telling you that the cursor looks too good ;D

Let me whip up a quick example of what I'd find a good cursor.
Title: Re: pyWrite - python script editor
Post by: Vogtinator on November 09, 2014, 09:20:27 am
Quote
The mouse behavior is good. But like Ivoah said, it's a little bit too large, and IMO it could just be a 2-color sprite instead of all this anti-aliased fancyness. Yes, I'm telling you that the cursor looks too good

Let me whip up a quick example of what I'd find a good cursor.
If it's a usable license, I'll use it :)
Title: Re: pyWrite - python script editor
Post by: aeTIos on November 09, 2014, 09:25:49 am
Actually I was meaning to design a cursor myself :)
Title: Re: pyWrite - python script editor
Post by: Vogtinator on November 09, 2014, 09:30:47 am
The license still applies :P
Title: Re: pyWrite - python script editor
Post by: aeTIos on November 09, 2014, 09:33:22 am
Sure but don't you think it'd be weird if I made something for you then applied a license that prohibited you from using it? :P
I'll probably create the sprite tonight.
Title: Re: pyWrite - python script editor
Post by: Vogtinator on November 09, 2014, 10:06:33 am
Quote
Sure but don't you think it'd be weird if I made something for you then applied a license that prohibited you from using it? :P
License: "Every binary containing this sprite or parts of it must only be used by aeTIos." ;-) Yes, that would be weird, although legal O.o
Quote
I'll probably create the sprite tonight.
Don't try to make a good looking cursor, otherwise it won't fit to the rest :P
(Could you design some other things as well, like Dialog boxes, buttons and text input fields?)
Title: Re: pyWrite - python script editor
Post by: aeTIos on November 09, 2014, 12:11:21 pm
Quote
Sure but don't you think it'd be weird if I made something for you then applied a license that prohibited you from using it? :P
License: "Every binary containing this sprite or parts of it must only be used by aeTIos." ;-) Yes, that would be weird, although legal O.o
Quote
I'll probably create the sprite tonight.
Don't try to make a good looking cursor, otherwise it won't fit to the rest :P
(Could you design some other things as well, like Dialog boxes, buttons and text input fields?)
Sure, though I already like the way those are right now :)
Title: Re: pyWrite - python script editor
Post by: Adriweb on December 06, 2014, 01:47:16 pm
Bump.

Lepzulnag released "NoteWriter 2.0 (https://tiplanet.org/forum/archives_voir.php?id=121680)" (beta for now) which has python-related features :)

(https://tiplanet.org/modules/archives/captures/1417887320notewriter2.png)

Main features
Quote
- Highlight syntax for .py files
- You can open multiple files on the same work space
- Sweet grahisms
- Text selection, copy and paste
- Fast, and no limit to file size
- Possibility to execute .py scripts directly from Notewriter *.

* He says it's buggy for now as MicroPython exists right after launching it, apparently.

I suggested on the announcement topic (https://tiplanet.org/forum/viewtopic.php?f=17&t=15683) that he and Vogtinator should combine the most interesting features from both in order to create the perfect editor - so far, both have unique features, it would be great to merge them ! :)
Title: Re: pyWrite - python script editor
Post by: Vogtinator on December 06, 2014, 02:16:52 pm
Quote
Lepzulnag released "NoteWriter 2.0" (beta for now) which has python-related features :)
(...)

I suggested on the announcement topic that he and Vogtinator should combine the most interesting features from both in order to create the perfect editor - so far, both have unique features, it would be great to merge them ! :)
Yeah, although it's probably not easy to decide which codebase to keep, especially since his project is not open source which is a terrible decision.
Anyway, if and when aeTIos draws some nice graphics, pyWrite is definitely equal - if not better, the mouse is one of the most useful features - to NoteWriter.
I'm also working on getting FreeType to render the glyphs, but it probably to slow.

Quote
* He says it's buggy for now as MicroPython exists right after launching it, apparently.
Works for me, just the direct way with nl_exec without workarounds..
Title: Re: pyWrite - python script editor
Post by: Spartan on December 06, 2014, 03:08:21 pm
Hello everyone,
Does anybody have any idea if there is a possibility of adding the SymPy Python library to micropython? it would be very useful for advanced python programming and i use it alot on desktop, so im wondering if there is any way...
http://www.sympy.org/en/index.html
Take a look and thanks Vogtinator :P its great.
 

Title: Re: pyWrite - python script editor
Post by: Adriweb on December 06, 2014, 03:10:02 pm
Quote
I suggested on the announcement topic that he and Vogtinator should combine the most interesting features from both in order to create the perfect editor - so far, both have unique features, it would be great to merge them ! :)
Yeah, although it's probably not easy to decide which codebase to keep, especially since his project is not open source which is a terrible decision.
Yeah, but I'm pretty sure he'll open-source it. At least I don't see why he wouldn't. Maybe it's closed just for the beta time ?

Anyway, if and when aeTIos draws some nice graphics, pyWrite is definitely equal - if not better, the mouse is one of the most useful features - to NoteWriter.
I'm also working on getting FreeType to render the glyphs, but it probably to slow.
I have to say, the mouse support is indeed definitely awesome.
Edit : NoteWriter's tabs are a neat idea, though :P


Quote
* He says it's buggy for now as MicroPython exists right after launching it, apparently.
Works for me, just the direct way with nl_exec without workarounds..
Well, I've pointed him to the source and here, so I guess he can take a look at what you did.
Title: Re: pyWrite - python script editor
Post by: Lepzulnag on December 06, 2014, 05:33:05 pm
Hi guys :)

I actually agree the mouse cursor is an awesome idea that I've no idea how to code. It's smooth and useful.

I'm sorry if I didn't post the code ; actually im not used to Github and cie. However I will work soon to put the code online. Notewriter uses the framework Winbox, so it's not easy to understand all my code, since its separated between the frameword and Notewriter's source code itself.

About nl_exec, it seems its not buggy, but I just couldnt test it properly, so I dont know : it may be buggy. If someone wanna tests it for me, I'd be glad :)
Title: Re: pyWrite - python script editor
Post by: Ivoah on December 06, 2014, 05:46:08 pm
Hello everyone,
Does anybody have any idea if there is a possibility of adding the SymPy Python library to micropython? it would be very useful for advanced python programming and i use it alot on desktop, so im wondering if there is any way...
http://www.sympy.org/en/index.html (http://www.sympy.org/en/index.html)
Take a look and thanks Vogtinator :P its great.


It looks like that is a pure-python library, which means that you should be able to use it without doing anything special
Title: Re: pyWrite - python script editor
Post by: Adriweb on December 06, 2014, 06:53:05 pm
@Vogt/Lepzulnag as suggested by Bisam, maybe the immediate exit was due to an older version of micropython, one before "pauses" get added automatically when launch from the FS...

So yeah, nl_exec is probably not buggy, but you may need to update your micropython :P
Title: Re: pyWrite - python script editor
Post by: Ivoah on December 06, 2014, 08:26:30 pm
Bump.

Lepzulnag released "NoteWriter 2.0 (https://tiplanet.org/forum/archives_voir.php?id=121680)" (beta for now) which has python-related features :)


[picture]

Main features
Quote
- Highlight syntax for .py files
- You can open multiple files on the same work space
- Sweet grahisms
- Text selection, copy and paste
- Fast, and no limit to file size
- Possibility to execute .py scripts directly from Notewriter *.

* He says it's buggy for now as MicroPython exists right after launching it, apparently.

I suggested on the announcement topic (https://tiplanet.org/forum/viewtopic.php?f=17&t=15683) that he and Vogtinator should combine the most interesting features from both in order to create the perfect editor - so far, both have unique features, it would be great to merge them ! :)


I really like the dark theme
Title: Re: pyWrite - python script editor
Post by: mdr1 on December 08, 2014, 12:05:10 pm
Thanks for this editor, it's really great!

I have suggestions about it:
* Draw a smaller menu and hide it when the program doesn't fit the screen (and use the scratchpad button to show it).
* Make mouse move box smaller so that we can at any time see at least on pixel of the mouse.
* Make an auto indentation.
* Add a scrolling bar.
* Open the last document on launching.
Title: Re: pyWrite - python script editor
Post by: Spartan on December 08, 2014, 04:54:58 pm
Hello everyone,
Does anybody have any idea if there is a possibility of adding the SymPy Python library to micropython? it would be very useful for advanced python programming and i use it alot on desktop, so im wondering if there is any way...
http://www.sympy.org/en/index.html (http://www.sympy.org/en/index.html)
Take a look and thanks Vogtinator :P its great.


It looks like that is a pure-python library, which means that you should be able to use it without doing anything special

That would be cool as it is a pure python library, but im having troubles actually making it useable on the ti nspire CX CAS... i cant transfer the library over due to restrictions on the software, as it obviously has to be a TI Nspire file, and obviously the files i need to import are .py... any ideas how this may be available to do?



I have suggestions about it:
* Draw a smaller menu and hide it when the program doesn't fit the screen (and use the scratchpad button to show it).
* Make mouse move box smaller so that we can at any time see at least on pixel of the mouse.
* Make an auto indentation.
* Add a scrolling bar.
* Open the last document on launching.

Agreed :) Nice work guys, never thought there would be such a rich community for such a thing, on these calculators :D

Please mind my english, it is not my native tongue :P
Thanks for this editor, it's really great!
Title: Re: pyWrite - python script editor
Post by: Lepzulnag on December 11, 2014, 01:35:54 am
That would be cool as it is a pure python library, but im having troubles actually making it useable on the ti nspire CX CAS... i cant transfer the library over due to restrictions on the software, as it obviously has to be a TI Nspire file, and obviously the files i need to import are .py... any ideas how this may be available to do?

I'm not a python-user, so I'm not awared about how to import a python library.
Do you only need to transfer the .py files to the calc to use the library ? If that is so, I'm already working on a solution.
Title: Re: pyWrite - python script editor
Post by: Ivoah on December 11, 2014, 08:16:06 am
I tried running sympy on the unix version of micropython, and I think it needs some editing to work, the imports don't work right.
Title: Re: pyWrite - python script editor
Post by: Spartan on December 12, 2014, 07:01:19 pm
That would be cool as it is a pure python library, but im having troubles actually making it useable on the ti nspire CX CAS... i cant transfer the library over due to restrictions on the software, as it obviously has to be a TI Nspire file, and obviously the files i need to import are .py... any ideas how this may be available to do?

I'm not a python-user, so I'm not awared about how to import a python library.
Do you only need to transfer the .py files to the calc to use the library ? If that is so, I'm already working on a solution.

yeah i do, since its a pure python library... but it doesnt work anyway so not the main issue at the moment :(

I tried running sympy on the unix version of micropython, and I think it needs some editing to work, the imports don't work right.
Ah damn. i should get to work on that really... thanks anyway :D
Title: Re: pyWrite - python script editor
Post by: Matrefeytontias on December 13, 2014, 01:03:24 am
The Nspire will reject any file that doesn't end with .tns, but doesn't do any other sort of check on them. So basically, you rename your .py files to .py.tns, and using "import" on them should work right if ╬╝Python knows that the files have the extension .py.tns.
Title: Re: pyWrite - python script editor
Post by: Lepzulnag on December 13, 2014, 11:56:40 am
I updated Notewriter by the way, fixed some issues, now it works perfectly fine. I also put my code on Github.





Notewriter downloading link : http://tiplanet.org/forum/archives_voir.php?id=121680 (http://tiplanet.org/forum/archives_voir.php?id=121680)
My Github : https://github.com/Lepzulnag (https://github.com/Lepzulnag)
Title: Re: pyWrite - python script editor
Post by: Vogtinator on December 13, 2014, 12:31:35 pm
Quote
Does anybody have any idea if there is a possibility of adding the SymPy Python library to micropython? it would be very useful for advanced python programming and i use it alot on desktop, so im wondering if there is any way...
I haven't tested module support at all, I assume it works like normal python does.
The default module search path is /documents/ndless.
As SymPy consists of a lot of files, it will be terribly slow to install, but it should work as it doesn't require other libs.

Quote
Edit : NoteWriter's tabs are a neat idea, though :P
I've got a better, less space consuming idea :P
But first I'll have to fix some bugs, test freetype and implement Undo & Redo.

Quote
I actually agree the mouse cursor is an awesome idea that I've no idea how to code.
It's not hard: https://github.com/Vogtinator/pyWrite/blob/master/cursortask.cpp
To query the state, it's using cursor_task.x, y and state.
In general, nGL has a quite different architecture compared to your WinBox, as nGL is mainly a game library with a main loop
which makes mouse handling a bit easier.

Quote
It's smooth and useful.
Contrary to the OS's one :P

Quote
Thanks for this editor, it's really great!

I have suggestions about it:
* Draw a smaller menu and hide it when the program doesn't fit the screen (and use the scratchpad button to show it).
Smaller: Yes Hiding: No More useful: Yes.

Quote
* Make mouse move box smaller so that we can at any time see at least on pixel of the mouse.
Yeah, definitely.

Quote
* Make an auto indentation.
That's going to be hard, as that would change the program.
How should:
Code: [Select]
y = 0
z = 0
if x == 1:
y = 1
z = 2
get indented?
Quote
* Add a scrolling bar.
Yup.
Quote
* Open the last document on launching.
Yup.

Quote
I updated Notewriter by the way, fixed some issues, now it works perfectly fine. I also put my code on Github.
I had a look at your code and I can already see some bugs:
-Still using the deprecated flat binary format with objcopy
-Using nl_exec incorrectly: argv[0] is the program itself, argv[1] the first parameter
-Placing the config file outside of /documents the user can't delete it in a usual way. IMO that's very annoying, each file slows the calc down.
-Not checking the return values of fread
-Saving the file as temporary file when running as python script
-In NoteWriter.c line 405 there's an 'n' missing.
-On line 633 there's an invalid character literal: '\25' isn't 0x25 but rather "25", which is not a single character, I guess you meant '\x25'

Your WinBox framework looks useful, but there's no documentation for it and IMO it would be 100x easier to use if it was coded in C++.
You're using quite a few triple-pointers: "Widget ***wFiles", I haven't seen those in the last 20 years and I'm only 17.

Wow, this is now quite a long post now, I had to write it in a text editor and it still have to scroll to read everything.
Title: Re: pyWrite - python script editor
Post by: Adriweb on December 13, 2014, 01:58:26 pm
Your WinBox framework looks useful, but there's no documentation for it
Actually, there is a rather large one included here : https://tiplanet.org/forum/archives_voir.php?id=10587 :)
Although it's in French.
Title: Re: pyWrite - python script editor
Post by: Vogtinator on December 13, 2014, 02:00:40 pm
Oh, I only looked at the repository on github, but I guess that wouldn't make a difference for me...
Title: Re: pyWrite - python script editor
Post by: Lepzulnag on December 13, 2014, 02:02:58 pm
Well, thank you for looking at my code and giving your opinion, I appreciate it  ;) Let me answer you.


Quote
Still using the deprecated flat binary format with objcopy
Hum... sorry about that, but I don't know what you are talking about ??? I'd be glad you enlight me :)


Quote
Using nl_exec incorrectly: argv[0] is the program itself, argv[1] the first parameter
Actually I read on hackspire :
"args[] must not include the program name (argv[0]) nor the terminating NULL argument"
Since .py execution is working, I guess im doing it the right way.


Quote
Placing the config file outside of /documents the user can't delete it in a usual way. IMO that's very annoying, each file slows the calc down.
I don't think this a real issue, since the config file's aim is to be not deleted ; and even if you do so, it will be re-created next time you launch the program. Therefore, I admit it's indeed more convenient for the user to control the file.


Quote
Not checking the return values of fread
You just spotted my laziness  :P
But since the config file is hidden and can't be edited by usual ways, it should always has the structure I gave him, no ? ;)


Quote
Saving the file as temporary file when running as python script
Why is this a problem ?  :o It enables the user, when he has modified a .py file, to test his changes without having to save his current work. There's no way to do it otherwise.


Quote
In NoteWriter.c line 405 there's an 'n' missing.
Thanks for this ;)


Quote
On line 633 there's an invalid character literal: '\25' isn't 0x25 but rather "25", which is not a single character, I guess you meant '\x25'
I have to thank you for this too. Actually Notewriter 1.0 was using this '\25' character for indicating line feeds, which wasn't very proper. The 2.0 version was not intended to use this character anymore, and even if it still supports his use, this '\25' was unintended.


Quote
Your WinBox framework looks useful, but there's no documentation for it and IMO it would be 100x easier to use if it was coded in C++.
Actually I made a documentation, but sadly its in french :( I wanted to provide an english version too, but since I was not on omnimaga at this time, I told myself it would be some harassing work for almost nothing.
If you want to take a look nonetheless, it's available here, with Winbox 1.2 : http://tiplanet.org/forum/archives_voir.php?id=10587 (http://tiplanet.org/forum/archives_voir.php?id=10587)
I would have prefer to code Winbox in C++ too, but when I started the project, years ago, C++ was not fully implemented for the nspire (or I've been misinformed).


Quote
You're using quite a few triple-pointers: "Widget ***wFiles", I haven't seen those in the last 20 years and I'm only 17.
The last, but not least ! I dont know if I should be ashamed, or proud... :angel: My father, who is an engeneer and develop projects for more than 20 years, also told me triple pointers were never necessary. I guess I just found a specific case where they are necessary.
Title: Re: pyWrite - python script editor
Post by: Vogtinator on December 13, 2014, 03:08:21 pm
Well, thank you for looking at my code and giving your opinion, I appreciate it  ;) Let me answer you.

Quote
Still using the deprecated flat binary format with objcopy
Hum... sorry about that, but I don't know what you are talking about ??? I'd be glad you enlight me :)
The PRG file format introduced by Ndless 1.2 I believe is basically just a hack to get basic execution working.
With 3.1 tangrs implemented a loader for the bFLT format which supports some relocations and I added Zehn some months ago which adds some more metadata,
is less buggy and supports C++ exceptions.

Quote
Using nl_exec incorrectly: argv[0] is the program itself, argv[1] the first parameter
Actually I read on hackspire :
"args[] must not include the program name (argv[0]) nor the terminating NULL argument"
Since .py execution is working, I guess im doing it the right way.[/quote]
Yup, you are. I forgot that nl_exec is an abomination of a syscall and I assumed it was doing it like it should do, like execve.
Actually, I should implement execve in libsyscalls so nl_exec can be deprecated.

Quote
Quote
Placing the config file outside of /documents the user can't delete it in a usual way. IMO that's very annoying, each file slows the calc down.
I don't think this a real issue, since the config file's aim is to be not deleted ; and even if you do so, it will be re-created next time you launch the program. Therefore, I admit it's indeed more convenient for the user to control the file.

Quote
Not checking the return values of fread
You just spotted my laziness  :P
But since the config file is hidden and can't be edited by usual ways, it should always has the structure I gave him, no ? ;)[/quote]
I'd add a version number, so it won't try to load a config file with incompatible data.

Quote
Quote
Saving the file as temporary file when running as python script
Why is this a problem ?  :o It enables the user, when he has modified a .py file, to test his changes without having to save his current work. There's no way to do it otherwise.
-It's slow
-It will damage the flash (although that's more an issue on classic calcs)
-The user may think if the file works, it's saved
-If micropython crashes or hangs, the work is lost.

Quote
Quote
In NoteWriter.c line 405 there's an 'n' missing.
Thanks for this ;)

Quote
On line 633 there's an invalid character literal: '\25' isn't 0x25 but rather "25", which is not a single character, I guess you meant '\x25'
I have to thank you for this too. Actually Notewriter 1.0 was using this '\25' character for indicating line feeds, which wasn't very proper. The 2.0 version was not intended to use this character anymore, and even if it still supports his use, this '\25' was unintended.
There are some more cases, it's highlighted in red on GitHub.

Quote
Quote
Your WinBox framework looks useful, but there's no documentation for it and IMO it would be 100x easier to use if it was coded in C++.
Actually I made a documentation, but sadly its in french :( I wanted to provide an english version too, but since I was not on omnimaga at this time, I told myself it would be some harassing work for almost nothing.
If you want to take a look nonetheless, it's available here, with Winbox 1.2 : http://tiplanet.org/forum/archives_voir.php?id=10587 (http://tiplanet.org/forum/archives_voir.php?id=10587)
If you like the doxygen approach, it's really easy to make documentation with it. It's generated from comments in your source files.

Quote
I would have prefer to code Winbox in C++ too, but when I started the project, years ago, C++ was not fully implemented for the nspire (or I've been misinformed).
You're absolutely right, vtables didn't work due to the missing support for relocations (like I said above), but now everything except std::thread is implemented.

Quote
Quote
You're using quite a few triple-pointers: "Widget ***wFiles", I haven't seen those in the last 20 years and I'm only 17.
The last, but not least ! I dont know if I should be ashamed, or proud... :angel: My father, who is an engeneer and develop projects for more than 20 years, also told me triple pointers were never necessary. I guess I just found a specific case where they are necessary.
Actually, they're only necessary in bad code, a refactor should get rid of most of them. The issue is that code that needs triple pointers has triple pointers and is therefore bad code... Also, it's a triple indirection nobody wants to think about so bugs are pre-programmed.
Title: Re: pyWrite - python script editor
Post by: hedehede81 on February 27, 2015, 08:58:32 am
Guys, is it possible to put quotation marks " as in print("hello world") on the calculator itself? I could put that using the key next to letter G, but don't know how to put it either in Pywrite or Notewriter. Thanks.
Title: Re: pyWrite - python script editor
Post by: Vogtinator on February 27, 2015, 09:01:44 am
It's shift + "*"
Title: Re: pyWrite - python script editor
Post by: Chirlian on March 08, 2017, 09:52:45 pm
Hi Vogtinator,
am trying to work with pyWrite but there seems to be a problem: can select signs and text, but the 'ctrl-c' function doesn't work (same with ctrl-x and ctrl-v. The functions don't work but when entering, I get simply the sign, so ctrl-c writes a 'c'.
cu
klaus