Python script for windows

62 views
Skip to first unread message

Francisco Del Roio

unread,
May 26, 2013, 9:32:01 AM5/26/13
to Proyecto Agrip
Hi,

I forked your MacOSX script into one for windows, but I removed all OSX
specific stuff.

I modified the GameController and the EngineWrapper classes and I
implemented the Speaker class. I think that is the right choise writing
the launcher in python.

Here is the patch to the git repository.

The script uses the Screen Reader API for the speech output, so to run
properly you need these dlls and the ctypes and pywin32 python packages.

This is the URL to the ZIP of the Screen Reader API:

https://dl.dropboxusercontent.com/u/28833196/ScreenReaderAPI.zip

The missing part, the graphical interface (or another) I'll write later.

S2

--
Cuando tus fuerzas terminan, las de Dios comienzan...

winscript.patch

Matthew Tylee Atkinson

unread,
May 26, 2013, 9:27:34 AM5/26/13
to agrip-...@googlegroups.com
Thanks for your work on this. I think what'd be best, if possible, is to make the one script as cross-platform as possible so that only one file needs to be maintained. The build scripts would then create the necessary directory structure to make a Mac, Windows or Linux release.

I'm hoping that both the speech and GUI code as it is should already work on windows, or do so with little modification, as I used a cross-platform GUI library (PyGUI) and a cross-platform TTS library (pyttsx) to create it. However the code to make pyttsx work on windows will be slightly different to that on OS X, as it would possibly need to load a different pyttsx driver. You shouldn't need to be calling SAPI directly as that should be hidden by pyttsx, but I look forward to trying this patch out.

Just to let you know, I'm on holiday until the 4th but will try to give this a go before I leave.

Thanks,


Sent from my iPhone
> --
> You received this message because you are subscribed to the Google Groups "AGRIP Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to agrip-projec...@googlegroups.com.
> To post to this group, send an email to agrip-...@googlegroups.com.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/agrip-project/51A20ED1.2060708%40gmail.com?hl=en-GB.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
> <winscript.patch>

matatk

unread,
Jun 5, 2013, 5:21:02 PM6/5/13
to agrip-...@googlegroups.com, francip...@gmail.com
Note for all readers: this email is about development; when there is an official Windows version of the game, none of the steps below will be required; it will "just work" as they say (we hope!)

I've just tried the following to get the python script running on Windows and it seems to be working -- though I've not yet complied the engine to test the TTS for sure.  I reckon that'll need a bit of work but this is a start...

1. Get python 2.7 from <http://www.python.org/download/>.
2. Get pywin for that version of python from <http://sourceforge.net/projects/pywin32/files/pywin32/>.
3. Get the PyGUI package from <http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/> and extract it; move the GUI directory to same directory as the script.
4. Get the pyttsx package from <https://pypi.python.org/pypi/pyttsx> and extract it; move the pyttsx directory to same directory as the sript.

I used 7-zip from <http://www.7-zip.org/> to do the extracting of the .tar.gz files.

There is an error in the PyGUI file win32/ButtonBases.py; as a mailing list message I found [1] points out: it should have this line before any other code:
from GUI.GControls import Control as GControl

At this point you will be able to run the launcher script on Windows but it won't work properly because the game and other files are not in the expected places, however this is a good start.  I am now working on compiling the engine on Windows.  When that's done I can see about how well the TTS works.

It would be really helpful to have a build script that puts all the files in the right place for the Windows release, much as we have now for OS X (although I don't think the script could download things automatically on Windows as I don't think there is a built-in command to do that).  I could probably quite quickly knock up such a thing in shell scripting language on OS X, which could generate a .zip file or similar to send over to Windows and use as the basis for building a release, but that would mean that to make a Windows release we'd need someone to run a script on UNIX first.  It might be best for me to move the files to a less platform-specific place in the repository and then tweak my OS X scripts to make the application bundle, and write a batch file on Windows to do the same sort of thing on the Windows side.


Matthew

Jacob Kruger

unread,
Jun 6, 2013, 12:58:36 AM6/6/13
to agrip-...@googlegroups.com
Not necessarily relevant either, but, to sort of package chunks of files for use on windows, I use py2exe, and include data_files to combine in/under /dist folder.
 
Stay well

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'
--
You received this message because you are subscribed to the Google Groups "AGRIP Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to agrip-projec...@googlegroups.com.
To post to this group, send an email to agrip-...@googlegroups.com.

matatk

unread,
Jun 6, 2013, 4:32:35 AM6/6/13
to agrip-...@googlegroups.com, Jacob Kruger, jacob...@afrihost.co.za
On Thursday, June 6, 2013 5:58:36 AM UTC+1, Jacob Kruger wrote:
Not necessarily relevant either, but, to sort of package chunks of files for use on windows, I use py2exe, and include data_files to combine in/under /dist folder.

That'll be of great help for the packaging process, which comes next I hope.  I have used cx_Freeze in the past but have come across py2exe too.  Glad to see that we have expertise in this area in the group and thanks for posting about the setup that works for you -- I'll check out that approach for packaging.

Cheers,


Matthew

Jacob Kruger

unread,
Jun 6, 2013, 5:24:36 AM6/6/13
to agrip-...@googlegroups.com
Well, will also be honest, in that I just use python as my secondary focus area, and haven't produced much more than forms of experimental packages, small apps in .exe format, etc., but, for example, here's a download link for a relatively simple package creation file, implementing sort of dependency combination for modules called sound_lib, and accessible_output, which include functions sound_lib.py2exe_datafiles() and accessible_output.py2exe_datafiles() to then render the list of required files, etc., and it also imports keyboard_handler, which is, AFAIK, a form of wrapper for wx keyboard handling, etc., and, the command I use to then execute this build is:
python setupDLG.py py2exe
 
Here's the whole folder/directory of files for this project, including setupDLG.py:
 
And, also not too relevant, but, am using modules from following pages from a guy called Q to implement 2D sound panning, etc., keyboard_handler, and accessible_output, which includes TTS speech - not sure if this server is currently/still online, but anyway - do have the downloaded packages here that you then install using python setup.py install command:
 
 
Lastly, like said, I am in no means in python production as such, so, for example, while the setup script includes some extra files, for sounds, am still fiddling around trying to get them placed in a relevant subdirectory automatically, etc...<smile>
(could handle it manually myself inside setupDLG.py, but would rather keep it somewhat automatic)
 
Stay well

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'
----- Original Message -----
From: matatk
--
You received this message because you are subscribed to the Google Groups "AGRIP Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to agrip-projec...@googlegroups.com.
To post to this group, send an email to agrip-...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages