[IronPython] Gestalt, IronPython in Silverlight and embedded xaml
fuzzyman at voidspace.org.uk
Thu Apr 1 01:34:10 CEST 2010
On 31/03/2010 03:06, Jimmy Schementi wrote:
>> I still need to package my app into a zip file and serve it locally (doesn't work from the filesystem)
> Michael, what do you exactly mean by this? You need your app to run out of browser?
I mean that if I develop in an html file I can't view it from the
filesystem in a browser but must still have a locally running server for
the scripts to run.
>> It doesn't seem to me that embedded xaml is working
> First of all, docs/spec issue: the current online bits only support application/xml+xaml, and the docs have application/xaml+xml.
oferchrisakes. Yes, switching solved the problem.
This leads into an interesting point - the docs show the following as
the public url to use for dlr.js:
This means any backwards incompatible changes are *guaranteed* to break
apps using it. :-) What are needed are versioned URLs so that you can
specify precisely which version to use. Are these available, I couldn't
find them in the docs but I may just not be looking in the right place.
> The release that will be online in a few days supports both. After correcting that you will get a SL control created on the page; here's the exact HTML (with a Text attribute added to the TextBlock to make it obvious that it worked):
> <script type="application/xml+xaml" id="inlineXAML" width="200" height="75">
> <Canvas> <TextBlock Canvas.Left="20" FontSize="24" Text="hi" /> </Canvas>
> Then, if you add the following Python script-tag after the XAML script tag, it will update the text:
> <script type="text/python" class="inlineXAML">
> from System.Windows.Application import Current as app
> app.RootVisual.Children.Text += " from python"
> Note the *class="inlineXAML"* attribute; if you did not include this, the code would run against a different Silverlight control than the one created by your *id="inlineXAML"* tag. In fact, it would run against a SL control that is essentially hidden, so app.RootVisual would be None. In short, giving a XAML script-tag an ID lets you pick the Python script-tags that will run against it by setting their class attribute to the same value.
> I'll update the docs accordingly...
Thanks for your help. I wasn't using the class attribute which would
have caused me problems even if I had been using the right xml type
declaration. I did think that the docs said all un-scoped scripts were
run against the default control, but using an explicit scope is no problem.
> Users mailing list
> Users at lists.ironpython.com
READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (”BOGUS AGREEMENTS”) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer.
More information about the Ironpython-users