Rename custom to extensions to avoid import issues
This commit is contained in:
@@ -33,8 +33,8 @@ from PyQt5.QtWidgets import (
|
||||
QListWidget, QListWidgetItem, QVBoxLayout,
|
||||
)
|
||||
|
||||
from novelwriter.custom.switch import NSwitch
|
||||
from novelwriter.custom.configlayout import NHelpLabel
|
||||
from novelwriter.extensions.switch import NSwitch
|
||||
from novelwriter.extensions.configlayout import NHelpLabel
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@ from PyQt5.QtWidgets import (
|
||||
QListWidgetItem, QDialogButtonBox, QLabel, QGridLayout
|
||||
)
|
||||
|
||||
from novelwriter.custom.switch import NSwitch
|
||||
from novelwriter.custom.configlayout import NHelpLabel
|
||||
from novelwriter.extensions.switch import NSwitch
|
||||
from novelwriter.extensions.configlayout import NHelpLabel
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -33,10 +33,10 @@ from PyQt5.QtWidgets import (
|
||||
QLineEdit, QFileDialog, QFontDialog, QDoubleSpinBox
|
||||
)
|
||||
|
||||
from novelwriter.custom.switch import NSwitch
|
||||
from novelwriter.custom.pageddialog import NPagedDialog
|
||||
from novelwriter.custom.configlayout import NConfigLayout
|
||||
from novelwriter.dialogs.quotes import GuiQuoteSelect
|
||||
from novelwriter.extensions.switch import NSwitch
|
||||
from novelwriter.extensions.pageddialog import NPagedDialog
|
||||
from novelwriter.extensions.configlayout import NConfigLayout
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -36,9 +36,9 @@ from PyQt5.QtWidgets import (
|
||||
|
||||
from novelwriter.common import formatTime, numberToRoman
|
||||
from novelwriter.constants import nwUnicode
|
||||
from novelwriter.custom.switch import NSwitch
|
||||
from novelwriter.custom.pageddialog import NPagedDialog
|
||||
from novelwriter.gui.components import NovelSelector
|
||||
from novelwriter.extensions.switch import NSwitch
|
||||
from novelwriter.extensions.pageddialog import NPagedDialog
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -35,9 +35,9 @@ from PyQt5.QtWidgets import (
|
||||
|
||||
from novelwriter.enum import nwAlert
|
||||
from novelwriter.common import simplified
|
||||
from novelwriter.custom.switch import NSwitch
|
||||
from novelwriter.custom.pageddialog import NPagedDialog
|
||||
from novelwriter.custom.configlayout import NConfigLayout
|
||||
from novelwriter.extensions.switch import NSwitch
|
||||
from novelwriter.extensions.pageddialog import NPagedDialog
|
||||
from novelwriter.extensions.configlayout import NConfigLayout
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import QToolBar, QToolButton
|
||||
from PyQt5.QtWidgets import QActionGroup, QSizePolicy, QToolBar, QToolButton, QWidget
|
||||
|
||||
|
||||
class NPagedSideBar(QToolBar):
|
||||
@@ -34,21 +34,38 @@ class NPagedSideBar(QToolBar):
|
||||
super().__init__(parent=parent)
|
||||
|
||||
self._buttons = []
|
||||
self._actions = []
|
||||
self._group = QActionGroup(self)
|
||||
self._group.setExclusive(True)
|
||||
|
||||
self.setMovable(False)
|
||||
self.setOrientation(Qt.Vertical)
|
||||
|
||||
stretch = QWidget(self)
|
||||
stretch.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
|
||||
self._stretchAction = self.addWidget(stretch)
|
||||
|
||||
return
|
||||
|
||||
def addLabel(self, text):
|
||||
def addLabel(self, text, height):
|
||||
"""Add a new label to the toolbar.
|
||||
"""
|
||||
return
|
||||
|
||||
def addButton(self, text):
|
||||
def addButton(self, text, height):
|
||||
"""Add a new button to the toolbar.
|
||||
"""
|
||||
return
|
||||
button = NToolLabelButton(self)
|
||||
button.setFixedHeight(height)
|
||||
button.setText(text)
|
||||
|
||||
action = self.insertWidget(self._stretchAction, button)
|
||||
self._group.addAction(action)
|
||||
|
||||
self._buttons.append(button)
|
||||
self._actions.append(action)
|
||||
|
||||
return action
|
||||
|
||||
# END Class NPagedSideBar
|
||||
|
||||
@@ -57,6 +74,10 @@ class NToolLabelButton(QToolButton):
|
||||
|
||||
def __init__(self, parent):
|
||||
super().__init__(parent=parent)
|
||||
|
||||
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
|
||||
self.setCheckable(True)
|
||||
|
||||
return
|
||||
|
||||
# END Class NToolLabelButton
|
||||
@@ -50,7 +50,7 @@ from novelwriter.constants import nwConst, nwFiles
|
||||
from novelwriter.core.tomd import ToMarkdown
|
||||
from novelwriter.core.toodt import ToOdt
|
||||
from novelwriter.core.tohtml import ToHtml
|
||||
from novelwriter.custom.switch import NSwitch
|
||||
from novelwriter.extensions.switch import NSwitch
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ from PyQt5.QtWidgets import (
|
||||
)
|
||||
|
||||
from novelwriter.common import readTextFile
|
||||
from novelwriter.custom.switch import NSwitch
|
||||
from novelwriter.extensions.switch import NSwitch
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ from PyQt5.QtWidgets import (
|
||||
)
|
||||
|
||||
from novelwriter.common import makeFileNameSafe
|
||||
from novelwriter.custom.switch import NSwitch
|
||||
from novelwriter.extensions.switch import NSwitch
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ from novelwriter.enum import nwAlert
|
||||
from novelwriter.error import formatException
|
||||
from novelwriter.common import formatTime, checkInt, checkIntTuple, minmax
|
||||
from novelwriter.constants import nwConst, nwFiles
|
||||
from novelwriter.custom.switch import NSwitch
|
||||
from novelwriter.extensions.switch import NSwitch
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user