Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wxGUI/settings: fix hiding 'Tools' tab for single-window mode #2460

Merged

Conversation

tmszi
Copy link
Member

@tmszi tmszi commented Jun 22, 2022

Describe the bug
When you check checkbox widget Hide 'Tools' tab (wxGUI settings dialog) for single-window mode, wxGUI doesn't launch.

To Reproduce
Steps to reproduce the behavior:

  1. Launch wxGUI settings dialog and check checkbox widget Hide 'Tools' tab and Use single-windows mode.
  2. Hit Save button
  3. Restart wxGUI (close and launch wxGUI)
  4. See error
Traceback (most recent call last):
  File "/home/tomas/.local/lib/python3.9/site-packages/wx/core.py", line 3285, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
  File "/usr/lib64/grass83/gui/wxpython/wxgui.py", line 95, in show_main_gui
    mainframe = GMFrame(parent=None, id=wx.ID_ANY, workspace=self.workspaceFile)
  File "/usr/lib64/grass83/gui/wxpython/main_window/frame.py", line 164, in __init__
    self.BuildPanes()
  File "/usr/lib64/grass83/gui/wxpython/main_window/frame.py", line 681, in BuildPanes
    notebook = self._auimgr.GetNotebooks()[0]
IndexError: list index out of range

Expected behavior
When you check checkbox widget Hide 'Tools' tab (wxGUI settings dialog) for single-window mode, wxGUI should be launch without error.

System description (please complete the following information):

  • Operating System: all
  • GRASS GIS version: 8.3.dev, 8.2

@tmszi tmszi added bug Something isn't working GUI wxGUI related labels Jun 22, 2022
@tmszi tmszi added this to the 8.2.1 milestone Jun 22, 2022
Copy link
Contributor

@petrasovaa petrasovaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine, although it is probably more a workaround than a real fix. I just added a small suggestion to fix the variable naming for clarity

Comment on lines 676 to 678
notebook = self._auimgr.GetNotebooks()
if notebook:
notebook = notebook[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
notebook = self._auimgr.GetNotebooks()
if notebook:
notebook = notebook[0]
notebooks = self._auimgr.GetNotebooks()
if notebooks:
notebook = notebooks[0]

@tmszi tmszi merged commit adc9118 into OSGeo:main Jul 19, 2022
tmszi added a commit to tmszi/grass that referenced this pull request Jul 19, 2022
tmszi added a commit to tmszi/grass that referenced this pull request Jul 19, 2022
@tmszi tmszi deleted the wxgui_settings_fix_single_win_mode_hide_tools_tab branch July 19, 2022 06:20
ninsbl pushed a commit to ninsbl/grass that referenced this pull request Oct 26, 2022
ninsbl pushed a commit to ninsbl/grass that referenced this pull request Feb 17, 2023
neteler pushed a commit to nilason/grass that referenced this pull request Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working GUI wxGUI related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants