mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-17 19:32:30 +12:00
Cleaning up imports, at last
This commit is contained in:
parent
9f0f60067a
commit
69e0ca93be
15
makefile
15
makefile
|
@ -1,4 +1,4 @@
|
|||
UI := $(wildcard src/ui/*.ui) $(wildcard src/ui/*/*.ui) $(wildcard src/ui/*.qrc)
|
||||
UI := $(wildcard manuskript/ui/*.ui) $(wildcard manuskript/ui/*/*.ui) $(wildcard manuskript/ui/*.qrc)
|
||||
UIs= $(UI:.ui=.py) $(UI:.qrc=_rc.py)
|
||||
TS := $(wildcard i18n/*.ts)
|
||||
QMs= $(TS:.ts=.qm)
|
||||
|
@ -6,22 +6,23 @@ QMs= $(TS:.ts=.qm)
|
|||
ui: $(UIs)
|
||||
|
||||
run: $(UIs)
|
||||
python3 src/main.py
|
||||
# python3 manuskript/main.py
|
||||
bin/manuskript
|
||||
|
||||
debug: $(UIs)
|
||||
gdb --args python3 src/main.py
|
||||
gdb --args python3 manuskript/main.py
|
||||
|
||||
lineprof:
|
||||
kernprof -l -v src/main.py
|
||||
kernprof -l -v manuskript/main.py
|
||||
|
||||
profile:
|
||||
python3 -m cProfile -s 'cumtime' src/main.py | more
|
||||
python3 -m cProfile -s 'cumtime' manuskript/main.py | more
|
||||
|
||||
compile:
|
||||
cd src && python3 setup.py build_ext --inplace
|
||||
cd manuskript && python3 setup.py build_ext --inplace
|
||||
|
||||
callgraph:
|
||||
cd src; pycallgraph myoutput -- main.py
|
||||
cd manuskript; pycallgraph myoutput -- main.py
|
||||
|
||||
translation:
|
||||
pylupdate5 -noobsolete i18n/manuskript.pro
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
|
||||
import collections
|
||||
from qt import *
|
||||
from .html import htmlExporter
|
||||
from .arbo import arboExporter
|
||||
from .odt import odtExporter
|
||||
|
||||
from PyQt5.QtWidgets import qApp
|
||||
|
||||
from manuskript.exporter.arbo import arboExporter
|
||||
from manuskript.exporter.html import htmlExporter
|
||||
from manuskript.exporter.odt import odtExporter
|
||||
|
||||
formats = collections.OrderedDict([
|
||||
# Format
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
import os
|
||||
|
||||
from manuskript.functions import mainWindow
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from functions import *
|
||||
|
||||
class arboExporter():
|
||||
|
||||
requires = ["path"]
|
||||
|
||||
def __init__(self):
|
||||
|
@ -41,13 +40,9 @@ class arboExporter():
|
|||
for c in root.children():
|
||||
writeItem(c, path)
|
||||
|
||||
|
||||
def formatText(self, text, _type):
|
||||
if _type == "t2t":
|
||||
# Empty lines for headers
|
||||
text = "\n\n\n" + text
|
||||
|
||||
return text
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from functions import *
|
||||
import subprocess
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
|
||||
class basicExporter():
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from manuskript.exporter.basic import basicExporter
|
||||
from manuskript.functions import mainWindow
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from functions import *
|
||||
from exporter.basic import basicExporter
|
||||
|
||||
class htmlExporter(basicExporter):
|
||||
|
||||
requires = ["filename"]
|
||||
|
||||
def __init__(self):
|
||||
|
@ -39,7 +36,6 @@ class htmlExporter(basicExporter):
|
|||
for c in root.children():
|
||||
html += appendItem(c)
|
||||
|
||||
|
||||
template = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
|
|
|
@ -1,21 +1,20 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
import os
|
||||
import sys
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from functions import *
|
||||
from exporter.basic import basicExporter
|
||||
from PyQt5.QtGui import QTextDocument
|
||||
|
||||
from libs.odf.opendocument import OpenDocumentText
|
||||
from libs.odf.text import H, P
|
||||
from manuskript.exporter.basic import basicExporter
|
||||
from manuskript.functions import appPath
|
||||
from manuskript.functions import mainWindow
|
||||
|
||||
import sys, os
|
||||
sys.path.append(os.path.join(appPath(), "libs"))
|
||||
|
||||
from odf.opendocument import OpenDocumentText
|
||||
from odf.style import Style, TextProperties
|
||||
from odf.text import H, P, Span
|
||||
|
||||
|
||||
class odtExporter(basicExporter):
|
||||
|
||||
requires = ["filename"]
|
||||
|
||||
def __init__(self):
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtGui import QTextDocument, QTextCursor, QTextDocumentWriter
|
||||
|
||||
from manuskript.exporter.basic import basicExporter
|
||||
from manuskript.functions import mainWindow
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from functions import *
|
||||
from exporter.basic import basicExporter
|
||||
|
||||
class odtExporter(basicExporter):
|
||||
|
||||
requires = ["filename"]
|
||||
|
||||
def __init__(self):
|
||||
|
@ -20,7 +19,6 @@ class odtExporter(basicExporter):
|
|||
doc = QTextDocument()
|
||||
cursor = QTextCursor(doc)
|
||||
|
||||
|
||||
def appendItem(item):
|
||||
if item.isFolder():
|
||||
|
||||
|
|
|
@ -1,12 +1,20 @@
|
|||
#!/usr/bin/env python
|
||||
#--!-- coding: utf8 --!--
|
||||
|
||||
from qt import *
|
||||
from random import *
|
||||
from enums import *
|
||||
import os
|
||||
from random import *
|
||||
|
||||
from PyQt5.QtCore import Qt, QRect, QStandardPaths, QObject
|
||||
|
||||
# Used to detect multiple connections
|
||||
from PyQt5.QtGui import QBrush, QIcon, QPainter
|
||||
from PyQt5.QtGui import QColor
|
||||
from PyQt5.QtGui import QImage
|
||||
from PyQt5.QtGui import QPixmap
|
||||
from PyQt5.QtWidgets import qApp
|
||||
|
||||
from manuskript.enums import Outline
|
||||
|
||||
AUC = Qt.AutoConnection | Qt.UniqueConnection
|
||||
MW = None
|
||||
|
||||
|
@ -70,7 +78,7 @@ def mainWindow():
|
|||
return MW
|
||||
|
||||
def iconColor(icon):
|
||||
"Returns a QRgb from a QIcon, assuming its all the same color"
|
||||
"""Returns a QRgb from a QIcon, assuming its all the same color"""
|
||||
px = icon.pixmap(5, 5)
|
||||
if px.width() != 0:
|
||||
return QColor(QImage(px).pixel(2, 2))
|
||||
|
@ -86,7 +94,7 @@ def iconFromColorString(string):
|
|||
return iconFromColor(QColor(string))
|
||||
|
||||
def randomColor(mix=None):
|
||||
"Generates a random color. If mix (QColor) is given, mixes the random color and mix."
|
||||
"""Generates a random color. If mix (QColor) is given, mixes the random color and mix."""
|
||||
r = randint(0, 255)
|
||||
g = randint(0, 255)
|
||||
b = randint(0, 255)
|
||||
|
@ -106,7 +114,7 @@ def mixColors(col1, col2, f=.5):
|
|||
return QColor(r, g, b)
|
||||
|
||||
def outlineItemColors(item):
|
||||
"Takes an OutlineItem and returns a dict of colors."
|
||||
"""Takes an OutlineItem and returns a dict of colors."""
|
||||
colors = {}
|
||||
mw = mainWindow()
|
||||
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
#!/usr/bin/env python
|
||||
#--!-- coding: utf8 --!--
|
||||
|
||||
from qt import *
|
||||
from functions import *
|
||||
from lxml import etree as ET
|
||||
import zipfile
|
||||
|
||||
from PyQt5.QtCore import QModelIndex, Qt
|
||||
from PyQt5.QtGui import QColor, QStandardItem
|
||||
from PyQt5.QtWidgets import qApp
|
||||
from lxml import etree as ET
|
||||
|
||||
from manuskript.functions import iconColor, iconFromColorString
|
||||
|
||||
try:
|
||||
import zlib # Used with zipfile for compression
|
||||
compression = zipfile.ZIP_DEFLATED
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
from qt import *
|
||||
|
||||
from functions import *
|
||||
import faulthandler
|
||||
import sys
|
||||
|
||||
from PyQt5.QtCore import QLocale, QTranslator, QSettings
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
from .functions import *
|
||||
|
||||
_version = "0.1"
|
||||
|
||||
|
@ -49,7 +50,7 @@ def run():
|
|||
|
||||
|
||||
def launch():
|
||||
from mainWindow import MainWindow
|
||||
from .mainWindow import MainWindow
|
||||
|
||||
main = MainWindow()
|
||||
main.show()
|
||||
|
|
|
@ -1,27 +1,33 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
|
||||
from qt import *
|
||||
|
||||
from ui.mainWindow import *
|
||||
from ui.helpLabel import helpLabel
|
||||
from ui.compileDialog import compileDialog
|
||||
from loadSave import *
|
||||
from enums import *
|
||||
from models.outlineModel import *
|
||||
from models.persosModel import *
|
||||
from models.plotModel import *
|
||||
from models.worldModel import worldModel
|
||||
from ui.views.outlineDelegates import outlinePersoDelegate
|
||||
from ui.views.plotDelegate import plotDelegate
|
||||
from ui.collapsibleDockWidgets import collapsibleDockWidgets
|
||||
# from models.persosProxyModel import *
|
||||
from functions import *
|
||||
from settingsWindow import *
|
||||
import settings
|
||||
import imp
|
||||
import os
|
||||
|
||||
from PyQt5.QtCore import pyqtSignal, QSignalMapper, QTimer, QSettings, Qt, QRegExp, QUrl
|
||||
from PyQt5.QtGui import QStandardItemModel
|
||||
from PyQt5.QtWidgets import QMainWindow, QHeaderView, qApp, QMenu, QActionGroup, QAction, QStyle
|
||||
|
||||
from manuskript import settings
|
||||
from manuskript.enums import Perso, Subplot, Plot, World
|
||||
from manuskript.functions import AUC, wordCount
|
||||
from manuskript.loadSave import loadStandardItemModelXML, loadFilesFromZip
|
||||
from manuskript.loadSave import saveFilesToZip
|
||||
from manuskript.loadSave import saveStandardItemModelXML
|
||||
from manuskript.models.outlineModel import outlineModel
|
||||
from manuskript.models.persosModel import persosModel
|
||||
from manuskript.models.plotModel import plotModel
|
||||
from manuskript.models.worldModel import worldModel
|
||||
from manuskript.settingsWindow import settingsWindow
|
||||
from manuskript.ui.collapsibleDockWidgets import collapsibleDockWidgets
|
||||
from manuskript.ui.compileDialog import compileDialog
|
||||
from manuskript.ui.helpLabel import helpLabel
|
||||
from manuskript.ui.mainWindow import Ui_MainWindow
|
||||
from manuskript.ui.views.outlineDelegates import outlinePersoDelegate
|
||||
from manuskript.ui.views.plotDelegate import plotDelegate
|
||||
|
||||
# Spellcheck support
|
||||
from manuskript.ui.views.textEditView import textEditView
|
||||
|
||||
try:
|
||||
import enchant
|
||||
except ImportError:
|
||||
|
@ -907,6 +913,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
w.setDict(settings.dict)
|
||||
|
||||
def openPyEnchantWebPage(self):
|
||||
from PyQt5.QtGui import QDesktopServices
|
||||
QDesktopServices.openUrl(QUrl("http://pythonhosted.org/pyenchant/"))
|
||||
|
||||
def toggleSpellcheck(self, val):
|
||||
|
|
|
@ -1,14 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from enum import Enum
|
||||
from lxml import etree as ET
|
||||
from functions import *
|
||||
import settings
|
||||
import locale
|
||||
|
||||
from PyQt5.QtCore import QAbstractItemModel, QMimeData
|
||||
from PyQt5.QtCore import QModelIndex
|
||||
from PyQt5.QtCore import QSize
|
||||
from PyQt5.QtCore import QVariant
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QIcon, QFont
|
||||
from PyQt5.QtWidgets import QTextEdit, qApp
|
||||
|
||||
from manuskript import settings
|
||||
from lxml import etree as ET
|
||||
|
||||
from manuskript.enums import Outline
|
||||
from manuskript.functions import mainWindow, toInt, wordCount
|
||||
|
||||
locale.setlocale(locale.LC_ALL, '')
|
||||
import time
|
||||
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtCore import QModelIndex, Qt
|
||||
from PyQt5.QtGui import QStandardItemModel, QStandardItem, QColor, QPixmap, QIcon
|
||||
from PyQt5.QtWidgets import QColorDialog
|
||||
|
||||
from manuskript.enums import Perso
|
||||
from manuskript.enums import Plot
|
||||
from manuskript.functions import iconColor
|
||||
from manuskript.functions import mainWindow
|
||||
from manuskript.functions import randomColor
|
||||
from manuskript.functions import toInt
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from functions import *
|
||||
|
||||
class persosModel(QStandardItemModel):
|
||||
|
||||
|
@ -174,4 +181,3 @@ class persosModel(QStandardItemModel):
|
|||
infos.append((name, val))
|
||||
|
||||
return infos
|
||||
|
|
@ -1,11 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
#--!-- coding: utf8 --!--
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from manuskript import enums
|
||||
|
||||
from enum import Enum
|
||||
from lxml import etree as ET
|
||||
|
||||
class persosProxyModel(QSortFilterProxyModel):
|
||||
|
||||
|
|
|
@ -1,12 +1,19 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtCore import QModelIndex
|
||||
from PyQt5.QtCore import QSignalMapper
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QBrush
|
||||
from PyQt5.QtGui import QStandardItem
|
||||
from PyQt5.QtGui import QStandardItemModel
|
||||
from PyQt5.QtWidgets import QAction, QMenu
|
||||
|
||||
from manuskript.enums import Plot
|
||||
from manuskript.enums import Subplot
|
||||
from manuskript.functions import toInt, mainWindow
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from functions import *
|
||||
|
||||
class plotModel(QStandardItemModel):
|
||||
|
||||
def __init__(self, parent):
|
||||
QStandardItemModel.__init__(self, 0, 3, parent)
|
||||
self.setHorizontalHeaderLabels([i.name for i in Plot])
|
||||
|
@ -55,7 +62,7 @@ class plotModel(QStandardItemModel):
|
|||
plotIndex = self.getIndexFromID(plotID)
|
||||
name = plotIndex.child(subplotRaw, Plot.name.value).data()
|
||||
summary = plotIndex.child(subplotRaw, 3).data() # 3 is for summary
|
||||
return (name, summary)
|
||||
return name, summary
|
||||
|
||||
def getIndexFromID(self, ID):
|
||||
for i in range(self.rowCount()):
|
||||
|
@ -83,7 +90,7 @@ class plotModel(QStandardItemModel):
|
|||
QStandardItem(), QStandardItem(), QStandardItem("Subplots")])
|
||||
|
||||
def getUniqueID(self, parent=QModelIndex()):
|
||||
"Returns an unused ID"
|
||||
"""Returns an unused ID"""
|
||||
parentItem = self.itemFromIndex(parent)
|
||||
vals = []
|
||||
for i in range(self.rowCount(parent)):
|
||||
|
@ -93,7 +100,8 @@ class plotModel(QStandardItemModel):
|
|||
vals.append(int(index.data()))
|
||||
|
||||
k = 0
|
||||
while k in vals: k += 1
|
||||
while k in vals:
|
||||
k += 1
|
||||
return str(k)
|
||||
|
||||
def removePlot(self, index):
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtCore import QModelIndex
|
||||
from PyQt5.QtCore import QSortFilterProxyModel
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtCore import pyqtSignal
|
||||
from PyQt5.QtGui import QBrush, QFont
|
||||
from PyQt5.QtGui import QColor
|
||||
from PyQt5.QtGui import QStandardItem
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from manuskript.enums import Plot
|
||||
|
||||
from enum import Enum
|
||||
from lxml import etree as ET
|
||||
|
||||
class plotsProxyModel(QSortFilterProxyModel):
|
||||
|
||||
newStatuses = pyqtSignal()
|
||||
|
||||
def __init__(self, parent=None):
|
||||
|
@ -93,7 +96,6 @@ class plotsProxyModel(QSortFilterProxyModel):
|
|||
|
||||
self.endResetModel()
|
||||
|
||||
|
||||
def data(self, index, role=Qt.DisplayRole):
|
||||
|
||||
if index.isValid() and not self.mapToSource(index).isValid():
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from functions import *
|
||||
import re
|
||||
|
||||
###############################################################################
|
||||
|
@ -11,6 +8,14 @@ import re
|
|||
###############################################################################
|
||||
|
||||
# A regex used to match references
|
||||
from PyQt5.QtWidgets import qApp
|
||||
|
||||
from manuskript.enums import Outline
|
||||
from manuskript.enums import Perso
|
||||
from manuskript.enums import Plot
|
||||
from manuskript.enums import Subplot
|
||||
from manuskript.functions import mainWindow
|
||||
|
||||
RegEx = r"{(\w):(\d+):?.*?}"
|
||||
# A non-capturing regex used to identify references
|
||||
RegExNonCapturing = r"{\w:\d+:?.*?}"
|
||||
|
@ -21,21 +26,26 @@ TextLetter = "T"
|
|||
PlotLetter = "P"
|
||||
WorldLetter = "W"
|
||||
|
||||
|
||||
def plotReference(ID):
|
||||
"Takes the ID of a plot and returns a reference for that plot."
|
||||
"""Takes the ID of a plot and returns a reference for that plot."""
|
||||
return EmptyRef.format(PlotLetter, ID, "")
|
||||
|
||||
|
||||
def persoReference(ID):
|
||||
"Takes the ID of a character and returns a reference for that character."
|
||||
"""Takes the ID of a character and returns a reference for that character."""
|
||||
return EmptyRef.format(PersoLetter, ID, "")
|
||||
|
||||
|
||||
def textReference(ID):
|
||||
"Takes the ID of an outline item and returns a reference for that item."
|
||||
"""Takes the ID of an outline item and returns a reference for that item."""
|
||||
return EmptyRef.format(TextLetter, ID, "")
|
||||
|
||||
|
||||
def worldReference(ID):
|
||||
"Takes the ID of a world item and returns a reference for that item."
|
||||
return EmptyRef.format(WordLetter, ID, "")
|
||||
"""Takes the ID of a world item and returns a reference for that item."""
|
||||
return EmptyRef.format(WorldLetter, ID, "")
|
||||
|
||||
|
||||
###############################################################################
|
||||
# READABLE INFOS
|
||||
|
@ -292,7 +302,7 @@ def infos(ref):
|
|||
steps="<h2>{title}</h2><ul>{steps}</ul>".format(
|
||||
title=stepsTitle,
|
||||
steps=steps) if steps else "",
|
||||
references=listReferences(ref, referenceTitle)
|
||||
references=listReferences(ref)
|
||||
)
|
||||
return text
|
||||
|
||||
|
@ -345,8 +355,9 @@ def infos(ref):
|
|||
else:
|
||||
return qApp.translate("references", "Unknown reference: {}.").format(ref)
|
||||
|
||||
|
||||
def tooltip(ref):
|
||||
"Returns a tooltip in HTML for the reference ``ref``."
|
||||
"""Returns a tooltip in HTML for the reference ``ref``."""
|
||||
match = re.fullmatch(RegEx, ref)
|
||||
|
||||
if not match:
|
||||
|
@ -364,10 +375,10 @@ def tooltip(ref):
|
|||
|
||||
item = idx.internalPointer()
|
||||
|
||||
tooltip = qApp.translate("references", "Text: <b>{}</b>").format(item.title())
|
||||
tooltip += "<br><i>{}</i>".format(item.path())
|
||||
tt = qApp.translate("references", "Text: <b>{}</b>").format(item.title())
|
||||
tt += "<br><i>{}</i>".format(item.path())
|
||||
|
||||
return tooltip
|
||||
return tt
|
||||
|
||||
elif _type == PersoLetter:
|
||||
m = mainWindow().mdlPersos
|
||||
|
@ -393,6 +404,7 @@ def tooltip(ref):
|
|||
|
||||
return qApp.translate("references", "<b>Unknown reference:</b> {}.").format(ref)
|
||||
|
||||
|
||||
###############################################################################
|
||||
# FUNCTIONS
|
||||
###############################################################################
|
||||
|
@ -433,10 +445,12 @@ def refToLink(ref):
|
|||
else:
|
||||
return ref
|
||||
|
||||
|
||||
def linkifyAllRefs(text):
|
||||
"Takes all the references in ``text`` and transform them into HMTL links."
|
||||
"""Takes all the references in ``text`` and transform them into HMTL links."""
|
||||
return re.sub(RegEx, lambda m: refToLink(m.group(0)), text)
|
||||
|
||||
|
||||
def listReferences(ref, title=qApp.translate("references", "Referenced in:")):
|
||||
oM = mainWindow().mdlOutline
|
||||
listRefs = ""
|
||||
|
@ -452,8 +466,9 @@ def listReferences(ref, title=qApp.translate("references", "Referenced in:")):
|
|||
title=title,
|
||||
ref=listRefs) if listRefs else ""
|
||||
|
||||
|
||||
def basicT2TFormat(text, formatting=True, EOL=True, titles=True):
|
||||
"A very basic t2t formatter to display notes and texts."
|
||||
"""A very basic t2t formatter to display notes and texts."""
|
||||
text = text.splitlines()
|
||||
for n, line in enumerate(text):
|
||||
if formatting:
|
||||
|
@ -475,6 +490,7 @@ def basicT2TFormat(text, formatting=True, EOL=True, titles=True):
|
|||
|
||||
return text
|
||||
|
||||
|
||||
def basicFormat(text):
|
||||
if not text:
|
||||
return ""
|
||||
|
@ -482,8 +498,9 @@ def basicFormat(text):
|
|||
text = linkifyAllRefs(text)
|
||||
return text
|
||||
|
||||
|
||||
def open(ref):
|
||||
"Identify ``ref`` and open it."
|
||||
"""Identify ``ref`` and open it."""
|
||||
match = re.fullmatch(RegEx, ref)
|
||||
if not match:
|
||||
return
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtCore import QModelIndex
|
||||
from PyQt5.QtCore import QSize
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QStandardItem, QBrush, QFontMetrics
|
||||
from PyQt5.QtGui import QStandardItemModel
|
||||
from PyQt5.QtWidgets import QMenu, QAction, qApp
|
||||
|
||||
from manuskript.enums import World
|
||||
from manuskript.functions import mainWindow, lightBlue
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from functions import *
|
||||
import collections
|
||||
|
||||
class worldModel(QStandardItemModel):
|
||||
|
||||
def __init__(self, parent):
|
||||
QStandardItemModel.__init__(self, 0, 3, parent)
|
||||
self.mw = mainWindow()
|
||||
|
@ -17,7 +21,7 @@ class worldModel(QStandardItemModel):
|
|||
###############################################################################
|
||||
|
||||
def selectedItem(self):
|
||||
"Returns the item selected in mw.treeWorld. invisibleRootItem if None."
|
||||
"""Returns the item selected in mw.treeWorld. invisibleRootItem if None."""
|
||||
index = self.selectedIndex()
|
||||
item = self.itemFromIndex(index)
|
||||
if item:
|
||||
|
@ -26,7 +30,7 @@ class worldModel(QStandardItemModel):
|
|||
return self.invisibleRootItem()
|
||||
|
||||
def selectedIndex(self):
|
||||
"Returns the selected index in the treeView."
|
||||
"""Returns the selected index in the treeView."""
|
||||
if self.mw.treeWorld.selectedIndexes():
|
||||
return self.mw.treeWorld.currentIndex()
|
||||
else:
|
||||
|
@ -40,12 +44,12 @@ class worldModel(QStandardItemModel):
|
|||
###############################################################################
|
||||
|
||||
def ID(self, index):
|
||||
"Returns the ID of the given index."
|
||||
"""Returns the ID of the given index."""
|
||||
index = index.sibling(index.row(), World.ID.value)
|
||||
return self.data(index)
|
||||
|
||||
def name(self, index):
|
||||
"Returns the name of the given index."
|
||||
"""Returns the name of the given index."""
|
||||
index = index.sibling(index.row(), World.name.value)
|
||||
return self.data(index)
|
||||
|
||||
|
@ -62,19 +66,19 @@ class worldModel(QStandardItemModel):
|
|||
return self.data(index)
|
||||
|
||||
def itemID(self, item):
|
||||
"Returns the ID of the given item."
|
||||
"""Returns the ID of the given item."""
|
||||
index = self.indexFromItem(item)
|
||||
return self.ID(index)
|
||||
|
||||
def children(self, item):
|
||||
"Returns a list of all item's children."
|
||||
"""Returns a list of all item's children."""
|
||||
c = []
|
||||
for i in range(item.rowCount()):
|
||||
c.append(item.child(i))
|
||||
return c
|
||||
|
||||
def listAll(self):
|
||||
"Returns a list of tupple ``(name, ID, path)`` for all items."
|
||||
"""Returns a list of tupple ``(name, ID, path)`` for all items."""
|
||||
lst = []
|
||||
|
||||
def readAll(item):
|
||||
|
@ -91,11 +95,12 @@ class worldModel(QStandardItemModel):
|
|||
return lst
|
||||
|
||||
def indexByID(self, ID):
|
||||
"Returns the index of item whose ID is ID."
|
||||
"""Returns the index of item whose ID is ID."""
|
||||
return self.indexFromItem(self.itemByID(ID))
|
||||
|
||||
def itemByID(self, ID):
|
||||
"Returns the item whose ID is ID."
|
||||
"""Returns the item whose ID is ID."""
|
||||
|
||||
def browse(item):
|
||||
if self.itemID(item) == ID:
|
||||
return item
|
||||
|
@ -108,7 +113,7 @@ class worldModel(QStandardItemModel):
|
|||
return r if r else None
|
||||
|
||||
def path(self, item):
|
||||
"Returns the path to the item in the form of 'ancestor > ... > grand-parent > parent'."
|
||||
"""Returns the path to the item in the form of 'ancestor > ... > grand-parent > parent'."""
|
||||
path = []
|
||||
while item.parent():
|
||||
item = item.parent()
|
||||
|
@ -121,7 +126,7 @@ class worldModel(QStandardItemModel):
|
|||
###############################################################################
|
||||
|
||||
def addItem(self, title=None, parent=None):
|
||||
"Adds an item, and returns it."
|
||||
"""Adds an item, and returns it."""
|
||||
if not parent:
|
||||
parent = self.selectedItem()
|
||||
if not title:
|
||||
|
@ -133,7 +138,7 @@ class worldModel(QStandardItemModel):
|
|||
return name
|
||||
|
||||
def getUniqueID(self):
|
||||
"Returns an unused ID"
|
||||
"""Returns an unused ID"""
|
||||
|
||||
parentItem = self.invisibleRootItem()
|
||||
vals = []
|
||||
|
@ -147,7 +152,8 @@ class worldModel(QStandardItemModel):
|
|||
collectIDs(c)
|
||||
|
||||
k = 0
|
||||
while k in vals: k += 1
|
||||
while k in vals:
|
||||
k += 1
|
||||
return str(k)
|
||||
|
||||
def removeItem(self):
|
||||
|
@ -160,7 +166,7 @@ class worldModel(QStandardItemModel):
|
|||
###############################################################################
|
||||
|
||||
def dataSets(self):
|
||||
"Returns sets of empty data that can guide the writer for world building."
|
||||
"""Returns sets of empty data that can guide the writer for world building."""
|
||||
dataset = {
|
||||
self.tr("Fantasy world building"): [
|
||||
(self.tr("Physical"), [
|
||||
|
@ -211,7 +217,7 @@ class worldModel(QStandardItemModel):
|
|||
return dataset
|
||||
|
||||
def emptyDataMenu(self):
|
||||
"Returns a menu with the empty data sets."
|
||||
"""Returns a menu with the empty data sets."""
|
||||
self.menu = QMenu("menu")
|
||||
for name in self.dataSets():
|
||||
a = QAction(name, self.menu)
|
||||
|
@ -220,7 +226,7 @@ class worldModel(QStandardItemModel):
|
|||
return self.menu
|
||||
|
||||
def setEmptyData(self):
|
||||
"Called from the menu generated with ``emptyDataMenu``."
|
||||
"""Called from the menu generated with ``emptyDataMenu``."""
|
||||
act = self.sender()
|
||||
data = self.dataSets()[act.text()]
|
||||
|
||||
|
@ -273,4 +279,3 @@ class worldModel(QStandardItemModel):
|
|||
return QSize(0, h + 6)
|
||||
|
||||
return QStandardItemModel.data(self, index, role)
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from PyQt5.QtCore import *
|
||||
from PyQt5.QtGui import *
|
||||
from PyQt5.QtWidgets import *
|
||||
|
||||
#from PyQt4.QtCore import *
|
||||
#from PyQt4.QtGui import *
|
|
@ -1,10 +1,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import pickle
|
||||
import pprint
|
||||
from enums import *
|
||||
from qt import *
|
||||
import collections
|
||||
import pickle
|
||||
|
||||
from PyQt5.QtWidgets import qApp
|
||||
|
||||
from manuskript.enums import Outline
|
||||
|
||||
viewSettings = {
|
||||
"Tree": {
|
||||
|
|
|
@ -1,24 +1,31 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
|
||||
from qt import *
|
||||
|
||||
from ui.settings import *
|
||||
from enums import *
|
||||
from functions import *
|
||||
from ui.editors.themes import *
|
||||
from ui.views.textEditView import *
|
||||
import settings
|
||||
import os
|
||||
|
||||
from PyQt5.QtCore import QSize, QSettings, QRegExp
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QIntValidator, QIcon, QFont, QColor, QPixmap, QStandardItem, QPainter
|
||||
from PyQt5.QtWidgets import QStyleFactory, QWidget, QStyle, QColorDialog, QListWidgetItem
|
||||
from PyQt5.QtWidgets import qApp
|
||||
|
||||
# Spell checker support
|
||||
from manuskript import settings
|
||||
from manuskript.enums import Outline
|
||||
from manuskript.functions import allPaths, iconColor, writablePath, appPath
|
||||
from manuskript.functions import mainWindow
|
||||
from manuskript.ui.editors.themes import createThemePreview
|
||||
from manuskript.ui.editors.themes import getThemeName
|
||||
from manuskript.ui.editors.themes import loadThemeDatas
|
||||
from manuskript.ui.settings_ui import Ui_Settings
|
||||
from manuskript.ui.views.textEditView import textEditView
|
||||
|
||||
try:
|
||||
import enchant
|
||||
except ImportError:
|
||||
enchant = None
|
||||
|
||||
class settingsWindow(QWidget, Ui_Settings):
|
||||
|
||||
class settingsWindow(QWidget, Ui_Settings):
|
||||
def __init__(self, mainWindow):
|
||||
QWidget.__init__(self)
|
||||
self.setupUi(self)
|
||||
|
@ -176,7 +183,6 @@ class settingsWindow(QWidget, Ui_Settings):
|
|||
self.btnThemeEdit.clicked.connect(self.editTheme)
|
||||
self.btnThemeRemove.clicked.connect(self.removeTheme)
|
||||
|
||||
|
||||
def setTab(self, tab):
|
||||
|
||||
tabs = {
|
||||
|
@ -220,7 +226,6 @@ class settingsWindow(QWidget, Ui_Settings):
|
|||
self.mw.saveTimerNoChanges.setInterval(settings.autoSaveNoChangesDelay * 1000)
|
||||
settings.defaultTextType = self.cmbDefaultTextType.currentData()
|
||||
|
||||
|
||||
####################################################################################################
|
||||
# REVISION #
|
||||
####################################################################################################
|
||||
|
@ -397,8 +402,6 @@ class settingsWindow(QWidget, Ui_Settings):
|
|||
self.setButtonColor(self.btnEditorBackgroundColor, color.name())
|
||||
self.updateEditorSettings()
|
||||
|
||||
|
||||
|
||||
####################################################################################################
|
||||
# STATUS #
|
||||
####################################################################################################
|
||||
|
@ -418,7 +421,8 @@ class settingsWindow(QWidget, Ui_Settings):
|
|||
# px = QPixmap(64, 64)
|
||||
# px.fill(iconColor(self.mw.mdlLabels.item(index.row()).icon()))
|
||||
# self.btnLabelColor.setIcon(QIcon(px))
|
||||
self.btnLabelColor.setStyleSheet("background:{};".format(iconColor(self.mw.mdlLabels.item(index.row()).icon()).name()))
|
||||
self.btnLabelColor.setStyleSheet(
|
||||
"background:{};".format(iconColor(self.mw.mdlLabels.item(index.row()).icon()).name()))
|
||||
self.btnLabelColor.setEnabled(True)
|
||||
|
||||
def addLabel(self):
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtCore import pyqtSignal, Qt, QTimer, QRect
|
||||
from PyQt5.QtGui import QBrush, QCursor, QPalette, QFontMetrics
|
||||
from PyQt5.QtWidgets import QWidget, QListWidgetItem, QToolTip, QStyledItemDelegate, QStyle
|
||||
|
||||
from manuskript.enums import Perso
|
||||
from manuskript.enums import Plot
|
||||
from manuskript.functions import lightBlue
|
||||
from manuskript.functions import mainWindow
|
||||
from manuskript.ui.cheatSheet_ui import Ui_cheatSheet
|
||||
from manuskript.models import references as Ref
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from models.outlineModel import *
|
||||
from ui.cheatSheet_ui import *
|
||||
from functions import *
|
||||
import models.references as Ref
|
||||
|
||||
class cheatSheet(QWidget, Ui_cheatSheet):
|
||||
|
||||
activated = pyqtSignal(str)
|
||||
|
||||
def __init__(self, parent=None):
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
from PyQt5 import QtCore, QtWidgets
|
||||
|
||||
class Ui_cheatSheet(object):
|
||||
def setupUi(self, cheatSheet):
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
|
||||
from qt import *
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import QToolBar, QDockWidget, QAction, QToolButton, QSizePolicy, QStylePainter, \
|
||||
QStyleOptionButton, QStyle
|
||||
|
||||
|
||||
class collapsibleDockWidgets(QToolBar):
|
||||
|
@ -68,7 +69,7 @@ class collapsibleDockWidgets(QToolBar):
|
|||
def setCurrentGroup(self, group):
|
||||
self.currentGroup = group
|
||||
for btn, action, widget, grp in self.otherWidgets:
|
||||
if not grp == group or grp == None:
|
||||
if not grp == group or grp is None:
|
||||
action.setVisible(False)
|
||||
else:
|
||||
action.setVisible(True)
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtCore import Qt, QRect, QRectF
|
||||
from PyQt5.QtGui import QColor, QBrush, QRegion, QTextOption, QFont
|
||||
from PyQt5.QtWidgets import QSizePolicy, QGroupBox, QWidget, QStylePainter, QStyleOptionGroupBox, qApp, QVBoxLayout, \
|
||||
QStyle, QStyleOptionFrame, QStyleOptionFocusRect
|
||||
|
||||
|
||||
|
||||
|
||||
from qt import *
|
||||
|
||||
class collapsibleGroupBox(QGroupBox):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QGroupBox.__init__(self)
|
||||
|
||||
|
@ -88,7 +87,7 @@ class collapsibleGroupBox(QGroupBox):
|
|||
style.drawPrimitive(style.PE_FrameGroupBox, frame, p)
|
||||
p.restore()
|
||||
|
||||
##// Draw title
|
||||
# // Draw title
|
||||
if groupBox.subControls & QStyle.SC_GroupBoxLabel and groupBox.text:
|
||||
# textColor = QColor(groupBox.textColor)
|
||||
# if textColor.isValid():
|
||||
|
@ -120,7 +119,7 @@ class collapsibleGroupBox(QGroupBox):
|
|||
# // Draw checkbox
|
||||
# if groupBox.subControls & style.SC_GroupBoxCheckBox:
|
||||
# box = QStyleOptionButton()
|
||||
##box.operator=(groupBox)
|
||||
# box.operator=(groupBox)
|
||||
# box.state = groupBox.state
|
||||
# box.rect = checkBoxRect
|
||||
# style.drawPrimitive(style.PE_IndicatorCheckBox, box, p)
|
|
@ -1,10 +1,10 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import QWidget, QFrame, QPushButton, QVBoxLayout, QSizePolicy
|
||||
|
||||
from qt import *
|
||||
|
||||
class collapsibleGroupBox2(QWidget):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QWidget.__init__(self, parent)
|
||||
self.frame = QFrame(self)
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import QDialog, qApp, QFileDialog
|
||||
|
||||
from manuskript import exporter
|
||||
from manuskript.ui.compileDialog_ui import Ui_compileDialog
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from models.outlineModel import *
|
||||
from ui.compileDialog_ui import *
|
||||
from functions import *
|
||||
import os
|
||||
import exporter
|
||||
|
||||
class compileDialog(QDialog, Ui_compileDialog):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QDialog.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
|
@ -24,7 +21,6 @@ class compileDialog(QDialog, Ui_compileDialog):
|
|||
self.txtPath.setText("/home/olivier/Documents/Travail/Geekeries/Python/manuskript/ExportTest")
|
||||
self.txtFilename.setText("/home/olivier/Documents/Travail/Geekeries/Python/manuskript/ExportTest/test.html")
|
||||
|
||||
|
||||
self.populatesTarget()
|
||||
self.updateUI()
|
||||
|
||||
|
@ -104,4 +100,3 @@ class compileDialog(QDialog, Ui_compileDialog):
|
|||
compiler.doCompile(self.txtFilename.text())
|
||||
|
||||
self.stopWorking()
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
from PyQt5 import QtCore, QtWidgets
|
||||
|
||||
class Ui_compileDialog(object):
|
||||
def setupUi(self, compileDialog):
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf8 -*-
|
||||
|
||||
from qt import *
|
||||
import re
|
||||
from functions import *
|
||||
import models.references as Ref
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QBrush, QTextCursor, QColor, QFont, QSyntaxHighlighter, QTextBlockFormat, QTextCharFormat
|
||||
|
||||
import manuskript.models.references as Ref
|
||||
|
||||
|
||||
class basicHighlighter(QSyntaxHighlighter):
|
||||
|
||||
def __init__(self, editor):
|
||||
QSyntaxHighlighter.__init__(self, editor.document())
|
||||
|
||||
|
@ -27,7 +29,6 @@ class basicHighlighter(QSyntaxHighlighter):
|
|||
def setMisspelledColor(self, color):
|
||||
self._misspelledColor = color
|
||||
|
||||
|
||||
def highlightBlock(self, text):
|
||||
"""Apply syntax highlighting to the given block of text.
|
||||
"""
|
||||
|
@ -82,6 +83,3 @@ class basicHighlighter(QSyntaxHighlighter):
|
|||
format.setUnderlineStyle(QTextCharFormat.SpellCheckUnderline)
|
||||
self.setFormat(word_object.start(),
|
||||
word_object.end() - word_object.start(), format)
|
||||
|
||||
|
||||
|
|
@ -1,14 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf8 -*-
|
||||
|
||||
from qt import *
|
||||
from PyQt5.QtGui import QTextBlockUserData
|
||||
|
||||
|
||||
class blockUserData(QTextBlockUserData):
|
||||
|
||||
@staticmethod
|
||||
def getUserData(block):
|
||||
"Returns userData if it exists, or a blank one."
|
||||
"""Returns userData if it exists, or a blank one."""
|
||||
data = block.userData()
|
||||
if data is None:
|
||||
data = blockUserData()
|
||||
|
@ -16,7 +14,7 @@ class blockUserData (QTextBlockUserData):
|
|||
|
||||
@staticmethod
|
||||
def getUserState(block):
|
||||
"Returns the block state."
|
||||
"""Returns the block state."""
|
||||
state = block.userState()
|
||||
while state >= 100:
|
||||
state -= 100 # +100 means in a list
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtCore import pyqtSignal, Qt, QRect
|
||||
from PyQt5.QtGui import QBrush, QFontMetrics, QPalette
|
||||
from PyQt5.QtWidgets import QWidget, QListWidgetItem, QStyledItemDelegate, QStyle
|
||||
|
||||
from manuskript.functions import lightBlue
|
||||
from manuskript.functions import mainWindow
|
||||
from manuskript.ui.editors.completer_ui import Ui_completer
|
||||
from manuskript.models import references as Ref
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from models.outlineModel import *
|
||||
from ui.editors.completer_ui import *
|
||||
from functions import *
|
||||
import models.references as Ref
|
||||
|
||||
class completer(QWidget, Ui_completer):
|
||||
|
||||
activated = pyqtSignal(str)
|
||||
|
||||
def __init__(self, parent=None):
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
from PyQt5 import QtCore, QtWidgets
|
||||
|
||||
class Ui_completer(object):
|
||||
def setupUi(self, completer):
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtCore import pyqtSignal, QModelIndex
|
||||
from PyQt5.QtGui import QPalette
|
||||
from PyQt5.QtWidgets import QWidget, QFrame, QSpacerItem, QSizePolicy, QVBoxLayout
|
||||
|
||||
from manuskript import settings
|
||||
from manuskript.functions import AUC, mainWindow
|
||||
from manuskript.ui.editors.editorWidget_ui import Ui_editorWidget_ui
|
||||
from manuskript.ui.views.textEditView import textEditView
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from ui.editors.editorWidget_ui import *
|
||||
from ui.editors.fullScreenEditor import *
|
||||
from ui.editors.textFormat import *
|
||||
from ui.views.textEditView import *
|
||||
from functions import *
|
||||
import settings
|
||||
|
||||
class editorWidget(QWidget, Ui_editorWidget_ui):
|
||||
|
||||
toggledSpellcheck = pyqtSignal(bool)
|
||||
dictChanged = pyqtSignal(str)
|
||||
|
||||
|
@ -67,7 +66,7 @@ class editorWidget(QWidget, Ui_editorWidget_ui):
|
|||
def setView(self):
|
||||
# index = mainWindow().treeRedacOutline.currentIndex()
|
||||
|
||||
## Couting the number of other selected items
|
||||
# Couting the number of other selected items
|
||||
# sel = []
|
||||
# for i in mainWindow().treeRedacOutline.selectionModel().selection().indexes():
|
||||
# if i.column() != 0: continue
|
||||
|
@ -87,7 +86,8 @@ class editorWidget(QWidget, Ui_editorWidget_ui):
|
|||
item = self.mw.mdlOutline.rootItem
|
||||
|
||||
def addTitle(itm):
|
||||
edt = textEditView(self, html="<h{l}>{t}</h{l}>".format(l=min(itm.level()+1, 5), t=itm.title()), autoResize=True)
|
||||
edt = textEditView(self, html="<h{l}>{t}</h{l}>".format(l=min(itm.level() + 1, 5), t=itm.title()),
|
||||
autoResize=True)
|
||||
edt.setFrameShape(QFrame.NoFrame)
|
||||
self.txtEdits.append(edt)
|
||||
l.addWidget(edt)
|
||||
|
@ -197,7 +197,6 @@ class editorWidget(QWidget, Ui_editorWidget_ui):
|
|||
|
||||
self.updateStatusBar()
|
||||
|
||||
|
||||
def setCurrentModelIndex(self, index=None):
|
||||
if index.isValid():
|
||||
self.currentIndex = index
|
||||
|
@ -234,7 +233,8 @@ class editorWidget(QWidget, Ui_editorWidget_ui):
|
|||
# if self.currentIndex and self.currentIndex.isValid():
|
||||
# if self._model:
|
||||
mw = mainWindow()
|
||||
if not mw: return
|
||||
if not mw:
|
||||
return
|
||||
|
||||
mw.mainEditor.updateStats()
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ class Ui_editorWidget_ui(object):
|
|||
self.scroll.setWidgetResizable(True)
|
||||
self.scroll.setObjectName("scroll")
|
||||
self.scrollAreaWidgetContents = QtWidgets.QWidget()
|
||||
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 396, 296))
|
||||
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 96, 26))
|
||||
self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
|
||||
self.scroll.setWidget(self.scrollAreaWidgetContents)
|
||||
self.verticalLayout.addWidget(self.scroll)
|
||||
|
@ -70,6 +70,6 @@ class Ui_editorWidget_ui(object):
|
|||
_translate = QtCore.QCoreApplication.translate
|
||||
editorWidget_ui.setWindowTitle(_translate("editorWidget_ui", "Form"))
|
||||
|
||||
from ui.views.corkView import corkView
|
||||
from ui.views.outlineView import outlineView
|
||||
from ui.views.textEditView import textEditView
|
||||
from manuskript.ui.views.corkView import corkView
|
||||
from manuskript.ui.views.outlineView import outlineView
|
||||
from manuskript.ui.views.textEditView import textEditView
|
||||
|
|
|
@ -14,7 +14,16 @@
|
|||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
|
@ -24,7 +33,16 @@
|
|||
</property>
|
||||
<widget class="QWidget" name="text">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
|
@ -37,7 +55,16 @@
|
|||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
|
@ -53,8 +80,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>396</width>
|
||||
<height>296</height>
|
||||
<width>96</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
|
@ -64,7 +91,16 @@
|
|||
</widget>
|
||||
<widget class="QWidget" name="cork">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
|
@ -74,7 +110,16 @@
|
|||
</widget>
|
||||
<widget class="QWidget" name="outline">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
|
@ -90,17 +135,17 @@
|
|||
<customwidget>
|
||||
<class>textEditView</class>
|
||||
<extends>QTextEdit</extends>
|
||||
<header>ui.views.textEditView.h</header>
|
||||
<header>manuskript.ui.views.textEditView.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>outlineView</class>
|
||||
<extends>QTreeView</extends>
|
||||
<header>ui.views.outlineView.h</header>
|
||||
<header>manuskript.ui.views.outlineView.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>corkView</class>
|
||||
<extends>QListView</extends>
|
||||
<header>ui.views.corkView.h</header>
|
||||
<header>manuskript.ui.views.corkView.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
|
|
|
@ -1,24 +1,30 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
import os
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from ui.views.textEditView import *
|
||||
from ui.editors.themes import *
|
||||
from ui.editors.textFormat import *
|
||||
from ui.editors.locker import locker
|
||||
|
||||
from functions import *
|
||||
import settings
|
||||
from PyQt5.QtCore import Qt, QSize, QPoint, QRect, QEvent, QTimer
|
||||
from PyQt5.QtGui import QFontMetrics, QColor, QBrush, QPalette, QPainter, QPixmap
|
||||
from PyQt5.QtGui import QIcon
|
||||
from PyQt5.QtWidgets import QFrame, QWidget, QPushButton, qApp, QStyle, QComboBox, QLabel, QScrollBar, \
|
||||
QStyleOptionSlider, QHBoxLayout, QVBoxLayout
|
||||
|
||||
# Spell checker support
|
||||
from manuskript import settings
|
||||
from manuskript.enums import Outline
|
||||
from manuskript.functions import allPaths, drawProgress
|
||||
from manuskript.ui.editors.locker import locker
|
||||
from manuskript.ui.editors.textFormat import textFormat
|
||||
from manuskript.ui.editors.themes import findThemePath, generateTheme, setThemeEditorDatas
|
||||
from manuskript.ui.editors.themes import loadThemeDatas
|
||||
from manuskript.ui.views.textEditView import textEditView
|
||||
|
||||
try:
|
||||
import enchant
|
||||
except ImportError:
|
||||
enchant = None
|
||||
|
||||
class fullScreenEditor(QWidget):
|
||||
|
||||
class fullScreenEditor(QWidget):
|
||||
def __init__(self, index, parent=None):
|
||||
QWidget.__init__(self, parent)
|
||||
self._background = None
|
||||
|
@ -278,6 +284,7 @@ class fullScreenEditor(QWidget):
|
|||
if goal - wc > 0:
|
||||
self.locker.spnWordTarget.setValue(goal - wc)
|
||||
|
||||
|
||||
class myScrollBar(QScrollBar):
|
||||
def __init__(self, color=Qt.white, parent=None):
|
||||
QScrollBar.__init__(self, parent)
|
||||
|
@ -311,6 +318,7 @@ class myScrollBar(QScrollBar):
|
|||
painter.fillRect(r, self._color)
|
||||
painter.end()
|
||||
|
||||
|
||||
class myPanel(QWidget):
|
||||
def __init__(self, color=Qt.white, vertical=False, parent=None):
|
||||
QWidget.__init__(self, parent)
|
||||
|
|
|
@ -1,19 +1,16 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtCore import pyqtSignal, QTimer
|
||||
from PyQt5.QtWidgets import QWidget, qApp
|
||||
|
||||
from manuskript.ui.editors.locker_ui import Ui_locker
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from ui.editors.locker_ui import Ui_locker
|
||||
from functions import *
|
||||
import models.references as Ref
|
||||
|
||||
class locker(QWidget, Ui_locker):
|
||||
|
||||
locked = pyqtSignal()
|
||||
unlocked = pyqtSignal()
|
||||
lockChanged = pyqtSignal(bool)
|
||||
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QWidget.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
|
@ -108,7 +105,6 @@ class locker(QWidget, Ui_locker):
|
|||
text))
|
||||
|
||||
# Word locked
|
||||
elif self._target != None:
|
||||
elif self._target is not None:
|
||||
self.btnLock.setText(self.tr("{} words remaining").format(
|
||||
self._target - self._words))
|
||||
|
|
@ -1,17 +1,24 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from ui.editors.mainEditor_ui import *
|
||||
from ui.editors.editorWidget import *
|
||||
from functions import *
|
||||
import locale
|
||||
|
||||
from PyQt5.QtCore import QModelIndex, QRect, QPoint
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QPixmap, QPainter
|
||||
from PyQt5.QtWidgets import QWidget
|
||||
from PyQt5.QtWidgets import qApp
|
||||
|
||||
from manuskript import settings
|
||||
from manuskript.enums import Outline
|
||||
from manuskript.functions import AUC, mainWindow, drawProgress
|
||||
from manuskript.ui.editors.editorWidget import editorWidget
|
||||
from manuskript.ui.editors.fullScreenEditor import fullScreenEditor
|
||||
from manuskript.ui.editors.mainEditor_ui import Ui_mainEditor
|
||||
|
||||
locale.setlocale(locale.LC_ALL, '')
|
||||
|
||||
|
||||
class mainEditor(QWidget, Ui_mainEditor):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QWidget.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
|
@ -120,7 +127,6 @@ class mainEditor(QWidget, Ui_mainEditor):
|
|||
self.currentEditor().setCurrentModelIndex(index)
|
||||
self.tab.setTabText(self.tab.currentIndex(), title)
|
||||
|
||||
|
||||
###############################################################################
|
||||
# UI
|
||||
###############################################################################
|
||||
|
@ -140,7 +146,6 @@ class mainEditor(QWidget, Ui_mainEditor):
|
|||
self.sldCorkSizeFactor.setVisible(visible)
|
||||
self.btnRedacFullscreen.setVisible(not visible)
|
||||
|
||||
|
||||
def updateFolderViewButtons(self, view):
|
||||
if view == "text":
|
||||
self.btnRedacFolderText.setChecked(True)
|
||||
|
@ -229,5 +234,3 @@ class mainEditor(QWidget, Ui_mainEditor):
|
|||
def toggleSpellcheck(self, val):
|
||||
for w in self.allTabs():
|
||||
w.toggleSpellcheck(val)
|
||||
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# Form implementation generated from reading ui file 'manuskript/ui/editors/mainEditor_ui.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.4.1
|
||||
# Created by: PyQt5 UI code generator 5.4.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
|
@ -94,4 +94,4 @@ class Ui_mainEditor(object):
|
|||
self.btnRedacFolderOutline.setText(_translate("mainEditor", "Outline"))
|
||||
self.btnRedacFullscreen.setShortcut(_translate("mainEditor", "F11"))
|
||||
|
||||
from ui.editors.textFormat import textFormat
|
||||
from manuskript.ui.editors.textFormat import textFormat
|
||||
|
|
|
@ -201,7 +201,7 @@
|
|||
<customwidget>
|
||||
<class>textFormat</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>ui.editors.textFormat.h</header>
|
||||
<header>manuskript.ui.editors.textFormat.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from qt import *
|
||||
import re
|
||||
|
||||
from PyQt5.QtCore import QRegExp
|
||||
from PyQt5.QtGui import QTextCursor
|
||||
|
||||
|
||||
def t2tFormatSelection(editor, style):
|
||||
"""
|
||||
Formats the current selection of ``editor`` in the format given by ``style``,
|
||||
|
@ -92,8 +95,9 @@ def t2tFormatSelection(editor, style):
|
|||
|
||||
editor.setTextCursor(cursor)
|
||||
|
||||
|
||||
def t2tClearFormat(editor):
|
||||
"Clears format on ``editor``'s current selection."
|
||||
"""Clears format on ``editor``'s current selection."""
|
||||
|
||||
cursor = editor.textCursor()
|
||||
cursor.beginEditBlock()
|
||||
|
@ -105,6 +109,7 @@ def t2tClearFormat(editor):
|
|||
cursor.endEditBlock()
|
||||
editor.setTextCursor(cursor)
|
||||
|
||||
|
||||
def textToFormatArray(text):
|
||||
"""
|
||||
Take some text and returns an array of array containing informations
|
||||
|
@ -273,7 +278,7 @@ def reformatText(text, markupArray):
|
|||
text = rText
|
||||
rText = ""
|
||||
|
||||
## Clean up
|
||||
# Clean up
|
||||
# Exclude first and last space of the markup
|
||||
for markup in ["\*", "/", "_", "-", "`", "\'"]:
|
||||
# r = QRegExp(r'(' + markup * 2 + ')(\s+)(.+)(' + markup * 2 + ')')
|
||||
|
@ -293,7 +298,7 @@ def reformatText(text, markupArray):
|
|||
|
||||
|
||||
def cleanFormat(text):
|
||||
"Makes markup clean (removes doubles, etc.)"
|
||||
"""Makes markup clean (removes doubles, etc.)"""
|
||||
t, a = textToFormatArrayNoMarkup(text)
|
||||
return reformatText(t, a)
|
||||
|
||||
|
|
|
@ -1,19 +1,23 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf8 -*-
|
||||
|
||||
from qt import *
|
||||
from ui.editors.t2tFunctions import *
|
||||
from ui.editors.blockUserData import blockUserData
|
||||
from ui.editors.t2tHighlighterStyle import t2tHighlighterStyle
|
||||
from ui.editors.basicHighlighter import *
|
||||
import re
|
||||
|
||||
# This is aiming at implementing every rule from www.txt2tags.org/rules.html
|
||||
# But we're not there yet.
|
||||
|
||||
# FIXME: macro words not hilighted properly if at the begining of a line.
|
||||
|
||||
#TODO: parse %!postproc et !%preproc, et si la ligne se termine par une couleur en commentaire (%#FF00FF), utiliser cette couleur pour highlighter. Permet des règles customisées par document, facilement.
|
||||
# TODO: parse %!postproc et !%preproc, et si la ligne se termine par une couleur en commentaire (%#FF00FF),
|
||||
# utiliser cette couleur pour highlighter. Permet des règles customisées par document, facilement.
|
||||
import re
|
||||
|
||||
from PyQt5.QtCore import QRegExp, QDir, QFileInfo
|
||||
from PyQt5.QtGui import QTextBlockFormat, QTextCursor, QTextCharFormat, QBrush
|
||||
|
||||
from manuskript.ui.editors.basicHighlighter import basicHighlighter
|
||||
from manuskript.ui.editors.blockUserData import blockUserData
|
||||
from manuskript.ui.editors.t2tFunctions import State, textToFormatArray
|
||||
from manuskript.ui.editors.t2tHighlighterStyle import t2tHighlighterStyle
|
||||
|
||||
|
||||
class t2tHighlighter(basicHighlighter):
|
||||
|
@ -94,7 +98,8 @@ class t2tHighlighter (basicHighlighter):
|
|||
# InDocRules: is it a settings which might have a specific rule,
|
||||
# a comment which contains color infos, or a include conf?
|
||||
# r'^%!p[or][se]t?proc[^\s]*\s*:\s*\'(.*)\'\s*\'.*\''
|
||||
rlist = [QRegExp(r'^%!p[or][se]t?proc[^\s]*\s*:\s*((\'[^\']*\'|\"[^\"]*\")\s*(\'[^\']*\'|\"[^\"]*\"))'), # pre/postproc
|
||||
rlist = [QRegExp(r'^%!p[or][se]t?proc[^\s]*\s*:\s*((\'[^\']*\'|\"[^\"]*\")\s*(\'[^\']*\'|\"[^\"]*\"))'),
|
||||
# pre/postproc
|
||||
QRegExp(r'^%.*\s\((.*)\)'), # comment
|
||||
QRegExp(r'^%!includeconf:\s*([^\s]*)\s*')] # includeconf
|
||||
for r in rlist:
|
||||
|
@ -265,7 +270,7 @@ class t2tHighlighter (basicHighlighter):
|
|||
while pos >= 0:
|
||||
for k in links:
|
||||
# print pos, k[0], k[1]
|
||||
if pos > k[0] and pos < k[0] + k[1]: # already highlighted
|
||||
if k[0] < pos < k[0] + k[1]: # already highlighted
|
||||
break
|
||||
else:
|
||||
self.setFormat(pos, len(r.cap(0)), self.style.format(State.LINKS))
|
||||
|
@ -304,7 +309,6 @@ class t2tHighlighter (basicHighlighter):
|
|||
self.style.makeFormat(preset="higlighted", base=self.format(p)))
|
||||
p = text.indexOf(self.editor.highlightWord, p + 1, cs=self.editor.highlightCS)
|
||||
|
||||
|
||||
### Highlight Selection
|
||||
### TODO: way to slow, find another way.
|
||||
##sel = self.editor.textCursor().selectedText()
|
||||
|
@ -451,7 +455,7 @@ class t2tHighlighter (basicHighlighter):
|
|||
QTextCursor(block).setBlockFormat(blockFormat)
|
||||
|
||||
def getBlankLines(self, block):
|
||||
"Returns if there is a blank line before in the list."
|
||||
"""Returns if there is a blank line before in the list."""
|
||||
state = block.userState()
|
||||
if state >= 200:
|
||||
return 1
|
||||
|
@ -459,7 +463,7 @@ class t2tHighlighter (basicHighlighter):
|
|||
return 0
|
||||
|
||||
def isList(self, block):
|
||||
"Returns TRUE if the block is in a list."
|
||||
"""Returns TRUE if the block is in a list."""
|
||||
if block.userState() == State.LIST_BEGINS or \
|
||||
block.userState() >= 100:
|
||||
return True
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf8 -*-
|
||||
|
||||
from qt import *
|
||||
from ui.editors.t2tFunctions import *
|
||||
from ui.editors.blockUserData import blockUserData
|
||||
|
||||
# TODO: creates a general way to generate styles (and edit/import/export)
|
||||
from PyQt5.QtCore import QRegExp, Qt
|
||||
from PyQt5.QtGui import QFont, QTextBlockFormat, QColor, QFontMetrics, QTextCharFormat
|
||||
from PyQt5.QtWidgets import qApp
|
||||
|
||||
from manuskript.ui.editors.blockUserData import blockUserData
|
||||
from manuskript.ui.editors.t2tFunctions import State
|
||||
|
||||
|
||||
class t2tHighlighterStyle():
|
||||
|
@ -81,7 +84,7 @@ class t2tHighlighterStyle ():
|
|||
return self.styles[state]
|
||||
|
||||
def beautifyFormat(self, base, beautifiers):
|
||||
"Apply beautifiers given in beautifiers array to format"
|
||||
"""Apply beautifiers given in beautifiers array to format"""
|
||||
if max(beautifiers) == 2:
|
||||
return self.makeFormat(preset=State.MARKUP, base=base)
|
||||
else:
|
||||
|
@ -100,7 +103,7 @@ class t2tHighlighterStyle ():
|
|||
return base
|
||||
|
||||
def formatBlock(self, block, state):
|
||||
"Apply transformation to given block."
|
||||
"""Apply transformation to given block."""
|
||||
blockFormat = QTextBlockFormat()
|
||||
|
||||
if state == State.BLOCKQUOTE_LINE:
|
||||
|
@ -151,7 +154,8 @@ class t2tHighlighterStyle ():
|
|||
_format = QTextCharFormat(self._defaultCharFormat)
|
||||
|
||||
# Base
|
||||
if base: _format = base
|
||||
if base:
|
||||
_format = base
|
||||
|
||||
# Presets
|
||||
if preset in [State.CODE_AREA, State.CODE_LINE, "code"]:
|
||||
|
@ -172,7 +176,7 @@ class t2tHighlighterStyle ():
|
|||
color = "red"
|
||||
|
||||
if preset in [State.HEADER_LINE]:
|
||||
size = size * 2
|
||||
size *= 2
|
||||
# print size
|
||||
|
||||
if preset in [State.RAW_AREA, State.RAW_LINE, "raw"]:
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtGui import QIcon
|
||||
from PyQt5.QtWidgets import QWidget, QAction
|
||||
|
||||
from manuskript.enums import Outline
|
||||
from manuskript.models.outlineModel import outlineModel
|
||||
from manuskript.ui.editors.textFormat_ui import Ui_textFormat
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from models.outlineModel import *
|
||||
from ui.editors.textFormat_ui import *
|
||||
from functions import *
|
||||
|
||||
class textFormat(QWidget, Ui_textFormat):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QWidget.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
|
@ -65,7 +65,6 @@ class textFormat(QWidget, Ui_textFormat):
|
|||
elif item.isT2T():
|
||||
self.align.setVisible(False)
|
||||
|
||||
|
||||
def setFormat(self):
|
||||
act = self.sender()
|
||||
if self._textEdit:
|
||||
|
|
|
@ -2,14 +2,17 @@
|
|||
# --!-- coding: utf8 --!--
|
||||
|
||||
# Lots of stuff from here comes from the excellet focuswriter.
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from functions import *
|
||||
from ui.views.textEditView import *
|
||||
import settings
|
||||
import os
|
||||
import re
|
||||
|
||||
from PyQt5.QtCore import QSettings, QRect, QSize, Qt, QPoint, QFile, QIODevice, QTextStream
|
||||
from PyQt5.QtGui import QPixmap, QPainter, QColor, QBrush, QImage, QTextBlockFormat, QTextCharFormat, QFont, qGray
|
||||
from PyQt5.QtWidgets import qApp, QFrame
|
||||
|
||||
from manuskript.functions import allPaths, appPath
|
||||
from manuskript.ui.views.textEditView import textEditView
|
||||
|
||||
|
||||
def loadThemeDatas(themeFile):
|
||||
settings = QSettings(themeFile, QSettings.IniFormat)
|
||||
_themeData = {}
|
||||
|
@ -45,12 +48,14 @@ def loadThemeDatas(themeFile):
|
|||
|
||||
return _themeData
|
||||
|
||||
|
||||
def loadThemeSetting(datas, settings, key, default):
|
||||
if settings.contains(key):
|
||||
datas[key] = type(default)(settings.value(key))
|
||||
else:
|
||||
datas[key] = default
|
||||
|
||||
|
||||
def getThemeName(theme):
|
||||
settings = QSettings(theme, QSettings.IniFormat)
|
||||
|
||||
|
@ -59,8 +64,8 @@ def getThemeName(theme):
|
|||
else:
|
||||
return os.path.splitext(os.path.split(theme)[1])[0]
|
||||
|
||||
def themeTextRect(themeDatas, screenRect):
|
||||
|
||||
def themeTextRect(themeDatas, screenRect):
|
||||
margin = themeDatas["Foreground/Margin"]
|
||||
x = 0
|
||||
y = margin
|
||||
|
@ -78,8 +83,8 @@ def themeTextRect(themeDatas, screenRect):
|
|||
width = screenRect.width() - 2 * margin
|
||||
return QRect(x, y, width, height)
|
||||
|
||||
def createThemePreview(theme, screenRect, size=QSize(200, 120)):
|
||||
|
||||
def createThemePreview(theme, screenRect, size=QSize(200, 120)):
|
||||
if type(theme) == str and os.path.exists(theme):
|
||||
# Theme is the path to an ini file
|
||||
themeDatas = loadThemeDatas(theme)
|
||||
|
@ -97,13 +102,15 @@ def createThemePreview(theme, screenRect, size=QSize(200, 120)):
|
|||
r = themeTextRect(themeDatas, screenRect)
|
||||
|
||||
painter = QPainter(px)
|
||||
painter.drawPixmap(QRect(w, h, w*4, h*5), pixmap, QRect(r.topLeft() - QPoint(w/3, h/3), QSize(w*4, h*5)))
|
||||
painter.drawPixmap(QRect(w, h, w * 4, h * 5), pixmap,
|
||||
QRect(r.topLeft() - QPoint(w / 3, h / 3), QSize(w * 4, h * 5)))
|
||||
painter.setPen(Qt.white)
|
||||
painter.drawRect(QRect(w, h, w * 4, h * 5))
|
||||
painter.end()
|
||||
|
||||
return px
|
||||
|
||||
|
||||
def findThemePath(themeName):
|
||||
p = findFirstFile(re.escape("{}.theme".format(themeName)), "resources/themes")
|
||||
if not p:
|
||||
|
@ -111,9 +118,11 @@ def findThemePath(themeName):
|
|||
else:
|
||||
return p
|
||||
|
||||
|
||||
def findBackground(filename):
|
||||
return findFirstFile(re.escape(filename), "resources/backgrounds")
|
||||
|
||||
|
||||
def findFirstFile(regex, path="resources"):
|
||||
paths = allPaths(path)
|
||||
for p in paths:
|
||||
|
@ -122,8 +131,8 @@ def findFirstFile(regex, path="resources"):
|
|||
if re.match(regex, l):
|
||||
return os.path.join(p, l)
|
||||
|
||||
def generateTheme(themeDatas, screenRect):
|
||||
|
||||
def generateTheme(themeDatas, screenRect):
|
||||
# Window Background
|
||||
px = QPixmap(screenRect.size())
|
||||
px.fill(QColor(themeDatas["Background/Color"]))
|
||||
|
@ -145,7 +154,8 @@ def generateTheme(themeDatas, screenRect):
|
|||
elif _type == 5: # Zoomed
|
||||
scaled.scale(screenRect.size(), Qt.KeepAspectRatioByExpanding)
|
||||
|
||||
painter.drawImage((screenRect.width() - scaled.width()) / 2, (screenRect.height() - scaled.height()) / 2, img.scaled(scaled))
|
||||
painter.drawImage((screenRect.width() - scaled.width()) / 2,
|
||||
(screenRect.height() - scaled.height()) / 2, img.scaled(scaled))
|
||||
|
||||
# Text Background
|
||||
textRect = themeTextRect(themeDatas, screenRect)
|
||||
|
@ -162,8 +172,8 @@ def generateTheme(themeDatas, screenRect):
|
|||
painter.end()
|
||||
return px
|
||||
|
||||
def themeEditorGeometry(themeDatas, textRect):
|
||||
|
||||
def themeEditorGeometry(themeDatas, textRect):
|
||||
padding = themeDatas["Foreground/Padding"]
|
||||
x = textRect.x() + padding
|
||||
y = textRect.y() + padding + themeDatas["Spacings/ParagraphAbove"]
|
||||
|
@ -171,6 +181,7 @@ def themeEditorGeometry(themeDatas, textRect):
|
|||
height = textRect.height() - 2 * padding - themeDatas["Spacings/ParagraphAbove"]
|
||||
return x, y, width, height
|
||||
|
||||
|
||||
def getThemeBlockFormat(themeDatas):
|
||||
bf = QTextBlockFormat()
|
||||
bf.setLineHeight(themeDatas["Spacings/LineSpacing"], QTextBlockFormat.ProportionalHeight)
|
||||
|
@ -179,8 +190,8 @@ def getThemeBlockFormat(themeDatas):
|
|||
bf.setBottomMargin(themeDatas["Spacings/ParagraphBelow"])
|
||||
return bf
|
||||
|
||||
def setThemeEditorDatas(editor, themeDatas, pixmap, screenRect):
|
||||
|
||||
def setThemeEditorDatas(editor, themeDatas, pixmap, screenRect):
|
||||
textRect = themeTextRect(themeDatas, screenRect)
|
||||
x, y, width, height = themeEditorGeometry(themeDatas, textRect)
|
||||
editor.setGeometry(x, y, width, height)
|
||||
|
@ -242,9 +253,7 @@ def setThemeEditorDatas(editor, themeDatas, pixmap, screenRect):
|
|||
editor._fromTheme = True
|
||||
|
||||
|
||||
|
||||
def addThemePreviewText(pixmap, themeDatas, screenRect):
|
||||
|
||||
# Text
|
||||
previewText = textEditView(highlighting=True)
|
||||
previewText.setFrameStyle(QFrame.NoFrame)
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtWidgets import QLabel, QSizePolicy
|
||||
|
||||
|
||||
|
||||
|
||||
from qt import *
|
||||
|
||||
class helpLabel(QLabel):
|
||||
|
||||
def __init__(self, text=None, parent=None):
|
||||
QLabel.__init__(self, text, parent)
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# Form implementation generated from reading ui file 'manuskript/ui/mainWindow.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.4.1
|
||||
# Created by: PyQt5 UI code generator 5.4.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
|
@ -40,8 +40,8 @@ class Ui_MainWindow(object):
|
|||
self.page_4 = QtWidgets.QWidget()
|
||||
self.page_4.setObjectName("page_4")
|
||||
self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.page_4)
|
||||
self.horizontalLayout_2.setSpacing(0)
|
||||
self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||
self.horizontalLayout_2.setSpacing(0)
|
||||
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||
self.tabMain = QtWidgets.QTabWidget(self.page_4)
|
||||
self.tabMain.setDocumentMode(True)
|
||||
|
@ -352,7 +352,7 @@ class Ui_MainWindow(object):
|
|||
self.btnRmPerso.setObjectName("btnRmPerso")
|
||||
self.horizontalLayout_14.addWidget(self.btnRmPerso)
|
||||
self.txtPersosFilter = QtWidgets.QLineEdit(self.groupBox)
|
||||
self.txtPersosFilter.setProperty("clearButtonEnabled", True)
|
||||
self.txtPersosFilter.setClearButtonEnabled(True)
|
||||
self.txtPersosFilter.setObjectName("txtPersosFilter")
|
||||
self.horizontalLayout_14.addWidget(self.txtPersosFilter)
|
||||
self.verticalLayout_8.addLayout(self.horizontalLayout_14)
|
||||
|
@ -536,7 +536,7 @@ class Ui_MainWindow(object):
|
|||
self.btnRmPlot.setObjectName("btnRmPlot")
|
||||
self.horizontalLayout_15.addWidget(self.btnRmPlot)
|
||||
self.txtPlotFilter = QtWidgets.QLineEdit(self.groupBox_2)
|
||||
self.txtPlotFilter.setProperty("clearButtonEnabled", True)
|
||||
self.txtPlotFilter.setClearButtonEnabled(True)
|
||||
self.txtPlotFilter.setObjectName("txtPlotFilter")
|
||||
self.horizontalLayout_15.addWidget(self.txtPlotFilter)
|
||||
self.verticalLayout_10.addLayout(self.horizontalLayout_15)
|
||||
|
@ -732,7 +732,7 @@ class Ui_MainWindow(object):
|
|||
self.btnRmWorld.setObjectName("btnRmWorld")
|
||||
self.horizontalLayout_19.addWidget(self.btnRmWorld)
|
||||
self.txtWorldFilter = QtWidgets.QLineEdit(self.frame_3)
|
||||
self.txtWorldFilter.setProperty("clearButtonEnabled", True)
|
||||
self.txtWorldFilter.setClearButtonEnabled(True)
|
||||
self.txtWorldFilter.setObjectName("txtWorldFilter")
|
||||
self.horizontalLayout_19.addWidget(self.txtWorldFilter)
|
||||
self.btnWorldEmptyData = QtWidgets.QPushButton(self.frame_3)
|
||||
|
@ -799,7 +799,6 @@ class Ui_MainWindow(object):
|
|||
self.layoutWidget = QtWidgets.QWidget(self.splitterOutlineH)
|
||||
self.layoutWidget.setObjectName("layoutWidget")
|
||||
self.verticalLayout_14 = QtWidgets.QVBoxLayout(self.layoutWidget)
|
||||
self.verticalLayout_14.setContentsMargins(0, 0, 0, 0)
|
||||
self.verticalLayout_14.setObjectName("verticalLayout_14")
|
||||
self.splitterOutlineV = QtWidgets.QSplitter(self.layoutWidget)
|
||||
self.splitterOutlineV.setOrientation(QtCore.Qt.Vertical)
|
||||
|
@ -979,7 +978,7 @@ class Ui_MainWindow(object):
|
|||
self.horizontalLayout_12.addWidget(self.stack)
|
||||
MainWindow.setCentralWidget(self.centralwidget)
|
||||
self.menubar = QtWidgets.QMenuBar(MainWindow)
|
||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 1145, 21))
|
||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 1145, 30))
|
||||
self.menubar.setObjectName("menubar")
|
||||
self.menuFile = QtWidgets.QMenu(self.menubar)
|
||||
self.menuFile.setObjectName("menuFile")
|
||||
|
@ -1215,52 +1214,52 @@ class Ui_MainWindow(object):
|
|||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_20), _translate("MainWindow", "Outline"))
|
||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("MainWindow", "Labels"))
|
||||
self.tabMain.setTabText(self.tabMain.indexOf(self.lytTabDebug), _translate("MainWindow", "Debug"))
|
||||
self.menuFile.setTitle(_translate("MainWindow", "File"))
|
||||
self.menuRecents.setTitle(_translate("MainWindow", "Recents"))
|
||||
self.menuMode.setTitle(_translate("MainWindow", "Mode"))
|
||||
self.menuFile.setTitle(_translate("MainWindow", "Fi&le"))
|
||||
self.menuRecents.setTitle(_translate("MainWindow", "&Recents"))
|
||||
self.menuMode.setTitle(_translate("MainWindow", "&Mode"))
|
||||
self.menuHelp.setTitle(_translate("MainWindow", "Help"))
|
||||
self.menuTools.setTitle(_translate("MainWindow", "Tools"))
|
||||
self.menuEdit.setTitle(_translate("MainWindow", "Edit"))
|
||||
self.menuView.setTitle(_translate("MainWindow", "View"))
|
||||
self.dckCheatSheet.setWindowTitle(_translate("MainWindow", "Cheat sheet"))
|
||||
self.dckSearch.setWindowTitle(_translate("MainWindow", "Search"))
|
||||
self.actOpen.setText(_translate("MainWindow", "Open"))
|
||||
self.menuView.setTitle(_translate("MainWindow", "&View"))
|
||||
self.dckCheatSheet.setWindowTitle(_translate("MainWindow", "&Cheat sheet"))
|
||||
self.dckSearch.setWindowTitle(_translate("MainWindow", "Sea&rch"))
|
||||
self.actOpen.setText(_translate("MainWindow", "&Open"))
|
||||
self.actOpen.setShortcut(_translate("MainWindow", "Ctrl+O"))
|
||||
self.actSave.setText(_translate("MainWindow", "Save"))
|
||||
self.actSave.setText(_translate("MainWindow", "&Save"))
|
||||
self.actSave.setShortcut(_translate("MainWindow", "Ctrl+S"))
|
||||
self.actSaveAs.setText(_translate("MainWindow", "Save as..."))
|
||||
self.actSaveAs.setText(_translate("MainWindow", "Sa&ve as..."))
|
||||
self.actSaveAs.setShortcut(_translate("MainWindow", "Ctrl+Shift+S"))
|
||||
self.actQuit.setText(_translate("MainWindow", "Quit"))
|
||||
self.actQuit.setText(_translate("MainWindow", "&Quit"))
|
||||
self.actQuit.setShortcut(_translate("MainWindow", "Ctrl+Q"))
|
||||
self.actShowHelp.setText(_translate("MainWindow", "Show help texts"))
|
||||
self.actShowHelp.setText(_translate("MainWindow", "&Show help texts"))
|
||||
self.actShowHelp.setShortcut(_translate("MainWindow", "Ctrl+Shift+B"))
|
||||
self.actSpellcheck.setText(_translate("MainWindow", "Spellcheck"))
|
||||
self.actSpellcheck.setText(_translate("MainWindow", "&Spellcheck"))
|
||||
self.actSpellcheck.setShortcut(_translate("MainWindow", "F9"))
|
||||
self.actLabels.setText(_translate("MainWindow", "Labels..."))
|
||||
self.actStatus.setText(_translate("MainWindow", "Status..."))
|
||||
self.actLabels.setText(_translate("MainWindow", "&Labels..."))
|
||||
self.actStatus.setText(_translate("MainWindow", "&Status..."))
|
||||
self.actViewTree.setText(_translate("MainWindow", "Tree"))
|
||||
self.actModeNorma.setText(_translate("MainWindow", "Normal"))
|
||||
self.actModeSimple.setText(_translate("MainWindow", "Simple"))
|
||||
self.actModeFractal.setText(_translate("MainWindow", "Fractal"))
|
||||
self.actModeNorma.setText(_translate("MainWindow", "&Normal"))
|
||||
self.actModeSimple.setText(_translate("MainWindow", "&Simple"))
|
||||
self.actModeFractal.setText(_translate("MainWindow", "&Fractal"))
|
||||
self.actViewCork.setText(_translate("MainWindow", "Index cards"))
|
||||
self.actViewOutline.setText(_translate("MainWindow", "Outline"))
|
||||
self.actSettings.setText(_translate("MainWindow", "Settings"))
|
||||
self.actSettings.setText(_translate("MainWindow", "S&ettings"))
|
||||
self.actSettings.setShortcut(_translate("MainWindow", "F8"))
|
||||
self.actCloseProject.setText(_translate("MainWindow", "Close project"))
|
||||
self.actCompile.setText(_translate("MainWindow", "Compile"))
|
||||
self.actCloseProject.setText(_translate("MainWindow", "&Close project"))
|
||||
self.actCompile.setText(_translate("MainWindow", "Co&mpile"))
|
||||
self.actCompile.setShortcut(_translate("MainWindow", "F6"))
|
||||
|
||||
from ui.views.basicItemView import basicItemView
|
||||
from ui.views.plotTreeView import plotTreeView
|
||||
from ui.search import search
|
||||
from ui.views.textEditCompleter import textEditCompleter
|
||||
from ui.views.treeView import treeView
|
||||
from ui.editors.mainEditor import mainEditor
|
||||
from ui.views.outlineView import outlineView
|
||||
from ui.views.lineEditView import lineEditView
|
||||
from ui.views.textEditView import textEditView
|
||||
from ui.welcome import welcome
|
||||
from ui.sldImportance import sldImportance
|
||||
from ui.cheatSheet import cheatSheet
|
||||
from ui.views.metadataView import metadataView
|
||||
from ui.views.persoTreeView import persoTreeView
|
||||
from manuskript.ui.cheatSheet import cheatSheet
|
||||
from manuskript.ui.editors.mainEditor import mainEditor
|
||||
from manuskript.ui.search import search
|
||||
from manuskript.ui.sldImportance import sldImportance
|
||||
from manuskript.ui.views.basicItemView import basicItemView
|
||||
from manuskript.ui.views.lineEditView import lineEditView
|
||||
from manuskript.ui.views.metadataView import metadataView
|
||||
from manuskript.ui.views.outlineView import outlineView
|
||||
from manuskript.ui.views.persoTreeView import persoTreeView
|
||||
from manuskript.ui.views.plotTreeView import plotTreeView
|
||||
from manuskript.ui.views.textEditCompleter import textEditCompleter
|
||||
from manuskript.ui.views.textEditView import textEditView
|
||||
from manuskript.ui.views.treeView import treeView
|
||||
from manuskript.ui.welcome import welcome
|
||||
|
|
|
@ -103,7 +103,16 @@
|
|||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
|
@ -706,7 +715,7 @@
|
|||
<property name="placeholderText">
|
||||
<string>Filter</string>
|
||||
</property>
|
||||
<property name="clearButtonEnabled" stdset="0">
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
|
@ -1055,7 +1064,7 @@
|
|||
<property name="placeholderText">
|
||||
<string>Filter</string>
|
||||
</property>
|
||||
<property name="clearButtonEnabled" stdset="0">
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
|
@ -1416,7 +1425,7 @@
|
|||
<property name="placeholderText">
|
||||
<string>Filter</string>
|
||||
</property>
|
||||
<property name="clearButtonEnabled" stdset="0">
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
|
@ -1658,7 +1667,16 @@
|
|||
<string>Redaction</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_15">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
|
@ -1668,7 +1686,16 @@
|
|||
</property>
|
||||
<widget class="QWidget" name="treeRedacWidget" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_30">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
|
@ -1850,19 +1877,21 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1145</width>
|
||||
<height>21</height>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
<property name="title">
|
||||
<string>File</string>
|
||||
<string>Fi&le</string>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuRecents">
|
||||
<property name="title">
|
||||
<string>Recents</string>
|
||||
<string>&Recents</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="folder-recent"/>
|
||||
<iconset theme="folder-recent">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
<addaction name="actOpen"/>
|
||||
|
@ -1877,7 +1906,7 @@
|
|||
</widget>
|
||||
<widget class="QMenu" name="menuMode">
|
||||
<property name="title">
|
||||
<string>Mode</string>
|
||||
<string>&Mode</string>
|
||||
</property>
|
||||
<addaction name="actModeNorma"/>
|
||||
<addaction name="actModeSimple"/>
|
||||
|
@ -1905,7 +1934,7 @@
|
|||
</widget>
|
||||
<widget class="QMenu" name="menuView">
|
||||
<property name="title">
|
||||
<string>View</string>
|
||||
<string>&View</string>
|
||||
</property>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
|
@ -1918,7 +1947,7 @@
|
|||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<widget class="QDockWidget" name="dckCheatSheet">
|
||||
<property name="windowTitle">
|
||||
<string>Cheat sheet</string>
|
||||
<string>&Cheat sheet</string>
|
||||
</property>
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>2</number>
|
||||
|
@ -1940,7 +1969,7 @@
|
|||
</widget>
|
||||
<widget class="QDockWidget" name="dckSearch">
|
||||
<property name="windowTitle">
|
||||
<string>Search</string>
|
||||
<string>Sea&rch</string>
|
||||
</property>
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>2</number>
|
||||
|
@ -1966,7 +1995,7 @@
|
|||
<normaloff>../../../../../../../.designer/backup</normaloff>../../../../../../../.designer/backup</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open</string>
|
||||
<string>&Open</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+O</string>
|
||||
|
@ -1978,7 +2007,7 @@
|
|||
<normaloff>../../../../../../../.designer/backup</normaloff>../../../../../../../.designer/backup</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
<string>&Save</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+S</string>
|
||||
|
@ -1990,7 +2019,7 @@
|
|||
<normaloff>../../../../../../../.designer/backup</normaloff>../../../../../../../.designer/backup</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save as...</string>
|
||||
<string>Sa&ve as...</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+Shift+S</string>
|
||||
|
@ -2002,7 +2031,7 @@
|
|||
<normaloff>../../../../../../../.designer/backup</normaloff>../../../../../../../.designer/backup</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Quit</string>
|
||||
<string>&Quit</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+Q</string>
|
||||
|
@ -2020,7 +2049,7 @@
|
|||
<normaloff>../../../../../../../.designer/backup</normaloff>../../../../../../../.designer/backup</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show help texts</string>
|
||||
<string>&Show help texts</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+Shift+B</string>
|
||||
|
@ -2038,7 +2067,7 @@
|
|||
<normaloff>../../../../../../../.designer/backup</normaloff>../../../../../../../.designer/backup</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Spellcheck</string>
|
||||
<string>&Spellcheck</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>F9</string>
|
||||
|
@ -2046,12 +2075,12 @@
|
|||
</action>
|
||||
<action name="actLabels">
|
||||
<property name="text">
|
||||
<string>Labels...</string>
|
||||
<string>&Labels...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actStatus">
|
||||
<property name="text">
|
||||
<string>Status...</string>
|
||||
<string>&Status...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actViewTree">
|
||||
|
@ -2067,7 +2096,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Normal</string>
|
||||
<string>&Normal</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actModeSimple">
|
||||
|
@ -2075,7 +2104,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Simple</string>
|
||||
<string>&Simple</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actModeFractal">
|
||||
|
@ -2083,7 +2112,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fractal</string>
|
||||
<string>&Fractal</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actViewCork">
|
||||
|
@ -2102,7 +2131,7 @@
|
|||
<normaloff>../../../../../../../.designer/backup</normaloff>../../../../../../../.designer/backup</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Settings</string>
|
||||
<string>S&ettings</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>F8</string>
|
||||
|
@ -2115,12 +2144,12 @@
|
|||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Close project</string>
|
||||
<string>&Close project</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actCompile">
|
||||
<property name="text">
|
||||
<string>Compile</string>
|
||||
<string>Co&mpile</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>F6</string>
|
||||
|
@ -2131,79 +2160,79 @@
|
|||
<customwidget>
|
||||
<class>textEditView</class>
|
||||
<extends>QTextEdit</extends>
|
||||
<header>ui.views.textEditView.h</header>
|
||||
<header>manuskript.ui.views.textEditView.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>lineEditView</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>ui.views.lineEditView.h</header>
|
||||
<header>manuskript.ui.views.lineEditView.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>outlineView</class>
|
||||
<extends>QTreeView</extends>
|
||||
<header>ui.views.outlineView.h</header>
|
||||
<header>manuskript.ui.views.outlineView.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>sldImportance</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>ui.sldImportance.h</header>
|
||||
<header>manuskript.ui.sldImportance.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>treeView</class>
|
||||
<extends>QTreeView</extends>
|
||||
<header>ui.views.treeView.h</header>
|
||||
<header>manuskript.ui.views.treeView.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>metadataView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>ui.views.metadataView.h</header>
|
||||
<header>manuskript.ui.views.metadataView.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>basicItemView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>ui.views.basicItemView.h</header>
|
||||
<header>manuskript.ui.views.basicItemView.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>plotTreeView</class>
|
||||
<extends>QTreeWidget</extends>
|
||||
<header>ui.views.plotTreeView.h</header>
|
||||
<header>manuskript.ui.views.plotTreeView.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>welcome</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>ui.welcome.h</header>
|
||||
<header>manuskript.ui.welcome.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>mainEditor</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>ui.editors.mainEditor.h</header>
|
||||
<header>manuskript.ui.editors.mainEditor.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>persoTreeView</class>
|
||||
<extends>QTreeWidget</extends>
|
||||
<header>ui.views.persoTreeView.h</header>
|
||||
<header>manuskript.ui.views.persoTreeView.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>cheatSheet</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>ui.cheatSheet.h</header>
|
||||
<header>manuskript.ui.cheatSheet.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>search</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>ui.search.h</header>
|
||||
<header>manuskript.ui.search.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>textEditCompleter</class>
|
||||
<extends>QTextEdit</extends>
|
||||
<header>ui.views.textEditCompleter.h</header>
|
||||
<header>manuskript.ui.views.textEditCompleter.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from models.outlineModel import *
|
||||
from ui.revisions_ui import *
|
||||
from functions import *
|
||||
import models.references as Ref
|
||||
import datetime
|
||||
import difflib
|
||||
import re
|
||||
|
||||
class revisions(QWidget, Ui_revisions):
|
||||
from PyQt5.QtCore import Qt, QTimer, QRect
|
||||
from PyQt5.QtGui import QPalette, QFontMetrics
|
||||
from PyQt5.QtWidgets import QWidget, QMenu, QActionGroup, QAction, QListWidgetItem, QStyledItemDelegate, QStyle
|
||||
|
||||
from manuskript.enums import Outline
|
||||
from manuskript.ui.revisions_ui import Ui_revisions
|
||||
from manuskript.models import references as Ref
|
||||
|
||||
|
||||
class revisions(QWidget, Ui_revisions):
|
||||
def __init__(self, parent=None):
|
||||
QWidget.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
|
@ -191,17 +193,21 @@ class revisions(QWidget, Ui_revisions):
|
|||
elif tag == "delete":
|
||||
newline += "<span style='color:red; background:yellow;'>{}</span>".format(_format(txt[i1:i2]))
|
||||
elif tag == "insert":
|
||||
newline += "<span style='color:green; background:yellow;'>{}</span>".format(_format(txt2[j1:j2]))
|
||||
newline += "<span style='color:green; background:yellow;'>{}</span>".format(
|
||||
_format(txt2[j1:j2]))
|
||||
elif tag == "replace":
|
||||
newline += "<span style='color:red; background:yellow;'>{}</span>".format(_format(txt[i1:i2]))
|
||||
newline += "<span style='color:green; background:yellow;'>{}</span>".format(_format(txt2[j1:j2]))
|
||||
newline += "<span style='color:green; background:yellow;'>{}</span>".format(
|
||||
_format(txt2[j1:j2]))
|
||||
|
||||
# Few ugly tweaks for html diffs
|
||||
newline = re.sub(r"(<span style='color.*?><span.*?>)</span>(.*)<span style='color:.*?>(</span></span>)",
|
||||
"\\1\\2\\3", newline)
|
||||
newline = re.sub(r"<p align=\"<span style='color:red; background:yellow;'>cen</span><span style='color:green; background:yellow;'>righ</span>t<span style='color:red; background:yellow;'>er</span>\" style=\" -qt-block-indent:0; -qt-user-state:0; \">(.*?)</p>",
|
||||
newline = re.sub(
|
||||
r"<p align=\"<span style='color:red; background:yellow;'>cen</span><span style='color:green; background:yellow;'>righ</span>t<span style='color:red; background:yellow;'>er</span>\" style=\" -qt-block-indent:0; -qt-user-state:0; \">(.*?)</p>",
|
||||
"<p align=\"right\"><span style='color:green; background:yellow;'>\\1</span></p>", newline)
|
||||
newline = re.sub(r"<p align=\"<span style='color:green; background:yellow;'>cente</span>r<span style='color:red; background:yellow;'>ight</span>\" style=\" -qt-block-indent:0; -qt-user-state:0; \">(.*)</p>",
|
||||
newline = re.sub(
|
||||
r"<p align=\"<span style='color:green; background:yellow;'>cente</span>r<span style='color:red; background:yellow;'>ight</span>\" style=\" -qt-block-indent:0; -qt-user-state:0; \">(.*)</p>",
|
||||
"<p align=\"center\"><span style='color:green; background:yellow;'>\\1</span></p>", newline)
|
||||
newline = re.sub(r"<p(<span.*?>)(.*?)(</span>)(.*?)>(.*?)</p>",
|
||||
"<p\\2\\4>\\1\\5\\3</p>", newline)
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtCore import Qt, QRect
|
||||
from PyQt5.QtGui import QPalette, QFontMetrics
|
||||
from PyQt5.QtWidgets import QWidget, QMenu, QAction, qApp, QListWidgetItem, QStyledItemDelegate, QStyle
|
||||
|
||||
from manuskript.enums import Outline
|
||||
from manuskript.functions import mainWindow
|
||||
from manuskript.ui.search_ui import Ui_search
|
||||
from manuskript.models import references as Ref
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from models.outlineModel import *
|
||||
import models.references as Ref
|
||||
from ui.search_ui import *
|
||||
from functions import *
|
||||
|
||||
class search(QWidget, Ui_search):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QWidget.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtCore import pyqtSignal, pyqtProperty
|
||||
from PyQt5.QtWidgets import QWidget
|
||||
|
||||
from manuskript.functions import toInt
|
||||
from manuskript.ui.sldImportance_ui import Ui_sldImportance
|
||||
|
||||
from qt import *
|
||||
from functions import *
|
||||
from ui.sldImportance_ui import *
|
||||
|
||||
class sldImportance(QWidget, Ui_sldImportance):
|
||||
|
||||
importanceChanged = pyqtSignal(str)
|
||||
|
||||
def __init__(self, parent=None):
|
||||
|
@ -82,5 +83,4 @@ class sldImportance(QWidget, Ui_sldImportance):
|
|||
self.setValue(val)
|
||||
self._updating = False
|
||||
|
||||
|
||||
importance = pyqtProperty(str, fget=getImportance, fset=setValue, notify=importanceChanged)
|
|
@ -6,7 +6,7 @@
|
|||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
from PyQt5 import QtCore, QtWidgets
|
||||
|
||||
class Ui_sldImportance(object):
|
||||
def setupUi(self, sldImportance):
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtWidgets import QWidget
|
||||
|
||||
from manuskript.enums import Outline
|
||||
from manuskript.ui.views.basicItemView_ui import Ui_basicItemView
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from ui.views.basicItemView_ui import *
|
||||
|
||||
class basicItemView(QWidget, Ui_basicItemView):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QWidget.__init__(self)
|
||||
self.setupUi(self)
|
||||
|
@ -21,7 +21,7 @@ class basicItemView(QWidget, Ui_basicItemView):
|
|||
self.txtGoal.setModel(mdlOutline)
|
||||
|
||||
def getIndexes(self, sourceView):
|
||||
"Returns a list of indexes from list of QItemSelectionRange"
|
||||
"""Returns a list of indexes from list of QItemSelectionRange"""
|
||||
indexes = []
|
||||
|
||||
for i in sourceView.selectionModel().selection().indexes():
|
||||
|
@ -60,5 +60,3 @@ class basicItemView(QWidget, Ui_basicItemView):
|
|||
|
||||
def toggleSpellcheck(self, v):
|
||||
self.txtSummaryFull.toggleSpellcheck(v)
|
||||
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# Form implementation generated from reading ui file 'manuskript/ui/views/basicItemView_ui.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.4.1
|
||||
# Created by: PyQt5 UI code generator 5.4.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
|
@ -66,6 +66,6 @@ class Ui_basicItemView(object):
|
|||
self.txtSummarySentance.setPlaceholderText(_translate("basicItemView", "One line summary"))
|
||||
self.label_9.setText(_translate("basicItemView", "Few sentences summary:"))
|
||||
|
||||
from ui.views.textEditView import textEditView
|
||||
from ui.views.lineEditView import lineEditView
|
||||
from ui.views.cmbOutlinePersoChoser import cmbOutlinePersoChoser
|
||||
from manuskript.ui.views.cmbOutlinePersoChoser import cmbOutlinePersoChoser
|
||||
from manuskript.ui.views.lineEditView import lineEditView
|
||||
from manuskript.ui.views.textEditView import textEditView
|
||||
|
|
|
@ -109,17 +109,17 @@
|
|||
<customwidget>
|
||||
<class>textEditView</class>
|
||||
<extends>QTextEdit</extends>
|
||||
<header>ui.views.textEditView.h</header>
|
||||
<header>manuskript.ui.views.textEditView.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>cmbOutlinePersoChoser</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>ui.views.cmbOutlinePersoChoser.h</header>
|
||||
<header>manuskript.ui.views.cmbOutlinePersoChoser.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>lineEditView</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>ui.views.lineEditView.h</header>
|
||||
<header>manuskript.ui.views.lineEditView.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
|
||||
|
||||
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
|
||||
# Because I have trouble with QDataWidgetMapper and the checkbox, I don't know why.
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import QCheckBox
|
||||
|
||||
from manuskript.enums import Outline
|
||||
|
||||
|
||||
class chkOutlineCompile(QCheckBox):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QCheckBox.__init__(self, parent)
|
||||
self.stateChanged.connect(self.submit)
|
||||
|
@ -116,4 +116,3 @@ class chkOutlineCompile(QCheckBox):
|
|||
self._model.setData(i, state)
|
||||
|
||||
self.setTristate(False)
|
||||
|
|
@ -1,11 +1,13 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QBrush
|
||||
from PyQt5.QtWidgets import QComboBox
|
||||
|
||||
from manuskript.enums import Outline
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
|
||||
class cmbOutlineLabelChoser(QComboBox):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QComboBox.__init__(self, parent)
|
||||
self.activated[int].connect(self.submit)
|
||||
|
@ -136,4 +138,3 @@ class cmbOutlineLabelChoser(QComboBox):
|
|||
for i in self._indexes:
|
||||
self.mdlOutline.setData(i, value)
|
||||
self._updating = False
|
||||
|
|
@ -1,12 +1,14 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QIcon, QBrush, QColor
|
||||
from PyQt5.QtWidgets import QComboBox
|
||||
|
||||
from manuskript.enums import Outline
|
||||
from manuskript.functions import toInt
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from functions import *
|
||||
|
||||
class cmbOutlinePersoChoser(QComboBox):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QComboBox.__init__(self, parent)
|
||||
self.activated[int].connect(self.submit)
|
||||
|
@ -38,12 +40,12 @@ class cmbOutlinePersoChoser(QComboBox):
|
|||
for i in range(self.mdlPersos.rowCount()):
|
||||
imp = toInt(self.mdlPersos.importance(i))
|
||||
|
||||
if not 2-imp == importance: continue
|
||||
if not 2 - imp == importance:
|
||||
continue
|
||||
|
||||
self.addItem(self.mdlPersos.icon(i), self.mdlPersos.name(i), self.mdlPersos.ID(i))
|
||||
self.setItemData(self.count() - 1, self.mdlPersos.name(i), Qt.ToolTipRole)
|
||||
|
||||
|
||||
self._various = False
|
||||
|
||||
if self._index or self._indexes:
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QBrush
|
||||
from PyQt5.QtWidgets import QComboBox
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from manuskript.enums import Outline
|
||||
|
||||
|
||||
class cmbOutlineStatusChoser(QComboBox):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QComboBox.__init__(self, parent)
|
||||
self.activated[int].connect(self.submit)
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QIcon, QBrush
|
||||
from PyQt5.QtWidgets import QComboBox
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from manuskript.enums import Outline
|
||||
|
||||
|
||||
class cmbOutlineTypeChoser(QComboBox):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QComboBox.__init__(self, parent)
|
||||
self.activated[int].connect(self.submit)
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtCore import QSize, Qt, QRect, QPoint
|
||||
from PyQt5.QtGui import QMouseEvent, QFont, QPalette, QRegion, QFontMetrics, QColor, QIcon
|
||||
from PyQt5.QtWidgets import QStyledItemDelegate, QLineEdit, QPlainTextEdit, QFrame, qApp, QStyle
|
||||
|
||||
from manuskript import settings
|
||||
from manuskript.enums import Outline
|
||||
from manuskript.functions import colorifyPixmap
|
||||
from manuskript.functions import mainWindow
|
||||
from manuskript.functions import mixColors
|
||||
from manuskript.functions import outlineItemColors
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from functions import *
|
||||
from random import randint
|
||||
import settings
|
||||
|
||||
class corkDelegate(QStyledItemDelegate):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QStyledItemDelegate.__init__(self, parent)
|
||||
self.factor = settings.corkSizeFactor / 100.
|
||||
|
@ -68,7 +72,6 @@ class corkDelegate(QStyledItemDelegate):
|
|||
edt.setPlaceholderText(self.tr("Full summary"))
|
||||
return edt
|
||||
|
||||
|
||||
def updateEditorGeometry(self, editor, option, index):
|
||||
|
||||
if self.editing == Outline.summarySentance:
|
||||
|
@ -240,7 +243,6 @@ class corkDelegate(QStyledItemDelegate):
|
|||
p.drawRoundedRect(itemRect, 10, 10)
|
||||
p.restore()
|
||||
|
||||
|
||||
# Draw the icon
|
||||
iconRect = self.iconRect
|
||||
mode = QIcon.Normal
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtWidgets import QListView
|
||||
|
||||
from manuskript import settings
|
||||
from manuskript.ui.views.corkDelegate import corkDelegate
|
||||
from manuskript.ui.views.dndView import dndView
|
||||
from manuskript.ui.views.outlineBasics import outlineBasics
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from functions import *
|
||||
from ui.views.corkDelegate import *
|
||||
from ui.views.dndView import *
|
||||
from ui.views.outlineBasics import *
|
||||
import settings
|
||||
|
||||
class corkView(QListView, dndView, outlineBasics):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QListView.__init__(self, parent)
|
||||
dndView.__init__(self, parent)
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import QAbstractItemView
|
||||
|
||||
|
||||
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from functions import *
|
||||
|
||||
class dndView(QAbstractItemView):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
# QAbstractItemView.__init__(self, parent)
|
||||
self.setDragDropMode(self.DragDrop)
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtWidgets import QLineEdit
|
||||
|
||||
from manuskript.enums import Outline
|
||||
from manuskript.functions import toString
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from functions import *
|
||||
|
||||
class lineEditView(QLineEdit):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QLineEdit.__init__(self, parent)
|
||||
self._column = Outline.title.value
|
||||
|
@ -30,7 +30,7 @@ class lineEditView(QLineEdit):
|
|||
self._index = index
|
||||
self._model = index.model()
|
||||
# self.item = index.internalPointer()
|
||||
if self._placeholderText != None:
|
||||
if self._placeholderText is not None:
|
||||
self.setPlaceholderText(self._placeholderText)
|
||||
self.textEdited.connect(self.submit)
|
||||
self.updateText()
|
||||
|
@ -110,4 +110,3 @@ class lineEditView(QLineEdit):
|
|||
self._placeholderText = self.placeholderText()
|
||||
|
||||
self.setPlaceholderText(self.tr("Various"))
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtWidgets import QWidget
|
||||
|
||||
from manuskript.enums import Outline
|
||||
from manuskript.ui.views.metadataView_ui import Ui_metadataView
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from ui.views.metadataView_ui import *
|
||||
|
||||
class metadataView(QWidget, Ui_metadataView):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QWidget.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
|
@ -24,7 +24,7 @@ class metadataView(QWidget, Ui_metadataView):
|
|||
self.revisions.setModel(mdlOutline)
|
||||
|
||||
def getIndexes(self, sourceView):
|
||||
"Returns a list of indexes from list of QItemSelectionRange"
|
||||
"""Returns a list of indexes from list of QItemSelectionRange"""
|
||||
indexes = []
|
||||
|
||||
for i in sourceView.selectionModel().selection().indexes():
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# Form implementation generated from reading ui file 'manuskript/ui/views/metadataView_ui.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.4.1
|
||||
# Created by: PyQt5 UI code generator 5.4.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
|
@ -83,9 +83,9 @@ class Ui_metadataView(object):
|
|||
self.grpNotes.setTitle(_translate("metadataView", "Notes / References"))
|
||||
self.grpRevisions.setTitle(_translate("metadataView", "Revisions"))
|
||||
|
||||
from ui.collapsibleGroupBox2 import collapsibleGroupBox2
|
||||
from ui.views.propertiesView import propertiesView
|
||||
from ui.views.textEditView import textEditView
|
||||
from ui.revisions import revisions
|
||||
from ui.views.textEditCompleter import textEditCompleter
|
||||
from ui.views.lineEditView import lineEditView
|
||||
from manuskript.ui.collapsibleGroupBox2 import collapsibleGroupBox2
|
||||
from manuskript.ui.revisions import revisions
|
||||
from manuskript.ui.views.lineEditView import lineEditView
|
||||
from manuskript.ui.views.propertiesView import propertiesView
|
||||
from manuskript.ui.views.textEditCompleter import textEditCompleter
|
||||
from manuskript.ui.views.textEditView import textEditView
|
||||
|
|
|
@ -137,34 +137,34 @@
|
|||
<customwidget>
|
||||
<class>textEditView</class>
|
||||
<extends>QTextEdit</extends>
|
||||
<header>ui.views.textEditView.h</header>
|
||||
<header>manuskript.ui.views.textEditView.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>lineEditView</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>ui.views.lineEditView.h</header>
|
||||
<header>manuskript.ui.views.lineEditView.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>collapsibleGroupBox2</class>
|
||||
<extends>QGroupBox</extends>
|
||||
<header>ui.collapsibleGroupBox2.h</header>
|
||||
<header>manuskript.ui.collapsibleGroupBox2.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>propertiesView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>ui.views.propertiesView.h</header>
|
||||
<header>manuskript.ui.views.propertiesView.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>textEditCompleter</class>
|
||||
<extends>QTextEdit</extends>
|
||||
<header>ui.views.textEditCompleter.h</header>
|
||||
<header>manuskript.ui.views.textEditCompleter.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>revisions</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>ui.revisions.h</header>
|
||||
<header>manuskript.ui.revisions.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
|
|
|
@ -1,22 +1,27 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtCore import Qt, QSignalMapper
|
||||
from PyQt5.QtGui import QIcon
|
||||
from PyQt5.QtWidgets import QAbstractItemView, qApp, QMenu, QAction
|
||||
|
||||
from manuskript import settings
|
||||
from manuskript.enums import Outline
|
||||
from manuskript.functions import mainWindow
|
||||
from manuskript.functions import toInt
|
||||
from manuskript.models.outlineModel import outlineItem
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from functions import *
|
||||
from models.outlineModel import *
|
||||
import settings
|
||||
|
||||
class outlineBasics(QAbstractItemView):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
pass
|
||||
|
||||
def getSelection(self):
|
||||
sel = []
|
||||
for i in self.selectedIndexes():
|
||||
if i.column() != 0: continue
|
||||
if not i in sel: sel.append(i)
|
||||
if i.column() != 0:
|
||||
continue
|
||||
if not i in sel:
|
||||
sel.append(i)
|
||||
return sel
|
||||
|
||||
def mouseReleaseEvent(self, event):
|
||||
|
@ -119,7 +124,6 @@ class outlineBasics(QAbstractItemView):
|
|||
mpr.mapped.connect(self.setLabel)
|
||||
menu.addMenu(self.menuLabel)
|
||||
|
||||
|
||||
if len(sel) > 0 and index.isValid() and not index.internalPointer().isFolder() \
|
||||
or not clipboard.mimeData().hasFormat("application/xml"):
|
||||
self.actPaste.setEnabled(False)
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtCore import Qt, QSize, QModelIndex
|
||||
from PyQt5.QtGui import QColor, QPalette, QIcon, QFont, QFontMetrics, QBrush
|
||||
from PyQt5.QtWidgets import QStyledItemDelegate, QStyleOptionViewItem, QStyle, QComboBox, QStyleOptionComboBox
|
||||
from PyQt5.QtWidgets import qApp
|
||||
|
||||
from manuskript import settings
|
||||
from manuskript.enums import Perso, Outline
|
||||
from manuskript.functions import outlineItemColors, mixColors, colorifyPixmap, toInt, toFloat, drawProgress
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from functions import *
|
||||
import settings
|
||||
|
||||
class outlineTitleDelegate(QStyledItemDelegate):
|
||||
def __init__(self, parent=None):
|
||||
|
@ -87,8 +91,8 @@ class outlineTitleDelegate(QStyledItemDelegate):
|
|||
|
||||
# QStyledItemDelegate.paint(self, painter, option, index)
|
||||
|
||||
class outlinePersoDelegate(QStyledItemDelegate):
|
||||
|
||||
class outlinePersoDelegate(QStyledItemDelegate):
|
||||
def __init__(self, mdlPersos, parent=None):
|
||||
QStyledItemDelegate.__init__(self, parent)
|
||||
self.mdlPersos = mdlPersos
|
||||
|
@ -174,7 +178,6 @@ class outlinePersoDelegate(QStyledItemDelegate):
|
|||
|
||||
|
||||
class outlineCompileDelegate(QStyledItemDelegate):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QStyledItemDelegate.__init__(self, parent)
|
||||
|
||||
|
@ -235,7 +238,6 @@ class outlineGoalPercentageDelegate(QStyledItemDelegate):
|
|||
|
||||
|
||||
class outlineStatusDelegate(QStyledItemDelegate):
|
||||
|
||||
def __init__(self, mdlStatus, parent=None):
|
||||
QStyledItemDelegate.__init__(self, parent)
|
||||
self.mdlStatus = mdlStatus
|
||||
|
@ -285,7 +287,6 @@ class outlineStatusDelegate(QStyledItemDelegate):
|
|||
|
||||
|
||||
class outlineLabelDelegate(QStyledItemDelegate):
|
||||
|
||||
def __init__(self, mdlLabels, parent=None):
|
||||
QStyledItemDelegate.__init__(self, parent)
|
||||
self.mdlLabels = mdlLabels
|
||||
|
@ -349,4 +350,3 @@ class outlineLabelDelegate(QStyledItemDelegate):
|
|||
r = qApp.style().subControlRect(QStyle.CC_ComboBox, opt, QStyle.SC_ComboBoxArrow)
|
||||
option.rect = r
|
||||
qApp.style().drawPrimitive(QStyle.PE_IndicatorArrowDown, option, painter)
|
||||
|
|
@ -1,18 +1,16 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtWidgets import QTreeView, QHeaderView
|
||||
|
||||
from manuskript import settings
|
||||
from manuskript.enums import Outline
|
||||
from manuskript.ui.views.dndView import dndView
|
||||
from manuskript.ui.views.outlineBasics import outlineBasics
|
||||
from manuskript.ui.views.outlineDelegates import outlineTitleDelegate, outlinePersoDelegate, outlineCompileDelegate, \
|
||||
outlineStatusDelegate, outlineGoalPercentageDelegate, outlineLabelDelegate
|
||||
|
||||
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from functions import *
|
||||
from ui.views.outlineDelegates import *
|
||||
from ui.views.dndView import *
|
||||
from ui.views.outlineBasics import *
|
||||
|
||||
class outlineView(QTreeView, dndView, outlineBasics):
|
||||
|
||||
def __init__(self, parent=None, modelPersos=None, modelLabels=None, modelStatus=None):
|
||||
QTreeView.__init__(self, parent)
|
||||
dndView.__init__(self)
|
||||
|
@ -84,4 +82,3 @@ class outlineView(QTreeView, dndView, outlineBasics):
|
|||
def mouseReleaseEvent(self, event):
|
||||
QTreeView.mouseReleaseEvent(self, event)
|
||||
outlineBasics.mouseReleaseEvent(self, event)
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtCore import QSize, QModelIndex, Qt
|
||||
from PyQt5.QtGui import QPixmap, QColor, QIcon, QBrush
|
||||
from PyQt5.QtWidgets import QTreeWidget, QTreeWidgetItem
|
||||
|
||||
from manuskript.enums import Perso
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from functions import *
|
||||
import settings
|
||||
|
||||
class persoTreeView(QTreeWidget):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QTreeWidget.__init__(self, parent)
|
||||
self._model = None
|
||||
|
@ -128,4 +128,3 @@ class persoTreeView(QTreeWidget):
|
|||
# Catching double clicks to forbid collapsing of toplevel items
|
||||
if item.parent():
|
||||
QTreeWidget.mouseDoubleClickEvent(self, event)
|
||||
|
|
@ -1,12 +1,13 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from functions import *
|
||||
import settings
|
||||
import collections
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QIcon
|
||||
from PyQt5.QtWidgets import QStyledItemDelegate, QLineEdit, QMenu, QAction
|
||||
|
||||
|
||||
class plotDelegate(QStyledItemDelegate):
|
||||
def __init__(self, parent=None):
|
||||
QStyledItemDelegate.__init__(self, parent)
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from functions import *
|
||||
import settings
|
||||
from PyQt5.QtCore import Qt, QModelIndex, QMimeData
|
||||
from PyQt5.QtGui import QBrush, QColor
|
||||
from PyQt5.QtWidgets import QTreeWidget, QTreeWidgetItem
|
||||
from lxml import etree as ET
|
||||
import models.references as Ref
|
||||
|
||||
from manuskript import settings
|
||||
from manuskript.enums import Plot, Outline
|
||||
from manuskript.models import references as Ref
|
||||
|
||||
|
||||
class plotTreeView(QTreeWidget):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QTreeWidget.__init__(self, parent)
|
||||
self._model = None
|
||||
|
@ -51,6 +52,7 @@ class plotTreeView(QTreeWidget):
|
|||
|
||||
def getItemByID(self, ID):
|
||||
"Recursively search items to find one whose data is ``ID``."
|
||||
|
||||
def find(item, ID):
|
||||
if item.data(0, Qt.UserRole) == ID:
|
||||
return item
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtWidgets import QWidget
|
||||
|
||||
from manuskript.enums import Outline
|
||||
from manuskript.ui.views.propertiesView_ui import Ui_propertiesView
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from ui.views.propertiesView_ui import *
|
||||
|
||||
class propertiesView(QWidget, Ui_propertiesView):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QWidget.__init__(self)
|
||||
self.setupUi(self)
|
||||
|
@ -22,7 +22,7 @@ class propertiesView(QWidget, Ui_propertiesView):
|
|||
self.txtGoal.setModel(mdlOutline)
|
||||
|
||||
def getIndexes(self, sourceView):
|
||||
"Returns a list of indexes from list of QItemSelectionRange"
|
||||
"""Returns a list of indexes from list of QItemSelectionRange"""
|
||||
indexes = []
|
||||
|
||||
for i in sourceView.selectionModel().selection().indexes():
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# Form implementation generated from reading ui file 'manuskript/ui/views/propertiesView_ui.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.4.1
|
||||
# Created by: PyQt5 UI code generator 5.4.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
|
@ -107,8 +107,8 @@ class Ui_propertiesView(object):
|
|||
self.page_2 = QtWidgets.QWidget()
|
||||
self.page_2.setObjectName("page_2")
|
||||
self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.page_2)
|
||||
self.verticalLayout_3.setSpacing(0)
|
||||
self.verticalLayout_3.setContentsMargins(0, 0, 0, 0)
|
||||
self.verticalLayout_3.setSpacing(0)
|
||||
self.verticalLayout_3.setObjectName("verticalLayout_3")
|
||||
self.formLayout_2 = QtWidgets.QFormLayout()
|
||||
self.formLayout_2.setObjectName("formLayout_2")
|
||||
|
@ -194,9 +194,9 @@ class Ui_propertiesView(object):
|
|||
self.label_36.setText(_translate("propertiesView", "Goal"))
|
||||
self.txtGoalMulti.setPlaceholderText(_translate("propertiesView", "Word count"))
|
||||
|
||||
from ui.views.lineEditView import lineEditView
|
||||
from ui.views.chkOutlineCompile import chkOutlineCompile
|
||||
from ui.views.cmbOutlineTypeChoser import cmbOutlineTypeChoser
|
||||
from ui.views.cmbOutlineLabelChoser import cmbOutlineLabelChoser
|
||||
from ui.views.cmbOutlinePersoChoser import cmbOutlinePersoChoser
|
||||
from ui.views.cmbOutlineStatusChoser import cmbOutlineStatusChoser
|
||||
from manuskript.ui.views.chkOutlineCompile import chkOutlineCompile
|
||||
from manuskript.ui.views.cmbOutlineLabelChoser import cmbOutlineLabelChoser
|
||||
from manuskript.ui.views.cmbOutlinePersoChoser import cmbOutlinePersoChoser
|
||||
from manuskript.ui.views.cmbOutlineStatusChoser import cmbOutlineStatusChoser
|
||||
from manuskript.ui.views.cmbOutlineTypeChoser import cmbOutlineTypeChoser
|
||||
from manuskript.ui.views.lineEditView import lineEditView
|
||||
|
|
|
@ -297,32 +297,32 @@
|
|||
<customwidget>
|
||||
<class>lineEditView</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>ui.views.lineEditView.h</header>
|
||||
<header>manuskript.ui.views.lineEditView.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>cmbOutlinePersoChoser</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>ui.views.cmbOutlinePersoChoser.h</header>
|
||||
<header>manuskript.ui.views.cmbOutlinePersoChoser.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>cmbOutlineStatusChoser</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>ui.views.cmbOutlineStatusChoser.h</header>
|
||||
<header>manuskript.ui.views.cmbOutlineStatusChoser.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>chkOutlineCompile</class>
|
||||
<extends>QCheckBox</extends>
|
||||
<header>ui.views.chkOutlineCompile.h</header>
|
||||
<header>manuskript.ui.views.chkOutlineCompile.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>cmbOutlineLabelChoser</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>ui.views.cmbOutlineLabelChoser.h</header>
|
||||
<header>manuskript.ui.views.cmbOutlineLabelChoser.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>cmbOutlineTypeChoser</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>ui.views.cmbOutlineTypeChoser.h</header>
|
||||
<header>manuskript.ui.views.cmbOutlineTypeChoser.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
|
|
|
@ -1,24 +1,26 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from functions import *
|
||||
from ui.views.textEditView import *
|
||||
from ui.editors.completer import *
|
||||
import models.references as Ref
|
||||
import settings
|
||||
import re
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QTextCursor, QFont, QFontMetrics
|
||||
from PyQt5.QtWidgets import QAction, qApp, QToolTip, QTextEdit
|
||||
|
||||
from manuskript.ui.editors.completer import completer
|
||||
from manuskript.ui.views.textEditView import textEditView
|
||||
from manuskript.models import references as Ref
|
||||
|
||||
try:
|
||||
import enchant
|
||||
except ImportError:
|
||||
enchant = None
|
||||
|
||||
class textEditCompleter(textEditView):
|
||||
|
||||
def __init__(self, parent=None, index=None, html=None, spellcheck=True, highlighting=False, dict="", autoResize=False):
|
||||
textEditView.__init__(self, parent=parent, index=index, html=html, spellcheck=spellcheck, highlighting=True, dict=dict, autoResize=autoResize)
|
||||
class textEditCompleter(textEditView):
|
||||
def __init__(self, parent=None, index=None, html=None, spellcheck=True, highlighting=False, dict="",
|
||||
autoResize=False):
|
||||
textEditView.__init__(self, parent=parent, index=index, html=html, spellcheck=spellcheck, highlighting=True,
|
||||
dict=dict, autoResize=autoResize)
|
||||
|
||||
self.completer = None
|
||||
self.setMouseTracking(True)
|
||||
|
|
|
@ -1,25 +1,31 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from ui.editors.t2tHighlighter import *
|
||||
from ui.editors.t2tFunctions import *
|
||||
from ui.editors.basicHighlighter import *
|
||||
from ui.editors.textFormat import *
|
||||
from models.outlineModel import *
|
||||
from functions import *
|
||||
import settings
|
||||
import re
|
||||
|
||||
from PyQt5.QtCore import QTimer, QModelIndex, Qt, QEvent, pyqtSignal, QRegExp
|
||||
from PyQt5.QtGui import QTextBlockFormat, QTextCharFormat, QFont, QColor, QMouseEvent, QTextCursor
|
||||
from PyQt5.QtWidgets import QTextEdit, qApp, QAction, QMenu
|
||||
|
||||
from manuskript import settings
|
||||
from manuskript.enums import Outline
|
||||
from manuskript.functions import AUC
|
||||
from manuskript.functions import toString
|
||||
from manuskript.models.outlineModel import outlineModel
|
||||
from manuskript.ui.editors.basicHighlighter import basicHighlighter
|
||||
from manuskript.ui.editors.t2tFunctions import t2tClearFormat
|
||||
from manuskript.ui.editors.t2tFunctions import t2tFormatSelection
|
||||
from manuskript.ui.editors.t2tHighlighter import t2tHighlighter
|
||||
from manuskript.ui.editors.textFormat import textFormat
|
||||
|
||||
try:
|
||||
import enchant
|
||||
except ImportError:
|
||||
enchant = None
|
||||
|
||||
class textEditView(QTextEdit):
|
||||
|
||||
def __init__(self, parent=None, index=None, html=None, spellcheck=True, highlighting=False, dict="", autoResize=False):
|
||||
class textEditView(QTextEdit):
|
||||
def __init__(self, parent=None, index=None, html=None, spellcheck=True, highlighting=False, dict="",
|
||||
autoResize=False):
|
||||
QTextEdit.__init__(self, parent)
|
||||
self._column = Outline.text.value
|
||||
self._index = None
|
||||
|
@ -46,7 +52,6 @@ class textEditView(QTextEdit):
|
|||
self._dict = None
|
||||
# self.document().contentsChanged.connect(self.submit, AUC)
|
||||
|
||||
|
||||
# Submit text changed only after 500ms without modifications
|
||||
self.updateTimer = QTimer()
|
||||
self.updateTimer.setInterval(500)
|
||||
|
@ -403,7 +408,7 @@ class textEditView(QTextEdit):
|
|||
QTextEdit.mousePressEvent(self, event)
|
||||
|
||||
class SpellAction(QAction):
|
||||
"A special QAction that returns the text in a signal. Used for spellckech."
|
||||
"""A special QAction that returns the text in a signal. Used for spellckech."""
|
||||
|
||||
correct = pyqtSignal(str)
|
||||
|
||||
|
@ -448,9 +453,9 @@ class textEditView(QTextEdit):
|
|||
return popup_menu
|
||||
|
||||
def correctWord(self, word):
|
||||
'''
|
||||
"""
|
||||
Replaces the selected text with word.
|
||||
'''
|
||||
"""
|
||||
cursor = self.textCursor()
|
||||
cursor.beginEditBlock()
|
||||
|
||||
|
@ -464,12 +469,12 @@ class textEditView(QTextEdit):
|
|||
###############################################################################
|
||||
|
||||
def focusOutEvent(self, event):
|
||||
"Submit changes just before focusing out."
|
||||
"""Submit changes just before focusing out."""
|
||||
QTextEdit.focusOutEvent(self, event)
|
||||
self.submit()
|
||||
|
||||
def focusInEvent(self, event):
|
||||
"Finds textFormatter and attach them to that view."
|
||||
"""Finds textFormatter and attach them to that view."""
|
||||
QTextEdit.focusInEvent(self, event)
|
||||
|
||||
p = self.parent()
|
||||
|
@ -546,6 +551,3 @@ class textEditView(QTextEdit):
|
|||
t2tFormatSelection(self, 2)
|
||||
elif _format == "Clear":
|
||||
t2tClearFormat(self)
|
||||
|
||||
|
||||
|
|
@ -1,15 +1,21 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtCore import Qt, QRect
|
||||
from PyQt5.QtGui import QColor, QPalette, QIcon, QFont, QFontMetrics
|
||||
from PyQt5.QtWidgets import QStyledItemDelegate, qApp, QStyleOptionViewItem, QStyle
|
||||
|
||||
from manuskript import settings
|
||||
from manuskript.enums import Outline
|
||||
from manuskript.functions import mixColors, colorifyPixmap
|
||||
from manuskript.functions import outlineItemColors
|
||||
from manuskript.functions import toFloat
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from functions import *
|
||||
import settings
|
||||
|
||||
class treeTitleDelegate(QStyledItemDelegate):
|
||||
"""The main purpose of ``treeTitleDelegate`` is to paint outline items
|
||||
in the treeview with propers colors according to settings.
|
||||
"""
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QStyledItemDelegate.__init__(self, parent)
|
||||
self._view = None
|
||||
|
@ -109,7 +115,6 @@ class treeTitleDelegate(QStyledItemDelegate):
|
|||
extraText = " ({}%)".format(extraText)
|
||||
|
||||
if extraText:
|
||||
|
||||
r = QRect(textRect)
|
||||
r.setLeft(r.left() + fm.width(opt.text + " "))
|
||||
|
||||
|
@ -118,7 +123,6 @@ class treeTitleDelegate(QStyledItemDelegate):
|
|||
painter.drawText(r, Qt.AlignLeft | Qt.AlignBottom, extraText)
|
||||
painter.restore()
|
||||
|
||||
|
||||
painter.restore()
|
||||
|
||||
# QStyledItemDelegate.paint(self, painter, option, index)
|
|
@ -1,18 +1,17 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QCursor
|
||||
from PyQt5.QtWidgets import QTreeView, QAction
|
||||
|
||||
from manuskript.enums import Outline
|
||||
from manuskript.functions import mainWindow
|
||||
from manuskript.ui.views.dndView import dndView
|
||||
from manuskript.ui.views.outlineBasics import outlineBasics
|
||||
from manuskript.ui.views.treeDelegates import treeTitleDelegate
|
||||
|
||||
|
||||
|
||||
from qt import *
|
||||
from enums import *
|
||||
from functions import *
|
||||
from ui.views.dndView import *
|
||||
from ui.views.outlineBasics import *
|
||||
from ui.views.treeDelegates import *
|
||||
|
||||
class treeView(QTreeView, dndView, outlineBasics):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QTreeView.__init__(self, parent)
|
||||
dndView.__init__(self, parent)
|
||||
|
|
|
@ -1,16 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
# --!-- coding: utf8 --!--
|
||||
|
||||
from qt import *
|
||||
from functions import *
|
||||
from ui.welcome_ui import *
|
||||
from models.outlineModel import *
|
||||
from models.persosModel import *
|
||||
from models.plotModel import *
|
||||
#from models.persosProxyModel import *
|
||||
import settings
|
||||
import locale
|
||||
import imp
|
||||
import os
|
||||
|
||||
from PyQt5.QtCore import QSettings, QRegExp, Qt
|
||||
from PyQt5.QtGui import QIcon, QBrush, QColor, QStandardItemModel, QStandardItem
|
||||
from PyQt5.QtWidgets import QWidget, QAction, QFileDialog, QSpinBox, QLineEdit, QLabel, QPushButton, QTreeWidgetItem
|
||||
|
||||
from manuskript import settings
|
||||
from manuskript.enums import Outline
|
||||
from manuskript.functions import mainWindow, iconFromColor
|
||||
from manuskript.models.outlineModel import outlineItem
|
||||
from manuskript.models.outlineModel import outlineModel
|
||||
from manuskript.models.persosModel import persosModel
|
||||
from manuskript.models.plotModel import plotModel
|
||||
from manuskript.ui.welcome_ui import Ui_welcome
|
||||
|
||||
locale.setlocale(locale.LC_ALL, '')
|
||||
|
||||
|
@ -237,7 +243,6 @@ class welcome(QWidget, Ui_welcome):
|
|||
|
||||
self.lytTemplate.addWidget(btn, k, 3)
|
||||
|
||||
|
||||
self.lytTemplate.addWidget(spin, k, 1)
|
||||
self.lytTemplate.addWidget(txt, k, 2)
|
||||
k += 1
|
||||
|
@ -393,4 +398,3 @@ class welcome(QWidget, Ui_welcome):
|
|||
|
||||
if self.template:
|
||||
addElement(root, self.template)
|
||||
|
Loading…
Reference in a new issue