Skip to content
This repository
Browse code

Platypus app bundling, changed a few things to avoid having to use co…

…mmand line options; /flash_firmware invokes avrdude for example; also the arduino can now be connected after the app is started and it will still find it (osx only for now)
  • Loading branch information...
commit 96148fe063ab2d650ff9ff850c0c88d7f4d1df6a 1 parent 5dc4961
Stefan Hechenberger authored
41 backend/app.py
@@ -10,7 +10,7 @@
10 10
11 11
12 12 APPNAME = "lasaurapp"
13   -VERSION = "v12.06b"
  13 +VERSION = "v12.06c"
14 14 COMPANY_NAME = "com.nortd.labs"
15 15 SERIAL_PORT = None
16 16 BITSPERSECOND = 9600
@@ -237,7 +237,9 @@ def serial_handler(connect):
237 237 print 'js is asking to connect serial'
238 238 if not SerialManager.is_connected():
239 239 try:
240   - global SERIAL_PORT, BITSPERSECOND
  240 + global SERIAL_PORT, BITSPERSECOND, GUESS_PPREFIX
  241 + if not SERIAL_PORT and os.name == 'posix':
  242 + SERIAL_PORT = SerialManager.match_device(GUESS_PPREFIX)
241 243 SerialManager.connect(SERIAL_PORT, BITSPERSECOND)
242 244 ret = "Serial connected to %s:%d." % (SERIAL_PORT, BITSPERSECOND) + '<br>'
243 245 time.sleep(1.0) # allow some time to receive a prompt/welcome
@@ -245,6 +247,7 @@ def serial_handler(connect):
245 247 SerialManager.flush_output()
246 248 return ret
247 249 except serial.SerialException:
  250 + SERIAL_PORT = None
248 251 print "Failed to connect to serial."
249 252 return ""
250 253 elif connect == '0':
@@ -259,7 +262,15 @@ def serial_handler(connect):
259 262 else:
260 263 print 'ambigious connect request from js: ' + connect
261 264 return ""
262   -
  265 +
  266 +@route('/flash_firmware')
  267 +def flash_firmware_handler():
  268 + if SerialManager.is_connected():
  269 + SerialManager.close()
  270 + if os.name == 'posix':
  271 + SERIAL_PORT = SerialManager.match_device(GUESS_PPREFIX)
  272 + flash_upload(SERIAL_PORT, resources_dir())
  273 + return '<h2>flashing finished!</h2> Check Log window for possible errors.<br><a href="/">return</a>'
263 274
264 275 # @route('/gcode/:gcode_line')
265 276 # def gcode_handler(gcode_line):
@@ -357,7 +368,7 @@ def run_helper():
357 368 run_with_callback('127.0.0.1')
358 369
359 370
360   -
  371 +print "LasaurApp " + VERSION
361 372 if args.list_serial_devices:
362 373 SerialManager.list_devices()
363 374 else:
@@ -390,19 +401,19 @@ def run_helper():
390 401 if SERIAL_PORT:
391 402 print "Using serial device '"+ str(SERIAL_PORT) +"' by best guess."
392 403
393   - if SERIAL_PORT:
394   - run_helper()
395   - else:
  404 + if SERIAL_PORT or os.name == 'posix':
  405 + # with posix system we can also guess the serial port later
  406 + print "-----------------------------------------------------------------------------"
  407 + print "WARNING: LasaurApp doesn't know what serial device to connect to!"
  408 + print "Make sure the Lasersaur hardware is connectd to the USB interface."
  409 + print "-----------------------------------------------------------------------------"
  410 + run_helper()
  411 + else:
396 412 print "-----------------------------------------------------------------------------"
397 413 print "WARNING: LasaurApp doesn't know what serial device to connect to!"
398   - print "On Linux or OSX this is something like '/dev/tty.usbmodemfd121' and on"
399   - print "Windows this is something like 'COM1', 'COM2', 'COM3', ..."
400   - print "The serial port can be supplied in one of the following ways:"
401   - print "(1) First argument on the command line."
402   - print "(2) In a config file named '" + CONFIG_FILE + "' (located in same directory)"
403   - print " with the serial port string on the first line."
404   - print "(3) Best guess. On Linux and OSX the app can guess the serial name by"
405   - print " choosing the first device it finds starting with '"+ GUESS_PPREFIX +"'."
  414 + print "Please specify the com port as the first argument, e.g:"
  415 + print "lasaurapp COM7"
  416 + print "where COM7 is the actual com port the Lasersaur is connected to."
406 417 print "-----------------------------------------------------------------------------"
407 418 ret = raw_input('Run anyways (y/n)? ')
408 419 if ret in 'yY' and ret != '':
3  frontend/js/app_svgreader.js
@@ -87,6 +87,9 @@ SVGReader = {
87 87 } else if (svghead.search(/CorelDraw/i) != -1) {
88 88 this.dpi = 96;
89 89 $().uxmessage('notice', "SVG exported with CorelDraw -> 96dpi.");
  90 + } else if (svghead.search(/Qt/i) != -1) {
  91 + this.dpi = 90;
  92 + $().uxmessage('notice', "SVG exported with Qt lib -> 90dpi.");
90 93 }
91 94 }
92 95
3  other/app.spec
@@ -52,4 +52,7 @@ exe = EXE(pyz,
52 52 strip=None,
53 53 upx=True,
54 54 console=True )
  55 +
  56 +# app = BUNDLE(exe,
  57 +# name=target_location + '.app')
55 58
BIN  other/dist_osx/LasaurApp.icns
Binary file not shown
92 other/dist_osx/LasaurApp.platypus
... ... @@ -0,0 +1,92 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3 +<plist version="1.0">
  4 +<dict>
  5 + <key>AcceptsFiles</key>
  6 + <true/>
  7 + <key>AcceptsText</key>
  8 + <false/>
  9 + <key>Authentication</key>
  10 + <false/>
  11 + <key>Author</key>
  12 + <string>Nortd Labs</string>
  13 + <key>BundledFiles</key>
  14 + <array>
  15 + <string>/Users/noema/Development/git/LasaurApp/other/dist_osx/lasaurapp</string>
  16 + </array>
  17 + <key>Creator</key>
  18 + <string>Platypus-4.7</string>
  19 + <key>DeclareService</key>
  20 + <false/>
  21 + <key>Destination</key>
  22 + <string>/Users/noema/Desktop/MyPlatypusApp.app</string>
  23 + <key>DestinationOverride</key>
  24 + <false/>
  25 + <key>DevelopmentVersion</key>
  26 + <false/>
  27 + <key>DocIcon</key>
  28 + <string></string>
  29 + <key>Droppable</key>
  30 + <false/>
  31 + <key>ExecutablePath</key>
  32 + <string>/usr/local/share/platypus/ScriptExec</string>
  33 + <key>FileTypes</key>
  34 + <array>
  35 + <string>****</string>
  36 + <string>fold</string>
  37 + </array>
  38 + <key>IconPath</key>
  39 + <string>/Users/noema/Development/git/LasaurApp/other/dist_osx/LasaurApp.icns</string>
  40 + <key>Identifier</key>
  41 + <string>org.noema.LasaurApp</string>
  42 + <key>Interpreter</key>
  43 + <string>/bin/bash</string>
  44 + <key>InterpreterArgs</key>
  45 + <array/>
  46 + <key>Name</key>
  47 + <string>LasaurApp</string>
  48 + <key>NibPath</key>
  49 + <string>/usr/local/share/platypus/MainMenu.nib</string>
  50 + <key>OptimizeApplication</key>
  51 + <true/>
  52 + <key>Output</key>
  53 + <string>Text Window</string>
  54 + <key>RemainRunning</key>
  55 + <true/>
  56 + <key>Role</key>
  57 + <string>Viewer</string>
  58 + <key>ScriptArgs</key>
  59 + <array/>
  60 + <key>ScriptPath</key>
  61 + <string>/Users/noema/Development/git/LasaurApp/other/dist_osx/platypus.sh</string>
  62 + <key>Secure</key>
  63 + <false/>
  64 + <key>ShowInDock</key>
  65 + <false/>
  66 + <key>StatusItemDisplayType</key>
  67 + <string>Text</string>
  68 + <key>StatusItemIcon</key>
  69 + <data>
  70 + </data>
  71 + <key>StatusItemTitle</key>
  72 + <string>MyPlatypusApp</string>
  73 + <key>Suffixes</key>
  74 + <array>
  75 + <string>*</string>
  76 + </array>
  77 + <key>TextBackground</key>
  78 + <string>#ffffff</string>
  79 + <key>TextEncoding</key>
  80 + <integer>4</integer>
  81 + <key>TextFont</key>
  82 + <string>Monaco</string>
  83 + <key>TextForeground</key>
  84 + <string>#000000</string>
  85 + <key>TextSize</key>
  86 + <real>10</real>
  87 + <key>UseXMLPlistFormat</key>
  88 + <true/>
  89 + <key>Version</key>
  90 + <string>v12.06c</string>
  91 +</dict>
  92 +</plist>
3  other/dist_osx/platypus.sh
... ... @@ -0,0 +1,3 @@
  1 +
  2 +chmod +x lasaurapp;
  3 +./lasaurapp

0 comments on commit 96148fe

Please sign in to comment.
Something went wrong with that request. Please try again.