Hello, I'm new to the list but I'm more than willing to contribute.
I'm working with the new Raspberry Pi and I'm trying to make Geany more kid friendly (6 year old+).
Where does Geany get its code folding delimiters from? I'm trying to configure Geany so that it initially folds most of the code and not just functions or other pre-defined areas. In my scenario, I want almost all the code folded on start-up with a blank area where the students can write stuff (i.e. hide all the scary import and main loop stuff).
I'm targeting Python. I've looked at the filetypes and considered downloading and looking at the source, but I just get a feeling this is easily do-able for someone with more knowledge than me.
/Andy
On 12-03-01 02:36 PM, Andy Bain wrote:
Hello, I'm new to the list but I'm more than willing to contribute.
I'm working with the new Raspberry Pi and I'm trying to make Geany more kid friendly (6 year old+).
Where does Geany get its code folding delimiters from? I'm trying to configure Geany so that it initially folds most of the code and not just functions or other pre-defined areas. In my scenario, I want almost all the code folded on start-up with a blank area where the students can write stuff (i.e. hide all the scary import and main loop stuff).
I'm targeting Python. I've looked at the filetypes and considered downloading and looking at the source, but I just get a feeling this is easily do-able for someone with more knowledge than me.
Hi,
I believe that the "fold points" come from the Scintilla lexers (in the scintilla/lexers/ directory, which is part of a separate project but happens to have its source embedded in Geany's source tree).
There's a feature available for C-style languages called "explicit fold points" where you can put a special comment in the file and it will allow folding of the area between the special comments (similar to #region/#endregion in C#/VS if you've ever used that).
If you were up for some hacking, you could look into making some similar feature for the LexPython.cxx lexer, which would allow you do what you want, albeit in a manual way (go to each computer and hide the scary stuff before the lesson).
Other than that maybe someone else has more insight.
P.S. In the Python lexer, you could use triple-quoted strings around the scary code to allow it to be folded, but of course it would be interpreted as such by Python when run.
Cheers, Matthew Brush
On 2 March 2012 09:36, Andy Bain andy.bain@port.ac.uk wrote:
Hello, I'm new to the list but I'm more than willing to contribute.
I'm working with the new Raspberry Pi and I'm trying to make Geany more kid friendly (6 year old+).
Where does Geany get its code folding delimiters from? I'm trying to configure Geany so that it initially folds most of the code and not just functions or other pre-defined areas. In my scenario, I want almost all the code folded on start-up with a blank area where the students can write stuff (i.e. hide all the scary import and main loop stuff).
Hi,
I'm not aware of any way of making things open folded, IIUC the fold state isn't stored between sessions.
Maybe you can set things up so the kids write in a nice empty file (just change the python template to be empty) and have it imported into a file with all the boilerplate when run.
Cheers Lex
I'm targeting Python. I've looked at the filetypes and considered downloading and looking at the source, but I just get a feeling this is easily do-able for someone with more knowledge than me.
/Andy
Geany mailing list Geany@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany
Having the boilerplate code be separate sounds like a good approach to avoid the "scary" parts you need to make the framework (without having to muck with the folding code), though perhaps going the other direction: import boilerplateCode.py at the beginning of each "program" file (could add it to the python template), then can be saved as childsNameProgramNumberOrWhatever.py might be easier.
I'm assuming you're looking at educational resources for python already, but out of curiosity I was checking out the python education SIG [1] and learned about the built-in turtle module [2] and Guido von Robot [3]. Even as an adult I think these are pretty cool. :)
1: http://www.python.org/community/sigs/current/edu-sig/ 2: http://docs.python.org/library/turtle.html 3: http://gvr.sourceforge.net/ (online version http://gvr-online.appspot.com )
-----Original Message----- From: geany-bounces@uvena.de [mailto:geany-bounces@uvena.de] On Behalf Of Lex Trotman Sent: Thursday, March 01, 2012 7:16 PM To: Geany general discussion list Subject: Re: [Geany] Code folding
On 2 March 2012 09:36, Andy Bain andy.bain@port.ac.uk wrote:
Hello, I'm new to the list but I'm more than willing to contribute.
I'm working with the new Raspberry Pi and I'm trying to make Geany more kid friendly (6 year old+).
Where does Geany get its code folding delimiters from? I'm trying to configure Geany so that it initially folds most of the code and not just functions or other pre-defined areas. In my scenario, I want almost all the code folded on start-up with a blank area where the students can write stuff (i.e. hide all the scary import and main loop stuff).
Hi,
I'm not aware of any way of making things open folded, IIUC the fold state isn't stored between sessions.
Maybe you can set things up so the kids write in a nice empty file (just change the python template to be empty) and have it imported into a file with all the boilerplate when run.
Cheers Lex
I'm targeting Python. I've looked at the filetypes and considered downloading and looking at the source, but I just get a feeling this is easily do-able for someone with more knowledge than me.
/Andy
Geany mailing list Geany@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany
_______________________________________________ Geany mailing list Geany@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany
I'm also going to chime in that I think the best way to handle boilerplate is to put it in a separate module, and to load it via a magic "import" incantation at the top.
Not only does this keep things out of the way, but it's editor-independent and settings-independent. And user-input-independent! If you rely on folding, you KNOW someone is going to either accidentally or through curiosity hit the unfold button.
If even a single import line is too scary, then I'm not sure these kids are ready for programming. At least not in Python (which I agree is already a pretty learner-friendly language). There are other languages/environments specifically designed for *kid* programming, like Alice (http://www.alice.org/). In a pinch, you could use Python's interactive prompt and turtle module as a kind of Logo (not sure if this is the way Kevin meant, but I agree with him that Python's turtle module is way cool, even as an adult).
But I don't know how well those other avenues would fit in a curriculum centered around the Raspberry Pi.
John
On 3 March 2012 10:58, John Yeung gallium.arsenide@gmail.com wrote:
I'm also going to chime in that I think the best way to handle boilerplate is to put it in a separate module, and to load it via a magic "import" incantation at the top.
I have to agree with John, what you should do is delete the system templates in all the other languages and create a set of Python templates, one for each exercise the students have to do. Then the new from template drop down will show the list of exercises.
Each Python file can describe the exercise in comments at the top and include imports or other boiler plate as well as any hints you want to give.
If the kids delete the import, thats a learning experience :) and they can always create a new one from the template.
Not only does this keep things out of the way, but it's editor-independent and settings-independent. And user-input-independent! If you rely on folding, you KNOW someone is going to either accidentally or through curiosity hit the unfold button.
Just like I accidently hit fold when trying to select whole lines :) I hope the kids don't learn the sort of language I use then.
If even a single import line is too scary, then I'm not sure these kids are ready for programming. At least not in Python (which I agree is already a pretty learner-friendly language). There are other languages/environments specifically designed for *kid* programming, like Alice (http://www.alice.org/). In a pinch, you could use Python's interactive prompt and turtle module as a kind of Logo (not sure if this is the way Kevin meant, but I agree with him that Python's turtle module is way cool, even as an adult).
But of course it all has to fit in Raspberry Pi's minimal memory.
Cheers Lex