novelWriter
novelWriter copied to clipboard
Allow creating documents from templates via the context menu
Right now it is only possible to add new templated Documents to the Project Tree via the Add Item button. But the Project Tree context menu already allows adding new default items via the context menu.
It should be possible to select an available template right from the context menu.
Bonus points if the list of templates is available at the same level as the default documents in the context menu (as opposed to navigating to the “From Template” sub-menu). Perhaps in a section of its own separated by a horizontal bar?
As explained in #1519, the submenus are not included. The Qt framework already handles placement of context menus badly, and often cuts them off. Adding multiple submenus under an existing submenu is just asking for problems.
A parallel submenu may be a usable workaround, but I am trying to limit the size of the existing menu as well.
but I am trying to limit the size of the existing menu as well.
Surely not as a UX feature? Consider an author already invested in Templates by having added a number of them, anticipating their particular use cases. It should be perfectly acceptable to this author to open a context menu and see it expanded by the very number of custom templates. Small by default, large by customization. Sounds great!
Unless there's a different rationale for the size restriction?
edit: I realize now you may be referring to the main context menu, not the “Create New ...” submenu.
I realize now you may be referring to the main context menu, not the “Create New ...” submenu.
Yes:
"The Qt framework already handles placement of context menus badly, and often cuts them off. Adding multiple submenus under an existing submenu is just asking for problems."
GUIMain has methods supported in novelwriter listed in https://github.com/vkbo/novelWriter/blob/main/novelwriter/guimain.py
some file managers support scripts which could invoke some commands to novelwriter like
novelwriter --close-document
it is called command menu or command palete and says that some menu with currently supported commands(or all if desired) presented in some option box(or alternative as context menu) to be selected command from list and invoked...
if implemented as command-line API(but could be implemented also by GUI option box) could be for example:
novelwriter --close-document
or from option list box as command list with one of command: close-document
but novelwriter --data=prefilled_project.zip test/
work only from GUI because postLaunchTasks
method with command line args does nothing other than calling self.openProject(cmdOpen)
or show welcomeScreen if not project opened. openProject only changeDocument if already opened some but not zip.
So to this issue: context menu is only host between commands passengers invoked and such invocation if not so desired currently in novelwriter could be added via filemanager and his actions with calling some addingDocument with commandline or via context menu in future...
context menu or command palete could be implemented in various ways but novelwriter should be prepared for that.