evil-mad / robopaint

The software for your friendly painting robot kit!
126 stars 34 forks source link

Switch from nw.js to Electron? #215

Closed techninja closed 9 years ago

techninja commented 9 years ago

Over the past year and a bit our dear glorious foundry of free source control hosting Github created a code editor, Atom, intended to be a desktop application for all to use, while still using web technologies to render it! Sound familiar?

Anyways, they experimented with nw.js (node-webkit), tossed it, tried some other things, then made their own thing the called "Atom-shell", which eventually became the aptly named Electron.

It claims to come stock with:

Which is a lot more than nw.js seems to go for, not to mention it's got backing from Github, and a number of platforms have already jumped on the boat (Spark, Microsoft, Atom (obviously), etc.).

Now it's not all sunshine and rainbows: It does work differently, and would likely require some code changes, but other than that It's likely 99% of the codebase could remain untouched, and might even get numerous speed boosts. What's good for Atom is good for github, and in turn, good for anyone on the shell platform. Intel is apparently the one funding the show over at NW.js, and suffice to say, though they've been gaining a version a month, I've not seen stability or speed do much more than waver.

So, perhaps I put it to a vote? Is it worth it to skip out on NW for big backers, better native support and automatic updates without a whole lot of extra work? This is the discussion thread.

techninja commented 9 years ago

FWIW: Found this in my travels regarding node-serialport & Electron -- https://gist.github.com/jedthehumanoid/a7f8278e0a37d259adca

techninja commented 9 years ago

Continuing on this front:

techninja commented 9 years ago

Progress:

Proof: img_3657

This single stroke image will happily kill 0.9.5, AND the current draft of 0.9.6 in decidedly different ways, yet the Electron version after a day of work surpasses them both and prints it with gusto.

docprofsky commented 9 years ago

For us to switch from nw.js to Electron I think we need to:

Using Electron looks very promising and from what @techninja has said it seems much easier to develop with and has more features and better developed features than nw.js. I think switching to Electron will let us implement some features that are harder to implement using nw.js and are better implemented than nw.js.

techninja commented 9 years ago

Remember, you can make multi-level bullets by adding more spaces in front of them.

Responses:

techninja commented 9 years ago

Current Status:

techninja commented 9 years ago

Update:

After this, I'm going to place my priority on working in my polygonal shape buffering to once and for all handle smooth buffering by handing the work to another processor via web workers. And then at the same time probably bugging @docprofsky and @rogerfachini to see if they're still alive...

oskay commented 9 years ago

w00t!

techninja commented 9 years ago

Building:

Menus & Extras:

Installers (It gets complicated):

techninja commented 9 years ago

WOOF

What the heck is left??

techninja commented 9 years ago

Monday morning notes:

oskay commented 9 years ago

I'm very happy either way on the installer front. Please go whichever way feels (easier + better) to you.

techninja commented 9 years ago

Cool. Will keep running with Squirrel then. If anything it tends to aim towards some very modern trends that learn from the last 20+ years of app installation that I believe have been sorely lacking in any improvement for quite some time.

Figured out the build issue (should have Googled it), fixed in the latest node-gyp 2.0.2 released 6 days ago. Gah, this bleeding edge stuff is crazy. Glad most of the rest of the community if getting on board! Will keep you posted as things keep moving :hamburger:

oskay commented 9 years ago

Awesome. :cat2:

techninja commented 9 years ago

Sigh, blocked again on windows installer builds, but that's fine, still lots more to do :) See https://github.com/atom/grunt-electron-installer/issues/39 for progress.

techninja commented 9 years ago

@oskay What should the app description be in the various app stores? This is the big flop of text on the app download page next to the screenshots.

Ubuntu Software Center is likely first step. I've got it under the "Graphics" category, with the tags "Arts" & "SVG"

oskay commented 9 years ago

I'm not sure that we're anywhere near ready for app stores yet...

techninja commented 9 years ago

DEB & RPM packages have the description as a minimum recommendation. This is what I have right now:

Software for drawing robots, and your friendly painting robot kit, the WaterColorBot!

See more about the WaterColorBot @ http://watercolorbot.com or
Fork & improve the project @ https://github.com/evil-mad/robopaint
techninja commented 9 years ago

I've mostly given up on the Linux package builds for now. Not only is it extra for us at this point, it's not setup cleanly for our current build structure, and very very little of the process is either documented, or easy to follow. I will push my work so far

Windows installer build update:

techninja commented 9 years ago

Umpteenth Update:

With a bit more testing (ignore printing performance for now), getting windows install builds sussed, I'm going to call this issue closed and will submit a PR for both repos!

techninja commented 9 years ago

More good news: I spent maybe 30-40 minutes with @rogerfachini and we got him completely setup for builds on his Linux machine, and tested said builds with the bot plugged in on his Windows machine! Very good stuff, and proof positive we've got a good thing going.

oskay commented 9 years ago

I can (presumably) generate and sign code on my computer-- I'm less sure about my ability to hand off signing to other people. :P

techninja commented 9 years ago

You wouldn't, obviously. We would simply either put the public identity in the file and let the local signature authorize it (the codesigning would fail for anyone other than you), or we set everything up with environment variables. It kind of looks like Atom does this like that... with some other bits thrown in...

You tried the build above yet?

oskay commented 9 years ago

No, haven't run it. It turns out to not be simple enough for me to understand. There are additional unstated prerequisites for this to work.

Edit: I've spent ~1.5 hours trying to figure out how to build this, without hint of success. This is not the best way for me to spend my time on the project. If you seriously need me to compile this, please provide instructions.

Edit: Make that 2 hours. And whoever wrote the grunt instructions should be ashamed of themselves.

oskay commented 9 years ago

Hour number 3: success.

techninja commented 9 years ago

@oskay Oh dear, no no no. Crossed wires. I meant, I built the application for you to try :arrow_right: [Robo Paint Mac WIP Electron_v0.9.6.dmg [47.4MB] ](http://robopaint.tn42.com/RoboPaintMacWIPElectron v0.9.6.dmg)

Will follow up with clearer actual build instructions.

techninja commented 9 years ago

I admire your dedication, but you likely should have scoffed at my lack of documentation to make the build and walked away, or asked for clarity. :P

I'm not sure how required any of these things are, but this ensure a clean and proper build as far as I can tell (for Mac):

Pretty straightforward, I think. I mean, you did eventually figure it out? :P

oskay commented 9 years ago

I did figure it out eventually. However, using node not io.js.

Really not working now, after switching over, trying those instructions. npm install is throwing buckets of errors at me.

techninja commented 9 years ago

Feh. Removing node may NOT have been clean, I have yet to do that on a mac. Paste in some of your errors, should give me a clue as to what's up.

oskay commented 9 years ago
$ npm install

> fs-xattr@0.1.6 install /Users/oskay/Documents/DIY/Project_WaterColorBot/RoboPaint_Release/electron/robopaint-build/node_modules/grunt-appdmg/node_modules/appdmg/node_modules/fs-xattr
> node-gyp rebuild

gyp WARN install got an error, rolling back install
gyp ERR! configure error 
gyp ERR! stack Error: 404 response downloading https://nodejs.org/dist/v2.4.0/node-v2.4.0.tar.gz
gyp ERR! stack     at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:251:14)
[...]

I've rolled back to node, and it's working again.

techninja commented 9 years ago

The 2.4.0 version is io.js, not node, which is why that's failing. My guess is it's not easy to uninstall node on mac. I guess running it on node is fine, though I've been told it's "not recommended", I suppose it doesn't matter unless you're upgrading the native modules :P

So!

oskay commented 9 years ago

So far as I can tell, I did manage to uninstall and unlink node, and then install and link io.js, and started with a fresh copy of the repository, too. Still, something is very screwy.

oskay commented 9 years ago

DMG looks nice. It launches OK, but I haven't had a chance to try much-- too busy wrestling with the other stuff. I may get a chance later tonight.

techninja commented 9 years ago

Hmm... http://stackoverflow.com/questions/11177954/how-do-i-completely-uninstall-node-js-and-reinstall-from-beginning-mac-os-x

I appear to have figured out what needs to happen to make the Squirrel Windows installer actually compile. It involves some very crazy rejiggering of how node works, but it's automated and after the build, so I'm not too concerned. Will update their issue queue and move on to the final phase of this ticket: Testing for electron specific bugs!

techninja commented 9 years ago

It should be noted that the current electron app for Mac is currently programmed to not close the application when the window is closed, "to better act like every other mac application", but I'm beginning to feel that since this is a single window app, this doesn't quite make sense.

@oskay do you think we need something better than just a quit menu item for mac for next release? or should we just avoid the extra work?

oskay commented 9 years ago

A "first class" Mac app should only use the mac menu bar for its functions, never internal menu bars.

That said, it would be good to add:

Launch and context-switching are both MUCH faster in the new version.

I do not know what stage signing has to take place at. In previous builds, I've signed before packaging in the DMG.

techninja commented 9 years ago

I never said anything about internal menu bars, I was referencing my earlier comment about Electron's over the top menu API and it's capability to handle basically anything we need... They can even be dynamic to the given mode. I'm sure that's a feature issue of its own of course.

I'll add the minimum menus given with default shortcuts and we should be in good shape. Bonus for this build system: as I update the electron branch, you can build locally and test any code branch as long as it's pushed :)

techninja commented 9 years ago

@oskay Forgot to ask... do we want to do Windows code and installer signing? Big benefits so says the Atom team. Might cost money. >> https://msdn.microsoft.com/en-us/library/windows/hardware/hh801887.aspx

EDIT: In addition, new to Electron, we have 32 and 64 bit builds, meaning that my Windows builds are by default 64bit. Do we want to offer both? All new Windows machines are shipped as 64bit, though that's likely only in the last 5yrs or so. Good news it should be relatively easy to extract the native build file, and the rest is another few lines of grunt config :)

oskay commented 9 years ago

I'm not sure that I understand the different "dashboard service" options mean, but I'm pretty sure we're not doing LSA or UEFI, which means that a standard certificate about $90/year would work. We could do that.

From what I can tell, even windows 10 (yet to be released!) supports 32-bit. We... probably should as well. :(

techninja commented 9 years ago

Just rolled the native builds for 32bit (thx VirtualBox!), and integrated it into the build scripts, and successfully used the installer and ran the app from the 32bit VM! Apart from code signing, looks like it's small bug mop-up from here on out.

techninja commented 9 years ago

Electron bugs squashed:

Everything else that's wrong appears to simply be things that were already wrong. So that's.. good. Fills are "broken" as they use the "nextTick()" solution, that very successfully BLOCKS anything else from working while they're filling the buffer. This will be fixed first thing after Electron is done.

Automatic Updates:

With that, I'm going to submit the PRs, and unless anything else comes up, will merge these into master (with updated contrib readmes) sometime in the next few days! WOot.

oskay commented 9 years ago

Awesome-- I've scheduled some time for basic tests on Monday morning.

oskay commented 9 years ago

screen shot 2015-07-27 at 4 17 28 pm

Bug in 0.9.6 (as built by me two days ago): The "park" block (in Scratch) does not seem to function.
It does work in 0.9.5, and the Park function within RoboPaint does work.

Snap shows an error when you try to run the park function (screenshot attached).

techninja commented 9 years ago

Wacky. :pineapple: Will take a look at it after Pancake work tonight.

techninja commented 9 years ago

Yea, totally missed that one! I haven't written automated tests for use as a node module (as RoboPaint does) yet, it slightly changes the interaction "surface" to work better/faster, but obviously still a few bits to be tested. this should be fixed now, just rebuild and it should grab a brand new copy of cncserver and park will work.

techninja commented 9 years ago

Alrighty, this seems done with. We're merged and pretty happy, now on to the real problems :)