Shop OBEX P1 Docs P2 Docs Learn Events
FlexGUI Libraries? — Parallax Forums

FlexGUI Libraries?

JonnyMacJonnyMac Posts: 9,102
edited 2019-10-17 21:05 in General Discussion
I found this line in .flexgui.config
library	{C:/MyPrograms/flexgui/include}
Since there is multi-language support, does it make sense to include language-specific library paths as well?

Comments

  • I believe you can mix and match libraries. C can include and call a BASIC lib, and vice versa.
  • So that means all of the Spin, Spin2, C, and BASIC libraries have to live in one folder? I have a substantial number of Spin libraries that I'd like to point to. What hoping that the compiler could use multiple library paths.
  • At the moment I usually keep the libraries in separate folders named "spin/", "basic/", and so on, and refer to them by names like "spin/FullDuplexSerial".

    The underlying compiler can handle multiple libraries (you can put the -L option on the command line multiple times, once for each library) but it isn't exposed in the GUI yet, except through the rather crude way of changing the compiler command in the Commands > Configure Commands... dialog box. It sounds like supporting multiple libraries in the GUI would be a useful addition, thanks for the suggestion.
  • AwesomeCronkAwesomeCronk Posts: 1,055
    edited 2019-10-19 19:31
    May or may not apply here, but with html, you can ‘jump up’ a file level using the ‘..’ operator.
    Main
    —other
     —folder
     —new
    —images
     —raw
     —processed
    
    Jump from ‘new’ to raw:
    Path = “../../images/raw
    

    That last line jumps up two directories, then down through images into raw. I don’t know if this works outside html or not, but it might.
  • ersmith wrote: »
    At the moment I usually keep the libraries in separate folders named "spin/", "basic/", and so on, and refer to them by names like "spin/FullDuplexSerial".

    The underlying compiler can handle multiple libraries (you can put the -L option on the command line multiple times, once for each library) but it isn't exposed in the GUI yet, except through the rather crude way of changing the compiler command in the Commands > Configure Commands... dialog box. It sounds like supporting multiple libraries in the GUI would be a useful addition, thanks for the suggestion.

    I tried adding a second -L with the path to my Spin libraries; it did not work, Is it because your main library folder acts like an anchor for any library option?
  • JonnyMac wrote: »
    ersmith wrote: »
    The underlying compiler can handle multiple libraries (you can put the -L option on the command line multiple times, once for each library) but it isn't exposed in the GUI yet, except through the rather crude way of changing the compiler command in the Commands > Configure Commands... dialog box. It sounds like supporting multiple libraries in the GUI would be a useful addition, thanks for the suggestion.

    I tried adding a second -L with the path to my Spin libraries; it did not work, Is it because your main library folder acts like an anchor for any library option?

    No, the library paths should be independent (and seem to be when I try it out here). They're all relative to the current directory the program is running in. It probably wouldn't hurt to give complete paths to the library (like "C:\MyProp\Library").

    Does your library path have spaces in it? Perhaps there's a bug in handling that. Could you share your command line and the errors it's showing?
  • evanhevanh Posts: 15,915
    ...
    Path = “../../images/raw
    
    That last line jumps up two directories, then down through images into raw. I don’t know if this works outside html or not, but it might.
    To HTML, that's just a string like any other. The meaning of the string as a path is handled by the host OS (Unix compatible in this case) when it gets used for file access.

  • So then it should work in this case. Nice!
  • JonnyMacJonnyMac Posts: 9,102
    edited 2019-10-20 19:58
    I did use the full path and enclosed it in quotes to deal with spaces. My modified P1 compile command:
    "%D/bin/fastspin" -l %O -L "%L" -L "C:\MyPrograms\Parallax Inc\Propeller Tool v1.3.2\Library" "%S"
    
    I added a refernce to my time library like this:
    #ifdef __P2__
      ser: "spin/SmartSerial"
    #else
      ser:  "spin/FullDuplexSerial"
      time: "jm_time_80"
    #endif
    
    Resulting error:
    Unable to open file `jm_time_80': child process exited abnormally
    This is the command output:
    "C:/MyPrograms/flexgui/bin/fastspin" -l -O1 -L "C:/MyPrograms/flexgui/include" -L "C:\MyPrograms\Parallax Inc\Propeller Tool v1.3.2\Library" "C:/MyPrograms/flexgui/samples/hello.spin"
  • JonnyMacJonnyMac Posts: 9,102
    edited 2019-10-20 20:01
    One second after posting I noticed that the path I added was Windows-style while the others are Linux-style. I modified my additional path and now it works.
    "%D/bin/fastspin" -l %O -L "%L" -L "C:/MyPrograms/Parallax Inc/Propeller Tool v1.3.2/Library" "%S"
  • Hmmm, that's interesting. The Windows style path should have worked. Somewhere there must be an assumption about the path separator. I'll have to open a bug for that. Thanks for checking it!
  • Jon: The final (non-preview) version of flexgui that I just uploaded has a new dialog box that allows you to select multiple libraries. Thanks for suggesting this, it should make things easier for many people coming from other IDEs.
  • JonnyMacJonnyMac Posts: 9,102
    edited 2019-10-23 17:21
    Gave it a try. The program does allow me to add to the libraries list, but that list is not being saved to when that window is closed. Is there supposed to be an [OK] button to handle that? The only thing now is [Add] and [Delete].
  • Darn it, I was sure I had tested that, but I must have forgotten and left the window open. So for now just leave the libraries window open (it's not modal, so you can switch away from it or even minimize it), and the contents will be used automatically when you compile and run.
  • Ah, I see what happened, I made a last minute change that I thought would improve things and actually broke it :(. Sorry about that. I'll release 4.0.1 in a day or two with that fixed and any other bugs that people find.
  • While making that change to save the library paths, can you fix the issue for macOS where the buttons are not displayed, initially? And the width of the window limits viewing long pathnames...

    To fix this, I added "tsk::" to button descriptions and a "-width 72" to the library path fields, in pathbox.tcl
    listbox .pb.pathbox -width 72
    ...
    ttk::button .pb.buttons.ok -text "Add..." -command do_pb_add
    ttk::button .pb.buttons.cancel -text "Delete" -command do_pb_delete
    

    dgately
  • Thanks @dgately. I've applied your fixes to the current github. Does that seem to work OK on MacOS?
  • The changes to the library path window work on macOS... Thanks!

    But... Every other time that window is opened (selecting the menu item, "Libraries directory..."), the UI is frozen. The OK button looks selected, but I can't click on any UI items except the red close box of the window. A third selection of the menu results in a working window... And on and on...
    InitialUse.png
    SecondUse.png
    dgately
    888 x 306 - 81K
    888 x 306 - 105K
  • Hmmm, interesting. Maybe on some platforms it's better to just destroy the window and re-create it rather than "withdraw" and re-show. I've updated the source code to do this, I hope it'll work better for you.

    Thanks @dgately
  • dgatelydgately Posts: 1,630
    edited 2019-10-25 01:45
    ersmith wrote: »
    Hmmm, interesting. Maybe on some platforms it's better to just destroy the window and re-create it rather than "withdraw" and re-show. I've updated the source code to do this, I hope it'll work better for you.
    That works... Note that the "Configure Commands..." has a similar issue in that the previously clicked button is highlighted when you return to that window... Then, it 'auto-magically' clears itself, leaving the button highlighted, but functional.
    CancelHighlighted.png
    dgately
    443 x 497 - 137K
  • Thanks @dgately. I think the Executable Paths dialog should be fixed now as well.

    There's a new binary release (4.0.1) containing these GUI fixes and some minor C bugfixes to fastspin, as well as the latest loadp2. As usual, it may be obtained either from my Patreon page (https://patreon.com/totalspectrum) or from Github (https://github.com/totalspectrum/flexgui/releases/latest).

  • That seems to be working well (Win10), thank you.
Sign In or Register to comment.