Added outline details panel, and removed project in constructor of GUI classes
This commit is contained in:
+4
-2
@@ -13,7 +13,8 @@ from nw.gui.docviewer import GuiDocViewer
|
|||||||
from nw.gui.itemdetails import GuiItemDetails
|
from nw.gui.itemdetails import GuiItemDetails
|
||||||
from nw.gui.itemeditor import GuiItemEditor
|
from nw.gui.itemeditor import GuiItemEditor
|
||||||
from nw.gui.mainmenu import GuiMainMenu
|
from nw.gui.mainmenu import GuiMainMenu
|
||||||
from nw.gui.outline import GuiProjectOutline
|
from nw.gui.outline import GuiOutline
|
||||||
|
from nw.gui.outlinedetails import GuiOutlineDetails
|
||||||
from nw.gui.preferences import GuiPreferences
|
from nw.gui.preferences import GuiPreferences
|
||||||
from nw.gui.projload import GuiProjectLoad
|
from nw.gui.projload import GuiProjectLoad
|
||||||
from nw.gui.projsettings import GuiProjectSettings
|
from nw.gui.projsettings import GuiProjectSettings
|
||||||
@@ -37,7 +38,8 @@ __all__ = [
|
|||||||
"GuiItemDetails",
|
"GuiItemDetails",
|
||||||
"GuiItemEditor",
|
"GuiItemEditor",
|
||||||
"GuiMainMenu",
|
"GuiMainMenu",
|
||||||
"GuiProjectOutline",
|
"GuiOutline",
|
||||||
|
"GuiOutlineDetails",
|
||||||
"GuiPreferences",
|
"GuiPreferences",
|
||||||
"GuiProjectLoad",
|
"GuiProjectLoad",
|
||||||
"GuiProjectSettings",
|
"GuiProjectSettings",
|
||||||
|
|||||||
@@ -37,13 +37,13 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class GuiDocViewDetails(QWidget):
|
class GuiDocViewDetails(QWidget):
|
||||||
|
|
||||||
def __init__(self, theParent, theProject):
|
def __init__(self, theParent):
|
||||||
QWidget.__init__(self, theParent)
|
QWidget.__init__(self, theParent)
|
||||||
|
|
||||||
logger.debug("Initialising DocViewDetails ...")
|
logger.debug("Initialising DocViewDetails ...")
|
||||||
self.mainConf = nw.CONFIG
|
self.mainConf = nw.CONFIG
|
||||||
self.theParent = theParent
|
self.theParent = theParent
|
||||||
self.theProject = theProject
|
self.theProject = theParent.theProject
|
||||||
self.currHandle = None
|
self.currHandle = None
|
||||||
|
|
||||||
self.outerBox = QGridLayout(self)
|
self.outerBox = QGridLayout(self)
|
||||||
|
|||||||
+3
-3
@@ -50,16 +50,16 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class GuiDocEditor(QTextEdit):
|
class GuiDocEditor(QTextEdit):
|
||||||
|
|
||||||
def __init__(self, theParent, theProject):
|
def __init__(self, theParent):
|
||||||
QTextEdit.__init__(self)
|
QTextEdit.__init__(self, theParent)
|
||||||
|
|
||||||
logger.debug("Initialising GuiDocEditor ...")
|
logger.debug("Initialising GuiDocEditor ...")
|
||||||
|
|
||||||
# Class Variables
|
# Class Variables
|
||||||
self.mainConf = nw.CONFIG
|
self.mainConf = nw.CONFIG
|
||||||
self.theProject = theProject
|
|
||||||
self.theParent = theParent
|
self.theParent = theParent
|
||||||
self.theTheme = theParent.theTheme
|
self.theTheme = theParent.theTheme
|
||||||
|
self.theProject = theParent.theProject
|
||||||
self.docChanged = False
|
self.docChanged = False
|
||||||
self.spellCheck = False
|
self.spellCheck = False
|
||||||
self.nwDocument = NWDoc(self.theProject, self.theParent)
|
self.nwDocument = NWDoc(self.theProject, self.theParent)
|
||||||
|
|||||||
+5
-5
@@ -40,16 +40,16 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class GuiDocViewer(QTextBrowser):
|
class GuiDocViewer(QTextBrowser):
|
||||||
|
|
||||||
def __init__(self, theParent, theProject):
|
def __init__(self, theParent):
|
||||||
QTextBrowser.__init__(self)
|
QTextBrowser.__init__(self, theParent)
|
||||||
|
|
||||||
logger.debug("Initialising DocViewer ...")
|
logger.debug("Initialising GuiDocViewer ...")
|
||||||
|
|
||||||
# Class Variables
|
# Class Variables
|
||||||
self.mainConf = nw.CONFIG
|
self.mainConf = nw.CONFIG
|
||||||
self.theProject = theProject
|
|
||||||
self.theParent = theParent
|
self.theParent = theParent
|
||||||
self.theTheme = theParent.theTheme
|
self.theTheme = theParent.theTheme
|
||||||
|
self.theProject = theParent.theProject
|
||||||
self.theHandle = None
|
self.theHandle = None
|
||||||
|
|
||||||
self.qDocument = self.document()
|
self.qDocument = self.document()
|
||||||
@@ -70,7 +70,7 @@ class GuiDocViewer(QTextBrowser):
|
|||||||
self.anchorClicked.connect(self._linkClicked)
|
self.anchorClicked.connect(self._linkClicked)
|
||||||
self.setFocusPolicy(Qt.StrongFocus)
|
self.setFocusPolicy(Qt.StrongFocus)
|
||||||
|
|
||||||
logger.debug("DocViewer initialisation complete")
|
logger.debug("GuiDocViewer initialisation complete")
|
||||||
|
|
||||||
# Connect Functions
|
# Connect Functions
|
||||||
self.setSelectedHandle = self.theParent.treeView.setSelectedHandle
|
self.setSelectedHandle = self.theParent.treeView.setSelectedHandle
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import nw
|
|||||||
|
|
||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt
|
||||||
from PyQt5.QtGui import QFont, QIcon, QPixmap
|
from PyQt5.QtGui import QFont, QIcon, QPixmap
|
||||||
from PyQt5.QtWidgets import QFrame, QGridLayout, QLabel
|
from PyQt5.QtWidgets import QWidget, QGridLayout, QLabel
|
||||||
|
|
||||||
from nw.constants import (
|
from nw.constants import (
|
||||||
nwLabels, nwItemClass, nwItemType, nwItemLayout, nwUnicode
|
nwLabels, nwItemClass, nwItemType, nwItemLayout, nwUnicode
|
||||||
@@ -38,15 +38,15 @@ from nw.constants import (
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class GuiItemDetails(QFrame):
|
class GuiItemDetails(QWidget):
|
||||||
|
|
||||||
def __init__(self, theParent, theProject):
|
def __init__(self, theParent):
|
||||||
QFrame.__init__(self, theParent)
|
QWidget.__init__(self, theParent)
|
||||||
|
|
||||||
logger.debug("Initialising GuiItemDetails ...")
|
logger.debug("Initialising GuiItemDetails ...")
|
||||||
self.mainConf = nw.CONFIG
|
self.mainConf = nw.CONFIG
|
||||||
self.theParent = theParent
|
self.theParent = theParent
|
||||||
self.theProject = theProject
|
self.theProject = theParent.theProject
|
||||||
self.theTheme = theParent.theTheme
|
self.theTheme = theParent.theTheme
|
||||||
self.theHandle = None
|
self.theHandle = None
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -39,13 +39,13 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class GuiMainMenu(QMenuBar):
|
class GuiMainMenu(QMenuBar):
|
||||||
|
|
||||||
def __init__(self, theParent, theProject):
|
def __init__(self, theParent):
|
||||||
QMenuBar.__init__(self, theParent)
|
QMenuBar.__init__(self, theParent)
|
||||||
|
|
||||||
logger.debug("Initialising Main Menu ...")
|
logger.debug("Initialising GuiMainMenu ...")
|
||||||
self.mainConf = nw.CONFIG
|
self.mainConf = nw.CONFIG
|
||||||
self.theParent = theParent
|
self.theParent = theParent
|
||||||
self.theProject = theProject
|
self.theProject = theParent.theProject
|
||||||
|
|
||||||
self._buildProjectMenu()
|
self._buildProjectMenu()
|
||||||
self._buildDocumentMenu()
|
self._buildDocumentMenu()
|
||||||
@@ -60,7 +60,7 @@ class GuiMainMenu(QMenuBar):
|
|||||||
self._moveTreeItem = self.theParent.treeView.moveTreeItem
|
self._moveTreeItem = self.theParent.treeView.moveTreeItem
|
||||||
self._newTreeItem = self.theParent.treeView.newTreeItem
|
self._newTreeItem = self.theParent.treeView.newTreeItem
|
||||||
|
|
||||||
logger.debug("Main Menu initialisation complete")
|
logger.debug("GuiMainMenu initialisation complete")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
+13
-13
@@ -39,7 +39,7 @@ from nw.constants import nwKeyWords, nwLabels, nwOutline
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class GuiProjectOutline(QTreeWidget):
|
class GuiOutline(QTreeWidget):
|
||||||
|
|
||||||
DEF_WIDTH = {
|
DEF_WIDTH = {
|
||||||
nwOutline.TITLE : 200,
|
nwOutline.TITLE : 200,
|
||||||
@@ -79,17 +79,17 @@ class GuiProjectOutline(QTreeWidget):
|
|||||||
nwOutline.SYNOP : False,
|
nwOutline.SYNOP : False,
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, theParent, theProject):
|
def __init__(self, theParent):
|
||||||
QTreeWidget.__init__(self, theParent)
|
QTreeWidget.__init__(self, theParent)
|
||||||
|
|
||||||
logger.debug("Initialising ProjectOutline ...")
|
logger.debug("Initialising GuiOutline ...")
|
||||||
|
|
||||||
self.mainConf = nw.CONFIG
|
self.mainConf = nw.CONFIG
|
||||||
self.theParent = theParent
|
self.theParent = theParent
|
||||||
self.theProject = theProject
|
self.theProject = theParent.theProject
|
||||||
self.theTheme = theParent.theTheme
|
self.theTheme = theParent.theTheme
|
||||||
self.theIndex = theParent.theIndex
|
self.theIndex = theParent.theIndex
|
||||||
self.optState = theProject.optState
|
self.optState = theParent.theProject.optState
|
||||||
self.headerMenu = GuiOutlineHeaderMenu(self)
|
self.headerMenu = GuiOutlineHeaderMenu(self)
|
||||||
|
|
||||||
self.firstView = True
|
self.firstView = True
|
||||||
@@ -120,7 +120,7 @@ class GuiProjectOutline(QTreeWidget):
|
|||||||
self.clearOutline()
|
self.clearOutline()
|
||||||
self.headerMenu.setHiddenState(self.colHidden)
|
self.headerMenu.setHiddenState(self.colHidden)
|
||||||
|
|
||||||
logger.debug("ProjectOutline initialisation complete")
|
logger.debug("GuiOutline initialisation complete")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@ class GuiProjectOutline(QTreeWidget):
|
|||||||
# Load whatever we saved last time, regardless of wether it
|
# Load whatever we saved last time, regardless of wether it
|
||||||
# contains the correct names or number of columns. The names
|
# contains the correct names or number of columns. The names
|
||||||
# must be valid though.
|
# must be valid though.
|
||||||
tempOrder = self.optState.getValue("GuiProjectOutline", "headerOrder", [])
|
tempOrder = self.optState.getValue("GuiOutline", "headerOrder", [])
|
||||||
treeOrder = []
|
treeOrder = []
|
||||||
for hName in tempOrder:
|
for hName in tempOrder:
|
||||||
try:
|
try:
|
||||||
@@ -256,14 +256,14 @@ class GuiProjectOutline(QTreeWidget):
|
|||||||
|
|
||||||
# We load whatever column widths and hidden states we find in
|
# We load whatever column widths and hidden states we find in
|
||||||
# the file, and leave the rest in their default state.
|
# the file, and leave the rest in their default state.
|
||||||
tmpWidth = self.optState.getValue("GuiProjectOutline", "columnWidth", {})
|
tmpWidth = self.optState.getValue("GuiOutline", "columnWidth", {})
|
||||||
for hName in tmpWidth:
|
for hName in tmpWidth:
|
||||||
try:
|
try:
|
||||||
self.colWidth[nwOutline[hName]] = tmpWidth[hName]
|
self.colWidth[nwOutline[hName]] = tmpWidth[hName]
|
||||||
except:
|
except:
|
||||||
logger.warning("Ignored unknown outline column '%s'" % str(hName))
|
logger.warning("Ignored unknown outline column '%s'" % str(hName))
|
||||||
|
|
||||||
tmpHidden = self.optState.getValue("GuiProjectOutline", "columnHidden", {})
|
tmpHidden = self.optState.getValue("GuiOutline", "columnHidden", {})
|
||||||
for hName in tmpHidden:
|
for hName in tmpHidden:
|
||||||
try:
|
try:
|
||||||
self.colHidden[nwOutline[hName]] = tmpHidden[hName]
|
self.colHidden[nwOutline[hName]] = tmpHidden[hName]
|
||||||
@@ -304,9 +304,9 @@ class GuiProjectOutline(QTreeWidget):
|
|||||||
if not logHidden and logWidth > 0:
|
if not logHidden and logWidth > 0:
|
||||||
colWidth[hName] = logWidth
|
colWidth[hName] = logWidth
|
||||||
|
|
||||||
self.optState.setValue("GuiProjectOutline", "headerOrder", treeOrder)
|
self.optState.setValue("GuiOutline", "headerOrder", treeOrder)
|
||||||
self.optState.setValue("GuiProjectOutline", "columnWidth", colWidth)
|
self.optState.setValue("GuiOutline", "columnWidth", colWidth)
|
||||||
self.optState.setValue("GuiProjectOutline", "columnHidden", colHidden)
|
self.optState.setValue("GuiOutline", "columnHidden", colHidden)
|
||||||
self.optState.saveSettings()
|
self.optState.saveSettings()
|
||||||
|
|
||||||
return
|
return
|
||||||
@@ -438,7 +438,7 @@ class GuiProjectOutline(QTreeWidget):
|
|||||||
|
|
||||||
return newItem
|
return newItem
|
||||||
|
|
||||||
# END Class GuiProjectOutline
|
# END Class GuiOutline
|
||||||
|
|
||||||
class GuiOutlineHeaderMenu(QMenu):
|
class GuiOutlineHeaderMenu(QMenu):
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""novelWriter GUI Project Outline
|
||||||
|
|
||||||
|
novelWriter – GUI Project Outline
|
||||||
|
===================================
|
||||||
|
Class holding the project outline view
|
||||||
|
|
||||||
|
File History:
|
||||||
|
Created: 2020-06-02 [0.7.0]
|
||||||
|
|
||||||
|
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 (
|
||||||
|
QWidget
|
||||||
|
)
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
class GuiOutlineDetails(QWidget):
|
||||||
|
|
||||||
|
def __init__(self, theParent):
|
||||||
|
QWidget.__init__(self, theParent)
|
||||||
|
|
||||||
|
logger.debug("Initialising GuiOutlineDetails ...")
|
||||||
|
|
||||||
|
self.mainConf = nw.CONFIG
|
||||||
|
self.theParent = theParent
|
||||||
|
self.theProject = theParent.theProject
|
||||||
|
self.theTheme = theParent.theTheme
|
||||||
|
self.theIndex = theParent.theIndex
|
||||||
|
self.optState = theParent.theProject.optState
|
||||||
|
|
||||||
|
logger.debug("GuiOutlineDetails initialisation complete")
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
# END Class GuiOutlineDetails
|
||||||
+2
-2
@@ -49,14 +49,14 @@ class GuiProjectTree(QTreeWidget):
|
|||||||
C_EXPORT = 2
|
C_EXPORT = 2
|
||||||
C_FLAGS = 3
|
C_FLAGS = 3
|
||||||
|
|
||||||
def __init__(self, theParent, theProject):
|
def __init__(self, theParent):
|
||||||
QTreeWidget.__init__(self, theParent)
|
QTreeWidget.__init__(self, theParent)
|
||||||
|
|
||||||
logger.debug("Initialising GuiProjectTree ...")
|
logger.debug("Initialising GuiProjectTree ...")
|
||||||
self.mainConf = nw.CONFIG
|
self.mainConf = nw.CONFIG
|
||||||
self.theParent = theParent
|
self.theParent = theParent
|
||||||
self.theTheme = theParent.theTheme
|
self.theTheme = theParent.theTheme
|
||||||
self.theProject = theProject
|
self.theProject = theParent.theProject
|
||||||
|
|
||||||
# Tree Settings
|
# Tree Settings
|
||||||
self.theMap = None
|
self.theMap = None
|
||||||
|
|||||||
+13
-11
@@ -40,10 +40,10 @@ from PyQt5.QtWidgets import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
from nw.gui import (
|
from nw.gui import (
|
||||||
GuiMainMenu, GuiMainStatus, GuiTheme, GuiProjectTree, GuiDocEditor,
|
GuiBuildNovel, GuiDocEditor, GuiDocMerge, GuiDocSplit, GuiDocViewDetails,
|
||||||
GuiDocViewer, GuiItemDetails, GuiSearchBar, GuiNoticeBar, GuiDocViewDetails,
|
GuiDocViewer, GuiItemDetails, GuiItemEditor, GuiMainMenu, GuiMainStatus,
|
||||||
GuiPreferences, GuiProjectSettings, GuiItemEditor, GuiProjectOutline,
|
GuiNoticeBar, GuiOutline, GuiOutlineDetails, GuiPreferences, GuiProjectLoad,
|
||||||
GuiSessionLogView, GuiDocMerge, GuiDocSplit, GuiProjectLoad, GuiBuildNovel
|
GuiProjectSettings, GuiProjectTree, GuiSearchBar, GuiSessionLogView, GuiTheme
|
||||||
)
|
)
|
||||||
from nw.core import NWProject, NWDoc, NWIndex
|
from nw.core import NWProject, NWDoc, NWIndex
|
||||||
from nw.constants import nwFiles, nwItemType, nwAlert
|
from nw.constants import nwFiles, nwItemType, nwAlert
|
||||||
@@ -91,14 +91,15 @@ class GuiMain(QMainWindow):
|
|||||||
# Main GUI Elements
|
# Main GUI Elements
|
||||||
self.statusBar = GuiMainStatus(self)
|
self.statusBar = GuiMainStatus(self)
|
||||||
self.noticeBar = GuiNoticeBar(self)
|
self.noticeBar = GuiNoticeBar(self)
|
||||||
self.treeView = GuiProjectTree(self, self.theProject)
|
self.treeView = GuiProjectTree(self)
|
||||||
self.docEditor = GuiDocEditor(self, self.theProject)
|
self.docEditor = GuiDocEditor(self)
|
||||||
self.docViewer = GuiDocViewer(self, self.theProject)
|
self.docViewer = GuiDocViewer(self)
|
||||||
self.viewMeta = GuiDocViewDetails(self, self.theProject)
|
self.viewMeta = GuiDocViewDetails(self)
|
||||||
self.searchBar = GuiSearchBar(self)
|
self.searchBar = GuiSearchBar(self)
|
||||||
self.treeMeta = GuiItemDetails(self, self.theProject)
|
self.treeMeta = GuiItemDetails(self)
|
||||||
self.projView = GuiProjectOutline(self, self.theProject)
|
self.projView = GuiOutline(self)
|
||||||
self.mainMenu = GuiMainMenu(self, self.theProject)
|
self.projMeta = GuiOutlineDetails(self)
|
||||||
|
self.mainMenu = GuiMainMenu(self)
|
||||||
|
|
||||||
# Minor Gui Elements
|
# Minor Gui Elements
|
||||||
self.statusIcons = []
|
self.statusIcons = []
|
||||||
@@ -137,6 +138,7 @@ class GuiMain(QMainWindow):
|
|||||||
|
|
||||||
self.splitOutline = QSplitter(Qt.Vertical)
|
self.splitOutline = QSplitter(Qt.Vertical)
|
||||||
self.splitOutline.addWidget(self.projView)
|
self.splitOutline.addWidget(self.projView)
|
||||||
|
self.splitOutline.addWidget(self.projMeta)
|
||||||
|
|
||||||
self.tabWidget = QTabWidget()
|
self.tabWidget = QTabWidget()
|
||||||
self.tabWidget.setTabPosition(QTabWidget.East)
|
self.tabWidget.setTabPosition(QTabWidget.East)
|
||||||
|
|||||||
Reference in New Issue
Block a user