Page 2 of 3

Re: PCMistress 3 redux (for developers)

Posted: Mon May 23, 2011 12:29 am
by froodly2005
I checked out the source, and tried building for a MacOSX Intel platform.

That necessitated a few changes to the build.xml file: make the os "macosx", add an URL for the macos x86_64 version of swt (the one you have in there is 32 bit), install JavaCC and add the javacchome attributed to the javacc element, change the architecture on the dist-jar element for macosx to be 64-bit, change the dist.dir part of a fileset element to be a dir for macosx-x86_64, change the name of a tarfileset element to reflect 64 bit, and add a download-swt-jar element to fetch the 64-bit swt jar.

Diffs to the build.xml file are below. That took a few attempts to figure out, but one can't be too afraid of fiddling around to make stuff work.

Then I tried to build it, which actually succeeded with the altered build.xml file. :-)

However, it does not launch. :-( I'm new to the mac platform, so I can't guide you much here, but it looks like you're creating the Display somewhere other than in the main thread and the Cocoa implementation of SWT doesn't much care for that:

Code: Select all

$ java -jar dist/macosx-x86_64/pcm3.jar***WARNING: Display must be created on main thread due to Cocoa restrictions.Exception in thread "main" java.lang.ExceptionInInitializerError    at pcm.gui.swt.SWTgui.<init>(SWTgui.java:41)    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)    at java.lang.Class.newInstance0(Class.java:355)    at java.lang.Class.newInstance(Class.java:308)    at pcm.UI.guiFactory(UI.java:54)    at pcm.UI.create(UI.java:74)    at pcm.PCM.main(PCM.java:25)Caused by: org.eclipse.swt.SWTException: Invalid thread access    at org.eclipse.swt.SWT.error(Unknown Source)    at org.eclipse.swt.SWT.error(Unknown Source)    at org.eclipse.swt.SWT.error(Unknown Source)    at org.eclipse.swt.widgets.Display.error(Unknown Source)    at org.eclipse.swt.widgets.Display.createDisplay(Unknown Source)    at org.eclipse.swt.widgets.Display.create(Unknown Source)    at org.eclipse.swt.graphics.Device.<init>(Unknown Source)    at org.eclipse.swt.widgets.Display.<init>(Unknown Source)    at org.eclipse.swt.widgets.Display.<init>(Unknown Source)    at pcm.gui.swt.Global.<clinit>(Global.java:16)    ... 10 more 
So I'd like to leave that error in your capable hands, since you know something about SWT and I do not. I'd be happy to test on the mac platform for you, if you don't mind my only being available on a 1-2 week intermittent basis. Of course it's also likely I've simply done something silly; I'd love to hear corrections to any violence I've perpetrated upon your innocent build.xml.

Here are the build.xml diffs:

Code: Select all

$ diff build.xml~ build.xml8c8<     <property name="os" value="linux" />--->     <property name="os" value="macosx" />50a51,53>     <property name="swt.macosx.x86_64.url" value="${eclipse.mirror}/eclipse/eclipse/downloads/drops/${eclipse.drop}/swt-${swt.version}-cocoa-macosx-x86_64.zip" />>     <property name="swt.macosx.x86_64.zip" value="${downloads.dir}/swt-${swt.version}-cocoa-macosx-x86_64.zip" />> 69c72<         <javacc target="${src.dir}/pcm/imp/parser/Parser.jj"/>--->         <javacc target="${src.dir}/pcm/imp/parser/Parser.jj" javacchome="../javacc-5.0"/>150c153<         <dist-jar os="macosx" arch="i386" />--->         <dist-jar os="macosx" arch="x86_64" />156c159<             <fileset dir="${dist.dir}/macosx-i386">--->             <fileset dir="${dist.dir}/macosx-x86_64">174c177<             <tarfileset dir="${basedir}/distfiles/macosx-i386" prefix="${bundle.name}" />--->             <tarfileset dir="${basedir}/distfiles/macosx" prefix="${bundle.name}" />283a287>         <download-swt-jar os="macosx" arch="x86_64" /> 

Re: PCMistress 3 redux (for developers)

Posted: Mon May 23, 2011 10:42 am
by dtspam
@MistressAlexa An alternative to the WxWidget stuff could be to use JPython and Swing. Would have the advantage, that custom widgets could be written in Java and it can be made look native on most platforms two.
I don't think, that's very important though. For a software like Cybermistress you probably want a custom look and feel, that goes better with the whole setting.

Re: PCMistress 3 redux (for developers)

Posted: Mon May 23, 2011 6:55 pm
by MistressAlexa
I don't particularly like Java, though. Python is much better in my opinion. :-)

Re: PCMistress 3 redux (for developers)

Posted: Mon May 23, 2011 11:03 pm
by dtspam
@MistressAlexa
Yes, but writing widgets in Java is still preferable over doing it in C or C++ ;-) And you could probably write them in JPython directly, as long as it is fast enough, or use languages like Scala. The JVM just gives you a platform independent graphics API (Java 2D). So I'm just advocating the platform here, not the language ;-)

Re: PCMistress 3 redux (for developers)

Posted: Tue May 24, 2011 12:53 am
by MistressAlexa
Oh no, I'm using WxWidgets through a Python implementation, WxPython. Yes, C and C++ are definitely not pleasant for writing interfaces (or anything else, for that matter). :lol:

Re: PCMistress 3 redux (for developers)

Posted: Tue May 24, 2011 10:38 am
by dtspam
Don't want to turn this in to much of a discussion about GUI-Frameworks. ;-)
But could you do something in wxPython like the animated timer widget in the flash teases? Or change the look of buttons etc. to something different, that better fits into webteases? I was under the impression, it was mostly buttons, menus and stuff. And if you can do it, is python fast enough, to handle more complex drawing? wxPython isn't implemented in Python, if I'm not mistaken, but is just a Python API to the C++-Library.

Re: PCMistress 3 redux (for developers)

Posted: Tue May 24, 2011 10:55 am
by les
O Oh programming;
Goes searching for new roll of industrial strength tin foil, and fresh batteries.

Really guys I admire your work,
I am just a "soho tech", adapting what I find.
Keep up the good work.

Re: PCMistress 3 redux (for developers)

Posted: Tue May 24, 2011 11:00 pm
by MistressAlexa
dtspam wrote:Don't want to turn this in to much of a discussion about GUI-Frameworks. ;-)
But could you do something in wxPython like the animated timer widget in the flash teases? Or change the look of buttons etc. to something different, that better fits into webteases? I was under the impression, it was mostly buttons, menus and stuff. And if you can do it, is python fast enough, to handle more complex drawing? wxPython isn't implemented in Python, if I'm not mistaken, but is just a Python API to the C++-Library.
For sure, it could be done. I don't know if through WxPython, but definitely doable (maybe Pygame). WxPython is just an interface to the C++ libraries, but Python is definitely fast enough to do complex drawing. It is certainly comparable in speed (if not faster) to Flash (which is what Nyx is written in) or Visual Basic (which is what CyberMistress was written in).

Re: PCMistress 3 redux (for developers)

Posted: Sat Jun 25, 2011 11:26 am
by solipsist
Just a quick note - as mentioned elsewhere I don't have much spare time at the moment.

MistressAlexa, I was thinking probably EPL, or possibly just Public Domain (like Antlr).

As to choice of language ... it's a personal preference thing. I'm very much in favour of strongly typed languages, and I find Python discovers problems at runtime that other languages pick up at compile time.

One issue I had with PCM was its scripting language. I wrote some complex PCM2 scripts, and they were *very* hard to write and debug. I thought about other existing languages, but the advantage of writing your own is you get to make it specific to the task at hand. For example "for 0:10" and weighted random choice just don't make it to most languages. I happen to study language implementation, which explains some of the internals.

Yes, the PCM2 interpreter is crude. Partly this was a learning exercise in Java, and particularly in writing interpreters in Java. Consider the 'imp' interpreter as 'version 2'. The main reason, though, is that the PCM2 design was both an exercise in writing an interpreter while I figured out the semantics of the language. The semantics turn out to be subtle and complex, probably a side-effect of the way they were implemented, which we no longer have access to.

The underlying idea behind PCM3 was to build a family of components that could be used to build teases etc: GUI components; scripting languages; language implementation tools etc.

I have ideas for a better scripting language, one in which there is minimal impedance between the script and the effect. For example, if you want a script that requires 2 images, with text, you can say

"Text 1"
image image1.jpg
"Text 2"
image image2.jpg

but still have the full power of a proper programming language (pure functional, probably) available if you need it.

Anyway, I'll be more on line in the second half of July, and happy to talk more then.

Re: PCMistress 3 redux (for developers)

Posted: Sat Jun 25, 2011 5:36 pm
by MistressAlexa
I'm not decided on a license yet. I'm all for permissive licenses, but we can decide later anyways. ANTLR is not public domain, it's BSD.

I think the advantage of CyberMistress was the simplicity of its language. Most people that write scripts are not programmers, so I think Kenneth was on the right track with the config-file scripts. They are easy to parse and easy to write. Some advanced features are compromised, but they can always be added in later. Besides, I don't have a clue about how to implement a language.

Re: PCMistress 3 redux (for developers)

Posted: Mon Jul 18, 2011 12:56 pm
by solipsist
froodly2005 wrote:

Code: Select all

$ java -jar dist/macosx-x86_64/pcm3.jar***WARNING: Display must be created on main thread due to Cocoa restrictions. 
According to https://github.com/udoprog/c10t-swt/issues/1, on OSX you need to add -XstartOnFirstThread to the java options to avoid this.

Re: PCMistress 3 redux (for developers)

Posted: Mon Jul 18, 2011 12:59 pm
by solipsist
I've added everyone who applied to join the "PCMistress Staff" group. Anyone who wants to participate in technical discussions about its development, just apply and you will (eventually) be added.

Re: PCMistress 3 redux (for developers)

Posted: Tue Dec 13, 2011 6:06 pm
by Holdingout1
Solipist - Would you mind adding me to the group - I am not a developer but still use PCM2 as well have programed as advanced scripts as I have seen out there. I think at some point I can help the project :-)

Re: PCMistress 3 redux (for developers)

Posted: Sat Jan 21, 2012 4:07 am
by solipsist
OK, all pending users added.

Re: PCMistress 3 redux (for developers)

Posted: Sun Jun 03, 2012 10:29 pm
by froodly2005
solipsist wrote:
froodly2005 wrote:

Code: Select all

$ java -jar dist/macosx-x86_64/pcm3.jar***WARNING: Display must be created on main thread due to Cocoa restrictions. 
According to https://github.com/udoprog/c10t-swt/issues/1, on OSX you need to add -XstartOnFirstThread to the java options to avoid this.
I decided to give this another try, building for the mac. I miss lapSqueeze!

The svn checkout went fine. But the ant download barfed with files not found, as below. Perhaps the build.xml needs to be edited for the mac; I'd be happy to do so if you'd guide me as to what needs to be done.

Code: Select all

download:     [echo] Downloading swt jar for linux-i386      [get] Getting: http://ftp.osuosl.org/pub/eclipse/eclip ... ux-x86.zip      [get] To: /Volumes/RANDOM6/pcm/beta/pcm3/download/swt-3.6.2-gtk-linux-x86.zip      [get] Error opening connection java.io.FileNotFoundException: http://ftp.osuosl.org/pub/eclipse/eclip ... ux-x86.zip      [get] Error opening connection java.io.FileNotFoundException: http://ftp.osuosl.org/pub/eclipse/eclip ... ux-x86.zip      [get] Error opening connection java.io.FileNotFoundException: http://ftp.osuosl.org/pub/eclipse/eclip ... ux-x86.zip      [get] Can't get http://ftp.osuosl.org/pub/eclipse/eclip ... ux-x86.zip to /Volumes/RANDOM6/pcm/beta/pcm3/download/swt-3.6.2-gtk-linux-x86.zip BUILD FAILED/Volumes/RANDOM6/pcm/beta/pcm3/build.xml:281: The following error occurred while executing this line:/Volumes/RANDOM6/pcm/beta/pcm3/build.xml:294: Can't get http://ftp.osuosl.org/pub/eclipse/eclip ... ux-x86.zip to /Volumes/RANDOM6/pcm/beta/pcm3/download/swt-3.6.2-gtk-linux-x86.zip  
Thanks in advance for any advice you can provide.