[Draft] Development Environment for Python

Discussions about the wiki documentation of FreeCAD and its translation.
User avatar
piffpoof
Posts: 347
Joined: Sun Nov 30, 2014 11:00 am
Location: Mare Nostrum
Contact:

Re: [Draft] Development Environment for Python

Postby piffpoof » Mon Mar 02, 2015 9:05 am

I have now added links to Scripting Examples for:

* PySide
* Python Development Environment
User avatar
microelly2
Posts: 4690
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: [Draft] Development Environment for Python

Postby microelly2 » Mon Mar 02, 2015 10:03 am

yorik wrote:Indeed our wiki truncates big scripts. So far nobody has been able to find out why and solve that problem...
Until now we all managed more or less the way Dan explained, by posting the complete script elsewhere... I wish we had a better solution...
what about a common git repo? there would be an easy way to get updated scripts on a simple way?
User avatar
piffpoof
Posts: 347
Joined: Sun Nov 30, 2014 11:00 am
Location: Mare Nostrum
Contact:

Re: [Draft] Development Environment for Python

Postby piffpoof » Mon Mar 02, 2015 10:20 am

microelly2 wrote:what about a common git repo? there would be an easy way to get updated scripts on a simple way?
At the suggestion of another forum member I set up a github account et al the other week and then found out that git doesn't like people to extract single files. And if they insist then it Zips the files on them. Plus git is anything but intuitive for non-programmers to use.

I've just migrated the abbreviated scripts to PasteBin as suggested by danielfalck and it seems to work fine. It supports Save As from the link (git doesn't), it will deliver single files in non-Zipped form (git doesn't)

Also you can get the source up in its original form simply by clicking on the link - if git supports this then I didn't find out how.

It took me a couple of hours to set up github and create a user ID, with PasteBin the longest part was waiting for the confirmation email.

I had been looking for something that was easy for non-programmers and PasteBin seems much more that way to me. I think PasteBin and git are focussed on different user groups and it seems to me that PasteBin suits the non-programmer user much better.
User avatar
shoogen
Posts: 2823
Joined: Thu Dec 01, 2011 5:24 pm

Re: [Draft] Development Environment for Python

Postby shoogen » Mon Mar 02, 2015 11:22 am

microelly2 wrote:what about a common git repo? there would be an easy way to get updated scripts on a simple way?
IMHO a shared repository for independent scripts does not make much sense. Having a single repo would mean that we need to control the access rights somehow. I personally prefer to create a "gist" for every project that exceeds about 50 lines of code. This a allows me to keep the history in a git repo but separated from unrelated scripts.
cox
Posts: 963
Joined: Wed Nov 26, 2014 11:37 pm

Re: [Draft] Development Environment for Python

Postby cox » Mon Mar 02, 2015 12:05 pm

Github wil give you the posibility to download lndividual files if you use the Raw link or url.

https://raw.githubusercontent.com/yorik ... Release.py

Code: Select all

<!DOCTYPE html>
<html>
<body>
<a href="https://raw.githubusercontent.com/yorikvanhavre/FreeCAD/master/README" download>
<p><b>Note:</b> Downlowd file via raw link from github.</p>
</a>
</body>
</html> 
Attachments
raw.png
raw.png (26.23 KiB) Viewed 1165 times
Need help? Feel free to ask, but please read the guidelines first
User avatar
yorik
Site Admin
Posts: 11971
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: [Draft] Development Environment for Python

Postby yorik » Mon Mar 02, 2015 1:08 pm

Anyway this is an interesting discussion.. piffpoof, I also suggest you use github's gists, but there are many other solutions, like pastebin, or simply attaching your full script in a post here on the forum...

But indeed we should think of a better way to store macros, and indeed one that allows easy update/upgrade by the script author and for the users...
User avatar
piffpoof
Posts: 347
Joined: Sun Nov 30, 2014 11:00 am
Location: Mare Nostrum
Contact:

Re: [Draft] Development Environment for Python

Postby piffpoof » Mon Mar 02, 2015 1:45 pm

yorik wrote:Anyway this is an interesting discussion.. piffpoof, I also suggest you use github's gists, but there are many other solutions, like pastebin, or simply attaching your full script in a post here on the forum...

But indeed we should think of a better way to store macros, and indeed one that allows easy update/upgrade by the script author and for the users...
One thing I learned about PasteBin is that you can perform a Save Link As from the link on the FreeCAD Wiki page and then direct the file to the appropriate directory. This is something I was looking for with regards to macros etc. The user can right-click on a link and start the Save Link As process.

Where PasteBin falls down is that it will not handle binary files like *.FCStd. I am looking for something so I can attach FreeCAD documents to Wiki documentation pages (either for Macros or for features of FreeCAD) such that the absolute beginners can download a document which has some prepared data in it. Then they can concentrate on what the documentation is describing - not the 99 steps necessary to get the data to the correct position. In essence, I would like them to be able to save a *.FCStd attached file the same as they can save the macro script - using the Save Link As.
yorik wrote:use github's gists
Does anyone have a link to a gist I can try out? Linus Torvalds' brain and mine don't work the same way. And I would prefer not to try and figure out how to set it up on a Macintosh as it is so time consuming to do things at the command level when they are just different enough from regular Unix to be different.

But, as PasteBin does not handle binary files, the search goes on...
User avatar
piffpoof
Posts: 347
Joined: Sun Nov 30, 2014 11:00 am
Location: Mare Nostrum
Contact:

Re: [Draft] Development Environment for Python

Postby piffpoof » Mon Mar 02, 2015 9:35 pm

thanks for the gist files

well as the saying goes, the plot thickens…

It seems that the behaviour of the repositories partially depends on which browser is used. I used the right-click option "Save File As" with the following 3 browsers:

Code: Select all

download of gist file from gisthub:
Chrome	1759773.html
Safari	1759773.html
Opera	1759773.html

Code: Select all

download of file from PasteBin:
Chrome	raw.txt
Safari	raw.php.txt
Opera	raw.txt
Please excuse the code tags but I was trying to keep the tab characters operational.

It seems that the gist file always comes down in HTML format.
It seems that the PasteBin comes down in ASCII format, although Safari inserts a '.php' into the file name

For downloading Python the gist files would not work as the file type is wrong but more importantly the file is in HTML format.

None of the browsers are current releases, the versions were:

Code: Select all

download of file from PasteBin:
Chrome	40.0.2214.115
Safari	5.1.7
Opera	24.0
So the summary is:
  • PasteBin - works OK for Python files and right-click Save File As, does not handle binary (i.e. *.FCStd) files
  • gist - Python comes down as HTML, unknown whether gist will handle binary files or not
cox
Posts: 963
Joined: Wed Nov 26, 2014 11:37 pm

Re: [Draft] Development Environment for Python

Postby cox » Mon Mar 02, 2015 11:26 pm

Need help? Feel free to ask, but please read the guidelines first