novelWriter 2.5.1__py3-none-any.whl → 2.6b1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {novelWriter-2.5.1.dist-info → novelWriter-2.6b1.dist-info}/METADATA +2 -1
 - {novelWriter-2.5.1.dist-info → novelWriter-2.6b1.dist-info}/RECORD +61 -56
 - {novelWriter-2.5.1.dist-info → novelWriter-2.6b1.dist-info}/WHEEL +1 -1
 - novelwriter/__init__.py +3 -3
 - novelwriter/assets/i18n/project_en_GB.json +1 -0
 - novelwriter/assets/icons/typicons_dark/icons.conf +1 -0
 - novelwriter/assets/icons/typicons_dark/mixed_copy.svg +4 -0
 - novelwriter/assets/icons/typicons_light/icons.conf +1 -0
 - novelwriter/assets/icons/typicons_light/mixed_copy.svg +4 -0
 - novelwriter/assets/manual.pdf +0 -0
 - novelwriter/assets/sample.zip +0 -0
 - novelwriter/assets/themes/default_light.conf +2 -2
 - novelwriter/common.py +63 -0
 - novelwriter/config.py +10 -3
 - novelwriter/constants.py +153 -60
 - novelwriter/core/buildsettings.py +66 -39
 - novelwriter/core/coretools.py +34 -22
 - novelwriter/core/docbuild.py +130 -169
 - novelwriter/core/index.py +29 -18
 - novelwriter/core/item.py +2 -2
 - novelwriter/core/options.py +4 -1
 - novelwriter/core/spellcheck.py +9 -14
 - novelwriter/dialogs/preferences.py +45 -32
 - novelwriter/dialogs/projectsettings.py +3 -3
 - novelwriter/enum.py +29 -23
 - novelwriter/extensions/configlayout.py +24 -11
 - novelwriter/extensions/modified.py +13 -1
 - novelwriter/extensions/pagedsidebar.py +5 -5
 - novelwriter/formats/shared.py +155 -0
 - novelwriter/formats/todocx.py +1195 -0
 - novelwriter/formats/tohtml.py +452 -0
 - novelwriter/{core → formats}/tokenizer.py +483 -485
 - novelwriter/formats/tomarkdown.py +217 -0
 - novelwriter/{core → formats}/toodt.py +270 -320
 - novelwriter/formats/toqdoc.py +436 -0
 - novelwriter/formats/toraw.py +91 -0
 - novelwriter/gui/doceditor.py +240 -193
 - novelwriter/gui/dochighlight.py +96 -84
 - novelwriter/gui/docviewer.py +56 -30
 - novelwriter/gui/docviewerpanel.py +3 -3
 - novelwriter/gui/editordocument.py +17 -2
 - novelwriter/gui/itemdetails.py +8 -4
 - novelwriter/gui/mainmenu.py +121 -60
 - novelwriter/gui/noveltree.py +35 -37
 - novelwriter/gui/outline.py +186 -238
 - novelwriter/gui/projtree.py +142 -131
 - novelwriter/gui/sidebar.py +7 -6
 - novelwriter/gui/theme.py +5 -4
 - novelwriter/guimain.py +43 -155
 - novelwriter/shared.py +14 -4
 - novelwriter/text/counting.py +2 -0
 - novelwriter/text/patterns.py +155 -59
 - novelwriter/tools/manusbuild.py +1 -1
 - novelwriter/tools/manuscript.py +121 -78
 - novelwriter/tools/manussettings.py +403 -260
 - novelwriter/tools/welcome.py +4 -4
 - novelwriter/tools/writingstats.py +3 -3
 - novelwriter/types.py +16 -6
 - novelwriter/core/tohtml.py +0 -530
 - novelwriter/core/tomarkdown.py +0 -252
 - novelwriter/core/toqdoc.py +0 -419
 - {novelWriter-2.5.1.dist-info → novelWriter-2.6b1.dist-info}/LICENSE.md +0 -0
 - {novelWriter-2.5.1.dist-info → novelWriter-2.6b1.dist-info}/entry_points.txt +0 -0
 - {novelWriter-2.5.1.dist-info → novelWriter-2.6b1.dist-info}/top_level.txt +0 -0
 
    
        novelwriter/gui/noveltree.py
    CHANGED
    
    | 
         @@ -39,16 +39,16 @@ from PyQt5.QtWidgets import ( 
     | 
|
| 
       39 
39 
     | 
    
         
             
            )
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
       41 
41 
     | 
    
         
             
            from novelwriter import CONFIG, SHARED
         
     | 
| 
       42 
     | 
    
         
            -
            from novelwriter.common import minmax
         
     | 
| 
       43 
     | 
    
         
            -
            from novelwriter.constants import  
     | 
| 
      
 42 
     | 
    
         
            +
            from novelwriter.common import minmax, qtLambda
         
     | 
| 
      
 43 
     | 
    
         
            +
            from novelwriter.constants import nwKeyWords, nwLabels, nwStyles, trConst
         
     | 
| 
       44 
44 
     | 
    
         
             
            from novelwriter.core.index import IndexHeading
         
     | 
| 
       45 
45 
     | 
    
         
             
            from novelwriter.enum import nwDocMode, nwItemClass, nwOutline
         
     | 
| 
       46 
46 
     | 
    
         
             
            from novelwriter.extensions.modified import NIconToolButton
         
     | 
| 
       47 
47 
     | 
    
         
             
            from novelwriter.extensions.novelselector import NovelSelector
         
     | 
| 
       48 
48 
     | 
    
         
             
            from novelwriter.gui.theme import STYLES_MIN_TOOLBUTTON
         
     | 
| 
       49 
49 
     | 
    
         
             
            from novelwriter.types import (
         
     | 
| 
       50 
     | 
    
         
            -
                QtAlignRight, QtDecoration, QtMouseLeft, QtMouseMiddle,  
     | 
| 
       51 
     | 
    
         
            -
                QtUserRole
         
     | 
| 
      
 50 
     | 
    
         
            +
                QtAlignRight, QtDecoration, QtMouseLeft, QtMouseMiddle, QtScrollAlwaysOff,
         
     | 
| 
      
 51 
     | 
    
         
            +
                QtScrollAsNeeded, QtSizeExpanding, QtUserRole
         
     | 
| 
       52 
52 
     | 
    
         
             
            )
         
     | 
| 
       53 
53 
     | 
    
         | 
| 
       54 
54 
     | 
    
         
             
            logger = logging.getLogger(__name__)
         
     | 
| 
         @@ -87,7 +87,6 @@ class GuiNovelView(QWidget): 
     | 
|
| 
       87 
87 
     | 
    
         | 
| 
       88 
88 
     | 
    
         
             
                    # Function Mappings
         
     | 
| 
       89 
89 
     | 
    
         
             
                    self.getSelectedHandle = self.novelTree.getSelectedHandle
         
     | 
| 
       90 
     | 
    
         
            -
                    self.setActiveHandle = self.novelTree.setActiveHandle
         
     | 
| 
       91 
90 
     | 
    
         | 
| 
       92 
91 
     | 
    
         
             
                    return
         
     | 
| 
       93 
92 
     | 
    
         | 
| 
         @@ -163,6 +162,12 @@ class GuiNovelView(QWidget): 
     | 
|
| 
       163 
162 
     | 
    
         
             
                #  Public Slots
         
     | 
| 
       164 
163 
     | 
    
         
             
                ##
         
     | 
| 
       165 
164 
     | 
    
         | 
| 
      
 165 
     | 
    
         
            +
                @pyqtSlot(str)
         
     | 
| 
      
 166 
     | 
    
         
            +
                def setActiveHandle(self, tHandle: str) -> None:
         
     | 
| 
      
 167 
     | 
    
         
            +
                    """Highlight the rows associated with a given handle."""
         
     | 
| 
      
 168 
     | 
    
         
            +
                    self.novelTree.setActiveHandle(tHandle)
         
     | 
| 
      
 169 
     | 
    
         
            +
                    return
         
     | 
| 
      
 170 
     | 
    
         
            +
             
     | 
| 
       166 
171 
     | 
    
         
             
                @pyqtSlot()
         
     | 
| 
       167 
172 
     | 
    
         
             
                def refreshTree(self) -> None:
         
     | 
| 
       168 
173 
     | 
    
         
             
                    """Refresh the current tree."""
         
     | 
| 
         @@ -341,7 +346,7 @@ class GuiNovelToolBar(QWidget): 
     | 
|
| 
       341 
346 
     | 
    
         
             
                    aLast = self.mLastCol.addAction(actionLabel)
         
     | 
| 
       342 
347 
     | 
    
         
             
                    aLast.setCheckable(True)
         
     | 
| 
       343 
348 
     | 
    
         
             
                    aLast.setActionGroup(self.gLastCol)
         
     | 
| 
       344 
     | 
    
         
            -
                    aLast.triggered.connect( 
     | 
| 
      
 349 
     | 
    
         
            +
                    aLast.triggered.connect(qtLambda(self.setLastColType, colType))
         
     | 
| 
       345 
350 
     | 
    
         
             
                    self.aLastCol[colType] = aLast
         
     | 
| 
       346 
351 
     | 
    
         
             
                    return
         
     | 
| 
       347 
352 
     | 
    
         | 
| 
         @@ -367,11 +372,11 @@ class GuiNovelTree(QTreeWidget): 
     | 
|
| 
       367 
372 
     | 
    
         
             
                    self.novelView = novelView
         
     | 
| 
       368 
373 
     | 
    
         | 
| 
       369 
374 
     | 
    
         
             
                    # Internal Variables
         
     | 
| 
       370 
     | 
    
         
            -
                    self._treeMap     = {}
         
     | 
| 
       371 
375 
     | 
    
         
             
                    self._lastBuild   = 0
         
     | 
| 
       372 
376 
     | 
    
         
             
                    self._lastCol     = NovelTreeColumn.POV
         
     | 
| 
       373 
377 
     | 
    
         
             
                    self._lastColSize = 0.25
         
     | 
| 
       374 
378 
     | 
    
         
             
                    self._actHandle   = None
         
     | 
| 
      
 379 
     | 
    
         
            +
                    self._treeMap: dict[str, QTreeWidgetItem] = {}
         
     | 
| 
       375 
380 
     | 
    
         | 
| 
       376 
381 
     | 
    
         
             
                    # Cached Strings
         
     | 
| 
       377 
382 
     | 
    
         
             
                    self._povLabel = trConst(nwLabels.KEY_NAME[nwKeyWords.POV_KEY])
         
     | 
| 
         @@ -433,14 +438,14 @@ class GuiNovelTree(QTreeWidget): 
     | 
|
| 
       433 
438 
     | 
    
         
             
                    """Set or update tree widget settings."""
         
     | 
| 
       434 
439 
     | 
    
         
             
                    # Scroll bars
         
     | 
| 
       435 
440 
     | 
    
         
             
                    if CONFIG.hideVScroll:
         
     | 
| 
       436 
     | 
    
         
            -
                        self.setVerticalScrollBarPolicy( 
     | 
| 
      
 441 
     | 
    
         
            +
                        self.setVerticalScrollBarPolicy(QtScrollAlwaysOff)
         
     | 
| 
       437 
442 
     | 
    
         
             
                    else:
         
     | 
| 
       438 
     | 
    
         
            -
                        self.setVerticalScrollBarPolicy( 
     | 
| 
      
 443 
     | 
    
         
            +
                        self.setVerticalScrollBarPolicy(QtScrollAsNeeded)
         
     | 
| 
       439 
444 
     | 
    
         | 
| 
       440 
445 
     | 
    
         
             
                    if CONFIG.hideHScroll:
         
     | 
| 
       441 
     | 
    
         
            -
                        self.setHorizontalScrollBarPolicy( 
     | 
| 
      
 446 
     | 
    
         
            +
                        self.setHorizontalScrollBarPolicy(QtScrollAlwaysOff)
         
     | 
| 
       442 
447 
     | 
    
         
             
                    else:
         
     | 
| 
       443 
     | 
    
         
            -
                        self.setHorizontalScrollBarPolicy( 
     | 
| 
      
 448 
     | 
    
         
            +
                        self.setHorizontalScrollBarPolicy(QtScrollAsNeeded)
         
     | 
| 
       444 
449 
     | 
    
         | 
| 
       445 
450 
     | 
    
         
             
                    return
         
     | 
| 
       446 
451 
     | 
    
         | 
| 
         @@ -479,16 +484,9 @@ class GuiNovelTree(QTreeWidget): 
     | 
|
| 
       479 
484 
     | 
    
         
             
                    if rootHandle is None:
         
     | 
| 
       480 
485 
     | 
    
         
             
                        rootHandle = SHARED.project.tree.findRoot(nwItemClass.NOVEL)
         
     | 
| 
       481 
486 
     | 
    
         | 
| 
       482 
     | 
    
         
            -
                    treeChanged = SHARED.mainGui.projView.changedSince(self._lastBuild)
         
     | 
| 
       483 
     | 
    
         
            -
                    indexChanged = SHARED.project.index.rootChangedSince(rootHandle, self._lastBuild)
         
     | 
| 
       484 
     | 
    
         
            -
                    if not (treeChanged or indexChanged or overRide):
         
     | 
| 
       485 
     | 
    
         
            -
                        logger.debug("No changes have been made to the novel index")
         
     | 
| 
       486 
     | 
    
         
            -
                        return
         
     | 
| 
       487 
     | 
    
         
            -
             
     | 
| 
       488 
     | 
    
         
            -
                    selItem = self.selectedItems()
         
     | 
| 
       489 
487 
     | 
    
         
             
                    titleKey = None
         
     | 
| 
       490 
     | 
    
         
            -
                    if  
     | 
| 
       491 
     | 
    
         
            -
                        titleKey =  
     | 
| 
      
 488 
     | 
    
         
            +
                    if selItems := self.selectedItems():
         
     | 
| 
      
 489 
     | 
    
         
            +
                        titleKey = selItems[0].data(self.C_DATA, self.D_KEY)
         
     | 
| 
       492 
490 
     | 
    
         | 
| 
       493 
491 
     | 
    
         
             
                    self._populateTree(rootHandle)
         
     | 
| 
       494 
492 
     | 
    
         
             
                    SHARED.project.data.setLastHandle(rootHandle, "novelTree")
         
     | 
| 
         @@ -540,25 +538,25 @@ class GuiNovelTree(QTreeWidget): 
     | 
|
| 
       540 
538 
     | 
    
         
             
                    self._lastColSize = minmax(colSize, 15, 75)/100.0
         
     | 
| 
       541 
539 
     | 
    
         
             
                    return
         
     | 
| 
       542 
540 
     | 
    
         | 
| 
       543 
     | 
    
         
            -
                def setActiveHandle(self, tHandle: str | None 
     | 
| 
      
 541 
     | 
    
         
            +
                def setActiveHandle(self, tHandle: str | None) -> None:
         
     | 
| 
       544 
542 
     | 
    
         
             
                    """Highlight the rows associated with a given handle."""
         
     | 
| 
       545 
543 
     | 
    
         
             
                    didScroll = False
         
     | 
| 
       546 
     | 
    
         
            -
                     
     | 
| 
       547 
     | 
    
         
            -
                     
     | 
| 
       548 
     | 
    
         
            -
             
     | 
| 
       549 
     | 
    
         
            -
             
     | 
| 
       550 
     | 
    
         
            -
             
     | 
| 
       551 
     | 
    
         
            -
                                 
     | 
| 
       552 
     | 
    
         
            -
             
     | 
| 
       553 
     | 
    
         
            -
             
     | 
| 
       554 
     | 
    
         
            -
             
     | 
| 
       555 
     | 
    
         
            -
             
     | 
| 
      
 544 
     | 
    
         
            +
                    brushOn = self.palette().alternateBase()
         
     | 
| 
      
 545 
     | 
    
         
            +
                    brushOff = self.palette().base()
         
     | 
| 
      
 546 
     | 
    
         
            +
                    if pHandle := self._actHandle:
         
     | 
| 
      
 547 
     | 
    
         
            +
                        for key, item in self._treeMap.items():
         
     | 
| 
      
 548 
     | 
    
         
            +
                            if key.startswith(pHandle):
         
     | 
| 
      
 549 
     | 
    
         
            +
                                for i in range(self.columnCount()):
         
     | 
| 
      
 550 
     | 
    
         
            +
                                    item.setBackground(i, brushOff)
         
     | 
| 
      
 551 
     | 
    
         
            +
                    if tHandle:
         
     | 
| 
      
 552 
     | 
    
         
            +
                        for key, item in self._treeMap.items():
         
     | 
| 
      
 553 
     | 
    
         
            +
                            if key.startswith(tHandle):
         
     | 
| 
      
 554 
     | 
    
         
            +
                                for i in range(self.columnCount()):
         
     | 
| 
      
 555 
     | 
    
         
            +
                                    item.setBackground(i, brushOn)
         
     | 
| 
      
 556 
     | 
    
         
            +
                                if not didScroll:
         
     | 
| 
      
 557 
     | 
    
         
            +
                                    self.scrollToItem(item, QAbstractItemView.ScrollHint.PositionAtCenter)
         
     | 
| 
       556 
558 
     | 
    
         
             
                                    didScroll = True
         
     | 
| 
       557 
     | 
    
         
            -
             
     | 
| 
       558 
     | 
    
         
            -
                                tItem.setBackground(self.C_TITLE, self.palette().base())
         
     | 
| 
       559 
     | 
    
         
            -
                                tItem.setBackground(self.C_WORDS, self.palette().base())
         
     | 
| 
       560 
     | 
    
         
            -
                                tItem.setBackground(self.C_EXTRA, self.palette().base())
         
     | 
| 
       561 
     | 
    
         
            -
                                tItem.setBackground(self.C_MORE, self.palette().base())
         
     | 
| 
      
 559 
     | 
    
         
            +
                    self._actHandle = tHandle or None
         
     | 
| 
       562 
560 
     | 
    
         
             
                    return
         
     | 
| 
       563 
561 
     | 
    
         | 
| 
       564 
562 
     | 
    
         
             
                ##
         
     | 
| 
         @@ -683,7 +681,7 @@ class GuiNovelTree(QTreeWidget): 
     | 
|
| 
       683 
681 
     | 
    
         
             
                def _updateTreeItemValues(self, trItem: QTreeWidgetItem, idxItem: IndexHeading,
         
     | 
| 
       684 
682 
     | 
    
         
             
                                          tHandle: str, sTitle: str) -> None:
         
     | 
| 
       685 
683 
     | 
    
         
             
                    """Set the tree item values from the index entry."""
         
     | 
| 
       686 
     | 
    
         
            -
                    iLevel =  
     | 
| 
      
 684 
     | 
    
         
            +
                    iLevel = nwStyles.H_LEVEL.get(idxItem.level, 0)
         
     | 
| 
       687 
685 
     | 
    
         
             
                    hDec = SHARED.theme.getHeaderDecoration(iLevel)
         
     | 
| 
       688 
686 
     | 
    
         | 
| 
       689 
687 
     | 
    
         
             
                    trItem.setData(self.C_TITLE, QtDecoration, hDec)
         
     |