03-16-2010, 05:35 PM | #1 |
Connoisseur
Posts: 68
Karma: 64
Join Date: Mar 2010
Location: Philadelphia
Device: iRex DR800SG
|
Python + pyGTK package for the DR v3.0
For those that want to try their hand at writing/porting simple apps for the DR but don't want to mess with the whole SDK, or just those that like Python, I've built a package that contains python 2.6.4 and pygtk linked against the iRex libraries. This means you get the optimized screen redraws and such for free.
Screenshot below is the 'editable cell' demo right out of the pygtk install, showing the stylus selecting a field and the keyboard popping up. To install, grab the tarball at https://dsl-scm.cis.upenn.edu:8888/s...+gtk-DR800.tbz and decompress it at the root of your sd card. Because it's just the support framework for writing other GUI apps, nothing runnable will show up automatically in the browser(so this really is for developers only right now). But that's no fun, so once you've installed Python put the two files in Mines.zip in Personal Documents or wherever you like and enjoy a game of minesweeper (from http://sites.google.com/site/victorhr02/pymassrotate2). |
03-19-2010, 09:20 AM | #2 | |
Guru
Posts: 730
Karma: 72743
Join Date: Feb 2008
Location: Here or there
Device: iRex iLiad, iRex DR800S. K4NT. Kobo Aura, Aura One, Libra 2.
|
Quote:
I like python a lot, but on the Iliad I was forced to use lua because python was very slow. (Damn, I can't test it here at work!) |
|
Advert | |
|
03-19-2010, 09:53 AM | #3 |
Connoisseur
Posts: 68
Karma: 64
Join Date: Mar 2010
Location: Philadelphia
Device: iRex DR800SG
|
I haven't tried anything too complicated in python yet, but for the stuff I have the eink refresh seemed to be the bottleneck more than python... I expect the limited RAM is going to be a much bigger issue than raw execution speed for porting stuff since it's easy to import a whole huge library just for one function when you don't care about memory usage
|
03-19-2010, 03:18 PM | #4 | |
Fanatic
Posts: 556
Karma: 1102020
Join Date: Sep 2009
Device: Kindle Keyboard (rip), Kindle Voyage, Fire Tablet 10 '17, iPad '19
|
Quote:
|
|
03-24-2010, 11:36 AM | #5 | |
Guru
Posts: 730
Karma: 72743
Join Date: Feb 2008
Location: Here or there
Device: iRex iLiad, iRex DR800S. K4NT. Kobo Aura, Aura One, Libra 2.
|
Quote:
Some suggestions: - add dbus bindings - strip libraries and executables - don't include .pyo files - don't include documentation Thanks for the package |
|
Advert | |
|
03-24-2010, 11:54 AM | #6 | |
Connoisseur
Posts: 68
Karma: 64
Join Date: Mar 2010
Location: Philadelphia
Device: iRex DR800SG
|
Quote:
I should probably make a dev and non-dev version of the tarball, one for people building apps with it and the other for most users to just install and get the run-time bits. I was a bit lazy for this first release since I just wanted to share it and not burn any more time on it at the moment... |
|
03-25-2010, 04:46 AM | #7 | |
Guru
Posts: 730
Karma: 72743
Join Date: Feb 2008
Location: Here or there
Device: iRex iLiad, iRex DR800S. K4NT. Kobo Aura, Aura One, Libra 2.
|
Quote:
|
|
05-19-2010, 04:56 PM | #8 |
Guru
Posts: 730
Karma: 72743
Join Date: Feb 2008
Location: Here or there
Device: iRex iLiad, iRex DR800S. K4NT. Kobo Aura, Aura One, Libra 2.
|
Hi,
find attached another python package for the DR800. In fact it's the same Mr. X published in this thread, but without documentation, tests, and other stuff not needed for a runtime package. Binaries and libraries have been stripped as well. Finally I decided to mantain the .pyo files... 10 MB vs. a bit of speed at start time. As a result, size after installation on the device has reduced from 100MB to 40MB, also the package is half of the original. I've also added 2 new modules: - ncurses - hashlib There is also a Eastern Egg, run /media/mmcblk0p1/Programs/_python26/bin/lfm from a terminal in emulator or using usbnet. It doesn't work completely (f.e. pyview doesn't start at all), but is somehow useful when developing or porting stuff. |
01-19-2012, 06:05 AM | #9 |
Guru
Posts: 999
Karma: 19985
Join Date: Dec 2008
Location: Netherlands
Device: iRex DR1000S
|
I wanted to get some more hands on experience with Python so I decided to continue where Iņigo and Mr.X stopped. What was missing is a way to control the local-libraries so that the application is added to the taskbar, menus can be added and toolbar icons can be added.
Iņigo did add this functionality in vala (which he uses to write his current additions to the DR) so I used that as a basis for Python. Since I also wanted to get some experience with the ctypes-module, I used that module to access the DR-libraries need for taskbar, menus, etc. I uses a simple application as a 'vehicle' to use the new functionality. The application currently allows to show csv-files (comma separated values) in a spreadsheet-like UI. I intend to add more functionality when I find time. I also modified the mines game that was part of the original port to use the new functionality (it now has a menu and appears in the taskbar). This is only a first experiment, I did not solve all refresh issues and certainly did not test all functionality that is available in Python and its modules. I also do not understand the garbage-collection of Python that well, so there might be some memory leaks. I created 3 new modules: eripc.py, erapp.py and erutils.py, they are located in _python26\lib\python2.6\site-packages. The applications are in _python26\apps. Note that to get the apps shown in the taskbar they had to be named 'python' else the firmware would not accept them. I added some desktop-files in Programs, so they can be started with the stylus. Like vala this creates an easy platform for creating applications for the DR. I hope this will inspire more people to create DR applications. What should be added/changed so that more people can use python (or vala)? What kind of new application are people waiting/hoping for on the DR? |
01-20-2012, 06:08 AM | #10 |
Guru
Posts: 999
Karma: 19985
Join Date: Dec 2008
Location: Netherlands
Device: iRex DR1000S
|
I modified some files so that the application can also be executed on a desktop PC (note I only tried under Windows). I am using Python2.7 (although on the DR 2.6 is used) and have installed pyGtk (got the instructions from internet).
For the DR, extract the upgrade zip-file on your SD card, it will overwrite the updated files (so first install the v2 release if you did not do that yet). For your PC, extract the py files from the v3-zip file (about 7 files) and put them in a single directory. Use IDLE or your own favourite python tool to start the application. Update: I made mistake in the mines.py, which is solved in the 3a version. Last edited by Mackx; 01-20-2012 at 06:27 AM. Reason: Mistake in mines.py |
01-20-2012, 11:28 AM | #11 | |
Addict
Posts: 326
Karma: 6908
Join Date: Sep 2010
Device: DRs, EE, ipad/iphone, Helix
|
Quote:
Apart from that, I do not see a lot. You can browse the pocketbook or the Boox forum, and I think that the DR's are still more than competitive in terms of applications that have been ported. For instance they would all like to have very much your Xournal port I believe. A secret dream is still to get wireless working by using one of these wireless SD cards (I even saw the first micro cards somewhere). |
|
01-21-2012, 09:43 AM | #12 | |
Guru
Posts: 999
Karma: 19985
Join Date: Dec 2008
Location: Netherlands
Device: iRex DR1000S
|
Quote:
|
|
01-21-2012, 12:10 PM | #13 |
Addict
Posts: 326
Karma: 6908
Join Date: Sep 2010
Device: DRs, EE, ipad/iphone, Helix
|
except for the original try by Mr X,
https://www.mobileread.com/forums/showthread.php?t=77453 which besides python contained ports of django, perl, php and xapian; at some stage I tried to make it work by just replacing the erbrowser with midori; I managed to get the server running on the DR, but somehow I could not generate usable datafiles... did you try that one ? it seemed to be close to a small version that was working on the iliad https://www.mobileread.com/forums/sho...ight=wikipedia Last edited by fekhner; 01-21-2012 at 02:12 PM. |
01-21-2012, 03:41 PM | #14 |
Addict
Posts: 326
Karma: 6908
Join Date: Sep 2010
Device: DRs, EE, ipad/iphone, Helix
|
back to the original purpose of the thread, sorry for being obsessed with the offline wikipedia stuff ...
your new implementation of python works beautifully on my DR1000, thanks ! If I understand correctly, the spreadsheet application allows to see previously inaccessible cvs files, great, so you have added a new file-type to the DR, will try to open some, but for the moment I have none which would be directly useful ... will try to see on the other forums which other python applications would be useful on the DR and have updated the wikipage accordingly. Last edited by fekhner; 01-21-2012 at 06:30 PM. |
01-21-2012, 03:54 PM | #15 |
Guru
Posts: 999
Karma: 19985
Join Date: Dec 2008
Location: Netherlands
Device: iRex DR1000S
|
You have to start the application and then use the Load-menu to open a cvs-file. I will see if I can change the application and create a schema-file to link cvs-extensions to the application.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Python 2.6 for iLiad | ericshliao | iRex | 14 | 01-28-2009 01:08 AM |
Python 2.5 or 2.6? | itimpi | Calibre | 5 | 01-19-2009 12:48 PM |
Mac and Python | hackettt | Sony Reader | 5 | 11-17-2008 10:39 AM |
python coding... | alexxxm | Sony Reader | 8 | 01-31-2008 12:25 PM |
iLiad pyGTK | rudysplif | iRex Developer's Corner | 2 | 12-23-2007 06:29 AM |