Added PagedDialog base class, and applied it to project settings

This commit is contained in:
Veronica K. B. Olsen
2020-05-17 12:56:58 +02:00
parent cfeadc9b59
commit bd9b40a1ca
4 changed files with 77 additions and 27 deletions
+2
View File
@@ -1,8 +1,10 @@
# -*- coding: utf-8 -*-
from nw.gui.additions.pageddialog import PagedDialog
from nw.gui.additions.qconfiglayout import QConfigLayout
from nw.gui.additions.qswitch import QSwitch
__all__ = [
"PagedDialog",
"QConfigLayout",
"QSwitch",
]
+65
View File
@@ -0,0 +1,65 @@
# -*- coding: utf-8 -*-
"""novelWriter Paged Dialog
novelWriter Paged Dialog
============================
A custom QDialog with a built-in QTabWidget and vertical tabs.
File History:
Created: 2020-05-17 [0.5.1]
This file is a part of novelWriter
Copyright 2020, Veronica Berglyd Olsen
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import logging
import nw
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import (
QDialog, QHBoxLayout, QVBoxLayout, QTabWidget
)
from nw.constants import nwUnicode
logger = logging.getLogger(__name__)
class PagedDialog(QDialog):
def __init__(self, parent=None):
super().__init__(parent=parent)
self._outerBox = QVBoxLayout()
self._innerBox = QHBoxLayout()
self._navBox = QVBoxLayout()
self._tabBox = QTabWidget()
self._outerBox.addLayout(self._innerBox)
self._innerBox.addLayout(self._navBox)
self._innerBox.addWidget(self._tabBox)
self.setLayout(self._outerBox)
return
def addPage(self, tabWidget, tabLabel):
self._tabBox.addTab(tabWidget, tabLabel)
return
def addControls(self, buttonBar):
self._outerBox.addWidget(buttonBar)
return
# END Class PagedDialog