Shop OBEX P1 Docs P2 Docs Learn Events
Python Downloader modified for MacOS — Parallax Forums

Python Downloader modified for MacOS

Mike GreenMike Green Posts: 23,101
edited 2008-01-25 22:12 in Propeller 1
I've taken the Propeller download program written in Python by Chad George
and modified it to work better under the MacOS. It requires an application
called CocoaDialog available from cocoadialog.sourceforge.net
to handle the file selection dialog and it automatically searches all USB to
serial adapters (/dev/tty.usbserial-). There's still one warning message for
a deprecated statement usage. I'll fix it sometime soon ... I'm new to Python.

Post Edited (Mike Green) : 12/7/2007 11:20:39 PM GMT

Comments

  • crgwbrcrgwbr Posts: 614
    edited 2007-12-05 02:12
    welcome to the world of Python, Mike. I'm certainly no expert in it, but I have written a few nice programs in it. I'm curious though, where were you able to find the original python loader? I heard about it a few months ago, but was unable to find it.

    regards,
    Craig

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "... one of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs." -

    "If Python is executable pseudocode, then perl is executable line noise."

    "The best accelerator available for a Mac is one that causes it to go at 9.81 m/s2."

    "My software never has bugs. It just develops random features."

    "Windows isn't a virus, viruses do something."

    "Programmers are tools for converting caffeine into code."

    "Enter any 11-digit prime number to continue."
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2007-12-05 02:42
  • samsn4samsn4 Posts: 49
    edited 2007-12-05 17:43
    So, does this mean we're closer to having a prop tool for Mac ?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Daniel Mueth
    WSIU-TV Master Control

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    "Just plug it in and let's see what happens"
  • Mike GreenMike Green Posts: 23,101
    edited 2007-12-05 19:12
    Daniel,
    These are all little pieces. There is an assembler in Java that's not finished by any means, but seems to be usable. There is this Python downloader. There are lots of Mac programming editors, many of which can work as an IDE. The big piece that is missing is a Spin compiler. ImageCraft's C compiler won't help because that's Windows-only.
  • Mike GreenMike Green Posts: 23,101
    edited 2007-12-07 23:23
    I updated the version of the downloader on the first message here. This version is a free standing application that's double clickable. It still needs the CocoaDialog program which I've included here. This can be put in the user's Applications folder or the system Applications folder. It automatically looks for the first attached Propeller, then asks for the file to download. It'll display a progress window, then a final closing dialog window.
  • Chad GeorgeChad George Posts: 138
    edited 2007-12-07 23:45
    Mike,

    Its funny about the Python loader because shortly after I wrote it I noticed somebody else had written one (I'm pretty sure independently) and that one ended up on Graham's thread index.
    Not that I care, actually the other one seems to work a little better and its definitely more feature complete.

    I even added another feature to it instead of mine. It's only been tested under Linux, but it should work on Mac OS too I would think.
    Now it accepts the -t flag to automatically open a serial terminal after downloading the program.
    This is a feature that I definitely think the Prop Tool should have but doesn't.

    The terminal program is somewhat compatible with combined keyboard-mouse-screen driver that was written for use with
    the PropTerminal program that is available for windows. Basically all that works is setting text position and keyboard
    input, but that's about all I use.

    It needs the curses terminal library which is available for Linux by default (but not available in windows at all as far as I know)

    This code is so rough that I hesitate to post it, but since it is functional enough for me I probably won't ever really finish it off.

    Hope its useful to someone else too,
    Chad
  • Mike GreenMike Green Posts: 23,101
    edited 2007-12-08 03:41
    I made a mistake in the routine to find CocoaDialog. Here also is a standalone tool to run pLMMAss.jar, a java assembler for the Large Memory Model. This will find pLMMAss.jar in either the user's applications folder or the system's (or Application Support), then run it with a selected assembly (.asm) file. The binary and listing files are put in the same folder as the source file.

    The assembler was written by Ale and is available here: http://forums.parallax.com/showthread.php?p=692062.
  • Remy BlankRemy Blank Posts: 42
    edited 2007-12-08 09:32
    Chad George said...
    Its funny about the Python loader because shortly after I wrote it I noticed somebody else had written one (I'm pretty sure independently) and that one ended up on Graham's thread index.
    Not completely independently, I did use Chip's protocol document and Delphi source code as the reference, but I also had a look at your loader. Which, IIRC, was a pretty direct translation from the Delphi unit.

    -- Remy
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-01-25 07:46
    Mike, would you be able to change this so that it downloads to the eeprom?

    Steven
  • Mike GreenMike Green Posts: 23,101
    edited 2008-01-25 16:18
    Here it is. At the end of the python code, there's a call to a routine "TalkToHardware". The 2nd parameter is a function code. 1 is the code for download to RAM then run. 3 is the code for download to RAM, write and verify to EEPROM, and run it. The easiest thing to do was to make two different versions which are attached here.
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-01-25 21:12
    Thanks Mike. How do you make the application run? I can get it to work if I open the application package and copy the script into a folder with the serial code but I can't get the application to work by itself. It just opens and then quits without doing anything.

    Steven
  • Mike GreenMike Green Posts: 23,101
    edited 2008-01-25 21:28
    You need an application called CocoaDialog. There's a link in the first message in this thread.

    The package was built with an application called Platypus which I don't believe is needed after building the package.
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-01-25 21:33
    Just downloaded it and put it in the same folder and it still doesn't work. Does it need to be in the application folder?

    Steven
  • Mike GreenMike Green Posts: 23,101
    edited 2008-01-25 21:36
    CocoaDialog needs to be in one of the following places: "/Applications", "/Library/Application Support", "~/Applications", "~/Library/Application Support". This list is in a routine at the beginning of the program and you can add to it if you want.
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-01-25 22:04
    Everything is now in the root application folder and it still doesn't work. The icon starts to appear in the dock and then instantly disappears. Does it write anything to any of the logs?

    Steven
  • Mike GreenMike Green Posts: 23,101
    edited 2008-01-25 22:12
    I'm afraid I can't help too much here. I took the existing Python loader which worked and added a GUI wrapper using sample code from CocoaDialog. There's no Python code in what I have that writes to the logs. CocoaDialog may do so. I don't know why it wouldn't work for you.
Sign In or Register to comment.