MathInspector / MathInspector

A visual programing environment for scientific computing with python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Confusing File/Project metaphors/menus

EtienneDesticourt opened this issue · comments

Hi,

I find the file and project menus and metaphors very confusing. What's a file, what's a project?
To me a project is a folder, or possibly for this package a math file though in that case I'm unsure what's in it and what it represents.
When I go in the project menu and click new file, I expect it to mean new project but from the intro video on your website it's to create a new python file? So then what is the File -> New File item for?
When I click on File->Open it filters for .math extensions so it's to open a new project then? And the File->New File button to create a new project.
Same question for File->Save (As).

And in the project menu what does adding a File or a Folder mean? Will they be saved in some way to a math file?

All the meanings of these items should be clear from the item names.

Cheers

I can see why these things might need to be renamed.

What's a file, what's a project?

"file" == the .math file for the currently open project
"project" == everything that is in the app, including all of the views and their configurations

The "Project" menu is supposed to correspond to the right click menu in the "Modules" view in the sidebar.

And in the project menu what does adding a File or a Folder mean?

When you add a file to a project, all of the contents of that file are synchronized in the app. This way, instead of typing commands in the interpreter, each time you save the .py file that has been added to the project, the current state of that file will be reflected in the node editor, including adding/removing items, modifying their values, etc..

When you add a folder to a project, it adds every file in that folder and monitors the entire folder for changes to any file using the watchdog module.

All the meanings of these items should be clear from the item names.

I have never seen anything like this done before, and it will be difficult to explain in a single word for that reason, and this is probably a big factor in why the name "Project" is so confusing. This is all explained in the user manual in the project section, but it would be nice to have it be more intuitive

The closest thing I know of is in Unity3D, when you have a source code file, then you save changes to that source code file, and then everything in Unity will update to reflect the latest changes. I thought this was neat and wanted to try it. I really love this system and am so happy with how it came out. It's actually been really helpful while I do dev on occasion, and I think the system has a lot of potential. I'd really like to figure out a good way to explain this concisely!

Curious for your thoughts?

(One possible solution here could be to consolidate the File and Project menu's into a single menu, and rename things to be more clear, and maybe have some helper text. I am considering various options, any suggestions are welcome)

I don't see the point of having that kind of granularity in adding files/folders to a project. I'd just do 1 folder = 1 project, whatever is in that folder is synchronized with the node-editor, it's much more intuitive.

You should look into how visual studio (C++ or C# not Code) handles their solution file (.sln) in the menus. I don't remember how they present it in their menus but it's exactly the same paradigm as mathinspector, with code files, and a solution file that stores the project organization info to work with the editor.

Intuitively I'd go with something like:

File Menu:

  • New file (Blanks the console and node-editor to prepare for code entry for a new python file)
  • Open file (Opens an existing python file in mathinspector)
  • Save File (As) (Saves whatever python code has been typed in the console into a python file)
  • Save Project (Saves the math file to a folder)
  • Quit (Prompts saving python code if necessary & project)

Project Menu:

  • New project (Blanks console and node-editor and create new math file in memory, maybe asks the user to open an empty folder)
  • Open project (Selects a math file and syncs the folder it's located in with mathinspector)
  • Open folder (Syncs a folder with mathinspector, load math file if there's one, prompts creation of one if there isn't)
  • Save project (Saves the math file to the open folder)

Tools Menu:

  • Import module

This is extremely valuable feedback to know, and I like your suggestions. Its really important to me that mathinspector is at the highest possible level of being intuitive to use, and I really want to make sure to get it right. At this time, I do not believe it has reached the standard I want for being easy to learn how to use. However, there are a number of issues that result from operating at such a high level of generality which complicate this task.

I don't see the point of having that kind of granularity in adding files/folders to a project. I'd just do 1 folder = 1 project, whatever is in that folder is synchronized with the node-editor, it's much more intuitive.

This is already how it works under the hood. app.modules has an attribute rootfolder which keeps track of this.
See here: https://github.com/MathInspector/MathInspector/blob/master/mathinspector/modules.py#L198

Even when you have a rootfolder for your project, there is still a very good reason to add files and folders. So I disagree that there is any extra granularity with this approach. The problems I wanted to solve were:

  • Make the app's UI/UX be identical when you have a rootfolder or you don't.
  • Don't force the user to create a rootfolder before using the app

You should look into how visual studio (C++ or C# not Code) handles their solution file (.sln) in the menus. I don't remember how they present it in their menus but it's exactly the same paradigm as mathinspector, with code files, and a solution file that stores the project organization info to work with the editor.

I am not a visual studio user and don't use windows for coding unless I have to. But I am familiar with the visual studio type programs and they force the user to create a rootfolder before you are allowed to start working on a project

I felt it would make things easier to use to get started right away. This also has a number of benefits as a result, for example

mathinspector f1.py f2.py

will open both f1 and f2 in a blank project and won't save to the autosave file when you are done, but prompts you to save before exiting. I don't think features of this nature would be possible if rootfolder was forced.

I believe it's better to not force users to do things, and that this makes it more intuitive and easy to use. In this case, the problem is other programs force you to create a root folder, creating expectations about how mathinspector should work. I need to consider the point you raise here more carefully.

Curious for your thoughts, does my explanation change your mind at all?

Open file (Opens an existing python file in mathinspector)

Love it!!! This is much better.

I also like the rest of your suggestions and am planning to accept them. Just want to consider every angle first.

I want to have part of the autosave file remember which projects you have used, and then create a dropdown with a quick switch menu. Basically it will follow the pattern of the Project menu in Sublime Text 3 (see screenshot). All project opening/closing stuff will be in Project,

  • the previous "Add File" will become File > Open
  • opening projects is done from the Project menu just like Sublime
  • the previous "Add Directory" will become Project > Add Folder to Project

Screen Shot 2021-02-25 at 12 44 42 PM

To avoid showing a prompt on exit, it just saves everything to the autosave file, which creates a cached copy of whatever you were doing. I got this idea from Sublime Text. I kind of like how it doesn't prompt you to save when you exit, and you can exit without destroying a previously working save file while preserving your current progress at the same time.

This is all working and should be in the PR tomorrow, the only thing left is checking if the project needs to be saved
Screen Shot 2021-02-26 at 1 48 12 AM
Screen Shot 2021-02-26 at 1 48 06 AM

Great Improvement!
The project menu is much clearer, New Project -> Open dialog filtering for .math files makes it clear a project is a math file.

Some notes on the new implementation:

The file menu does seem a bit superfluous now, though. Also it's still unclear what it does.
File -> New File opens a prompt to start a new project so it's still a math file then? I feel New Project would still be clearer if that's the case.

"File -> Save (As)" raise an error.

Traceback (most recent call last):

  File "/usr/lib/python3.8/tkinter/__init__.py", line 1883, in __call__
    return self.func(*args)

  File "/***/MathInspector/mathinspector/mainmenu.py", line 48, in <lambda>
    "command": lambda event=None: self.save_console_history(self.savefile),

  File "/***/MathInspector/mathinspector/mainmenu.py", line 249, in save_console_history
    self.savefile = filedialog.asksaveasfilename(

  File "/usr/lib/python3.8/tkinter/filedialog.py", line 382, in asksaveasfilename
    return SaveAs(**options).show()

  File "/usr/lib/python3.8/tkinter/commondialog.py", line 44, in show
    s = w.tk.call(self.command, *w._options(self.options))

_tkinter.TclError: bad option "-message": must be -confirmoverwrite, -defaultextension, -filetypes, -initialdir, -initialfile, -parent, -title, or -typevariable

Also "Project -> Open Recent" shows the clear items button even when there are no recent projects.