Browse files

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...
1 parent 5dc4961 commit 96148fe063ab2d650ff9ff850c0c88d7f4d1df6a @stefanix committed May 18, 2012
View
41 backend/app.py
@@ -10,7 +10,7 @@
APPNAME = "lasaurapp"
-VERSION = "v12.06b"
+VERSION = "v12.06c"
COMPANY_NAME = "com.nortd.labs"
SERIAL_PORT = None
BITSPERSECOND = 9600
@@ -237,14 +237,17 @@ def serial_handler(connect):
print 'js is asking to connect serial'
if not SerialManager.is_connected():
try:
- global SERIAL_PORT, BITSPERSECOND
+ global SERIAL_PORT, BITSPERSECOND, GUESS_PPREFIX
+ if not SERIAL_PORT and os.name == 'posix':
+ SERIAL_PORT = SerialManager.match_device(GUESS_PPREFIX)
SerialManager.connect(SERIAL_PORT, BITSPERSECOND)
ret = "Serial connected to %s:%d." % (SERIAL_PORT, BITSPERSECOND) + '<br>'
time.sleep(1.0) # allow some time to receive a prompt/welcome
SerialManager.flush_input()
SerialManager.flush_output()
return ret
except serial.SerialException:
+ SERIAL_PORT = None
print "Failed to connect to serial."
return ""
elif connect == '0':
@@ -259,7 +262,15 @@ def serial_handler(connect):
else:
print 'ambigious connect request from js: ' + connect
return ""
-
+
+@route('/flash_firmware')
+def flash_firmware_handler():
+ if SerialManager.is_connected():
+ SerialManager.close()
+ if os.name == 'posix':
+ SERIAL_PORT = SerialManager.match_device(GUESS_PPREFIX)
+ flash_upload(SERIAL_PORT, resources_dir())
+ return '<h2>flashing finished!</h2> Check Log window for possible errors.<br><a href="/">return</a>'
# @route('/gcode/:gcode_line')
# def gcode_handler(gcode_line):
@@ -357,7 +368,7 @@ def run_helper():
run_with_callback('127.0.0.1')
-
+print "LasaurApp " + VERSION
if args.list_serial_devices:
SerialManager.list_devices()
else:
@@ -390,19 +401,19 @@ def run_helper():
if SERIAL_PORT:
print "Using serial device '"+ str(SERIAL_PORT) +"' by best guess."
- if SERIAL_PORT:
- run_helper()
- else:
+ if SERIAL_PORT or os.name == 'posix':
+ # with posix system we can also guess the serial port later
+ print "-----------------------------------------------------------------------------"
+ print "WARNING: LasaurApp doesn't know what serial device to connect to!"
+ print "Make sure the Lasersaur hardware is connectd to the USB interface."
+ print "-----------------------------------------------------------------------------"
+ run_helper()
+ else:
print "-----------------------------------------------------------------------------"
print "WARNING: LasaurApp doesn't know what serial device to connect to!"
- print "On Linux or OSX this is something like '/dev/tty.usbmodemfd121' and on"
- print "Windows this is something like 'COM1', 'COM2', 'COM3', ..."
- print "The serial port can be supplied in one of the following ways:"
- print "(1) First argument on the command line."
- print "(2) In a config file named '" + CONFIG_FILE + "' (located in same directory)"
- print " with the serial port string on the first line."
- print "(3) Best guess. On Linux and OSX the app can guess the serial name by"
- print " choosing the first device it finds starting with '"+ GUESS_PPREFIX +"'."
+ print "Please specify the com port as the first argument, e.g:"
+ print "lasaurapp COM7"
+ print "where COM7 is the actual com port the Lasersaur is connected to."
print "-----------------------------------------------------------------------------"
ret = raw_input('Run anyways (y/n)? ')
if ret in 'yY' and ret != '':
View
3 frontend/js/app_svgreader.js
@@ -87,6 +87,9 @@ SVGReader = {
} else if (svghead.search(/CorelDraw/i) != -1) {
this.dpi = 96;
$().uxmessage('notice', "SVG exported with CorelDraw -> 96dpi.");
+ } else if (svghead.search(/Qt/i) != -1) {
+ this.dpi = 90;
+ $().uxmessage('notice', "SVG exported with Qt lib -> 90dpi.");
}
}
View
3 other/app.spec
@@ -52,4 +52,7 @@ exe = EXE(pyz,
strip=None,
upx=True,
console=True )
+
+# app = BUNDLE(exe,
+# name=target_location + '.app')
View
BIN other/dist_osx/LasaurApp.icns
Binary file not shown.
View
92 other/dist_osx/LasaurApp.platypus
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>AcceptsFiles</key>
+ <true/>
+ <key>AcceptsText</key>
+ <false/>
+ <key>Authentication</key>
+ <false/>
+ <key>Author</key>
+ <string>Nortd Labs</string>
+ <key>BundledFiles</key>
+ <array>
+ <string>/Users/noema/Development/git/LasaurApp/other/dist_osx/lasaurapp</string>
+ </array>
+ <key>Creator</key>
+ <string>Platypus-4.7</string>
+ <key>DeclareService</key>
+ <false/>
+ <key>Destination</key>
+ <string>/Users/noema/Desktop/MyPlatypusApp.app</string>
+ <key>DestinationOverride</key>
+ <false/>
+ <key>DevelopmentVersion</key>
+ <false/>
+ <key>DocIcon</key>
+ <string></string>
+ <key>Droppable</key>
+ <false/>
+ <key>ExecutablePath</key>
+ <string>/usr/local/share/platypus/ScriptExec</string>
+ <key>FileTypes</key>
+ <array>
+ <string>****</string>
+ <string>fold</string>
+ </array>
+ <key>IconPath</key>
+ <string>/Users/noema/Development/git/LasaurApp/other/dist_osx/LasaurApp.icns</string>
+ <key>Identifier</key>
+ <string>org.noema.LasaurApp</string>
+ <key>Interpreter</key>
+ <string>/bin/bash</string>
+ <key>InterpreterArgs</key>
+ <array/>
+ <key>Name</key>
+ <string>LasaurApp</string>
+ <key>NibPath</key>
+ <string>/usr/local/share/platypus/MainMenu.nib</string>
+ <key>OptimizeApplication</key>
+ <true/>
+ <key>Output</key>
+ <string>Text Window</string>
+ <key>RemainRunning</key>
+ <true/>
+ <key>Role</key>
+ <string>Viewer</string>
+ <key>ScriptArgs</key>
+ <array/>
+ <key>ScriptPath</key>
+ <string>/Users/noema/Development/git/LasaurApp/other/dist_osx/platypus.sh</string>
+ <key>Secure</key>
+ <false/>
+ <key>ShowInDock</key>
+ <false/>
+ <key>StatusItemDisplayType</key>
+ <string>Text</string>
+ <key>StatusItemIcon</key>
+ <data>
+ </data>
+ <key>StatusItemTitle</key>
+ <string>MyPlatypusApp</string>
+ <key>Suffixes</key>
+ <array>
+ <string>*</string>
+ </array>
+ <key>TextBackground</key>
+ <string>#ffffff</string>
+ <key>TextEncoding</key>
+ <integer>4</integer>
+ <key>TextFont</key>
+ <string>Monaco</string>
+ <key>TextForeground</key>
+ <string>#000000</string>
+ <key>TextSize</key>
+ <real>10</real>
+ <key>UseXMLPlistFormat</key>
+ <true/>
+ <key>Version</key>
+ <string>v12.06c</string>
+</dict>
+</plist>
View
3 other/dist_osx/platypus.sh
@@ -0,0 +1,3 @@
+
+chmod +x lasaurapp;
+./lasaurapp

0 comments on commit 96148fe

Please sign in to comment.