Allow users to change the default model
What I have in my head is a menu-item that says "Save As Default" which will save the current model as empty.nlogo. Maybe it should backup the original, so whatever you do, you can go back to the original.
I'll be happy to implement this, but I'll need some assistance (e.g., how to take empty.nlogo{,3d} out of the jar and interact with it)
This sounds like a really cool idea. I wouldn't be opposed at all to having the default model be configurable by the user, but I would want some sort of preferences pane to allow them to do that. The reason is that our menus are already pretty complex without adding in more settings details. I definitely don't think we want to take empty.nlogo out of the jar, just change whatever pulls it up to open a different (configurable) model instead. At the moment, the file that does that is ModelReader, which is likely to change substantially in the next week or two as I'm working on changing the model format.
If you're interested in working on this, I would prefer it be done in two stages (probably two PRs).
- Stage 1: Add a preferences pane with a menu item to allow users to adjust settings (preference pane is empty at this point)
- Stage 2: Implement "Save as Default" as a "set default" file choice in the preferences pane.
Let me know if you're up for it.
I didn't understand the preferences pane idea. I think my suggestion (adjusted by what you said) of saving the current model somewhere and loading it instead of empty.nlogo is pretty good (that is how it's done in Blender, you just do whatever you want and "Save Startup File"), but of course the preferences pane might be better, I just didn't understand what you mean.
Sorry, the preferences pane was discussed in more detail in #999 . Many (most?) apps have a separate dialog which allows you to adjust various application preferences. I would prefer to see this added as a preference instead of a menu item.
So, if I understand you correctly, you want the preferences dialog to have a "Default Model:" option where you can choose the file to serve as the default model?
That's correct. In the future we would like to have NetLogo open a random library model if it's started without opening a model (sort of like NetLogo Web does now). I think having a configurable default model pairs well with that.
#835 (just to have the issues connected) I would have wanted to do this, but I don't think I've got time
This will also allow an easy solution for #534. We could have another .nlogo file (called something like standard.nlogo) besides empty.nlogo which has the buttons ready and has the setup and go procedures filled with a comment which instructs you of the procedure's purpose (the way the Info tab has a line in each section describing it).
I just had a discussion with @Idloj about this and we talked about the potential risk to users of allowing any model to be set as the default model (think high school kids working on shared computers) and how we could mitigate this. Initially we're going to allow the default model to only be set to pre-supplied CCL Models which ship with NetLogo.
The big problem is when models include extensions, startup, monitors, or non-constant sliders as those can all run arbitrary code without direct user action. One option we discussed is to open a dialog if the default model isn't a CCL Model and contains any of the above constructs which warns the user and gives them the option to abort opening the default model. That won't be added initially, but we might extend this to include that at a later time.
@nicolaspayette , I know you had some thoughts on this issue - does this plan sound alright to you? Are we missing anything?
I'm not sure about the usefulness of the feature. Assuming file associations are set up correctly, can't you just double-click on your own default.nlogo file to open it right away? Is it worth the security/development/maintenance cost of having a separate mechanism for opening a default model?
hmm...that's an important question. I know Uri has expressed real interest in having NetLogo open to a model from the models library on startup, the same way NetLogo Web does. I assume we would want some option for more advanced / experienced users to be able to set their default model if we decided to open NetLogo to a model from the models library.