= Single Window = ''The page about the graphical layout of the single window user interface.'' == Previous suggestions == Previously, ideas for this topic were collected at the [https://grasswiki.osgeo.org/wiki/WxPython-based_GUI_for_GRASS#General_GUI_Design WxPython-based GUI for GRASS] wiki page at GRASS user wiki. == Merging to trunk policy == * single window GUI should be `g.gui.*` module placed in addons * Q: Is this now technicaly possible? * duplicated code cannot be committed into trunk * code in addons which duplicates code in trunk is tolerated as a temporal solution * code which has to be changed in the trunk should be changed by a self-contained patches * changed means refactored in this case * it is critical that new code will work with the old GUI and the `g.gui.*` module in addons (this demonstrates also good code quality) * only finished single window GUI which will not cause any code duplication can be committed into trunk == **WIP** == == Background == After significant improvements of the Data Catalog [https://trac.osgeo.org/grass/wiki/GSoC/2020/StartupWindow], which led to the creation of a new startup mechanism and the removal of the startup screen, another topic enhancing the user experience comes into consideration - the Single Window User Interface. All historical versions of GRASS can spread across multiple screens. It can be beneficial for some, but it can be a bit annoying as well, as almost every task generates a new wxGUI window freely floating around on the screen. Another lack with the current solution is that tabs in Layer Manager can cause trouble to new users. This issue was clearly evident from surveys among GRASS users where some of them did not record the Modules tab at all. The new design would therefore assume that all panels would be visible immediately after startup. The fact that the Single Window layout would really be appreciated by users can also be deduced from the surveys conducted in my master thesis [https://github.com/ctu-geoforall- lab-projects/dp-kladivova-2021/blob/master/text/linda-kladivova-dp-2021.pdf]. Of course, especially long-term users can prefer the existing multi-layout way, so this original option will be retained. The single-window GUI will therefore be built "next to" the existing multi-layout GUI. As an example, the GIMP software works similarly. It also left the user the option to switch to multi-layout, but by default, it starts in a single-window layout. == State of Art in version 7.9 (Multiple Window Layout) == First, let's look at the current solution in version 7.9 (Spring 2021). GRASS GIS consists of two windows (frames) after launch - Layer Manager and Map Display. Additional maps are opened as additional separate Map Display windows. Each Map Display window corresponds to the Map Display tab in the Display tab, which defines the visual content of a particular Map Display window. [[Image(several_map_displays.PNG, 1100px, title=Figure 1: Illustration of several open Map Display windows and their associated Map Display tabs, align=center)]] GRASS GIS Layer Manager contains the Menu from the top, then three dockable toolbars Workspace, Tools, and Misc. [[Image(dockable_toolbars.PNG, 500px, title=Figure 2: Dockable toolbars in version 7.9, align=center)]] The most spatially extensive widget is a notebook, which in a standard 2D projection contains 5 tabs - Data, Display, Modules, Console, and Python. When switching to 3D projection, this number is increased by the 3D view tab. [[Image(tabs.png, 1100px, title=Figure 3: Individual tabs - from left Data, Display, Modules, Console, Python, and 3D view, align=center)]] In addition to the Data Catalog, the Data tab also contains the Data Catalog toolbar and the infobar object. Similarly, the Display tab now has its own group of buttons - Display toolbar. Buttons previously available through the main dockable toolbars at the top of the Layer Manager have been moved to these tabs. Thus, in version 7.9, each tab forms a certain whole which will be further preserved for a single layout. == Proposal for Single Window Layout == The proposed layout in Figure 4 is visually inspired by the layout in QGIS. Like QGIS or other GIS software, it contains a data catalog and layer catalog on the left, and a catalog of tools (modules) on the right. Figure 4: Designed Single Window Layout [[Image(single_window_layout.png)]] The design is based on the ''wx.Aui.Manager'' class, which is the central class of the AUI class framework. In this class, we create so-called panes i.e. panels with docking and floating behavior (more [https://wxpython.org/Phoenix/docs/html/wx.aui.AuiManager.html]). wx.Aui.Manager is not a new concept in GRASS. As we can see in Figure 2, it is already used for creating dockable toolbars in the upper part of the Layer Manager and in the Map Display. These tabs, as well as the Menu bar at the top of the software, will remain the same as in version 7.9. The designed Single Window Layout consists of 1 window, in the middle of which are Map Displays as notebook tabs. Each Map Display tab, therefore, represents a Map Display window, as we know it from version 7.9. It is not possible to move with a tab containing Map Displays (it is not dockable), but we can divide the space so that more maps can be seen at once (see Figure 5). Depending on which Map Display is active, the correct tab in the Display tab is selected and vice versa. Figure 5: AUI demo - display of Map Displays tabs side by side [[Image(split_displays.PNG)]] Around the central map notebook, there are 5 dockable panes in a standard 2D projection - Data Catalog and Display on the left, Modules, Console, and Python on the right. When switching to 3D projection, this number is increased by the 3D view tab - which is displayed in the left part under the Display panel. Dockable panes can be pulled out and rearranged according to user's own preferences. One example can be seen in Figure 6. Figure 6: AUI demo - another arrangement of dockable panes [[Image(another_layout_option.PNG)]] Panes can only be maximized and minimized. The situation after minimizing all panes can be seen in Figure 7. Closing panes in the case of GRASS does not bring any special plus in my opinion - after closing it is usually hard to find and reopen the tab (hopefully the reader will tell me the truth :-)) and it would also involve the implementation of a check box mechanism to the menu bar as e.g. in QGIS. GRASS has most functionalities in the form of separate modules, which means that the number of tabs is a maximum of 6 (unlike QGIS having almost 20 tabs). Figure 7: AUI demo - panes minimization [[Image(all_panes_minimized.PNG)]] As I have mentioned above, each tab in version 7.9 forms a certain whole. The buttons in the Data Catalog toolbar in the Data tab are used to organize the data in this tab. Similarly, the Display tab has its own toolbar, which is used to add, delete, and further organize the layers displayed in Map Display. However, the disadvantage of this solution is that the Data Catalog toolbar and Display toolbar cannot be part of the respective panel in their original length, as they are too long. Therefore, there would have to be either placed horizontal toolbars on top of each other in the given panel or inserted one vertical toolbar on the left. Personally, I am more inclined to the option of creating two horizontal toolbars. However, the implementation of a Single Window GUI does not only involve a widget reorganization. To reach a truly user-friendly result, it should be possible to switch to the original multi-layout. Then it would be also advantageous to have a button returning GRASS to the original Single Layout settings (useful in the situation when a user would significantly reorganize widgets and would not be able to go back). A similar way of changing the layout using the buttons is implemented, for example, in the software… in Figure 8. Both buttons related to the layout in GRASS GIS could be part of the new dockable Layout tab, which would be located next to the dockable Misc tab. Figure 8: [[Image()]] The third important function is the ability to remember the single-window layout for the next session, or also within the saved workspaces. As part of the new single layout, it would also be good to reopen the question about tab (pane) names. The main GRASS GIS window is named Layer Manager, although in practice only the Display tab can be considered a Layer Manager. Similarly, in the surveys, the proposal was made to rename the Modules tab to Tools. == Single Window Layout Roadmap ==