On 25/04/12 02:29, lkcl luke wrote:
On Tue, Apr 24, 2012 at 11:16 PM, John P Charlesworth
<[email protected]>  wrote:

On Tue, Apr 24, 2012 at 6:09 PM, lkcl luke<[email protected]>  wrote:
On Tue, Apr 24, 2012 at 5:19 PM, Phil Charlesworth
<[email protected]>  wrote:
On 24/04/12 15:37, Vsevolod Fedorov wrote:
On 04/24/12 18:29, lkcl luke wrote:

rhhhmm.... i knew there was a reason why i was reluctant about the
getImageBaseURL thing (pygwt.py). ok, a workaround is to just go "if
not getModuleBaseURL.startswith("http://";) or https:// or better yet,
if it startswith "file://" then return pyjdinitpth+blahblah.

for now however please just hack Tree.py and other uses of
pygwt.getImageBaseUrl to pass in images=True ok? ... or think of a
modification or other solution :) l.

May be just return getModuleBaseURL(), like this:
----
diff --git a/library/pygwt.py b/library/pygwt.py
index 1c3477c..650012a 100644
--- a/library/pygwt.py
+++ b/library/pygwt.py
@@ -42,7 +42,5 @@ def getImageBaseURL(images=False):
                return getModuleBaseURL() + images + '/'
            else:
                return getModuleBaseURL() + "images/"
-    elif pyjd.is_desktop:
-        return pyjd.pyjdinitpth + "/library/pyjamas/ui/public/"
        else:
            return getModuleBaseURL()
---
With this patch all is working as before.

Otherwise, it is bad when public/ directory structure must be different
for pyjd and pyjs.

Seva

Seva,
Not sure I understand your problem. As a test I am running the
KitchenSink example under pyjd on Windows 7.  The URL for pyjd.setup is
'http://localhost/examples/kitchensink/public/KitchenSink.html', so the
html file is being served by the local server.

When I click on the Trees page link, pygwt.getImageBaseURL() gets called
with no arguments and is returning
'C:\pyjamas/library/pyjamas/ui/public/', which is where the images for
the Tree widget are by default.
  yes.  he does not have any images in
c:\pyjamas\library\pyjamas\ui\public.  he has images on
http://localhost/location/images

  l.
Oh, why not? They are part of the distribution. If he is using different
images, in the public/images directory of his application, he just needs to
construct the Trees with Images = True.
  i have to say: i'm really not keen on this.  it's the only major
discrepancy between pyjd and pyjs, and i don't like it.
Sorry, what exactly is the discrepancy that worries you?
   i'd actually far rather that pyjd, on startup, actually copied the
missing images into the public/ folder.
That would be OK if you can see an easy way to do it.

 l.

I have looked at Seva's code and it doesn't produce any errors on my system. However, it doesn't access the images at all! If I add some additional tree items to force it to use images, it works fine even if I move the images out of the public directory. I attach my version of his index.py. and it's located in the examples/seva/ sub-directory of my web root.

I am using an apache server (Xampp for Windows). Is the problem something to do with the way he is serving using server.py. He is not by any chance serving index.py, I suppose? Would that cause the observed problem?
P
import pyjd
from pyjamas.ui.Tree import Tree
from pyjamas.ui.TreeItem import TreeItem
from pyjamas.ui.RootPanel import RootPanel


def main():
    pyjd.setup("http://localhost/examples/seva/public/index.html";)
    tree = Tree()
    s1 = TreeItem("Section 1")
    s1.addItem(TreeItem("Item 1.1"))
    s1.addItem(TreeItem("Item 1.2"))

    s2 = TreeItem("Section 2")
    s2.addItem(TreeItem("Item 2.1"))
    s2.addItem(TreeItem("Item 2.2"))

    tree.addItem(s1)
    tree.addItem(s2)
    RootPanel().add(tree)
    pyjd.run()

main()

Reply via email to