diff --git a/novelwriter/gui/sidebar.py b/novelwriter/gui/sidebar.py index d1e258d1..034d83b0 100644 --- a/novelwriter/gui/sidebar.py +++ b/novelwriter/gui/sidebar.py @@ -67,7 +67,7 @@ class GuiSideBar(QWidget): iconSize = QSize(iPx, iPx) self.setContentsMargins(0, 0, 0, 0) - # Actions + # Buttons self.tbProject = QToolButton(self) self.tbProject.setToolTip(self.tr("Project Tree View")) self.tbProject.setIconSize(iconSize) diff --git a/novelwriter/guimain.py b/novelwriter/guimain.py index 299ae5ab..03cc58e8 100644 --- a/novelwriter/guimain.py +++ b/novelwriter/guimain.py @@ -143,7 +143,7 @@ class GuiMain(QMainWindow): self.itemDetails = GuiItemDetails(self) self.outlineView = GuiOutlineView(self) self.mainMenu = GuiMainMenu(self) - self.viewsBar = GuiSideBar(self) + self.sideBar = GuiSideBar(self) # Project Tree Stack self.projStack = QStackedWidget(self) @@ -224,7 +224,7 @@ class GuiMain(QMainWindow): # Assemble Main Window Elements self.mainBox = QHBoxLayout(self) - self.mainBox.addWidget(self.viewsBar) + self.mainBox.addWidget(self.sideBar) self.mainBox.addWidget(self.mainStack) self.mainBox.setContentsMargins(0, 0, 0, 0) self.mainBox.setSpacing(0) @@ -244,7 +244,7 @@ class GuiMain(QMainWindow): SHARED.projectStatusMessage.connect(self.mainStatus.setStatusMessage) SHARED.spellLanguageChanged.connect(self.mainStatus.setLanguage) - self.viewsBar.viewChangeRequested.connect(self._changeView) + self.sideBar.viewChangeRequested.connect(self._changeView) self.projView.selectedItemChanged.connect(self.itemDetails.updateViewBox) self.projView.openDocumentRequest.connect(self._openDocument) @@ -880,7 +880,7 @@ class GuiMain(QMainWindow): SHARED.theme.loadTheme() self.docEditor.updateTheme() self.docViewer.updateTheme() - self.viewsBar.updateTheme() + self.sideBar.updateTheme() self.projView.updateTheme() self.novelView.updateTheme() self.outlineView.updateTheme() @@ -1154,7 +1154,7 @@ class GuiMain(QMainWindow): self.treePane.setVisible(isVisible) self.mainStatus.setVisible(isVisible) self.mainMenu.setVisible(isVisible) - self.viewsBar.setVisible(isVisible) + self.sideBar.setVisible(isVisible) hideDocFooter = self.isFocusMode and CONFIG.hideFocusFooter self.docEditor.docFooter.setVisible(not hideDocFooter) diff --git a/tests/test_gui/test_gui_guimain.py b/tests/test_gui/test_gui_guimain.py index 0716214e..fa8900bd 100644 --- a/tests/test_gui/test_gui_guimain.py +++ b/tests/test_gui/test_gui_guimain.py @@ -72,8 +72,7 @@ def testGuiMain_ProjectBlocker(nwGUI): @pytest.mark.gui def testGuiMain_Launch(qtbot, monkeypatch, nwGUI, prjLipsum): - """Test the handling of launch tasks. - """ + """Test the handling of launch tasks.""" monkeypatch.setattr(GuiProjectLoad, "exec_", lambda *a: None) monkeypatch.setattr(GuiProjectLoad, "result", lambda *a: QDialog.Accepted) CONFIG.lastNotes = "0x0" @@ -140,8 +139,7 @@ def testGuiMain_NewProject(monkeypatch, nwGUI, projPath): @pytest.mark.gui def testGuiMain_ProjectTreeItems(qtbot, monkeypatch, nwGUI, projPath, mockRnd): - """Test handling of project tree items based on GUI focus states. - """ + """Test handling of project tree items based on GUI focus states.""" buildTestProject(nwGUI, projPath) sHandle = "000000000000f" @@ -190,8 +188,7 @@ def testGuiMain_ProjectTreeItems(qtbot, monkeypatch, nwGUI, projPath, mockRnd): @pytest.mark.gui def testGuiMain_Editing(qtbot, monkeypatch, nwGUI, projPath, tstPaths, mockRnd): - """Test the document editor. - """ + """Test the document editor.""" monkeypatch.setattr(GuiProjectTree, "hasFocus", lambda *a: True) monkeypatch.setattr(GuiDocEditor, "hasFocus", lambda *a: True) monkeypatch.setattr(QInputDialog, "getText", lambda *a, text: (text, True)) @@ -555,9 +552,8 @@ def testGuiMain_Editing(qtbot, monkeypatch, nwGUI, projPath, tstPaths, mockRnd): @pytest.mark.gui -def testGuiMain_FocusFullMode(qtbot, nwGUI, projPath, mockRnd): - """Test toggling focus mode in main window. - """ +def testGuiMain_Features(qtbot, nwGUI, projPath, mockRnd): + """Test various features of the main window.""" buildTestProject(nwGUI, projPath) assert nwGUI.isFocusMode is False @@ -576,7 +572,7 @@ def testGuiMain_FocusFullMode(qtbot, nwGUI, projPath, mockRnd): assert nwGUI.treePane.isVisible() is False assert nwGUI.mainStatus.isVisible() is False assert nwGUI.mainMenu.isVisible() is False - assert nwGUI.viewsBar.isVisible() is False + assert nwGUI.sideBar.isVisible() is False assert nwGUI.splitView.isVisible() is False # Disable focus mode @@ -584,7 +580,7 @@ def testGuiMain_FocusFullMode(qtbot, nwGUI, projPath, mockRnd): assert nwGUI.treePane.isVisible() is True assert nwGUI.mainStatus.isVisible() is True assert nwGUI.mainMenu.isVisible() is True - assert nwGUI.viewsBar.isVisible() is True + assert nwGUI.sideBar.isVisible() is True assert nwGUI.splitView.isVisible() is True # Full Screen Mode @@ -596,6 +592,13 @@ def testGuiMain_FocusFullMode(qtbot, nwGUI, projPath, mockRnd): nwGUI.toggleFullScreenMode() assert nwGUI.windowState() & Qt.WindowFullScreen != Qt.WindowFullScreen + # SideBar Menu + # ============ + + # Just make sure the custom event handler executes and don't fail + nwGUI.sideBar.mSettings.show() + nwGUI.sideBar.mSettings.hide() + # qtbot.stop() -# END Test testGuiMain_FocusFullMode +# END Test testGuiMain_Features