• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

PBI - emulate WebDialogs in a browser?

Scheduled Pinned Locked Moved Developers' Forum
6 Posts 3 Posters 935 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    RichMorin
    last edited by 5 Nov 2010, 20:02

    Although I've been able to use a browser (eg, Safari) to debug HTML, CSS, and JavaScript content stored in static files, I can't do this with dynamically loaded content. Nor can I test things that depend on communication between Ruby and JavaScript code.

    So, I'd like a way to emulate WebDialogs in a browser. My Partly-Baked Idea (PBI) goes something like this:

    1. Create a simple HTML/JS file for testing (eg, a header and a checkbox, where the checkbox is supposed to control the color of the header, via a Ruby round trip). Wrap the "location=" call in a JS method, for flexibility.

    2. Get the file working with a SketchUp plugin, using callbacks, etc.

    3. Get the file working with a simple web app, using (say) Rack or Sinatra.

    4. Find a way to emulate the needed parts of the web app under SketchUp.

    5. Fold the emulation code into the WebDialog class.

    Comments, clues, suggestions?

    -r

    1 Reply Last reply Reply Quote 0
    • R Offline
      RichMorin
      last edited by 27 Nov 2010, 04:47

      I have some encouraging progress to report. I now have a proxy server, based on EventMachine, that works on Mac OS X 10.5.8 (Mac Pro).

      The server should be able to provide asynchronous communication between a SketchUp plugin and JavaScript code in any browser capable of handling WebSockets (eg, Chrome, Safari). See my wiki pages for more information:

      • http://cfcl.com/twiki/bin/view/Projects/SketchUp/WD_WoR_BrowserDialog - project overview
      • http://cfcl.com/twiki/bin/view/Projects/SketchUp/WD_WoR_BD_Server - server details

      I'm now getting ready to create some Ruby and JavaScript methods to emulate the WebDialog API. I'll report any substantial progress if and when it occurs...

      Meanwhile, I'd love to have someone try out the proxy server on something other than a Mac. Aside from letting me know about (and possibly resolve) portability issues, this could help me to create setup and usage notes for Windows, WINE, etc.

      -r

      1 Reply Last reply Reply Quote 0
      • R Offline
        RichMorin
        last edited by 30 Nov 2010, 13:39

        I now have a BrowserDialog class which lets me emulate a WebDialog under Safari. Although it's usable, there are still a few rough edges. In particular, it takes over the plugin, looking for input files (see http://forums.sketchucation.com/viewtopic.php?f=180&t=33012 for details).

        Still, I was able to use it successfully on a couple of very substantial plugins, so I am quite encouraged. At this point, I'm looking for some other plugin developers who would like to try out the code, look it over for problems, etc. I'm particularly interested in finding a tester who runs something other than Mac OS X.

        1 Reply Last reply Reply Quote 0
        • M Offline
          morgan_greywolf
          last edited by 1 Dec 2010, 21:42

          Sure, I'll take a look at it. I'm running SU8 on Linux/Wine.

          1 Reply Last reply Reply Quote 0
          • C Offline
            Chris Fullmer
            last edited by 2 Dec 2010, 05:05

            Phew!, glad someone responded. It sounds interesting....I just don't know what any of the terms mean that you're using. So I'd count it as being a little over my head 😄

            Lately you've been tan, suspicious for the winter.
            All my Plugins I've written

            1 Reply Last reply Reply Quote 0
            • R Offline
              RichMorin
              last edited by 2 Dec 2010, 19:29

              @morgan_greywolf said:

              Sure, I'll take a look at it. I'm running SU8 on Linux/Wine.

              Great. You can get started with the proxy server and the test page; send me a note off-list (rdm@cfcl.com) letting me know what you find out. As soon as I have my example plugin ready for Alpha testing, I'll let you know.

              FYI, the plugin no longer sits in a read loop. Instead, I use UI.start_timer to perform periodic scans of the input directory. This seems to work quite nicely, but it does require SU8, because it's using a sub-second interval.

              Also, I'm still hoping for a CygWin and/or native Windows tester!

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement