Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Codea 2.3.3 (Previously Codea 2.3.3 Beta Thread)

SimeonSimeon Admin Mod
edited March 11 in General Posts: 4,352

This is the thread for beta discussion. It looks like Apple has approved the project import feature (at least for beta testing!).

There is also the project API I discussed with @dave1707, however the documentation for that API will come in the next build.

«1

Comments

  • dave1707dave1707 Mod
    edited January 22 Posts: 5,903

    @Simeon Exactly what is the export option going to do and where is the zip file going to be. Does it do anything to the existing projects because I have 400+ projects that I don't want to have to fix.

  • Posts: 1,983

    @dave1707 that's the point of being a beta-tester, you're meant to tap it and see.

    Once it's produced the zip archive, it gives you the standard iOS share dialogue, so you can put it wherever you like. I airdropped it to my Mac.

    I also have around 400 projects, about 250mb altogether (probably the assets making up most of that). It took about 5 minutes to zip the files.

    I haven't been brave enough to try the re-import yet, as I only have 1 iPad. Perhaps someone with more than one device should test that.

  • dave1707dave1707 Mod
    Posts: 5,903

    So far, the createProject(), deleteProject(), and listProjects() appear to work as described.

  • Posts: 1,983

    @Simeon thanks for this, seems great so far!

    I think procedural project managing is actually really important, as it will allow people to write proper installers and dependency management.

  • dave1707dave1707 Mod
    Posts: 5,903

    @yojimbo2000 I tried the export on my 475 projects. It took about 20 seconds before it asked me where to put the file. I picked Dropbox and that took about a minute before it was done. My zip file shows 6.5 MB. @Simeon I like the comments that show as the zip file is created.

  • SimeonSimeon Admin Mod
    Posts: 4,352

    @dave1707 @yojimbo2000 thanks for your feedback!

    @yojimbo2000 the import will display a panel asking you to select which projects or assets to import. It won't do anything until you confirm the import. But yeah, it might be better to test it with a zip file of one or two projects, or assets. It should be able to import anything that Codea can read from a zip file.

    @dave1707 I think if you are an advanced user that has more than 400 projects then we're not going to be able to offer the perfect solution for project management. Thank you for prompting me about the create project API, hopefully it lets you build what you need.

  • dave1707dave1707 Mod
    Posts: 5,903

    @Simeon Thanks for the listProjects, createProject, and deleteProject functions. I have code already written to use them, I was just waiting for those functions to show up. I'll be changing my code now that I can actually test with them to create something useful.

  • dave1707dave1707 Mod
    edited January 23 Posts: 5,903

    @Simeon Here's something that needs to be looked at.

    1. createProject() causes an error if the project exists.
    2. createProject() doesn't return anything when it creates a project.
    3. deleteProject() causes an error if the project doesn't exist.
    4. deleteProject() doesn't return anything when it deletes a project.

    I don't know if they need to return something if successful, but they shouldn't cause the program to terminate with an error.

    EDIT: I can get around the problem if I use listProjectTabs to see if a project exists, but that's kind of goofy.

  • dave1707dave1707 Mod
    Posts: 5,903

    @Simeon After some thought, I think createProject should return true if it creates a project, return false without touching a project if the project exists. If it returns false, then I can determine why I'm trying to create an existing project. If needed, I could then delete the project and then create it. Same goes for deleteProject. If it deletes a project, return true, if the project doesn't exist, return false. If false, then I can determine why I'm trying to delete a project that doesn't exist.

  • dave1707dave1707 Mod
    Posts: 5,903

    @Simeon One thing I noticed, when I tap on a project name and select to delete it, it seems to take a long time. I tried it several times and it seems a lot longer. This is when 2 iPads would be nice, one on the beta, one on the last release.

  • dave1707dave1707 Mod
    Posts: 5,903

    @Simeon I don't use Air Code, but I tried it anyways and all I get is a black screen.

  • dave1707dave1707 Mod
    Posts: 5,903

    @Simeon I did the export of all my projects. On the iPad I tried to look at the zip file with a zip viewer. I see all of my projects in a list as projectname.codea. When I select a project, I see a info.plist and Main.lua file. When I look at either of them, I see nothing. I found 2 png files and when I selected them, I see the correct images. Not sure why I can see the images, but not any text when I look at the project files.

  • SimeonSimeon Admin Mod
    Posts: 4,352

    @dave1707 thank you for the feedback. I better look into the Air Code issue.

    I purposefully made createProject and deleteProject throw runtime errors in those circumstances. I considered that they are fairly powerful functions and by throwing errors we can hopefully ensure that code is using them correctly.

    The solution I envisioned was as you said, use listProjects to check if a project exists. But I think we need to have a function to check. Something like projectExists(name)

    Then you could say:

    if projectExists(name) then
        deleteProject(name)
        createProject(name)
    else
        createProject(name)
    end
    

    (Or whatever you want to do.)

    The function projectExists could be written now in terms of listProjects, but I agree that you shouldn't have to write that just to use the project management API.

  • SimeonSimeon Admin Mod
    Posts: 4,352

    Also note there is a kind of "secret" feature exposed under the new project management API.

    If you create a project with a non-existent collection, that collection will be created and it should show as a separate section in the project browser UI.

    For example, createProject("Libraries:My Library") will add a new section to the main UI called "Libraries" with the project in it. The project collections feature will be exposed properly in the main UI in a future update, but for now it can be used through the API.

    These projects are stored in your documents as Documents/<Collection Name>.collection/<Project Name>.codea

  • dave1707dave1707 Mod
    Posts: 5,903

    @Simeon I think the projectExists function would be perfect. It would be use just like you show above and the create and delete project functions wouldn't have to be changed.

  • Posts: 505

    Hi Guys,

    Testing with iPad Pro (9.7) with iOS 10.2.

    I have had some problems with the Project Archive, which I'll go into later (as I am currently installing 10.2.1 and will retest then) ... but I have just being trying to access my pad by Aircode for editing a simple program and when I click on the program icon in Firefox the iPad drops back to the 'desktop' screen.

    Can someone else confirm this.

    Bri_G
    :)

  • dave1707dave1707 Mod
    Posts: 5,903

    @Bri_G I'm using an iPad Air and I mentioned above that when I try using Aircode I get a black screen.

  • Posts: 505

    Hi @dave1707 ,

    Thanks for the reply, I got a black screen when I first loaded up the template when I was on iOS 10.2 switching to another program resulted in the crash, now I have 10.21 and I'm getting a black screen with any program - totally hooked up (p.s. also updated to the latest Firefox - so where the change is I'm not sure.

    Thanks.

    Bri_G
    :)

  • SimeonSimeon Admin Mod
    Posts: 4,352
    AirCode black screen issue will be fixed in the next version. I'll upload it shortly.
  • dave1707dave1707 Mod
    Posts: 5,903

    @Simeon I did the export to a zip file and saved it on the iCloud Drive. I was able to use the free version of iZip to unzip one of my projects, copy it, and then paste it back into a Codea project. So the use of the zip file as a way to have a backup copy of projects works well. Of course, I wouldn't want to have to do that for hundreds of projects, but just in case a project gets deleted, that works just fine.

  • dave1707dave1707 Mod
    Posts: 5,903

    Tried Aircode in the latest version and it now show the address to connect to instead of a black screen. I don't use Aircode, so that's as far as I went.

  • SimeonSimeon Admin Mod
    Posts: 4,352

    Thanks @dave1707, you can check for projects with the hasProject(name) now.

  • dave1707dave1707 Mod
    edited January 24 Posts: 5,903

    @Simeon hasProject() works just fine. Thanks.

    EDIT: The editor showing the argument labels seems to work also. I normally type the () anytime they're needed and then put the cursor inside them, so I probably won't see the change for the argument labels. But I guess anyone who uses an external keyboard would probably use it.

  • dave1707dave1707 Mod
    Posts: 5,903

    @Simeon The TestFlight info says support for importing files. I'm not sure what you mean or how to do this. Not sure how to test this.

  • SimeonSimeon Admin Mod
    Posts: 4,352

    @dave1707 basically if you Airdrop a PNG, PDF, JPG, or Project.codea file (or use the sharing menu on such files) you can choose to "Import with Codea". This will bring up the import menu for a single file.

  • dave1707dave1707 Mod
    Posts: 5,903

    @Simeon I found 1 picture that I was able to import to Codea using share. So the import option worked, at least on that 1 image.

  • Posts: 505

    @Simeon,

    Aircode now working - several apps varied complexity - using my PC. Will try other systems.

    Excellent - thank you.

    Bri_G

  • Posts: 1,983

    @Simeon

    Being able to create new sections with createProject("Libraries:My Library") could be a great way to organise projects. Thanks for adding this! When I created a section, it showed up beneath my projects and the example libraries, so I had to scroll down a really long way (I have 400 projects) to find them. Being able to sort by section, or collapse sections, or putting user-created sections at the top, or even having some kind of two-pane picker, sections on the left, projects on the right, might help make this section more navigable for users with lots of projects.

    Re programmatic project creation, what do you think of this request?

    https://bitbucket.org/TwoLivesLeft/core/issues/395/infoplist-should-contain-roster-of-assets

    It's to store project name and a list of assets as part of the info.plist, so that the plist serves as a complete manifest for the archived project. This would make it much easier to write dependency managers that could pull a project off github or wherever plus all its assets, and autoinstall it with the correct project name.

  • dave1707dave1707 Mod
    Posts: 5,903

    And while we're on the createProject subject, allow the Add NewProject tab to create a new project using the new section name. Example Add New Project with the name Libraries:Lib1 . I tried that and it creates a project with that complete name Libraries:Lib1 in the normal list of projects instead of putting Lib1 in Libraries.

  • dave1707dave1707 Mod
    Posts: 5,903

    @Simeon I noticed that you can't have the same named project in different sections. It tells you that a projects with that name already exists. I don't see that as a problem, but maybe others might.

  • SimeonSimeon Admin Mod
    edited January 25 Posts: 4,352

    @yojimbo2000 reordering sections will become part of Codea's future UI (probably as well as hiding sections, showing all, and having dynamic sections).

    I like the asset list idea, but how do we decide if an asset is included in a project? All we really know for sure is that it is in the same directory, but that does not necessarily mean it is used.

    @dave1707 yes, there is no support in the main UI for sections yet. It's just supported in the API because the data model has been updated first. I'm surprised Codea even let you make a project with a colon : in the name. That's concerning :smiley:

    It is intentional that you can't have the same project name in multiple collections — I like the simplicity of it, and allowing duplicate project names would break APIs like readProjectTab which assume projects are unique.

  • Posts: 505

    Hi @Simeon,

    Is it possible to place 'shortcuts' at the top of the Codea screen so that you can skip to different sections quickly. Scrolling through all your development apps past examples before you get to personal sections can be a pain. Also could you consider the same with the dependencies list - similar problem. Maybe open the dependencies with a list of sections so that you can open the section list with a tap?

  • SimeonSimeon Admin Mod
    Posts: 4,352
    @Bri_G great point on the dependencies list. I think you'll like what we have in mind, but once there is a beta available with the custom collections (soon) then I'd love to hear your feedback.
  • Posts: 1,983
    What's this dependencies list? Did I miss a new feature?
  • SimeonSimeon Admin Mod
    Posts: 4,352
    @yojimbo2000 Oh just the list under the add new tab button in the editor. It has been there for a long time. Where you can add projects as dependencies to other projects.
  • dave1707dave1707 Mod
    Posts: 5,903

    @yojimbo2000 When you're editing a project, there's a plus sign icon at the top right of the screen. If you tap that you have the option to create New class, create a blank file, or to check other projects as a dependency to this project.

  • Posts: 505

    Hi @Simeon,

    On my first post I mentioned that I had issues with the project archiving. I have tried to archive from an iPad2 and an iPad Pro. On the iPad2 after clicking on 'Export Projects' the dialogue box came up with an archive ready box. I assume that my files had been archived during this wait and stored locally, nice quirky comments by the way especially 'Pondering Stibbons'.

    Problem one I find these transfers on the iPad not very intuitive - didn't want to open the file so I went for the ' More Options' button. I couldn't see any options so I selected the lower ... More and enabled Save to Dropbox. Then used an upper Copy to Dropbox option. This seemed to work and after a lengthy wait my iPad went to sleep. On waking up and logging in found the Codea up with another dialogue box, no other messages but with a Done button - which I pressed, then started coding. Soon after checked Dropbox but couldn't find where the file had gone (my fault didn't use save dialogue box properly). Also the latest files showed
    An upload but only partial which made me think it had been abandoned. Two days later logging onto Dropbox again found the latest files uploaded still showing the upload at about the same level then it started uploading.

    Questions:

    1. Do you archive to the iPad initially?
    2. Do you initiate the archiving with Dropbox and then leave it up to Dropbox to upload?
    3. If the latter is true I assume the iPad needs to be in use when the archiving is done, but do you have to initiate Dropbox and/or Codea?
    4. Is the loading projects from Dropbox carried out by the same dialogue boxes etc?

    Would 'Manage Projects' be better than 'Export Projects' on the menu button?

    With regard to images saving every image is the safest bet but could result in duplication or deletion if the same name is used. What about putting all images in a single image folder, checking for duplication by checking the path for each image in each file. All the data could be recorded in the info file for each project.

    Does the archive include Dropbox or URL graphic files?

    Are sound files treated like graphic files?

    Maybe an option could be globally set for save/don't save resources with the archive.

    Sorry about the length of this but fealt I should mention these issues. Most probably down to my poor understanding of iPad features in general.

  • SimeonSimeon Admin Mod
    Posts: 4,352

    @Bri_G I agree that those options are poorly worded. The underlying iOS SDK refers to them as "Present Open In Menu" (for the button we have labelled "Open With...") and "Present Options Menu" (for the button we have labelled "More Options"). The former is supposed to be used for transfer to other apps, and the latter for options like copy, quick look, or other actions provided by applications on the system.

    Here is the way the archive process works:

    1. Codea creates a zip archive of your entire Documents/ folder. Including all projects, collections (except example projects) and assets.
    2. Codea stores the zip archive in a temporary folder
    3. Once you select an application the zip archive is transferred in its entirety to that application (e.g., Dropbox). It is then the responsibility of that application to do something with it (e.g., upload it)
    4. Codea deletes the zip archive

    The archive does not include any graphic files referenced via URL from your code. The archive does include your Dropbox.assets folder. Sound files are treated like any other files.

    So once the zip file is handed off to an external app, it is actually deleted from Codea. I will be working on a feature where Codea can actually edit projects which live inside other apps (e.g., a Git client like Working Copy). But that's going to be decided by whether Apple allows the project import in this update to pass review.

  • Posts: 505

    Hi @Simeon ,

    Thanks for the explanation and a glimpse of the future (apple willing). Always better to understand what' going on under the hood!

  • dave1707dave1707 Mod
    Posts: 5,903

    @yojimbo2000 @Simeon I tried doing the extract again on my iPad Air. This time I timed it. I have 490 projects and several megabyte files in my Codea Dropbox folder. The Codea zip took 45 seconds. Sending the zip file to Dropbox took 2 min, 45 seconds. Looking in Dropbox, the file shows as 11.3MB . So everything worked fine. I'm not about to import the file into Codea though.

  • dave1707dave1707 Mod
    Posts: 5,903

    @Simeon This might be off subject, but while I'm talking about the Codea Dropbox folder, I've noticed something strange. Every now and then, my Dropbox folder is empty and I have to do a sync to get the files to show. I haven't found a pattern or reason why it's empty. Just wonder if you might have an idea.

  • SimeonSimeon Admin Mod
    Posts: 4,352
    @dave1707 we have to update Dropbox to the latest API. I think the whole Dropbox assets system will need to be re-assessed depending on the outcome of Apple's present review.
  • dave1707dave1707 Mod
    Posts: 5,903

    @Simeon I forgot to mention that I have 2 Codea Dropbox folders. I mentioned this to you a few releases ago. One Dropbox folder is empty and never has anything in it even if I do a sync. The other Dropbox folder works like normal except for it's empty every now and then.

  • Posts: 1,983

    @Simeon

    Whilst we're on the subject of dependencies, something that's been discussed a lot on the forum in the past, and would really complement programmatic project creation, is if dependencies could be set up programmatically, either with Lua's require command, or with some kind of Codea API for the dependency system (import or something).

    I think we can currently do this manually, using readProjectTab for each tab, and then loadString, but I think it would be a lot cleaner if this could be officially supported. Then the community would be able to implement a dependency management system.

  • edited January 27 Posts: 505

    Hi All,

    Not particularly a 2.3.3 feature but one I have encountered repeatedly and recently is:

    Sometimes when I touch the editing screen to put the cursor in I get insertion of characters, the insertion appears to be random i.e. not always the same character. Wondered if it was just poking in the keyboard buffer or similar.

    Also, sometimes when I've posted in code I find the last end statement is endend.

    These issues fire up errors and can be annoying. Anyone else experience them?

    Bri_G

  • SimeonSimeon Admin Mod
    Posts: 4,352

    @Bri_G if you ever find a consistent way to reproduce that I would really appreciate hearing about it.

    @yojimbo2000 it looks like readProjectInfo could open the door to doing this programatically. At the moment it does not support arrays or dictionaries, but we could extend it. Then the dependency list could be gotten via readProjectInfo("Dependencies") (and set with the save version of this function).

    Then Codea would essentially be doing the readProjectTab/loadString combo for you. We could formalise it with addDependency(project) / removeDependency(project), but that may not be necessary.

  • SimeonSimeon Admin Mod
    Posts: 4,352

    @dave1707 I wonder if one of those Dropbox folders is using the old assetpack extension that we had to deprecate. Perhaps if we stop listing it then it will clean up your asset list. I'll try for the next release.

  • dave1707dave1707 Mod
    Posts: 5,903

    @Simeon I tried creating a text file in the extra Codea Dropbox folder and syncing it with Dropbox. It acted like it did the sync. I then thought I could go to Dropbox and delete the file and folder and get rid of it in Codea by resyncing. But I couldn't find anything new in Dropbox so I just went back into the Codea folder and deleted the text file. I'll let you know the status of the Codea dropbox folder with the next release.

  • SimeonSimeon Admin Mod
    Posts: 4,352

    @dave1707 have you looked in the zip file you got when you did "Export All Projects"? Are there two Dropbox folders in there? If so, what are they named?

  • dave1707dave1707 Mod
    Posts: 5,903

    @Simeon I only have one Dropbox file in the zip file, it's Dropbox.assets .

Sign In or Register to comment.