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,14 +1,15 @@
|
|||
#!/usr/bin/env python
|
||||
#--!-- coding: utf8 --!--
|
||||
|
||||
# --!-- 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
|
||||
# Format
|
||||
# Readable name
|
||||
# Class
|
||||
# QFileDialog filter
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
#!/usr/bin/env python
|
||||
#--!-- coding: utf8 --!--
|
||||
# --!-- 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):
|
||||
pass
|
||||
|
||||
def doCompile(self, path):
|
||||
#FIXME: overwrites when items have identical names
|
||||
# FIXME: overwrites when items have identical names
|
||||
mw = mainWindow()
|
||||
root = mw.mdlOutline.rootItem
|
||||
|
||||
|
@ -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 --!--
|
||||
# --!-- 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 --!--
|
||||
# --!-- 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):
|
||||
|
@ -23,8 +20,8 @@ class htmlExporter(basicExporter):
|
|||
if item.isFolder():
|
||||
html = ""
|
||||
title = "<h{l}>{t}</h{l}>\n".format(
|
||||
l = str(item.level() + 1),
|
||||
t = item.title())
|
||||
l=str(item.level() + 1),
|
||||
t=item.title())
|
||||
html += title
|
||||
|
||||
for c in item.children():
|
||||
|
@ -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 --!--
|
||||
# --!-- 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):
|
||||
|
@ -51,17 +50,17 @@ class odtExporter(basicExporter):
|
|||
if not text:
|
||||
return text
|
||||
|
||||
#if _type == "t2t":
|
||||
#text = self.runT2T(text)
|
||||
# if _type == "t2t":
|
||||
# text = self.runT2T(text)
|
||||
|
||||
#elif _type == "txt":
|
||||
#text = text.replace("\n", "<br>")
|
||||
# elif _type == "txt":
|
||||
# text = text.replace("\n", "<br>")
|
||||
|
||||
elif _type == "html":
|
||||
doc = QTextDocument()
|
||||
doc.setHtml(text)
|
||||
text = doc.toPlainText()
|
||||
#text = self.htmlBody(text)
|
||||
# text = self.htmlBody(text)
|
||||
|
||||
return text
|
||||
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
#!/usr/bin/env python
|
||||
#--!-- coding: utf8 --!--
|
||||
# --!-- 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,14 +19,13 @@ class odtExporter(basicExporter):
|
|||
doc = QTextDocument()
|
||||
cursor = QTextCursor(doc)
|
||||
|
||||
|
||||
def appendItem(item):
|
||||
if item.isFolder():
|
||||
|
||||
cursor.setPosition(doc.characterCount() - 1)
|
||||
title = "<h{l}>{t}</h{l}><br>\n".format(
|
||||
l = str(item.level() + 1),
|
||||
t = item.title())
|
||||
l=str(item.level() + 1),
|
||||
t=item.title())
|
||||
cursor.insertHtml(title)
|
||||
|
||||
for c in item.children():
|
||||
|
|
|
@ -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 --!--
|
||||
# --!-- 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):
|
||||
|
||||
|
@ -11,8 +18,8 @@ class persosModel(QStandardItemModel):
|
|||
QStandardItemModel.__init__(self, 0, 3, parent)
|
||||
self.setHorizontalHeaderLabels([i.name for i in Plot])
|
||||
self.mw = mainWindow()
|
||||
#self._proxy = plotsProxyModel()
|
||||
#self._proxy.setSourceModel(self)
|
||||
# self._proxy = plotsProxyModel()
|
||||
# self._proxy.setSourceModel(self)
|
||||
|
||||
###############################################################################
|
||||
# PERSOS QUERRIES
|
||||
|
@ -126,7 +133,7 @@ class persosModel(QStandardItemModel):
|
|||
###############################################################################
|
||||
|
||||
def updatePersoColor(self, idx):
|
||||
#idx = self.currentPersoIndex()
|
||||
# idx = self.currentPersoIndex()
|
||||
color = self.getPersoColorName(idx)
|
||||
self.mw.btnPersoColor.setStyleSheet("background:{};".format(color))
|
||||
|
||||
|
@ -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 --!--
|
||||
# --!-- 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])
|
||||
|
@ -14,16 +21,16 @@ class plotModel(QStandardItemModel):
|
|||
|
||||
self.updatePlotPersoButton()
|
||||
|
||||
###############################################################################
|
||||
# QUERIES
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# QUERIES
|
||||
###############################################################################
|
||||
|
||||
def getPlotsByImportance(self):
|
||||
plots = [[], [], []]
|
||||
for i in range(self.rowCount()):
|
||||
importance = self.item(i, Plot.importance.value).text()
|
||||
ID = self.item(i, Plot.ID.value).text()
|
||||
plots[2-toInt(importance)].append(ID)
|
||||
plots[2 - toInt(importance)].append(ID)
|
||||
return plots
|
||||
|
||||
def getSubPlotsByID(self, ID):
|
||||
|
@ -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()):
|
||||
|
@ -66,14 +73,14 @@ class plotModel(QStandardItemModel):
|
|||
|
||||
def currentIndex(self):
|
||||
i = self.mw.lstPlots.currentIndex()
|
||||
if i .isValid():
|
||||
if i.isValid():
|
||||
return i
|
||||
else:
|
||||
return None
|
||||
|
||||
###############################################################################
|
||||
# ADDING / REMOVING
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# ADDING / REMOVING
|
||||
###############################################################################
|
||||
|
||||
def addPlot(self):
|
||||
p = QStandardItem(self.tr("New plot"))
|
||||
|
@ -83,25 +90,26 @@ 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)):
|
||||
index = self.index(i, Plot.ID.value, parent)
|
||||
#item = self.item(i, Plot.ID.value)
|
||||
# item = self.item(i, Plot.ID.value)
|
||||
if index.isValid() and index.data():
|
||||
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):
|
||||
self.takeRow(index.row())
|
||||
|
||||
###############################################################################
|
||||
# SUBPLOTS
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# SUBPLOTS
|
||||
###############################################################################
|
||||
|
||||
def headerData(self, section, orientation, role=Qt.DisplayRole):
|
||||
if role == Qt.DisplayRole:
|
||||
|
@ -150,7 +158,7 @@ class plotModel(QStandardItemModel):
|
|||
parentItem.appendRow([p, _id, QStandardItem(), summary])
|
||||
|
||||
# Select last index
|
||||
self.mw.lstSubPlots.setCurrentIndex(parent.child(self.rowCount(parent)-1, 0))
|
||||
self.mw.lstSubPlots.setCurrentIndex(parent.child(self.rowCount(parent) - 1, 0))
|
||||
|
||||
def removeSubPlot(self):
|
||||
index = self.mw.lstSubPlots.currentIndex()
|
||||
|
@ -167,9 +175,9 @@ class plotModel(QStandardItemModel):
|
|||
else:
|
||||
return QStandardItemModel.flags(self, index)
|
||||
|
||||
###############################################################################
|
||||
# PLOT PERSOS
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# PLOT PERSOS
|
||||
###############################################################################
|
||||
|
||||
def addPlotPerso(self, v):
|
||||
index = self.mw.lstPlots.currentPlotIndex()
|
||||
|
@ -212,7 +220,7 @@ class plotModel(QStandardItemModel):
|
|||
|
||||
imp = toInt(self.mw.mdlPersos.importance(i))
|
||||
|
||||
menus[2-imp].addAction(a)
|
||||
menus[2 - imp].addAction(a)
|
||||
|
||||
mpr.mapped.connect(self.addPlotPerso)
|
||||
self.mw.btnAddPlotPerso.setMenu(menu)
|
|
@ -1,20 +1,23 @@
|
|||
#!/usr/bin/env python
|
||||
#--!-- coding: utf8 --!--
|
||||
# --!-- 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):
|
||||
QSortFilterProxyModel.__init__(self, parent)
|
||||
|
||||
#self.rootItem = QStandardItem()
|
||||
# self.rootItem = QStandardItem()
|
||||
self.p1 = QStandardItem(self.tr("Main"))
|
||||
self.p2 = QStandardItem(self.tr("Secundary"))
|
||||
self.p3 = QStandardItem(self.tr("Minors"))
|
||||
|
@ -30,7 +33,7 @@ class plotsProxyModel(QSortFilterProxyModel):
|
|||
return QModelIndex()
|
||||
|
||||
row = self._map.index(sourceIndex.row())
|
||||
#item = sourceIndex.internalPointer()
|
||||
# item = sourceIndex.internalPointer()
|
||||
item = self.sourceModel().itemFromIndex(sourceIndex)
|
||||
|
||||
return self.createIndex(row, sourceIndex.column(), item)
|
||||
|
@ -40,7 +43,7 @@ class plotsProxyModel(QSortFilterProxyModel):
|
|||
return Qt.NoItemFlags
|
||||
|
||||
if index.isValid() and not self.mapToSource(index).isValid():
|
||||
return Qt.NoItemFlags#Qt.ItemIsEnabled
|
||||
return Qt.NoItemFlags # Qt.ItemIsEnabled
|
||||
else:
|
||||
return Qt.ItemIsEnabled | Qt.ItemIsSelectable
|
||||
|
||||
|
@ -53,7 +56,7 @@ class plotsProxyModel(QSortFilterProxyModel):
|
|||
if type(row) != int:
|
||||
return QModelIndex()
|
||||
|
||||
#item = proxyIndex.internalPointer()
|
||||
# item = proxyIndex.internalPointer()
|
||||
item = self.sourceModel().item(row, proxyIndex.column())
|
||||
|
||||
return self.sourceModel().indexFromItem(item)
|
||||
|
@ -88,12 +91,11 @@ class plotsProxyModel(QSortFilterProxyModel):
|
|||
else:
|
||||
imp = 0
|
||||
|
||||
if 2-imp == i:
|
||||
if 2 - imp == i:
|
||||
self._map.append(p)
|
||||
|
||||
self.endResetModel()
|
||||
|
||||
|
||||
def data(self, index, role=Qt.DisplayRole):
|
||||
|
||||
if index.isValid() and not self.mapToSource(index).isValid():
|
||||
|
@ -110,11 +112,11 @@ class plotsProxyModel(QSortFilterProxyModel):
|
|||
return Qt.AlignCenter
|
||||
elif role == Qt.FontRole:
|
||||
f = QFont()
|
||||
#f.setPointSize(f.pointSize() + 1)
|
||||
# f.setPointSize(f.pointSize() + 1)
|
||||
f.setWeight(QFont.Bold)
|
||||
return f
|
||||
else:
|
||||
#FIXME: sometimes, the name of the character is not displayed
|
||||
# FIXME: sometimes, the name of the character is not displayed
|
||||
return self.sourceModel().data(self.mapToSource(index), role)
|
||||
|
||||
def index(self, row, column, parent):
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
#--!-- coding: utf8 --!--
|
||||
# --!-- 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
|
||||
|
@ -62,7 +72,7 @@ def infos(ref):
|
|||
|
||||
item = idx.internalPointer()
|
||||
|
||||
#Titles
|
||||
# Titles
|
||||
pathTitle = qApp.translate("references", "Path:")
|
||||
statsTitle = qApp.translate("references", "Stats:")
|
||||
POVTitle = qApp.translate("references", "POV:")
|
||||
|
@ -173,9 +183,9 @@ def infos(ref):
|
|||
]:
|
||||
val = m.data(index.sibling(index.row(), i[0].value))
|
||||
if val:
|
||||
basic .append("<b>{title}:</b>{n}{val}".format(
|
||||
basic.append("<b>{title}:</b>{n}{val}".format(
|
||||
title=i[1],
|
||||
n = "\n" if i[2] else " ",
|
||||
n="\n" if i[2] else " ",
|
||||
val=val))
|
||||
basic = "<br>".join(basic)
|
||||
|
||||
|
@ -268,7 +278,7 @@ def infos(ref):
|
|||
steps += "<li><b>{title}</b>{summary}{meta}</li>".format(
|
||||
title=title,
|
||||
summary=": {}".format(summary) if summary else "",
|
||||
meta = meta if meta else "")
|
||||
meta=meta if meta else "")
|
||||
|
||||
text = """<h1>{name}</h1>
|
||||
{goto}
|
||||
|
@ -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,23 +1,27 @@
|
|||
#!/usr/bin/env python
|
||||
#--!-- coding: utf8 --!--
|
||||
# --!-- 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()
|
||||
|
||||
###############################################################################
|
||||
# SELECTION
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# SELECTION
|
||||
###############################################################################
|
||||
|
||||
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:
|
||||
|
@ -35,17 +39,17 @@ class worldModel(QStandardItemModel):
|
|||
def selectedIndexes(self):
|
||||
return self.mw.treeWorld.selectedIndexes()
|
||||
|
||||
###############################################################################
|
||||
# GETTERS
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# GETTERS
|
||||
###############################################################################
|
||||
|
||||
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()
|
||||
|
@ -116,12 +121,12 @@ class worldModel(QStandardItemModel):
|
|||
path = " > ".join(path)
|
||||
return path
|
||||
|
||||
###############################################################################
|
||||
# ADDING AND REMOVE
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# ADDING AND REMOVE
|
||||
###############################################################################
|
||||
|
||||
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):
|
||||
|
@ -155,12 +161,12 @@ class worldModel(QStandardItemModel):
|
|||
index = self.selectedIndexes()[0]
|
||||
self.removeRows(index.row(), 1, index.parent())
|
||||
|
||||
###############################################################################
|
||||
# TEMPLATES
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# TEMPLATES
|
||||
###############################################################################
|
||||
|
||||
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()]
|
||||
|
||||
|
@ -235,9 +241,9 @@ class worldModel(QStandardItemModel):
|
|||
addItems(data, None)
|
||||
self.mw.treeWorld.expandAll()
|
||||
|
||||
###############################################################################
|
||||
# APPEARANCE
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# APPEARANCE
|
||||
###############################################################################
|
||||
|
||||
def data(self, index, role=Qt.EditRole):
|
||||
level = 0
|
||||
|
@ -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
|
||||
# --!-- coding: utf8 --!--
|
||||
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,27 +183,26 @@ class settingsWindow(QWidget, Ui_Settings):
|
|||
self.btnThemeEdit.clicked.connect(self.editTheme)
|
||||
self.btnThemeRemove.clicked.connect(self.removeTheme)
|
||||
|
||||
|
||||
def setTab(self, tab):
|
||||
|
||||
tabs = {
|
||||
"General":0,
|
||||
"Views":1,
|
||||
"Labels":2,
|
||||
"Status":3,
|
||||
"Fullscreen":4,
|
||||
"General": 0,
|
||||
"Views": 1,
|
||||
"Labels": 2,
|
||||
"Status": 3,
|
||||
"Fullscreen": 4,
|
||||
}
|
||||
|
||||
if tab in tabs:
|
||||
self.lstMenu.setCurrentRow(tabs[tab])
|
||||
else:
|
||||
self.lstMenu.setCurrentRow(tab)
|
||||
####################################################################################################
|
||||
# GENERAL #
|
||||
####################################################################################################
|
||||
####################################################################################################
|
||||
# GENERAL #
|
||||
####################################################################################################
|
||||
|
||||
def setStyle(self, style):
|
||||
#Save style to Qt Settings
|
||||
# Save style to Qt Settings
|
||||
sttgs = QSettings(qApp.organizationName(), qApp.applicationName())
|
||||
sttgs.setValue("applicationStyle", style)
|
||||
qApp.setStyle(style)
|
||||
|
@ -220,10 +226,9 @@ class settingsWindow(QWidget, Ui_Settings):
|
|||
self.mw.saveTimerNoChanges.setInterval(settings.autoSaveNoChangesDelay * 1000)
|
||||
settings.defaultTextType = self.cmbDefaultTextType.currentData()
|
||||
|
||||
|
||||
####################################################################################################
|
||||
# REVISION #
|
||||
####################################################################################################
|
||||
####################################################################################################
|
||||
# REVISION #
|
||||
####################################################################################################
|
||||
|
||||
def revisionsSettingsChanged(self):
|
||||
opt = settings.revisions
|
||||
|
@ -235,9 +240,9 @@ class settingsWindow(QWidget, Ui_Settings):
|
|||
opt["rules"][60 * 60 * 24 * 30] = 60 * 60 * 24 / self.spnRevisionsMonth.value()
|
||||
opt["rules"][None] = 60 * 60 * 24 * 7 / self.spnRevisionsEternity.value()
|
||||
|
||||
####################################################################################################
|
||||
# VIEWS #
|
||||
####################################################################################################
|
||||
####################################################################################################
|
||||
# VIEWS #
|
||||
####################################################################################################
|
||||
|
||||
def viewSettingsDatas(self):
|
||||
return {
|
||||
|
@ -324,8 +329,8 @@ class settingsWindow(QWidget, Ui_Settings):
|
|||
self.mw.mainEditor.updateCorkBackground()
|
||||
|
||||
def populatesCmbBackgrounds(self, cmb):
|
||||
#self.cmbDelegate = cmbPixmapDelegate()
|
||||
#self.cmbCorkImage.setItemDelegate(self.cmbDelegate)
|
||||
# self.cmbDelegate = cmbPixmapDelegate()
|
||||
# self.cmbCorkImage.setItemDelegate(self.cmbDelegate)
|
||||
|
||||
paths = allPaths("resources/backgrounds")
|
||||
cmb.clear()
|
||||
|
@ -346,9 +351,9 @@ class settingsWindow(QWidget, Ui_Settings):
|
|||
if i != -1:
|
||||
self.cmbCorkImage.setCurrentIndex(i)
|
||||
|
||||
####################################################################################################
|
||||
# VIEWS / EDITOR
|
||||
####################################################################################################
|
||||
####################################################################################################
|
||||
# VIEWS / EDITOR
|
||||
####################################################################################################
|
||||
|
||||
def updateEditorSettings(self):
|
||||
# Store settings
|
||||
|
@ -356,9 +361,9 @@ class settingsWindow(QWidget, Ui_Settings):
|
|||
f.setPointSize(self.spnEditorFontSize.value())
|
||||
settings.textEditor["font"] = f.toString()
|
||||
settings.textEditor["lineSpacing"] = \
|
||||
100 if self.cmbEditorLineSpacing.currentIndex() == 0 else\
|
||||
150 if self.cmbEditorLineSpacing.currentIndex() == 1 else\
|
||||
200 if self.cmbEditorLineSpacing.currentIndex() == 2 else\
|
||||
100 if self.cmbEditorLineSpacing.currentIndex() == 0 else \
|
||||
150 if self.cmbEditorLineSpacing.currentIndex() == 1 else \
|
||||
200 if self.cmbEditorLineSpacing.currentIndex() == 2 else \
|
||||
self.spnEditorLineSpacing.value()
|
||||
self.spnEditorLineSpacing.setEnabled(self.cmbEditorLineSpacing.currentIndex() == 3)
|
||||
settings.textEditor["tabWidth"] = self.spnEditorTabWidth.value()
|
||||
|
@ -397,11 +402,9 @@ class settingsWindow(QWidget, Ui_Settings):
|
|||
self.setButtonColor(self.btnEditorBackgroundColor, color.name())
|
||||
self.updateEditorSettings()
|
||||
|
||||
|
||||
|
||||
####################################################################################################
|
||||
# STATUS #
|
||||
####################################################################################################
|
||||
####################################################################################################
|
||||
# STATUS #
|
||||
####################################################################################################
|
||||
|
||||
def addStatus(self):
|
||||
self.mw.mdlStatus.appendRow(QStandardItem(self.tr("New status")))
|
||||
|
@ -410,15 +413,16 @@ class settingsWindow(QWidget, Ui_Settings):
|
|||
for i in self.lstStatus.selectedIndexes():
|
||||
self.mw.mdlStatus.removeRows(i.row(), 1)
|
||||
|
||||
####################################################################################################
|
||||
# LABELS #
|
||||
####################################################################################################
|
||||
####################################################################################################
|
||||
# LABELS #
|
||||
####################################################################################################
|
||||
|
||||
def updateLabelColor(self, index):
|
||||
#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()))
|
||||
# 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.setEnabled(True)
|
||||
|
||||
def addLabel(self):
|
||||
|
@ -441,15 +445,15 @@ class settingsWindow(QWidget, Ui_Settings):
|
|||
self.mw.mdlLabels.item(index.row()).setIcon(QIcon(px))
|
||||
self.updateLabelColor(index)
|
||||
|
||||
####################################################################################################
|
||||
# FULLSCREEN #
|
||||
####################################################################################################
|
||||
####################################################################################################
|
||||
# FULLSCREEN #
|
||||
####################################################################################################
|
||||
|
||||
def themeSelected(self, current, previous):
|
||||
if current:
|
||||
# UI updates
|
||||
self.btnThemeEdit.setEnabled(current.data(Qt.UserRole+1))
|
||||
self.btnThemeRemove.setEnabled(current.data(Qt.UserRole+1))
|
||||
self.btnThemeEdit.setEnabled(current.data(Qt.UserRole + 1))
|
||||
self.btnThemeRemove.setEnabled(current.data(Qt.UserRole + 1))
|
||||
# Save settings
|
||||
theme = current.data(Qt.UserRole)
|
||||
settings.fullScreenTheme = os.path.splitext(os.path.split(theme)[1])[0]
|
||||
|
@ -501,7 +505,7 @@ class settingsWindow(QWidget, Ui_Settings):
|
|||
|
||||
item = QListWidgetItem(n)
|
||||
item.setData(Qt.UserRole, theme)
|
||||
item.setData(Qt.UserRole+1, editable)
|
||||
item.setData(Qt.UserRole + 1, editable)
|
||||
|
||||
thumb = os.path.join(p, t.replace(".theme", ".jpg"))
|
||||
px = QPixmap(200, 120)
|
||||
|
@ -513,7 +517,7 @@ class settingsWindow(QWidget, Ui_Settings):
|
|||
|
||||
icon = QPixmap(thumb).scaled(200, 120, Qt.KeepAspectRatio)
|
||||
painter = QPainter(px)
|
||||
painter.drawPixmap(px.rect().center()-icon.rect().center(), icon)
|
||||
painter.drawPixmap(px.rect().center() - icon.rect().center(), icon)
|
||||
painter.end()
|
||||
item.setIcon(QIcon(px))
|
||||
|
||||
|
@ -567,7 +571,7 @@ class settingsWindow(QWidget, Ui_Settings):
|
|||
self.btnThemeMisspelledColor.clicked.connect(lambda: self.getThemeColor("Text/Misspelled"))
|
||||
|
||||
# Paragraph Options
|
||||
self.chkThemeIndent.stateChanged.connect(lambda v: self.setSetting("Spacings/IndendFirstLine", v!=0))
|
||||
self.chkThemeIndent.stateChanged.connect(lambda v: self.setSetting("Spacings/IndendFirstLine", v != 0))
|
||||
self.cmbThemeLineSpacing.currentIndexChanged.connect(self.updateLineSpacing)
|
||||
self.cmbThemeLineSpacing.currentIndexChanged.connect(self.updateLineSpacing)
|
||||
self.spnThemeLineSpacing.valueChanged.connect(lambda v: self.setSetting("Spacings/LineSpacing", v))
|
||||
|
@ -615,7 +619,7 @@ class settingsWindow(QWidget, Ui_Settings):
|
|||
self.cmbThemeFontSize.setCurrentIndex(i)
|
||||
else:
|
||||
self.cmbThemeFontSize.addItem(str(f.pointSize()))
|
||||
self.cmbThemeFontSize.setCurrentIndex(self.cmbThemeFontSize.count()-1)
|
||||
self.cmbThemeFontSize.setCurrentIndex(self.cmbThemeFontSize.count() - 1)
|
||||
self.setButtonColor(self.btnThemeMisspelledColor, self._themeData["Text/Misspelled"])
|
||||
|
||||
# Paragraph Options
|
||||
|
@ -637,7 +641,7 @@ class settingsWindow(QWidget, Ui_Settings):
|
|||
|
||||
def populatesFontSize(self):
|
||||
self.cmbThemeFontSize.clear()
|
||||
s = list(range(6, 13)) + list(range(14,29, 2)) + [36, 48, 72]
|
||||
s = list(range(6, 13)) + list(range(14, 29, 2)) + [36, 48, 72]
|
||||
for i in s:
|
||||
self.cmbThemeFontSize.addItem(str(i))
|
||||
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
#!/usr/bin/env python
|
||||
#--!-- coding: utf8 --!--
|
||||
# --!-- 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):
|
||||
|
@ -119,7 +122,7 @@ class cheatSheet(QWidget, Ui_cheatSheet):
|
|||
for item in filtered:
|
||||
i = QListWidgetItem(item[0])
|
||||
i.setData(Qt.UserRole, Ref.EmptyRef.format(cat[1], item[1], item[0]))
|
||||
i.setData(Qt.UserRole+1, item[2])
|
||||
i.setData(Qt.UserRole + 1, item[2])
|
||||
self.list.addItem(i)
|
||||
|
||||
self.list.setCurrentRow(1)
|
||||
|
@ -149,7 +152,7 @@ class listCompleterDelegate(QStyledItemDelegate):
|
|||
QStyledItemDelegate.__init__(self, parent)
|
||||
|
||||
def paint(self, painter, option, index):
|
||||
extra = index.data(Qt.UserRole+1)
|
||||
extra = index.data(Qt.UserRole + 1)
|
||||
if not extra:
|
||||
return QStyledItemDelegate.paint(self, painter, option, index)
|
||||
|
||||
|
|
|
@ -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 *
|
||||
# --!-- coding: utf8 --!--
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import QToolBar, QDockWidget, QAction, QToolButton, QSizePolicy, QStylePainter, \
|
||||
QStyleOptionButton, QStyle
|
||||
|
||||
|
||||
class collapsibleDockWidgets(QToolBar):
|
||||
|
@ -27,7 +28,7 @@ class collapsibleDockWidgets(QToolBar):
|
|||
self.setFloatable(False)
|
||||
self.setMovable(False)
|
||||
|
||||
#self.setAllowedAreas(self.TRANSPOSED_AREA[self._area])
|
||||
# self.setAllowedAreas(self.TRANSPOSED_AREA[self._area])
|
||||
self.parent().addToolBar(self.TRANSPOSED_AREA[self._area], self)
|
||||
|
||||
# Dock widgets
|
||||
|
@ -52,23 +53,23 @@ class collapsibleDockWidgets(QToolBar):
|
|||
a.setCheckable(True)
|
||||
a.setChecked(widget.isVisible())
|
||||
a.toggled.connect(widget.setVisible)
|
||||
#widget.installEventFilter(self)
|
||||
# widget.installEventFilter(self)
|
||||
b = verticalButton(self)
|
||||
b.setDefaultAction(a)
|
||||
a2 = self.addWidget(b)
|
||||
self.otherWidgets.append((b, a2, widget, group))
|
||||
|
||||
#def eventFilter(self, widget, event):
|
||||
#if event.type() in [QEvent.Show, QEvent.Hide]:
|
||||
#for btn, action, w, grp in self.otherWidgets:
|
||||
#if w == widget:
|
||||
#btn.defaultAction().setChecked(event.type() == QEvent.Show)
|
||||
#return False
|
||||
# def eventFilter(self, widget, event):
|
||||
# if event.type() in [QEvent.Show, QEvent.Hide]:
|
||||
# for btn, action, w, grp in self.otherWidgets:
|
||||
# if w == widget:
|
||||
# btn.defaultAction().setChecked(event.type() == QEvent.Show)
|
||||
# return False
|
||||
|
||||
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 --!--
|
||||
# --!-- 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)
|
||||
|
||||
|
@ -25,7 +24,7 @@ class collapsibleGroupBox(QGroupBox):
|
|||
self.tempWidget.setLayout(self.layout())
|
||||
# Set empty layout
|
||||
l = QVBoxLayout()
|
||||
#print(l.contentsMargins().left(), l.contentsMargins().bottom(), l.contentsMargins().top(), )
|
||||
# print(l.contentsMargins().left(), l.contentsMargins().bottom(), l.contentsMargins().top(), )
|
||||
l.setContentsMargins(0, 0, 0, 0)
|
||||
self.setLayout(l)
|
||||
self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Maximum)
|
||||
|
@ -48,13 +47,13 @@ class collapsibleGroupBox(QGroupBox):
|
|||
style = qApp.style()
|
||||
groupBox = opt
|
||||
|
||||
#// Draw frame
|
||||
# // Draw frame
|
||||
textRect = style.subControlRect(style.CC_GroupBox, opt, style.SC_GroupBoxLabel)
|
||||
checkBoxRect = style.subControlRect(style.CC_GroupBox, opt, style.SC_GroupBoxCheckBox)
|
||||
|
||||
p.save()
|
||||
titleRect = style.subControlRect(style.CC_GroupBox, opt, style.SC_GroupBoxFrame)
|
||||
#r.setBottom(style.subControlRect(style.CC_GroupBox, opt, style.SC_GroupBoxContents).top())
|
||||
# r.setBottom(style.subControlRect(style.CC_GroupBox, opt, style.SC_GroupBoxContents).top())
|
||||
titleRect.setHeight(textRect.height())
|
||||
titleRect.moveTop(textRect.top())
|
||||
|
||||
|
@ -65,7 +64,7 @@ class collapsibleGroupBox(QGroupBox):
|
|||
|
||||
if groupBox.subControls & QStyle.SC_GroupBoxFrame:
|
||||
frame = QStyleOptionFrame()
|
||||
#frame.operator=(groupBox)
|
||||
# frame.operator=(groupBox)
|
||||
frame.state = groupBox.state
|
||||
frame.features = groupBox.features
|
||||
frame.lineWidth = groupBox.lineWidth
|
||||
|
@ -88,18 +87,18 @@ 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():
|
||||
#p.setPen(textColor)
|
||||
#alignment = int(groupBox.textAlignment)
|
||||
#if not style.styleHint(QStyle.SH_UnderlineShortcut, opt):
|
||||
#alignment |= Qt.TextHideMnemonic
|
||||
# textColor = QColor(groupBox.textColor)
|
||||
# if textColor.isValid():
|
||||
# p.setPen(textColor)
|
||||
# alignment = int(groupBox.textAlignment)
|
||||
# if not style.styleHint(QStyle.SH_UnderlineShortcut, opt):
|
||||
# alignment |= Qt.TextHideMnemonic
|
||||
|
||||
#style.drawItemText(p, textRect, Qt.TextShowMnemonic | Qt.AlignHCenter | alignment,
|
||||
#groupBox.palette, groupBox.state & style.State_Enabled, groupBox.text,
|
||||
#QPalette.NoRole if textColor.isValid() else QPalette.WindowText)
|
||||
# style.drawItemText(p, textRect, Qt.TextShowMnemonic | Qt.AlignHCenter | alignment,
|
||||
# groupBox.palette, groupBox.state & style.State_Enabled, groupBox.text,
|
||||
# QPalette.NoRole if textColor.isValid() else QPalette.WindowText)
|
||||
|
||||
p.save()
|
||||
topt = QTextOption(Qt.AlignHCenter | Qt.AlignVCenter)
|
||||
|
@ -112,15 +111,15 @@ class collapsibleGroupBox(QGroupBox):
|
|||
|
||||
if groupBox.state & style.State_HasFocus:
|
||||
fropt = QStyleOptionFocusRect()
|
||||
#fropt.operator=(groupBox)
|
||||
# fropt.operator=(groupBox)
|
||||
fropt.state = groupBox.state
|
||||
fropt.rect = textRect
|
||||
style.drawPrimitive(style.PE_FrameFocusRect, fropt, p)
|
||||
|
||||
#// Draw checkbox
|
||||
#if groupBox.subControls & style.SC_GroupBoxCheckBox:
|
||||
#box = QStyleOptionButton()
|
||||
##box.operator=(groupBox)
|
||||
#box.state = groupBox.state
|
||||
#box.rect = checkBoxRect
|
||||
#style.drawPrimitive(style.PE_IndicatorCheckBox, box, p)
|
||||
# // Draw checkbox
|
||||
# if groupBox.subControls & style.SC_GroupBoxCheckBox:
|
||||
# box = QStyleOptionButton()
|
||||
# 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 --!--
|
||||
# --!-- 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 --!--
|
||||
# --!-- 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,13 +21,12 @@ 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()
|
||||
|
||||
###############################################################################
|
||||
# UI
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# UI
|
||||
###############################################################################
|
||||
|
||||
def populatesTarget(self):
|
||||
for code in exporter.formats:
|
||||
|
@ -66,9 +62,9 @@ class compileDialog(QDialog, Ui_compileDialog):
|
|||
self.btnCompile.setEnabled(True)
|
||||
self.btnCompile.setText(self.txtBtn)
|
||||
|
||||
###############################################################################
|
||||
# USER INPUTS
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# USER INPUTS
|
||||
###############################################################################
|
||||
|
||||
def getPath(self):
|
||||
path = self.txtPath.text()
|
||||
|
@ -86,9 +82,9 @@ class compileDialog(QDialog, Ui_compileDialog):
|
|||
self.txtFilename.setText(fn[0])
|
||||
|
||||
|
||||
###############################################################################
|
||||
# COMPILE
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# COMPILE
|
||||
###############################################################################
|
||||
|
||||
def doCompile(self):
|
||||
target = self.cmbTargets.currentData()
|
||||
|
@ -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.
|
||||
"""
|
||||
|
@ -44,7 +45,7 @@ class basicHighlighter(QSyntaxHighlighter):
|
|||
bf.setAlignment(QTextCursor(self.currentBlock()).blockFormat().alignment())
|
||||
QTextCursor(self.currentBlock()).setBlockFormat(bf)
|
||||
|
||||
#self.setFormat(0, len(text), self._defaultCharFormat)
|
||||
# self.setFormat(0, len(text), self._defaultCharFormat)
|
||||
|
||||
def highlightBlockAfter(self, text):
|
||||
"""Highlighting to do after everything else.
|
||||
|
@ -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):
|
||||
|
||||
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 --!--
|
||||
# --!-- 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):
|
||||
|
@ -47,7 +48,7 @@ class completer(QWidget, Ui_completer):
|
|||
for item in filtered:
|
||||
i = QListWidgetItem(item[0])
|
||||
i.setData(Qt.UserRole, Ref.EmptyRef.format(cat[1], item[1], item[0]))
|
||||
i.setData(Qt.UserRole+1, item[2])
|
||||
i.setData(Qt.UserRole + 1, item[2])
|
||||
self.list.addItem(i)
|
||||
|
||||
self.list.setCurrentRow(1)
|
||||
|
@ -70,7 +71,7 @@ class listCompleterDelegate(QStyledItemDelegate):
|
|||
QStyledItemDelegate.__init__(self, parent)
|
||||
|
||||
def paint(self, painter, option, index):
|
||||
extra = index.data(Qt.UserRole+1)
|
||||
extra = index.data(Qt.UserRole + 1)
|
||||
if not extra:
|
||||
return QStyledItemDelegate.paint(self, painter, option, index)
|
||||
|
||||
|
|
|
@ -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 --!--
|
||||
# --!-- 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)
|
||||
|
||||
|
@ -30,9 +29,9 @@ class editorWidget(QWidget, Ui_editorWidget_ui):
|
|||
self.folderView = "cork"
|
||||
self.mw = mainWindow()
|
||||
|
||||
#def setModel(self, model):
|
||||
#self._model = model
|
||||
#self.setView()
|
||||
# def setModel(self, model):
|
||||
# self._model = model
|
||||
# self.setView()
|
||||
|
||||
def setFolderView(self, v):
|
||||
oldV = self.folderView
|
||||
|
@ -65,21 +64,21 @@ class editorWidget(QWidget, Ui_editorWidget_ui):
|
|||
self.corkView.itemDelegate().sizeHintChanged.emit(r.child(c, 0))
|
||||
|
||||
def setView(self):
|
||||
#index = mainWindow().treeRedacOutline.currentIndex()
|
||||
# index = mainWindow().treeRedacOutline.currentIndex()
|
||||
|
||||
## Couting the number of other selected items
|
||||
#sel = []
|
||||
#for i in mainWindow().treeRedacOutline.selectionModel().selection().indexes():
|
||||
#if i.column() != 0: continue
|
||||
#if i not in sel: sel.append(i)
|
||||
# Couting the number of other selected items
|
||||
# sel = []
|
||||
# for i in mainWindow().treeRedacOutline.selectionModel().selection().indexes():
|
||||
# if i.column() != 0: continue
|
||||
# if i not in sel: sel.append(i)
|
||||
|
||||
#if len(sel) != 0:
|
||||
#item = index.internalPointer()
|
||||
#else:
|
||||
#index = QModelIndex()
|
||||
#item = self.mw.mdlOutline.rootItem
|
||||
# if len(sel) != 0:
|
||||
# item = index.internalPointer()
|
||||
# else:
|
||||
# index = QModelIndex()
|
||||
# item = self.mw.mdlOutline.rootItem
|
||||
|
||||
#self.currentIndex = index
|
||||
# self.currentIndex = index
|
||||
|
||||
if self.currentIndex.isValid():
|
||||
item = self.currentIndex.internalPointer()
|
||||
|
@ -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)
|
||||
|
@ -110,7 +110,7 @@ class editorWidget(QWidget, Ui_editorWidget_ui):
|
|||
edt.setStatusTip("{} ({})".format(itm.path(), itm.type()))
|
||||
self.toggledSpellcheck.connect(edt.toggleSpellcheck, AUC)
|
||||
self.dictChanged.connect(edt.setDict, AUC)
|
||||
#edt.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
|
||||
# edt.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
|
||||
self.txtEdits.append(edt)
|
||||
l.addWidget(edt)
|
||||
|
||||
|
@ -130,28 +130,28 @@ class editorWidget(QWidget, Ui_editorWidget_ui):
|
|||
l.addItem(QSpacerItem(10, 1000, QSizePolicy.Minimum, QSizePolicy.Expanding))
|
||||
|
||||
# Display multiple selected items
|
||||
#if len(sel) > 1 and False: # Buggy and not very useful, skip
|
||||
#self.stack.setCurrentIndex(1)
|
||||
#w = QWidget()
|
||||
#l = QVBoxLayout(w)
|
||||
#self.txtEdits = []
|
||||
#for idx in sel:
|
||||
#sItem = idx.internalPointer()
|
||||
#addTitle(sItem)
|
||||
#if sItem.isFolder():
|
||||
#addChildren(sItem)
|
||||
#else:
|
||||
#addText(sItem)
|
||||
#addLine()
|
||||
#addSpacer()
|
||||
#self.scroll.setWidget(w)
|
||||
# if len(sel) > 1 and False: # Buggy and not very useful, skip
|
||||
# self.stack.setCurrentIndex(1)
|
||||
# w = QWidget()
|
||||
# l = QVBoxLayout(w)
|
||||
# self.txtEdits = []
|
||||
# for idx in sel:
|
||||
# sItem = idx.internalPointer()
|
||||
# addTitle(sItem)
|
||||
# if sItem.isFolder():
|
||||
# addChildren(sItem)
|
||||
# else:
|
||||
# addText(sItem)
|
||||
# addLine()
|
||||
# addSpacer()
|
||||
# self.scroll.setWidget(w)
|
||||
|
||||
if item and item.isFolder() and self.folderView == "text":
|
||||
self.stack.setCurrentIndex(1)
|
||||
w = QWidget()
|
||||
l = QVBoxLayout(w)
|
||||
w.setStyleSheet("background: {};".format(settings.textEditor["background"]))
|
||||
#self.scroll.setWidgetResizable(False)
|
||||
# self.scroll.setWidgetResizable(False)
|
||||
|
||||
self.txtEdits = []
|
||||
|
||||
|
@ -197,12 +197,11 @@ class editorWidget(QWidget, Ui_editorWidget_ui):
|
|||
|
||||
self.updateStatusBar()
|
||||
|
||||
|
||||
def setCurrentModelIndex(self, index=None):
|
||||
if index.isValid():
|
||||
self.currentIndex = index
|
||||
self.currentID = self.mw.mdlOutline.ID(index)
|
||||
#self._model = index.model()
|
||||
# self._model = index.model()
|
||||
else:
|
||||
self.currentIndex = QModelIndex()
|
||||
|
||||
|
@ -215,8 +214,8 @@ class editorWidget(QWidget, Ui_editorWidget_ui):
|
|||
self.setView()
|
||||
|
||||
def modelDataChanged(self, topLeft, bottomRight):
|
||||
#if self.currentID:
|
||||
#self.updateIndexFromID()
|
||||
# if self.currentID:
|
||||
# self.updateIndexFromID()
|
||||
if not self.currentIndex:
|
||||
return
|
||||
if topLeft.row() <= self.currentIndex.row() <= bottomRight.row():
|
||||
|
@ -231,10 +230,11 @@ class editorWidget(QWidget, Ui_editorWidget_ui):
|
|||
|
||||
def updateStatusBar(self):
|
||||
# Update progress
|
||||
#if self.currentIndex and self.currentIndex.isValid():
|
||||
#if self._model:
|
||||
# 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 --!--
|
||||
# --!-- 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
|
||||
|
@ -45,7 +51,7 @@ class fullScreenEditor(QWidget):
|
|||
|
||||
# Top Panel
|
||||
self.topPanel = myPanel(parent=self)
|
||||
#self.topPanel.layout().addStretch(1)
|
||||
# self.topPanel.layout().addStretch(1)
|
||||
|
||||
# Spell checking
|
||||
if enchant:
|
||||
|
@ -109,10 +115,10 @@ class fullScreenEditor(QWidget):
|
|||
# Connection
|
||||
self._index.model().dataChanged.connect(self.dataChanged)
|
||||
|
||||
#self.updateTheme()
|
||||
# self.updateTheme()
|
||||
self.showFullScreen()
|
||||
#self.showMaximized()
|
||||
#self.show()
|
||||
# self.showMaximized()
|
||||
# self.show()
|
||||
|
||||
def setLocked(self, val):
|
||||
self._locked = val
|
||||
|
@ -150,7 +156,7 @@ class fullScreenEditor(QWidget):
|
|||
r.setWidth(w)
|
||||
r.moveRight(rect.right() - rect.left())
|
||||
self.scrollBar.setGeometry(r)
|
||||
#self.scrollBar.setVisible(False)
|
||||
# self.scrollBar.setVisible(False)
|
||||
self.hideWidget(self.scrollBar)
|
||||
p = self.scrollBar.palette()
|
||||
b = QBrush(self._background.copy(self.scrollBar.geometry()))
|
||||
|
@ -172,19 +178,19 @@ class fullScreenEditor(QWidget):
|
|||
# Top / Bottom Panels
|
||||
r = QRect(0, 0, 0, 24)
|
||||
r.setWidth(rect.width())
|
||||
#r.moveLeft(rect.center().x() - r.width() / 2)
|
||||
# r.moveLeft(rect.center().x() - r.width() / 2)
|
||||
self.topPanel.setGeometry(r)
|
||||
#self.topPanel.setVisible(False)
|
||||
# self.topPanel.setVisible(False)
|
||||
self.hideWidget(self.topPanel)
|
||||
r.moveBottom(rect.bottom() - rect.top())
|
||||
self.bottomPanel.setGeometry(r)
|
||||
#self.bottomPanel.setVisible(False)
|
||||
# self.bottomPanel.setVisible(False)
|
||||
self.hideWidget(self.bottomPanel)
|
||||
self.topPanel.setColor(self._bgcolor)
|
||||
self.bottomPanel.setColor(self._bgcolor)
|
||||
|
||||
# Lst theme
|
||||
#p = self.lstThemes.palette()
|
||||
# p = self.lstThemes.palette()
|
||||
p = self.palette()
|
||||
p.setBrush(QPalette.Button, self._bgcolor)
|
||||
p.setBrush(QPalette.ButtonText, self._fgcolor)
|
||||
|
@ -195,8 +201,8 @@ class fullScreenEditor(QWidget):
|
|||
item = panel.layout().itemAt(i)
|
||||
if item.widget():
|
||||
item.widget().setPalette(p)
|
||||
#self.lstThemes.setPalette(p)
|
||||
#self.lblWC.setPalette(p)
|
||||
# self.lstThemes.setPalette(p)
|
||||
# self.lblWC.setPalette(p)
|
||||
|
||||
self.update()
|
||||
|
||||
|
@ -222,7 +228,7 @@ class fullScreenEditor(QWidget):
|
|||
|
||||
for w in [self.scrollBar, self.topPanel,
|
||||
self.bottomPanel, self.leftPanel]:
|
||||
#w.setVisible(w.geometry().contains(event.pos()))
|
||||
# w.setVisible(w.geometry().contains(event.pos()))
|
||||
if self._geometries[w].contains(event.pos()):
|
||||
self.showWidget(w)
|
||||
else:
|
||||
|
@ -241,7 +247,7 @@ class fullScreenEditor(QWidget):
|
|||
if obj == self.editor and event.type() == QEvent.Enter:
|
||||
for w in [self.scrollBar, self.topPanel,
|
||||
self.bottomPanel, self.leftPanel]:
|
||||
#w.setVisible(False)
|
||||
# w.setVisible(False)
|
||||
self.hideWidget(w)
|
||||
return QWidget.eventFilter(self, obj, event)
|
||||
|
||||
|
@ -278,11 +284,12 @@ 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)
|
||||
self._color = color
|
||||
#self.setAttribute(Qt.WA_TranslucentBackground)
|
||||
# self.setAttribute(Qt.WA_TranslucentBackground)
|
||||
self.timer = QTimer()
|
||||
self.timer.setInterval(500)
|
||||
self.timer.setSingleShot(True)
|
||||
|
@ -300,17 +307,18 @@ class myScrollBar(QScrollBar):
|
|||
painter = QPainter(self)
|
||||
|
||||
# Background (Necessary with Qt 5.2 it seems, not with 5.4)
|
||||
#painter.save()
|
||||
#painter.setPen(Qt.NoPen)
|
||||
#painter.setBrush(self.palette().brush(QPalette.Base))
|
||||
#painter.drawRect(event.rect())
|
||||
#painter.restore()
|
||||
# painter.save()
|
||||
# painter.setPen(Qt.NoPen)
|
||||
# painter.setBrush(self.palette().brush(QPalette.Base))
|
||||
# painter.drawRect(event.rect())
|
||||
# painter.restore()
|
||||
|
||||
#slider
|
||||
# slider
|
||||
r = style.subControlRect(style.CC_ScrollBar, opt, style.SC_ScrollBarSlider)
|
||||
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 --!--
|
||||
# --!-- 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 *
|
||||
# --!-- coding: utf8 --!--
|
||||
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)
|
||||
|
@ -37,9 +44,9 @@ class mainEditor(QWidget, Ui_mainEditor):
|
|||
self.btnRedacFullscreen.clicked.connect(
|
||||
self.showFullScreen, AUC)
|
||||
|
||||
###############################################################################
|
||||
# TABS
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# TABS
|
||||
###############################################################################
|
||||
|
||||
def currentEditor(self):
|
||||
return self.tab.currentWidget()
|
||||
|
@ -65,7 +72,7 @@ class mainEditor(QWidget, Ui_mainEditor):
|
|||
self.updateThingsVisible(index)
|
||||
|
||||
def closeTab(self, index):
|
||||
#FIXME: submit data if textedit?
|
||||
# FIXME: submit data if textedit?
|
||||
w = self.tab.widget(index)
|
||||
self.tab.removeTab(index)
|
||||
w.deleteLater()
|
||||
|
@ -73,9 +80,9 @@ class mainEditor(QWidget, Ui_mainEditor):
|
|||
def allTabs(self):
|
||||
return [self.tab.widget(i) for i in range(self.tab.count())]
|
||||
|
||||
###############################################################################
|
||||
# SELECTION AND UPDATES
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# SELECTION AND UPDATES
|
||||
###############################################################################
|
||||
|
||||
def selectionChanged(self):
|
||||
if self._updating:
|
||||
|
@ -120,10 +127,9 @@ class mainEditor(QWidget, Ui_mainEditor):
|
|||
self.currentEditor().setCurrentModelIndex(index)
|
||||
self.tab.setTabText(self.tab.currentIndex(), title)
|
||||
|
||||
|
||||
###############################################################################
|
||||
# UI
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# UI
|
||||
###############################################################################
|
||||
|
||||
def updateThingsVisible(self, index):
|
||||
if index.isValid():
|
||||
|
@ -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)
|
||||
|
@ -166,7 +171,7 @@ class mainEditor(QWidget, Ui_mainEditor):
|
|||
wc = item.data(Outline.wordCount.value)
|
||||
goal = item.data(Outline.goal.value)
|
||||
progress = item.data(Outline.goalPercentage.value)
|
||||
#mw = qApp.activeWindow()
|
||||
# mw = qApp.activeWindow()
|
||||
|
||||
if not wc:
|
||||
wc = 0
|
||||
|
@ -188,9 +193,9 @@ class mainEditor(QWidget, Ui_mainEditor):
|
|||
self.lblRedacWC.setText(self.tr("{} words").format(
|
||||
locale.format("%d", wc, grouping=True)))
|
||||
|
||||
###############################################################################
|
||||
# VIEWS
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# VIEWS
|
||||
###############################################################################
|
||||
|
||||
def setFolderView(self, view):
|
||||
if self.currentEditor():
|
||||
|
@ -217,9 +222,9 @@ class mainEditor(QWidget, Ui_mainEditor):
|
|||
if self.currentEditor():
|
||||
self._fullScreen = fullScreenEditor(self.currentEditor().currentIndex)
|
||||
|
||||
###############################################################################
|
||||
# DICT AND STUFF LIKE THAT
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# DICT AND STUFF LIKE THAT
|
||||
###############################################################################
|
||||
|
||||
def setDict(self, dict):
|
||||
print(dict)
|
||||
|
@ -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``,
|
||||
|
@ -54,7 +57,7 @@ def t2tFormatSelection(editor, style):
|
|||
# Adjusts selection to exclude the markup
|
||||
while text[start:start + 1] == formatChar:
|
||||
start += 1
|
||||
while text[end - 1:end] ==formatChar:
|
||||
while text[end - 1:end] == formatChar:
|
||||
end -= 1
|
||||
|
||||
# Get the text without formatting, and the array of format
|
||||
|
@ -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
|
||||
|
@ -140,7 +145,7 @@ def textToFormatArray(text):
|
|||
pos = r.indexIn(text, 0)
|
||||
lastPos = 0
|
||||
while pos >= 0:
|
||||
#We have a winner
|
||||
# We have a winner
|
||||
rList += [0] * (pos - lastPos)
|
||||
rList += [2] * 2
|
||||
rList += [1] * len(r.cap(2))
|
||||
|
@ -231,7 +236,7 @@ def reformatText(text, markupArray):
|
|||
markup = ["**", "//", "__", "--", "``", "''"]
|
||||
|
||||
for k, m in enumerate(markupArray):
|
||||
#m = markupArray[k]
|
||||
# m = markupArray[k]
|
||||
_open = False # Are we in an _openned markup
|
||||
d = 0
|
||||
alreadySeen = []
|
||||
|
@ -256,7 +261,7 @@ def reformatText(text, markupArray):
|
|||
for j, m2 in enumerate(markupArray):
|
||||
# The other array still have the same length
|
||||
if j > k:
|
||||
#Insert 2 for bold, 3 for italic, etc.
|
||||
# Insert 2 for bold, 3 for italic, etc.
|
||||
m2.insert(i + d, k + 2)
|
||||
m2.insert(i + d, k + 2)
|
||||
alreadySeen = []
|
||||
|
@ -267,24 +272,24 @@ def reformatText(text, markupArray):
|
|||
for j, m2 in enumerate(markupArray):
|
||||
# The other array still have the same length
|
||||
if j > k:
|
||||
#Insert 2 for bold, 3 for italic, etc.
|
||||
# Insert 2 for bold, 3 for italic, etc.
|
||||
m2.insert(i + d, k + 2)
|
||||
m2.insert(i + d, k + 2)
|
||||
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 + ')')
|
||||
#r.setMinimal(True)
|
||||
#text.replace(r, "\\2\\1\\3\\4")
|
||||
# r = QRegExp(r'(' + markup * 2 + ')(\s+)(.+)(' + markup * 2 + ')')
|
||||
# r.setMinimal(True)
|
||||
# text.replace(r, "\\2\\1\\3\\4")
|
||||
text = re.sub(r'(' + markup * 2 + ')(\s+?)(.+?)(' + markup * 2 + ')',
|
||||
"\\2\\1\\3\\4",
|
||||
text)
|
||||
#r = QRegExp(r'(' + markup * 2 + ')(.+)(\s+)(' + markup * 2 + ')')
|
||||
#r.setMinimal(True)
|
||||
#text.replace(r, "\\1\\2\\4\\3")
|
||||
# r = QRegExp(r'(' + markup * 2 + ')(.+)(\s+)(' + markup * 2 + ')')
|
||||
# r.setMinimal(True)
|
||||
# text.replace(r, "\\1\\2\\4\\3")
|
||||
text = re.sub(r'(' + markup * 2 + ')(.+?)(\s+?)(' + markup * 2 + ')',
|
||||
"\\1\\2\\4\\3",
|
||||
text)
|
||||
|
@ -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)
|
||||
|
||||
|
@ -327,7 +332,7 @@ class State:
|
|||
RAW_AREA_ENDS = 20
|
||||
TAGGED_AREA_BEGINS = 21
|
||||
TAGGED_AREA_ENDS = 22
|
||||
#LINE
|
||||
# LINE
|
||||
COMMENT_LINE = 30
|
||||
CODE_LINE = 31
|
||||
RAW_LINE = 32
|
||||
|
@ -346,7 +351,7 @@ class State:
|
|||
# TABLE
|
||||
TABLE_LINE = 50
|
||||
TABLE_HEADER = 51
|
||||
#OTHER
|
||||
# OTHER
|
||||
MARKUP = 60
|
||||
LINKS = 61
|
||||
MACRO = 62
|
||||
|
|
|
@ -1,22 +1,26 @@
|
|||
#!/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.
|
||||
# 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):
|
||||
class t2tHighlighter(basicHighlighter):
|
||||
"""Syntax highlighter for the Txt2Tags language.
|
||||
"""
|
||||
|
||||
|
@ -81,7 +85,7 @@ class t2tHighlighter (basicHighlighter):
|
|||
self.identifyBlock(block)
|
||||
# formatBlock prevent undo/redo from working
|
||||
# TODO: find a todo/undo compatible way of formatting block
|
||||
#self.formatBlock(block)
|
||||
# self.formatBlock(block)
|
||||
|
||||
state = blockUserData.getUserState(block)
|
||||
data = blockUserData.getUserData(block)
|
||||
|
@ -89,12 +93,13 @@ class t2tHighlighter (basicHighlighter):
|
|||
|
||||
op = self.style.format(State.MARKUP)
|
||||
|
||||
#self.setFormat(0, len(text), self.style.format(State.DEFAULT))
|
||||
# self.setFormat(0, len(text), self.style.format(State.DEFAULT))
|
||||
|
||||
# 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:
|
||||
|
@ -161,15 +166,15 @@ class t2tHighlighter (basicHighlighter):
|
|||
self.setFormat(i, 1, self.style.format(lineState))
|
||||
|
||||
# Lists
|
||||
#if text == " p": print(data.isList())
|
||||
# if text == " p": print(data.isList())
|
||||
if data.isList():
|
||||
r = QRegExp(r'^\s*[\+\-\:]? ?')
|
||||
r.indexIn(text)
|
||||
self.setFormat(0, r.matchedLength(), self.style.format(State.LIST_BULLET))
|
||||
#if state == State.LIST_BEGINS:
|
||||
#r = QRegExp(r'^\s*[+-:] ')
|
||||
#r.indexIn(text)
|
||||
#self.setFormat(0, r.matchedLength(), self.style.format(State.LIST_BULLET))
|
||||
# if state == State.LIST_BEGINS:
|
||||
# r = QRegExp(r'^\s*[+-:] ')
|
||||
# r.indexIn(text)
|
||||
# self.setFormat(0, r.matchedLength(), self.style.format(State.LIST_BULLET))
|
||||
|
||||
if state == State.LIST_ENDS:
|
||||
self.setFormat(0, len(text), self.style.format(State.LIST_BULLET_ENDS))
|
||||
|
@ -181,8 +186,8 @@ class t2tHighlighter (basicHighlighter):
|
|||
if pos >= 0:
|
||||
f = self.style.format(state)
|
||||
# Uncomment for markup to be same size as title
|
||||
#op = self.formats(preset="markup",
|
||||
#base=self.formats(preset=state))
|
||||
# op = self.formats(preset="markup",
|
||||
# base=self.formats(preset=state))
|
||||
self.setFormat(r.pos(2), len(r.cap(2)), f)
|
||||
self.setFormat(r.pos(1), len(r.cap(1)), op)
|
||||
self.setFormat(r.pos(3), len(r.cap(3)), op)
|
||||
|
@ -202,8 +207,8 @@ class t2tHighlighter (basicHighlighter):
|
|||
|
||||
# Inline formatting
|
||||
if state not in [
|
||||
#State.COMMENT_AREA,
|
||||
#State.COMMENT_LINE,
|
||||
# State.COMMENT_AREA,
|
||||
# State.COMMENT_LINE,
|
||||
State.RAW_AREA,
|
||||
State.RAW_LINE,
|
||||
State.CODE_AREA,
|
||||
|
@ -236,8 +241,8 @@ class t2tHighlighter (basicHighlighter):
|
|||
pos = r.indexIn(text)
|
||||
links = []
|
||||
while pos >= 0:
|
||||
#TODO: The text should not be formatted if [**not bold**]
|
||||
#if max([k[pos] for k in formatArray]) == 0 or 1 == 1:
|
||||
# TODO: The text should not be formatted if [**not bold**]
|
||||
# if max([k[pos] for k in formatArray]) == 0 or 1 == 1:
|
||||
self.setFormat(pos, 1,
|
||||
self.style.format(State.MARKUP))
|
||||
self.setFormat(pos + 1, len(r.cap(0)) - 1,
|
||||
|
@ -260,12 +265,12 @@ class t2tHighlighter (basicHighlighter):
|
|||
# - also: adresse@email.com, ftp://, www2, www3, etc.
|
||||
# - But for now, does the job
|
||||
r = QRegExp(r'http://[^\s]*|www\.[a-zA-Z0-9-_]+\.[a-zA-Z0-9-_]+[^\s]*')
|
||||
#r.setMinimal(True)
|
||||
# r.setMinimal(True)
|
||||
pos = r.indexIn(text)
|
||||
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
|
||||
# print pos, k[0], k[1]
|
||||
if k[0] < pos < k[0] + k[1]: # already highlighted
|
||||
break
|
||||
else:
|
||||
self.setFormat(pos, len(r.cap(0)), self.style.format(State.LINKS))
|
||||
|
@ -293,34 +298,33 @@ class t2tHighlighter (basicHighlighter):
|
|||
if self.editor.highlightWord:
|
||||
if self.editor.highligtCS and self.editor.highlightWord in text or \
|
||||
not self.editor.highlightCs and self.editor.highlightWord.lower() in text.lower():
|
||||
#if self.editor.highlightCS:
|
||||
#s = self.editor.highlightWord
|
||||
#else:
|
||||
#s = self.editor.highlightWord.toLower()
|
||||
#print(s)
|
||||
# if self.editor.highlightCS:
|
||||
# s = self.editor.highlightWord
|
||||
# else:
|
||||
# s = self.editor.highlightWord.toLower()
|
||||
# print(s)
|
||||
p = text.indexOf(self.editor.highlightWord, cs=self.editor.highlightCS)
|
||||
while p >= 0:
|
||||
self.setFormat(p, len(self.editor.highlightWord),
|
||||
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()
|
||||
##if len(sel) > 5: self.keywordRules.append((QRegExp(sel), "selected"))
|
||||
|
||||
## Do keyword formatting
|
||||
#for expression, style in self.keywordRules:
|
||||
#expression.setMinimal( True )
|
||||
#index = expression.indexIn(text, 0)
|
||||
# for expression, style in self.keywordRules:
|
||||
# expression.setMinimal( True )
|
||||
# index = expression.indexIn(text, 0)
|
||||
|
||||
## There might be more than one on the same line
|
||||
#while index >= 0:
|
||||
#length = expression.cap(0).length()
|
||||
#f = self.formats(preset=style, base=self.formats(index))
|
||||
#self.setFormat(index, length, f)
|
||||
#index = expression.indexIn(text, index + length)
|
||||
# while index >= 0:
|
||||
# length = expression.cap(0).length()
|
||||
# f = self.formats(preset=style, base=self.formats(index))
|
||||
# self.setFormat(index, length, f)
|
||||
# index = expression.indexIn(text, index + length)
|
||||
|
||||
basicHighlighter.highlightBlockAfter(self, text)
|
||||
|
||||
|
@ -333,19 +337,19 @@ class t2tHighlighter (basicHighlighter):
|
|||
|
||||
# Header Lines
|
||||
# No header line here
|
||||
#if block.blockNumber() == 0:
|
||||
#block.setUserState(State.HEADER_LINE)
|
||||
#return
|
||||
#elif block.blockNumber() in [1, 2] and \
|
||||
#self.document().findBlockByNumber(0).text():
|
||||
#block.setUserState(State.HEADER_LINE)
|
||||
#return
|
||||
# if block.blockNumber() == 0:
|
||||
# block.setUserState(State.HEADER_LINE)
|
||||
# return
|
||||
# elif block.blockNumber() in [1, 2] and \
|
||||
# self.document().findBlockByNumber(0).text():
|
||||
# block.setUserState(State.HEADER_LINE)
|
||||
# return
|
||||
|
||||
state = 0
|
||||
inList = False
|
||||
blankLinesBefore = 0
|
||||
|
||||
#if text.contains(QRegExp(r'^\s*[-+:] [^ ].*[^-+]{1}\s*$')):
|
||||
# if text.contains(QRegExp(r'^\s*[-+:] [^ ].*[^-+]{1}\s*$')):
|
||||
if QRegExp(r'^\s*[-+:] [^ ].*[^-+]{1}\s*$').indexIn(text) != -1:
|
||||
state = State.LIST_BEGINS
|
||||
|
||||
|
@ -354,7 +358,7 @@ class t2tHighlighter (basicHighlighter):
|
|||
inList = True
|
||||
|
||||
# listLevel and leadingSpaces
|
||||
#FIXME: not behaving exactly correctly...
|
||||
# FIXME: not behaving exactly correctly...
|
||||
lastData = blockUserData.getUserData(block.previous())
|
||||
if state == State.LIST_BEGINS:
|
||||
leadingSpaces = QRegExp(r'[-+:]').indexIn(text, 0)
|
||||
|
@ -423,8 +427,8 @@ class t2tHighlighter (basicHighlighter):
|
|||
break
|
||||
|
||||
if state in [State.BLOCKQUOTE_LINE, State.LIST_ENDS]:
|
||||
#FIXME: doesn't work exactly. Closes only the current level, not
|
||||
#FIXME: the whole list.
|
||||
# FIXME: doesn't work exactly. Closes only the current level, not
|
||||
# FIXME: the whole list.
|
||||
inList = False
|
||||
|
||||
if inList and not state == State.LIST_BEGINS:
|
||||
|
@ -439,8 +443,8 @@ class t2tHighlighter (basicHighlighter):
|
|||
"""
|
||||
Formats the block according to its state.
|
||||
"""
|
||||
#TODO: Use QTextDocument format presets, and QTextBlock's
|
||||
#TODO: blockFormatIndex. And move that in t2tHighlighterStyle.
|
||||
# TODO: Use QTextDocument format presets, and QTextBlock's
|
||||
# TODO: blockFormatIndex. And move that in t2tHighlighterStyle.
|
||||
state = block.userState()
|
||||
blockFormat = QTextBlockFormat()
|
||||
|
||||
|
@ -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,8 +463,8 @@ class t2tHighlighter (basicHighlighter):
|
|||
return 0
|
||||
|
||||
def isList(self, block):
|
||||
"Returns TRUE if the block is in a list."
|
||||
if block.userState() == State.LIST_BEGINS or\
|
||||
"""Returns TRUE if the block is in a list."""
|
||||
if block.userState() == State.LIST_BEGINS or \
|
||||
block.userState() >= 100:
|
||||
return True
|
||||
|
||||
|
@ -495,20 +499,20 @@ class t2tHighlighter (basicHighlighter):
|
|||
try:
|
||||
import codecs
|
||||
f = self.editor.fileWidget.file
|
||||
d = QDir.cleanPath(QFileInfo(f).absoluteDir().absolutePath()+"/"+c)
|
||||
d = QDir.cleanPath(QFileInfo(f).absoluteDir().absolutePath() + "/" + c)
|
||||
file = codecs.open(d, 'r', "utf-8")
|
||||
except:
|
||||
print(("Error: cannot open {}.".format(c)))
|
||||
continue
|
||||
# We add the content to the current lines of the current document
|
||||
lines += file.readlines() #lines.extend(file.readlines())
|
||||
lines += file.readlines() # lines.extend(file.readlines())
|
||||
|
||||
#b = self.thisDocument.firstBlock()
|
||||
# b = self.thisDocument.firstBlock()
|
||||
lastColor = ""
|
||||
|
||||
#while b.isValid():
|
||||
# while b.isValid():
|
||||
for l in lines:
|
||||
text = l #b.text()
|
||||
text = l # b.text()
|
||||
r = QRegExp(r'^%!p[or][se]t?proc[^\s]*\s*:\s*(\'[^\']*\'|\"[^\"]*\")\s*(\'[^\']*\'|\"[^\"]*\")')
|
||||
if r.indexIn(text) != -1:
|
||||
rule = r.cap(1)[1:-1]
|
||||
|
@ -517,27 +521,27 @@ class t2tHighlighter (basicHighlighter):
|
|||
self.inDocRules.append((str(rule), lastColor))
|
||||
# Check if previous block is a comment like it should
|
||||
else:
|
||||
previousText = lines[lines.indexOf(l)-1] #b.previous().text()
|
||||
previousText = lines[lines.indexOf(l) - 1] # b.previous().text()
|
||||
r = QRegExp(r'^%.*\s\((.*)\)')
|
||||
if r.indexIn(previousText) != -1:
|
||||
lastColor = r.cap(1)
|
||||
self.inDocRules.append((str(rule), lastColor))
|
||||
else:
|
||||
lastColor = ""
|
||||
#b = b.next()
|
||||
# b = b.next()
|
||||
|
||||
if oldRules != self.inDocRules:
|
||||
#Rules have changed, we need to rehighlight
|
||||
#print("Rules have changed.", len(self.inDocRules))
|
||||
#self.rehighlight() # Doesn't work (seg fault), why?
|
||||
# Rules have changed, we need to rehighlight
|
||||
# print("Rules have changed.", len(self.inDocRules))
|
||||
# self.rehighlight() # Doesn't work (seg fault), why?
|
||||
pass
|
||||
#b = self.thisDocument.firstBlock()
|
||||
#while b.isValid():
|
||||
#for (r, c) in self.inDocRules:
|
||||
#r = QRegExp(r)
|
||||
#pos = r.indexIn(b.text())
|
||||
#if pos >= 0:
|
||||
#print("rehighlighting:", b.text())
|
||||
#self.rehighlightBlock(b)
|
||||
#break
|
||||
#b = b.next()
|
||||
# b = self.thisDocument.firstBlock()
|
||||
# while b.isValid():
|
||||
# for (r, c) in self.inDocRules:
|
||||
# r = QRegExp(r)
|
||||
# pos = r.indexIn(b.text())
|
||||
# if pos >= 0:
|
||||
# print("rehighlighting:", b.text())
|
||||
# self.rehighlightBlock(b)
|
||||
# break
|
||||
# b = b.next()
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
#!/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)
|
||||
# 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 ():
|
||||
class t2tHighlighterStyle():
|
||||
"""Style for the Syntax highlighter for the Txt2Tags language.
|
||||
"""
|
||||
|
||||
|
@ -21,7 +24,7 @@ class t2tHighlighterStyle ():
|
|||
self._defaultCharFormat = charFormat
|
||||
|
||||
# Defaults
|
||||
#self.defaultFontPointSize = self.editor.defaultFontPointSize
|
||||
# self.defaultFontPointSize = self.editor.defaultFontPointSize
|
||||
self.defaultFontFamily = qApp.font().family()
|
||||
self.tabStopWidth = 40
|
||||
|
||||
|
@ -29,7 +32,7 @@ class t2tHighlighterStyle ():
|
|||
|
||||
if self.name == "Default":
|
||||
self.initDefaults()
|
||||
#Temporary other theme
|
||||
# Temporary other theme
|
||||
elif self.name == "Monospace":
|
||||
self.defaultFontFamily = "Monospace"
|
||||
self.initDefaults()
|
||||
|
@ -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:
|
||||
|
@ -109,12 +112,12 @@ class t2tHighlighterStyle ():
|
|||
blockFormat.setIndent(0)
|
||||
blockFormat.setTextIndent(-self.tabStopWidth * n)
|
||||
blockFormat.setLeftMargin(self.tabStopWidth * n)
|
||||
#blockFormat.setRightMargin(self.editor.contentsRect().width()
|
||||
# blockFormat.setRightMargin(self.editor.contentsRect().width()
|
||||
# - self.editor.lineNumberAreaWidth()
|
||||
# - fm.width("X") * self.editor.LimitLine
|
||||
#+ self.editor.tabStopWidth())
|
||||
# + self.editor.tabStopWidth())
|
||||
blockFormat.setAlignment(Qt.AlignJustify)
|
||||
if self.name == "Default" :
|
||||
if self.name == "Default":
|
||||
blockFormat.setTopMargin(5)
|
||||
blockFormat.setBottomMargin(5)
|
||||
elif state == State.HEADER_LINE:
|
||||
|
@ -133,7 +136,7 @@ class t2tHighlighterStyle ():
|
|||
blockUserData.getUserData(block).listSymbol())
|
||||
blockFormat.setTextIndent(-fm)
|
||||
blockFormat.setLeftMargin(fm)
|
||||
if blockUserData.getUserState(block) == State.LIST_BEGINS and\
|
||||
if blockUserData.getUserState(block) == State.LIST_BEGINS and \
|
||||
self.name == "Default":
|
||||
blockFormat.setTopMargin(5)
|
||||
return blockFormat
|
||||
|
@ -145,13 +148,14 @@ class t2tHighlighterStyle ():
|
|||
"""
|
||||
|
||||
_color = QColor()
|
||||
#_format = QTextCharFormat()
|
||||
#_format.setFont(self.editor.font())
|
||||
#size = _format.fontPointSize()
|
||||
# _format = QTextCharFormat()
|
||||
# _format.setFont(self.editor.font())
|
||||
# size = _format.fontPointSize()
|
||||
_format = QTextCharFormat(self._defaultCharFormat)
|
||||
|
||||
# Base
|
||||
if base: _format = base
|
||||
if base:
|
||||
_format = base
|
||||
|
||||
# Presets
|
||||
if preset in [State.CODE_AREA, State.CODE_LINE, "code"]:
|
||||
|
@ -165,15 +169,15 @@ class t2tHighlighterStyle ():
|
|||
color = "darkGreen"
|
||||
|
||||
if preset in [State.SETTINGS_LINE, "setting", State.MACRO]:
|
||||
#style = "italic"
|
||||
# style = "italic"
|
||||
color = "magenta"
|
||||
|
||||
if preset in [State.BLOCKQUOTE_LINE]:
|
||||
color = "red"
|
||||
|
||||
if preset in [State.HEADER_LINE]:
|
||||
size = size * 2
|
||||
#print size
|
||||
size *= 2
|
||||
# print size
|
||||
|
||||
if preset in [State.RAW_AREA, State.RAW_LINE, "raw"]:
|
||||
color = "blue"
|
||||
|
@ -211,8 +215,8 @@ class t2tHighlighterStyle ():
|
|||
fixedPitch = True
|
||||
|
||||
if preset == State.LINKS:
|
||||
color="blue"
|
||||
#style="underline"
|
||||
color = "blue"
|
||||
# style="underline"
|
||||
|
||||
if preset == "selected":
|
||||
_format.setBackground(QColor("yellow"))
|
||||
|
@ -220,9 +224,9 @@ class t2tHighlighterStyle ():
|
|||
if preset == "higlighted":
|
||||
bgcolor = "yellow"
|
||||
|
||||
#if preset == State.DEFAULT:
|
||||
#size = self.defaultFontPointSize
|
||||
#_format.setFontFamily(self.defaultFontFamily)
|
||||
# if preset == State.DEFAULT:
|
||||
# size = self.defaultFontPointSize
|
||||
# _format.setFontFamily(self.defaultFontFamily)
|
||||
|
||||
# Manual formatting
|
||||
if color:
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#!/usr/bin/env python
|
||||
#--!-- coding: utf8 --!--
|
||||
# --!-- 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:
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
#!/usr/bin/env python
|
||||
#--!-- coding: utf8 --!--
|
||||
# --!-- 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.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,35 +190,35 @@ 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)
|
||||
|
||||
#p = editor.palette()
|
||||
# p = editor.palette()
|
||||
##p.setBrush(QPalette.Base, QBrush(pixmap.copy(x, y, width, height)))
|
||||
#p.setBrush(QPalette.Base, QColor(Qt.transparent))
|
||||
#p.setColor(QPalette.Text, QColor(themeDatas["Text/Color"]))
|
||||
#p.setColor(QPalette.Highlight, QColor(themeDatas["Text/Color"]))
|
||||
#p.setColor(QPalette.HighlightedText, Qt.black if qGray(QColor(themeDatas["Text/Color"]).rgb()) > 127 else Qt.white)
|
||||
#editor.setPalette(p)
|
||||
# p.setBrush(QPalette.Base, QColor(Qt.transparent))
|
||||
# p.setColor(QPalette.Text, QColor(themeDatas["Text/Color"]))
|
||||
# p.setColor(QPalette.Highlight, QColor(themeDatas["Text/Color"]))
|
||||
# p.setColor(QPalette.HighlightedText, Qt.black if qGray(QColor(themeDatas["Text/Color"]).rgb()) > 127 else Qt.white)
|
||||
# editor.setPalette(p)
|
||||
|
||||
editor.setAttribute(Qt.WA_NoSystemBackground, True)
|
||||
|
||||
bf = getThemeBlockFormat(themeDatas)
|
||||
editor.setDefaultBlockFormat(bf)
|
||||
|
||||
#b = editor.document().firstBlock()
|
||||
#cursor = editor.textCursor()
|
||||
#cursor.setBlockFormat(bf)
|
||||
#while b.isValid():
|
||||
#bf2 = b.blockFormat()
|
||||
#bf2.merge(bf)
|
||||
#cursor.setPosition(b.position())
|
||||
# b = editor.document().firstBlock()
|
||||
# cursor = editor.textCursor()
|
||||
# cursor.setBlockFormat(bf)
|
||||
# while b.isValid():
|
||||
# bf2 = b.blockFormat()
|
||||
# bf2.merge(bf)
|
||||
# cursor.setPosition(b.position())
|
||||
##cursor.setPosition(b.position(), QTextCursor.KeepAnchor)
|
||||
#cursor.setBlockFormat(bf2)
|
||||
#b = b.next()
|
||||
# cursor.setBlockFormat(bf2)
|
||||
# b = b.next()
|
||||
|
||||
editor.setTabStopWidth(themeDatas["Spacings/TabWidth"])
|
||||
editor.document().setIndentWidth(themeDatas["Spacings/TabWidth"])
|
||||
|
@ -215,13 +226,13 @@ def setThemeEditorDatas(editor, themeDatas, pixmap, screenRect):
|
|||
editor.highlighter.setMisspelledColor(QColor(themeDatas["Text/Misspelled"]))
|
||||
|
||||
cf = QTextCharFormat()
|
||||
#f = QFont()
|
||||
#f.fromString(themeDatas["Text/Font"])
|
||||
#cf.setFont(f)
|
||||
# f = QFont()
|
||||
# f.fromString(themeDatas["Text/Font"])
|
||||
# cf.setFont(f)
|
||||
editor.highlighter.setDefaultCharFormat(cf)
|
||||
f = QFont()
|
||||
f.fromString(themeDatas["Text/Font"])
|
||||
#editor.setFont(f)
|
||||
# editor.setFont(f)
|
||||
|
||||
editor.setStyleSheet("""
|
||||
background: transparent;
|
||||
|
@ -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)
|
||||
|
@ -270,7 +279,7 @@ def addThemePreviewText(pixmap, themeDatas, screenRect):
|
|||
## Text Options
|
||||
##themeDatas["Text/Color"]
|
||||
##themeDatas["Text/Font"]
|
||||
#themeDatas["Text/Misspelled"]
|
||||
# themeDatas["Text/Misspelled"]
|
||||
|
||||
## Paragraph Options
|
||||
##themeDatas["Spacings/IndendFirstLine"]
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
#!/usr/bin/env python
|
||||
#--!-- coding: utf8 --!--
|
||||
# --!-- 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 --!--
|
||||
# --!-- 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)
|
||||
|
@ -29,7 +31,7 @@ class revisions(QWidget, Ui_revisions):
|
|||
self.btnRestore.clicked.connect(self.restore)
|
||||
self.btnRestore.setEnabled(False)
|
||||
|
||||
#self.list.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
||||
# self.list.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
||||
|
||||
self.updateTimer = QTimer()
|
||||
self.updateTimer.setSingleShot(True)
|
||||
|
@ -84,7 +86,7 @@ class revisions(QWidget, Ui_revisions):
|
|||
if self._index and \
|
||||
topLeft.column() <= Outline.revisions.value <= bottomRight.column() and \
|
||||
topLeft.row() <= self._index.row() <= bottomRight.row():
|
||||
#self.update()
|
||||
# self.update()
|
||||
self.updateTimer.start()
|
||||
|
||||
def update(self):
|
||||
|
@ -92,13 +94,13 @@ class revisions(QWidget, Ui_revisions):
|
|||
item = self._index.internalPointer()
|
||||
rev = item.revisions()
|
||||
# Sort revisions
|
||||
rev = sorted(rev, key=lambda x:x[0], reverse=True)
|
||||
rev = sorted(rev, key=lambda x: x[0], reverse=True)
|
||||
for r in rev:
|
||||
timestamp = datetime.datetime.fromtimestamp(r[0]).strftime('%Y-%m-%d %H:%M:%S')
|
||||
readable = self.readableDelta(r[0])
|
||||
i = QListWidgetItem(readable)
|
||||
i.setData(Qt.UserRole, r[0])
|
||||
i.setData(Qt.UserRole+1, timestamp)
|
||||
i.setData(Qt.UserRole + 1, timestamp)
|
||||
self.list.addItem(i)
|
||||
|
||||
def readableDelta(self, timestamp):
|
||||
|
@ -124,7 +126,7 @@ class revisions(QWidget, Ui_revisions):
|
|||
self.actShowSpaces.setEnabled(self.actShowDiff.isChecked())
|
||||
self.actDiffOnly.setEnabled(self.actShowDiff.isChecked())
|
||||
|
||||
#FIXME: Errors in line number
|
||||
# FIXME: Errors in line number
|
||||
i = self.list.currentItem()
|
||||
|
||||
if not i:
|
||||
|
@ -156,7 +158,7 @@ class revisions(QWidget, Ui_revisions):
|
|||
if self.actShowSpaces.isChecked():
|
||||
_format = lambda x: x.replace(" ", "␣ ")
|
||||
else:
|
||||
_format = lambda x:x
|
||||
_format = lambda x: x
|
||||
|
||||
extra = "" if item.type() == "html" else "<br>"
|
||||
diff = [d for d in diff if d and not d[:2] == "? "]
|
||||
|
@ -166,8 +168,8 @@ class revisions(QWidget, Ui_revisions):
|
|||
l = diff[n]
|
||||
op = l[:2]
|
||||
txt = l[2:]
|
||||
op2 = diff[n+1][:2] if n+1 < len(diff) else None
|
||||
txt2 = diff[n+1][2:] if n+1 < len(diff) else None
|
||||
op2 = diff[n + 1][:2] if n + 1 < len(diff) else None
|
||||
txt2 = diff[n + 1][2:] if n + 1 < len(diff) else None
|
||||
|
||||
if skip:
|
||||
skip = False
|
||||
|
@ -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)
|
||||
|
@ -228,7 +234,7 @@ class revisions(QWidget, Ui_revisions):
|
|||
textBefore = [r[1] for r in item.revisions() if r[0] == ts][0]
|
||||
index = self._index.sibling(self._index.row(), Outline.text.value)
|
||||
self._index.model().setData(index, textBefore)
|
||||
#item.setData(Outline.text.value, textBefore)
|
||||
# item.setData(Outline.text.value, textBefore)
|
||||
|
||||
def delete(self):
|
||||
i = self.list.currentItem()
|
||||
|
@ -274,7 +280,7 @@ class listCompleterDelegate(QStyledItemDelegate):
|
|||
QStyledItemDelegate.__init__(self, parent)
|
||||
|
||||
def paint(self, painter, option, index):
|
||||
extra = index.data(Qt.UserRole+1)
|
||||
extra = index.data(Qt.UserRole + 1)
|
||||
if not extra:
|
||||
return QStyledItemDelegate.paint(self, painter, option, index)
|
||||
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
#!/usr/bin/env python
|
||||
#--!-- coding: utf8 --!--
|
||||
# --!-- 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)
|
||||
|
@ -117,9 +118,9 @@ class search(QWidget, Ui_search):
|
|||
def openItem(self, item):
|
||||
r = Ref.textReference(item.data(Qt.UserRole))
|
||||
Ref.open(r)
|
||||
#mw = mainWindow()
|
||||
#index = mw.mdlOutline.getIndexByID(item.data(Qt.UserRole))
|
||||
#mw.mainEditor.setCurrentModelIndex(index, newTab=True)
|
||||
# mw = mainWindow()
|
||||
# index = mw.mdlOutline.getIndexByID(item.data(Qt.UserRole))
|
||||
# mw.mainEditor.setCurrentModelIndex(index, newTab=True)
|
||||
|
||||
|
||||
class listResultDelegate(QStyledItemDelegate):
|
||||
|
@ -127,7 +128,7 @@ class listResultDelegate(QStyledItemDelegate):
|
|||
QStyledItemDelegate.__init__(self, parent)
|
||||
|
||||
def paint(self, painter, option, index):
|
||||
extra = index.data(Qt.UserRole+1)
|
||||
extra = index.data(Qt.UserRole + 1)
|
||||
if not extra:
|
||||
return QStyledItemDelegate.paint(self, painter, option, index)
|
||||
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
#!/usr/bin/env python
|
||||
#--!-- coding: utf8 --!--
|
||||
# --!-- 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 --!--
|
||||
# --!-- 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/>
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
#!/usr/bin/env python
|
||||
#--!-- coding: utf8 --!--
|
||||
# --!-- coding: utf8 --!--
|
||||
|
||||
|
||||
|
||||
|
||||
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 --!--
|
||||
# --!-- 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 --!--
|
||||
# --!-- 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)
|
||||
|
@ -31,19 +33,19 @@ class cmbOutlinePersoChoser(QComboBox):
|
|||
|
||||
for importance in range(3):
|
||||
self.addItem(l[importance])
|
||||
self.setItemData(self.count()-1, QBrush(QColor(Qt.darkBlue)), Qt.ForegroundRole)
|
||||
self.setItemData(self.count()-1, QBrush(QColor(Qt.blue).lighter(190)), Qt.BackgroundRole)
|
||||
item = self.model().item(self.count()-1)
|
||||
self.setItemData(self.count() - 1, QBrush(QColor(Qt.darkBlue)), Qt.ForegroundRole)
|
||||
self.setItemData(self.count() - 1, QBrush(QColor(Qt.blue).lighter(190)), Qt.BackgroundRole)
|
||||
item = self.model().item(self.count() - 1)
|
||||
item.setFlags(Qt.ItemIsEnabled)
|
||||
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 --!--
|
||||
# --!-- 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 --!--
|
||||
# --!-- 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 --!--
|
||||
# --!-- 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.
|
||||
|
@ -52,11 +56,11 @@ class corkDelegate(QStyledItemDelegate):
|
|||
edt.setFocusPolicy(Qt.StrongFocus)
|
||||
edt.setFrame(False)
|
||||
f = QFont(option.font)
|
||||
#f.setPointSize(f.pointSize() + 1)
|
||||
# f.setPointSize(f.pointSize() + 1)
|
||||
f.setBold(True)
|
||||
edt.setFont(f)
|
||||
edt.setAlignment(Qt.AlignCenter)
|
||||
#edt.setGeometry(self.titleRect)
|
||||
# edt.setGeometry(self.titleRect)
|
||||
return edt
|
||||
|
||||
else: # self.mainTextRect.contains(self.lastPos):
|
||||
|
@ -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:
|
||||
|
@ -114,7 +117,7 @@ class corkDelegate(QStyledItemDelegate):
|
|||
|
||||
def updateRects(self, option, index):
|
||||
margin = self.margin
|
||||
iconSize = max(16*self.factor, 12)
|
||||
iconSize = max(16 * self.factor, 12)
|
||||
item = index.internalPointer()
|
||||
self.itemRect = option.rect.adjusted(margin, margin, -margin, -margin)
|
||||
self.iconRect = QRect(self.itemRect.topLeft() + QPoint(margin, margin), QSize(iconSize, iconSize))
|
||||
|
@ -130,13 +133,13 @@ class corkDelegate(QStyledItemDelegate):
|
|||
self.mainRect.topRight() + QPoint(0, iconSize))
|
||||
self.mainTextRect = QRect(self.mainLineRect.bottomLeft() + QPoint(0, margin),
|
||||
self.mainRect.bottomRight())
|
||||
if not item.data(Outline.summarySentance.value) :
|
||||
if not item.data(Outline.summarySentance.value):
|
||||
self.mainTextRect.setTopLeft(self.mainLineRect.topLeft())
|
||||
if item.data(Outline.label.value) in ["", "0"]:
|
||||
self.titleRect.setBottomRight(self.labelRect.bottomRight() - QPoint(self.margin, self.margin))
|
||||
|
||||
def paint(self, p, option, index):
|
||||
#QStyledItemDelegate.paint(self, p, option, index)
|
||||
# QStyledItemDelegate.paint(self, p, option, index)
|
||||
if not index.isValid():
|
||||
return
|
||||
|
||||
|
@ -169,7 +172,7 @@ class corkDelegate(QStyledItemDelegate):
|
|||
p.save()
|
||||
p.setBrush(Qt.white)
|
||||
for i in reversed(range(3)):
|
||||
p.drawRoundedRect(self.itemRect.adjusted(2*i, 2*i, -2*i, 2*i), 10, 10)
|
||||
p.drawRoundedRect(self.itemRect.adjusted(2 * i, 2 * i, -2 * i, 2 * i), 10, 10)
|
||||
|
||||
p.restore()
|
||||
|
||||
|
@ -199,7 +202,7 @@ class corkDelegate(QStyledItemDelegate):
|
|||
p.setBrush(color)
|
||||
p.setClipRegion(QRegion(topRect))
|
||||
p.drawRoundedRect(itemRect, 10, 10)
|
||||
#p.drawRect(topRect)
|
||||
# p.drawRect(topRect)
|
||||
p.restore()
|
||||
|
||||
# Label color
|
||||
|
@ -210,7 +213,7 @@ class corkDelegate(QStyledItemDelegate):
|
|||
p.setBrush(color)
|
||||
p.setClipRegion(QRegion(self.labelRect))
|
||||
p.drawRoundedRect(itemRect, 10, 10)
|
||||
#p.drawRect(topRect)
|
||||
# p.drawRect(topRect)
|
||||
p.restore()
|
||||
p.drawLine(self.labelRect.topLeft(), self.labelRect.bottomLeft())
|
||||
|
||||
|
@ -219,7 +222,7 @@ class corkDelegate(QStyledItemDelegate):
|
|||
fullSummary = item.data(Outline.summaryFull.value)
|
||||
if lineSummary or not fullSummary:
|
||||
m = self.margin
|
||||
r = self.mainLineRect.adjusted(-m, -m, m, m/2)
|
||||
r = self.mainLineRect.adjusted(-m, -m, m, m / 2)
|
||||
p.save()
|
||||
p.setPen(Qt.NoPen)
|
||||
p.setBrush(QColor("#EEE"))
|
||||
|
@ -240,7 +243,6 @@ class corkDelegate(QStyledItemDelegate):
|
|||
p.drawRoundedRect(itemRect, 10, 10)
|
||||
p.restore()
|
||||
|
||||
|
||||
# Draw the icon
|
||||
iconRect = self.iconRect
|
||||
mode = QIcon.Normal
|
||||
|
@ -248,7 +250,7 @@ class corkDelegate(QStyledItemDelegate):
|
|||
mode = QIcon.Disabled
|
||||
elif option.state & style.State_Selected:
|
||||
mode = QIcon.Selected
|
||||
#index.data(Qt.DecorationRole).paint(p, iconRect, option.decorationAlignment, mode)
|
||||
# index.data(Qt.DecorationRole).paint(p, iconRect, option.decorationAlignment, mode)
|
||||
icon = index.data(Qt.DecorationRole).pixmap(iconRect.size())
|
||||
if settings.viewSettings["Cork"]["Icon"] != "Nothing":
|
||||
color = colors[settings.viewSettings["Cork"]["Icon"]]
|
||||
|
@ -266,7 +268,7 @@ class corkDelegate(QStyledItemDelegate):
|
|||
col = Qt.black
|
||||
p.setPen(col)
|
||||
f = QFont(option.font)
|
||||
#f.setPointSize(f.pointSize() + 1)
|
||||
# f.setPointSize(f.pointSize() + 1)
|
||||
f.setBold(True)
|
||||
p.setFont(f)
|
||||
fm = QFontMetrics(f)
|
||||
|
@ -277,8 +279,8 @@ class corkDelegate(QStyledItemDelegate):
|
|||
# Draw the line
|
||||
bottomRect = self.bottomRect
|
||||
p.save()
|
||||
#p.drawLine(itemRect.x(), iconRect.bottom() + margin,
|
||||
#itemRect.right(), iconRect.bottom() + margin)
|
||||
# p.drawLine(itemRect.x(), iconRect.bottom() + margin,
|
||||
# itemRect.right(), iconRect.bottom() + margin)
|
||||
p.drawLine(bottomRect.topLeft(), bottomRect.topRight())
|
||||
p.restore()
|
||||
|
||||
|
@ -328,6 +330,6 @@ class corkDelegate(QStyledItemDelegate):
|
|||
p.setFont(option.font)
|
||||
p.drawText(self.mainTextRect, Qt.TextWordWrap, fullSummary)
|
||||
|
||||
#Debug
|
||||
#for r in [self.itemRect, self.iconRect, self.titleRect, self.bottomRect, self.mainLineRect, self.mainTextRect]:
|
||||
#p.drawRect(r)
|
||||
# Debug
|
||||
# for r in [self.itemRect, self.iconRect, self.titleRect, self.bottomRect, self.mainLineRect, self.mainTextRect]:
|
||||
# p.drawRect(r)
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
#!/usr/bin/env python
|
||||
#--!-- coding: utf8 --!--
|
||||
# --!-- 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,24 +1,19 @@
|
|||
#!/usr/bin/env python
|
||||
#--!-- coding: utf8 --!--
|
||||
# --!-- 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)
|
||||
# QAbstractItemView.__init__(self, parent)
|
||||
self.setDragDropMode(self.DragDrop)
|
||||
self.setDefaultDropAction(Qt.MoveAction)
|
||||
self.setSelectionMode(self.ExtendedSelection)
|
||||
|
||||
def dragMoveEvent(self, event):
|
||||
#return QAbstractItemView.dragMoveEvent(self, event)
|
||||
#print(a)
|
||||
# return QAbstractItemView.dragMoveEvent(self, event)
|
||||
# print(a)
|
||||
if event.keyboardModifiers() & Qt.ControlModifier:
|
||||
event.setDropAction(Qt.CopyAction)
|
||||
else:
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#!/usr/bin/env python
|
||||
#--!-- coding: utf8 --!--
|
||||
# --!-- 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
|
||||
|
@ -29,8 +29,8 @@ class lineEditView(QLineEdit):
|
|||
index = index.sibling(index.row(), self._column)
|
||||
self._index = index
|
||||
self._model = index.model()
|
||||
#self.item = index.internalPointer()
|
||||
if self._placeholderText != None:
|
||||
# self.item = index.internalPointer()
|
||||
if self._placeholderText is not None:
|
||||
self.setPlaceholderText(self._placeholderText)
|
||||
self.textEdited.connect(self.submit)
|
||||
self.updateText()
|
||||
|
@ -50,14 +50,14 @@ class lineEditView(QLineEdit):
|
|||
|
||||
def submit(self):
|
||||
if self._index:
|
||||
#item = self._index.internalPointer()
|
||||
# item = self._index.internalPointer()
|
||||
if self.text() != self._model.data(self._index):
|
||||
self._model.setData(self._index, self.text())
|
||||
|
||||
elif self._indexes:
|
||||
self._updating = True
|
||||
for i in self._indexes:
|
||||
#item = i.internalPointer()
|
||||
# item = i.internalPointer()
|
||||
if self.text() != self._model.data(i):
|
||||
self._model.setData(i, self.text())
|
||||
self._updating = False
|
||||
|
@ -82,8 +82,8 @@ class lineEditView(QLineEdit):
|
|||
|
||||
def updateText(self):
|
||||
if self._index:
|
||||
#item = self._index.internalPointer()
|
||||
#txt = toString(item.data(self._column))
|
||||
# item = self._index.internalPointer()
|
||||
# txt = toString(item.data(self._column))
|
||||
txt = toString(self._model.data(self._index))
|
||||
if self.text() != txt:
|
||||
self.setText(txt)
|
||||
|
@ -92,8 +92,8 @@ class lineEditView(QLineEdit):
|
|||
t = []
|
||||
same = True
|
||||
for i in self._indexes:
|
||||
#item = i.internalPointer()
|
||||
#t.append(toString(item.data(self._column)))
|
||||
# item = i.internalPointer()
|
||||
# t.append(toString(item.data(self._column)))
|
||||
t.append(toString(self._model.data(i)))
|
||||
|
||||
for t2 in t[1:]:
|
||||
|
@ -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 --!--
|
||||
# --!-- 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 --!--
|
||||
# --!-- 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):
|
||||
|
@ -85,17 +90,17 @@ class outlineBasics(QAbstractItemView):
|
|||
|
||||
imp = toInt(mw.mdlPersos.importance(i))
|
||||
|
||||
menus[2-imp].addAction(a)
|
||||
menus[2 - imp].addAction(a)
|
||||
|
||||
mpr.mapped.connect(self.setPOV)
|
||||
menu.addMenu(self.menuPOV)
|
||||
|
||||
# Status
|
||||
self.menuStatus = QMenu(qApp.translate("outlineBasics", "Set Status"), menu)
|
||||
#a = QAction(QIcon.fromTheme("dialog-no"), qApp.translate("outlineBasics", "None"), self.menuStatus)
|
||||
#a.triggered.connect(lambda: self.setStatus(""))
|
||||
#self.menuStatus.addAction(a)
|
||||
#self.menuStatus.addSeparator()
|
||||
# a = QAction(QIcon.fromTheme("dialog-no"), qApp.translate("outlineBasics", "None"), self.menuStatus)
|
||||
# a.triggered.connect(lambda: self.setStatus(""))
|
||||
# self.menuStatus.addAction(a)
|
||||
# self.menuStatus.addSeparator()
|
||||
|
||||
mpr = QSignalMapper(self.menuStatus)
|
||||
for i in range(mw.mdlStatus.rowCount()):
|
||||
|
@ -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 --!--
|
||||
# --!-- 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):
|
||||
|
@ -85,16 +89,16 @@ class outlineTitleDelegate(QStyledItemDelegate):
|
|||
|
||||
painter.restore()
|
||||
|
||||
#QStyledItemDelegate.paint(self, painter, option, index)
|
||||
# QStyledItemDelegate.paint(self, painter, option, index)
|
||||
|
||||
|
||||
class outlinePersoDelegate(QStyledItemDelegate):
|
||||
|
||||
def __init__(self, mdlPersos, parent=None):
|
||||
QStyledItemDelegate.__init__(self, parent)
|
||||
self.mdlPersos = mdlPersos
|
||||
|
||||
def sizeHint(self, option, index):
|
||||
#s = QStyledItemDelegate.sizeHint(self, option, index)
|
||||
# s = QStyledItemDelegate.sizeHint(self, option, index)
|
||||
|
||||
item = QModelIndex()
|
||||
for i in range(self.mdlPersos.rowCount()):
|
||||
|
@ -113,8 +117,8 @@ class outlinePersoDelegate(QStyledItemDelegate):
|
|||
|
||||
def createEditor(self, parent, option, index):
|
||||
item = index.internalPointer()
|
||||
#if item.isFolder(): # No POV for folders
|
||||
#return
|
||||
# if item.isFolder(): # No POV for folders
|
||||
# return
|
||||
|
||||
editor = QComboBox(parent)
|
||||
editor.setAutoFillBackground(True)
|
||||
|
@ -122,7 +126,7 @@ class outlinePersoDelegate(QStyledItemDelegate):
|
|||
return editor
|
||||
|
||||
def setEditorData(self, editor, index):
|
||||
#editor.addItem("")
|
||||
# editor.addItem("")
|
||||
editor.addItem(QIcon.fromTheme("dialog-no"), self.tr("None"))
|
||||
|
||||
l = [self.tr("Main"), self.tr("Secondary"), self.tr("Minor")]
|
||||
|
@ -134,13 +138,13 @@ class outlinePersoDelegate(QStyledItemDelegate):
|
|||
item.setFlags(Qt.ItemIsEnabled)
|
||||
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
|
||||
|
||||
#try:
|
||||
# try:
|
||||
editor.addItem(self.mdlPersos.icon(i), self.mdlPersos.name(i), self.mdlPersos.ID(i))
|
||||
editor.setItemData(editor.count() - 1, self.mdlPersos.name(i), Qt.ToolTipRole)
|
||||
#except:
|
||||
#pass
|
||||
# except:
|
||||
# pass
|
||||
|
||||
editor.setCurrentIndex(editor.findData(index.data()))
|
||||
editor.showPopup()
|
||||
|
@ -151,7 +155,7 @@ class outlinePersoDelegate(QStyledItemDelegate):
|
|||
|
||||
def paint(self, painter, option, index):
|
||||
##option.rect.setWidth(option.rect.width() - 18)
|
||||
#QStyledItemDelegate.paint(self, painter, option, index)
|
||||
# QStyledItemDelegate.paint(self, painter, option, index)
|
||||
##option.rect.setWidth(option.rect.width() + 18)
|
||||
|
||||
item = QModelIndex()
|
||||
|
@ -164,7 +168,7 @@ class outlinePersoDelegate(QStyledItemDelegate):
|
|||
|
||||
qApp.style().drawControl(QStyle.CE_ItemViewItem, opt, painter)
|
||||
|
||||
#if index.isValid() and index.internalPointer().data(Outline.POV.value) not in ["", None]:
|
||||
# if index.isValid() and index.internalPointer().data(Outline.POV.value) not in ["", None]:
|
||||
if index.isValid() and self.mdlPersos.data(index) not in ["", None]:
|
||||
opt = QStyleOptionComboBox()
|
||||
opt.rect = option.rect
|
||||
|
@ -174,7 +178,6 @@ class outlinePersoDelegate(QStyledItemDelegate):
|
|||
|
||||
|
||||
class outlineCompileDelegate(QStyledItemDelegate):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QStyledItemDelegate.__init__(self, parent)
|
||||
|
||||
|
@ -189,7 +192,7 @@ class outlineGoalPercentageDelegate(QStyledItemDelegate):
|
|||
|
||||
def sizeHint(self, option, index):
|
||||
sh = QStyledItemDelegate.sizeHint(self, option, index)
|
||||
#if sh.width() > 50:
|
||||
# if sh.width() > 50:
|
||||
sh.setWidth(100)
|
||||
return sh
|
||||
|
||||
|
@ -213,7 +216,7 @@ class outlineGoalPercentageDelegate(QStyledItemDelegate):
|
|||
level -= self.rootIndex.internalPointer().level() + 1
|
||||
|
||||
margin = 5
|
||||
height = max(min(option.rect.height() - 2*margin, 12) - 2 * level, 6)
|
||||
height = max(min(option.rect.height() - 2 * margin, 12) - 2 * level, 6)
|
||||
|
||||
painter.save()
|
||||
|
||||
|
@ -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
|
||||
|
@ -308,7 +309,7 @@ class outlineLabelDelegate(QStyledItemDelegate):
|
|||
def createEditor(self, parent, option, index):
|
||||
item = index.internalPointer()
|
||||
editor = QComboBox(parent)
|
||||
#editor.setAutoFillBackground(True)
|
||||
# editor.setAutoFillBackground(True)
|
||||
editor.setFrame(False)
|
||||
return editor
|
||||
|
||||
|
@ -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 --!--
|
||||
# --!-- 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)
|
||||
|
@ -41,7 +39,7 @@ class outlineView(QTreeView, dndView, outlineBasics):
|
|||
|
||||
# Setting delegates
|
||||
self.outlineTitleDelegate = outlineTitleDelegate(self)
|
||||
#self.outlineTitleDelegate.setView(self)
|
||||
# self.outlineTitleDelegate.setView(self)
|
||||
self.setItemDelegateForColumn(Outline.title.value, self.outlineTitleDelegate)
|
||||
self.outlinePersoDelegate = outlinePersoDelegate(self.modelPersos)
|
||||
self.setItemDelegateForColumn(Outline.POV.value, self.outlinePersoDelegate)
|
||||
|
@ -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 --!--
|
||||
# --!-- 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
|
||||
|
@ -48,7 +48,7 @@ class persoTreeView(QTreeWidget):
|
|||
self.updateItems()
|
||||
|
||||
def updateMaybe2(self, parent, first, last):
|
||||
#Rows inserted or removed, we update only if they are topLevel rows.
|
||||
# Rows inserted or removed, we update only if they are topLevel rows.
|
||||
if parent == QModelIndex():
|
||||
self.updateItems()
|
||||
|
||||
|
@ -90,7 +90,7 @@ class persoTreeView(QTreeWidget):
|
|||
f.setBold(True)
|
||||
cat.setFont(0, f)
|
||||
self.addTopLevelItem(cat)
|
||||
#cat.setChildIndicatorPolicy(cat.DontShowIndicator)
|
||||
# cat.setChildIndicatorPolicy(cat.DontShowIndicator)
|
||||
|
||||
for ID in persos[i]:
|
||||
name = self._model.getPersoNameByID(ID)
|
||||
|
@ -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 --!--
|
||||
# --!-- 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
|
||||
# --!-- coding: utf8 --!--
|
||||
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
|
||||
|
@ -24,11 +25,11 @@ class plotTreeView(QTreeWidget):
|
|||
self.setColumnCount(1)
|
||||
self._rootItem = QTreeWidgetItem()
|
||||
self.insertTopLevelItem(0, self._rootItem)
|
||||
#self.currentItemChanged.connect(self._currentItemChanged)
|
||||
# self.currentItemChanged.connect(self._currentItemChanged)
|
||||
|
||||
###############################################################################
|
||||
# SETTERS
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# SETTERS
|
||||
###############################################################################
|
||||
|
||||
def setShowSubPlot(self, v):
|
||||
self._showSubPlot = v
|
||||
|
@ -45,12 +46,13 @@ class plotTreeView(QTreeWidget):
|
|||
self._filter = text
|
||||
self.updateItems()
|
||||
|
||||
###############################################################################
|
||||
# GETTERS
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# GETTERS
|
||||
###############################################################################
|
||||
|
||||
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
|
||||
|
@ -69,9 +71,9 @@ class plotTreeView(QTreeWidget):
|
|||
|
||||
return self._model.getIndexFromID(ID)
|
||||
|
||||
###############################################################################
|
||||
# UPDATES
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# UPDATES
|
||||
###############################################################################
|
||||
|
||||
def updateMaybe(self, topLeft, bottomRight):
|
||||
if topLeft.parent() != QModelIndex():
|
||||
|
@ -126,7 +128,7 @@ class plotTreeView(QTreeWidget):
|
|||
cat.setFont(0, f)
|
||||
cat.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
|
||||
self.addTopLevelItem(cat)
|
||||
#cat.setChildIndicatorPolicy(cat.DontShowIndicator)
|
||||
# cat.setChildIndicatorPolicy(cat.DontShowIndicator)
|
||||
|
||||
for ID in plots[i]:
|
||||
name = self._model.getPlotNameByID(ID)
|
||||
|
@ -144,7 +146,7 @@ class plotTreeView(QTreeWidget):
|
|||
|
||||
for subID, name, summary in self._model.getSubPlotsByID(ID):
|
||||
sub = QTreeWidgetItem(item, [name])
|
||||
#sub.setData(0, Qt.UserRole, "{}:{}".format(ID, subID))
|
||||
# sub.setData(0, Qt.UserRole, "{}:{}".format(ID, subID))
|
||||
sub.setData(0, Qt.UserRole, ID)
|
||||
|
||||
if ID == self._lastID:
|
||||
|
@ -153,9 +155,9 @@ class plotTreeView(QTreeWidget):
|
|||
self.expandAll()
|
||||
self._updating = False
|
||||
|
||||
###############################################################################
|
||||
# DRAG N DROP
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# DRAG N DROP
|
||||
###############################################################################
|
||||
|
||||
def mimeTypes(self):
|
||||
return ["application/xml"]
|
||||
|
@ -185,9 +187,9 @@ class plotTreeView(QTreeWidget):
|
|||
mimeData.setData("application/xml", encodedData)
|
||||
return mimeData
|
||||
|
||||
###############################################################################
|
||||
# EVENTS
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# EVENTS
|
||||
###############################################################################
|
||||
|
||||
def mouseDoubleClickEvent(self, event):
|
||||
item = self.currentItem()
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#!/usr/bin/env python
|
||||
#--!-- coding: utf8 --!--
|
||||
# --!-- 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():
|
||||
|
@ -37,7 +37,7 @@ class propertiesView(QWidget, Ui_propertiesView):
|
|||
def selectionChanged(self, sourceView):
|
||||
|
||||
indexes = self.getIndexes(sourceView)
|
||||
#print(indexes)
|
||||
# print(indexes)
|
||||
if len(indexes) == 0:
|
||||
self.setEnabled(False)
|
||||
|
||||
|
|
|
@ -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
|
||||
# --!-- coding: utf8 --!--
|
||||
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)
|
||||
|
@ -58,16 +60,16 @@ class textEditCompleter(textEditView):
|
|||
if text.find(m) <= pos <= text.find(m) + len(m):
|
||||
return m
|
||||
|
||||
#def event(self, event):
|
||||
#if event.type() == QEvent.ToolTip:
|
||||
#cursor = self.cursorForPosition(event.pos())
|
||||
#ref = self.refUnderCursor(cursor)
|
||||
#if ref:
|
||||
#QToolTip.showText(self.mapToGlobal(event.pos()), infoForRef(ref))
|
||||
#else:
|
||||
#QToolTip.hideText()
|
||||
#return True
|
||||
#return textEditView.event(self, event)
|
||||
# def event(self, event):
|
||||
# if event.type() == QEvent.ToolTip:
|
||||
# cursor = self.cursorForPosition(event.pos())
|
||||
# ref = self.refUnderCursor(cursor)
|
||||
# if ref:
|
||||
# QToolTip.showText(self.mapToGlobal(event.pos()), infoForRef(ref))
|
||||
# else:
|
||||
# QToolTip.hideText()
|
||||
# return True
|
||||
# return textEditView.event(self, event)
|
||||
|
||||
def createStandardContextMenu(self):
|
||||
menu = textEditView.createStandardContextMenu(self)
|
||||
|
@ -89,7 +91,7 @@ class textEditCompleter(textEditView):
|
|||
event.ignore()
|
||||
return
|
||||
|
||||
isShortcut = (event.modifiers() == Qt.ControlModifier and\
|
||||
isShortcut = (event.modifiers() == Qt.ControlModifier and \
|
||||
event.key() == Qt.Key_Space)
|
||||
|
||||
if not self.completer or not isShortcut:
|
||||
|
@ -156,7 +158,7 @@ class textEditCompleter(textEditView):
|
|||
QTextEdit.paintEvent(self, event)
|
||||
|
||||
# Debug: paint rects
|
||||
#painter = QPainter(self.viewport())
|
||||
#painter.setPen(Qt.gray)
|
||||
#for r in self.refRects:
|
||||
#painter.drawRect(r)
|
||||
# painter = QPainter(self.viewport())
|
||||
# painter.setPen(Qt.gray)
|
||||
# for r in self.refRects:
|
||||
# painter.drawRect(r)
|
||||
|
|
|
@ -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
|
||||
# --!-- coding: utf8 --!--
|
||||
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
|
||||
|
@ -44,21 +50,20 @@ class textEditView(QTextEdit):
|
|||
self.highligtCS = False
|
||||
self.defaultFontPointSize = qApp.font().pointSize()
|
||||
self._dict = None
|
||||
#self.document().contentsChanged.connect(self.submit, AUC)
|
||||
|
||||
# self.document().contentsChanged.connect(self.submit, AUC)
|
||||
|
||||
# Submit text changed only after 500ms without modifications
|
||||
self.updateTimer = QTimer()
|
||||
self.updateTimer.setInterval(500)
|
||||
self.updateTimer.setSingleShot(True)
|
||||
self.updateTimer.timeout.connect(self.submit)
|
||||
#self.updateTimer.timeout.connect(lambda: print("Timeout"))
|
||||
# self.updateTimer.timeout.connect(lambda: print("Timeout"))
|
||||
|
||||
self.updateTimer.stop()
|
||||
self.document().contentsChanged.connect(self.updateTimer.start, AUC)
|
||||
#self.document().contentsChanged.connect(lambda: print("Document changed"))
|
||||
# self.document().contentsChanged.connect(lambda: print("Document changed"))
|
||||
|
||||
#self.document().contentsChanged.connect(lambda: print(self.objectName(), "Contents changed"))
|
||||
# self.document().contentsChanged.connect(lambda: print(self.objectName(), "Contents changed"))
|
||||
|
||||
self.setEnabled(False)
|
||||
|
||||
|
@ -184,7 +189,7 @@ class textEditView(QTextEdit):
|
|||
opt = settings.textEditor
|
||||
f = QFont()
|
||||
f.fromString(opt["font"])
|
||||
#self.setFont(f)
|
||||
# self.setFont(f)
|
||||
self.setStyleSheet("""
|
||||
background: {bg};
|
||||
color: {foreground};
|
||||
|
@ -197,8 +202,8 @@ class textEditView(QTextEdit):
|
|||
fs="{}pt".format(str(f.pointSize()))))
|
||||
|
||||
cf = QTextCharFormat()
|
||||
#cf.setFont(f)
|
||||
#cf.setForeground(QColor(opt["fontColor"]))
|
||||
# cf.setFont(f)
|
||||
# cf.setForeground(QColor(opt["fontColor"]))
|
||||
|
||||
bf = QTextBlockFormat()
|
||||
bf.setLineHeight(opt["lineSpacing"], bf.ProportionalHeight)
|
||||
|
@ -223,11 +228,11 @@ class textEditView(QTextEdit):
|
|||
if topLeft.parent() != self._index.parent():
|
||||
return
|
||||
|
||||
#print("Model changed: ({}:{}), ({}:{}/{}), ({}:{}) for {} of {}".format(
|
||||
#topLeft.row(), topLeft.column(),
|
||||
#self._index.row(), self._index.row(), self._column,
|
||||
#bottomRight.row(), bottomRight.column(),
|
||||
#self.objectName(), self.parent().objectName()))
|
||||
# print("Model changed: ({}:{}), ({}:{}/{}), ({}:{}) for {} of {}".format(
|
||||
# topLeft.row(), topLeft.column(),
|
||||
# self._index.row(), self._index.row(), self._column,
|
||||
# bottomRight.row(), bottomRight.column(),
|
||||
# self.objectName(), self.parent().objectName()))
|
||||
|
||||
if topLeft.row() <= self._index.row() <= bottomRight.row():
|
||||
if self._column == Outline.text.value and \
|
||||
|
@ -256,7 +261,7 @@ class textEditView(QTextEdit):
|
|||
self._index = None
|
||||
self.setEnabled(False)
|
||||
|
||||
#FIXME: self._indexes
|
||||
# FIXME: self._indexes
|
||||
|
||||
def disconnectDocument(self):
|
||||
try:
|
||||
|
@ -270,18 +275,18 @@ class textEditView(QTextEdit):
|
|||
def updateText(self):
|
||||
if self._updating:
|
||||
return
|
||||
#print("Updating", self.objectName())
|
||||
# print("Updating", self.objectName())
|
||||
self._updating = True
|
||||
if self._index:
|
||||
self.disconnectDocument()
|
||||
if self._textFormat == "html":
|
||||
if self.toHtml() != toString(self._model.data(self._index)):
|
||||
#print(" Updating html")
|
||||
# print(" Updating html")
|
||||
html = self._model.data(self._index)
|
||||
self.document().setHtml(toString(html))
|
||||
else:
|
||||
if self.toPlainText() != toString(self._model.data(self._index)):
|
||||
#print(" Updating plaintext")
|
||||
# print(" Updating plaintext")
|
||||
self.document().setPlainText(toString(self._model.data(self._index)))
|
||||
self.reconnectDocument()
|
||||
|
||||
|
@ -315,12 +320,12 @@ class textEditView(QTextEdit):
|
|||
self.updateTimer.stop()
|
||||
if self._updating:
|
||||
return
|
||||
#print("Submitting", self.objectName())
|
||||
# print("Submitting", self.objectName())
|
||||
if self._index:
|
||||
#item = self._index.internalPointer()
|
||||
# item = self._index.internalPointer()
|
||||
if self._textFormat == "html":
|
||||
if self.toHtml() != self._model.data(self._index):
|
||||
#print(" Submitting html")
|
||||
# print(" Submitting html")
|
||||
self._updating = True
|
||||
html = self.toHtml()
|
||||
# We don't store paragraph and font settings
|
||||
|
@ -329,12 +334,12 @@ class textEditView(QTextEdit):
|
|||
html = re.sub(r"margin-.*?;\s*", "", html)
|
||||
html = re.sub(r"text-indent:.*?;\s*", "", html)
|
||||
html = re.sub(r"line-height:.*?;\s*", "", html)
|
||||
#print("Submitting:", html)
|
||||
# print("Submitting:", html)
|
||||
self._model.setData(self._index, html)
|
||||
self._updating = False
|
||||
else:
|
||||
if self.toPlainText() != self._model.data(self._index):
|
||||
#print(" Submitting plain text")
|
||||
# print(" Submitting plain text")
|
||||
self._updating = True
|
||||
self._model.setData(self._index, self.toPlainText())
|
||||
self._updating = False
|
||||
|
@ -374,10 +379,10 @@ class textEditView(QTextEdit):
|
|||
self.heightMax = 65000
|
||||
self.sizeChange()
|
||||
|
||||
###############################################################################
|
||||
# SPELLCHECKING
|
||||
###############################################################################
|
||||
# Based on http://john.nachtimwald.com/2009/08/22/qplaintextedit-with-in-line-spell-check/
|
||||
###############################################################################
|
||||
# SPELLCHECKING
|
||||
###############################################################################
|
||||
# Based on http://john.nachtimwald.com/2009/08/22/qplaintextedit-with-in-line-spell-check/
|
||||
|
||||
def setDict(self, d):
|
||||
self.currentDict = d
|
||||
|
@ -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)
|
||||
|
||||
|
@ -426,7 +431,7 @@ class textEditView(QTextEdit):
|
|||
|
||||
# Select the word under the cursor.
|
||||
cursor = self.textCursor()
|
||||
#cursor = self.cursorForPosition(pos)
|
||||
# cursor = self.cursorForPosition(pos)
|
||||
cursor.select(QTextCursor.WordUnderCursor)
|
||||
self.setTextCursor(cursor)
|
||||
# Check if the selected word is misspelled and offer spelling
|
||||
|
@ -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()
|
||||
|
||||
|
@ -459,17 +464,17 @@ class textEditView(QTextEdit):
|
|||
|
||||
cursor.endEditBlock()
|
||||
|
||||
###############################################################################
|
||||
# FORMATTING
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# FORMATTING
|
||||
###############################################################################
|
||||
|
||||
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()
|
||||
|
@ -526,7 +531,7 @@ class textEditView(QTextEdit):
|
|||
|
||||
cursor = self.textCursor()
|
||||
|
||||
#bf = cursor.blockFormat()
|
||||
# bf = cursor.blockFormat()
|
||||
bf = QTextBlockFormat()
|
||||
bf.setAlignment(
|
||||
Qt.AlignLeft if _format == "Left" else
|
||||
|
@ -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 --!--
|
||||
# --!-- 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)
|
||||
# QStyledItemDelegate.paint(self, painter, option, index)
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
#!/usr/bin/env python
|
||||
#--!-- coding: utf8 --!--
|
||||
# --!-- 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)
|
||||
|
@ -58,7 +57,7 @@ class treeView(QTreeView, dndView, outlineBasics):
|
|||
|
||||
# Expand /collapse item
|
||||
if mouseIndex.isValid():
|
||||
#index = self.currentIndex()
|
||||
# index = self.currentIndex()
|
||||
item = mouseIndex.internalPointer()
|
||||
self.actExpand = QAction(self.tr("Expand {}").format(item.title()), menu)
|
||||
self.actExpand.triggered.connect(self.expandCurrentIndex)
|
||||
|
@ -88,7 +87,7 @@ class treeView(QTreeView, dndView, outlineBasics):
|
|||
|
||||
def expandCurrentIndex(self, index=None):
|
||||
if index is None or type(index) == bool:
|
||||
index = self._indexesToOpen[0] #self.currentIndex()
|
||||
index = self._indexesToOpen[0] # self.currentIndex()
|
||||
|
||||
self.expand(index)
|
||||
for i in range(self.model().rowCount(index)):
|
||||
|
@ -97,7 +96,7 @@ class treeView(QTreeView, dndView, outlineBasics):
|
|||
|
||||
def collapseCurrentIndex(self, index=None):
|
||||
if index is None or type(index) == bool:
|
||||
index = self._indexesToOpen[0] #self.currentIndex()
|
||||
index = self._indexesToOpen[0] # self.currentIndex()
|
||||
|
||||
self.collapse(index)
|
||||
for i in range(self.model().rowCount(index)):
|
||||
|
|
|
@ -1,16 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
#--!-- coding: utf8 --!--
|
||||
# --!-- 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, '')
|
||||
|
||||
|
@ -40,9 +46,9 @@ class welcome(QWidget, Ui_welcome):
|
|||
# Recent Files
|
||||
self.loadRecents()
|
||||
|
||||
###############################################################################
|
||||
# AUTOLOAD
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# AUTOLOAD
|
||||
###############################################################################
|
||||
|
||||
def showEvent(self, event):
|
||||
"""Waiting for things to be fully loaded to start opening projects."""
|
||||
|
@ -70,9 +76,9 @@ class welcome(QWidget, Ui_welcome):
|
|||
def setAutoLoad(self, v):
|
||||
QSettings().setValue("autoLoad", v)
|
||||
|
||||
###############################################################################
|
||||
# RECENTS
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# RECENTS
|
||||
###############################################################################
|
||||
|
||||
def loadRecents(self):
|
||||
sttgns = QSettings()
|
||||
|
@ -108,9 +114,9 @@ class welcome(QWidget, Ui_welcome):
|
|||
self.appendToRecentFiles(act.data())
|
||||
self.mw.loadProject(act.data())
|
||||
|
||||
###############################################################################
|
||||
# DIALOGS
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# DIALOGS
|
||||
###############################################################################
|
||||
|
||||
def openFile(self):
|
||||
"""File dialog that request an existing file. For opening project."""
|
||||
|
@ -147,36 +153,36 @@ class welcome(QWidget, Ui_welcome):
|
|||
self.loadDefaultDatas()
|
||||
self.mw.loadProject(filename, loadFromFile=False)
|
||||
|
||||
###############################################################################
|
||||
# TEMPLATES
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# TEMPLATES
|
||||
###############################################################################
|
||||
|
||||
def templates(self):
|
||||
return [
|
||||
(self.tr("Empty"), []),
|
||||
(self.tr("Novel"), [
|
||||
( 20, self.tr("Chapter")),
|
||||
( 5, self.tr("Scene")),
|
||||
( 500, None) # A line with None is word count
|
||||
(20, self.tr("Chapter")),
|
||||
(5, self.tr("Scene")),
|
||||
(500, None) # A line with None is word count
|
||||
]),
|
||||
(self.tr("Novella"), [
|
||||
( 10, self.tr("Chapter")),
|
||||
( 5, self.tr("Scene")),
|
||||
( 500, None)
|
||||
(10, self.tr("Chapter")),
|
||||
(5, self.tr("Scene")),
|
||||
(500, None)
|
||||
]),
|
||||
(self.tr("Short Story"), [
|
||||
( 10, self.tr("Scene")),
|
||||
(10, self.tr("Scene")),
|
||||
(1000, None)
|
||||
]),
|
||||
(self.tr("Trilogy"), [
|
||||
( 3, self.tr("Book")),
|
||||
( 3, self.tr("Section")),
|
||||
( 10, self.tr("Chapter")),
|
||||
( 5, self.tr("Scene")),
|
||||
( 500, None)
|
||||
(3, self.tr("Book")),
|
||||
(3, self.tr("Section")),
|
||||
(10, self.tr("Chapter")),
|
||||
(5, self.tr("Scene")),
|
||||
(500, None)
|
||||
]),
|
||||
(self.tr("Research paper"), [
|
||||
( 3, self.tr("Section")),
|
||||
(3, self.tr("Section")),
|
||||
(1000, None)
|
||||
])
|
||||
]
|
||||
|
@ -206,9 +212,9 @@ class welcome(QWidget, Ui_welcome):
|
|||
|
||||
clearLayout(self.lytTemplate)
|
||||
|
||||
#self.templateLayout.addStretch()
|
||||
#l = QGridLayout()
|
||||
#self.templateLayout.addLayout(l)
|
||||
# self.templateLayout.addStretch()
|
||||
# l = QGridLayout()
|
||||
# self.templateLayout.addLayout(l)
|
||||
|
||||
k = 0
|
||||
hasWC = False
|
||||
|
@ -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
|
||||
|
@ -322,14 +327,14 @@ class welcome(QWidget, Ui_welcome):
|
|||
self.mw.mdlFlatData = QStandardItemModel(2, 8, self.mw)
|
||||
|
||||
# Persos
|
||||
#self.mw.mdlPersos = QStandardItemModel(0, 0, self.mw)
|
||||
# self.mw.mdlPersos = QStandardItemModel(0, 0, self.mw)
|
||||
self.mw.mdlPersos = persosModel(self.mw)
|
||||
#self.mdlPersosProxy = None # persosProxyModel() # None
|
||||
#self.mw.mdlPersosProxy = persosProxyModel(self.mw)
|
||||
# self.mdlPersosProxy = None # persosProxyModel() # None
|
||||
# self.mw.mdlPersosProxy = persosProxyModel(self.mw)
|
||||
|
||||
#self.mw.mdlPersosInfos = QStandardItemModel(1, 0, self.mw)
|
||||
#self.mw.mdlPersosInfos.insertColumn(0, [QStandardItem("ID")])
|
||||
#self.mw.mdlPersosInfos.setHorizontalHeaderLabels(["Description"])
|
||||
# self.mw.mdlPersosInfos = QStandardItemModel(1, 0, self.mw)
|
||||
# self.mw.mdlPersosInfos.insertColumn(0, [QStandardItem("ID")])
|
||||
# self.mw.mdlPersosInfos.setHorizontalHeaderLabels(["Description"])
|
||||
|
||||
# Labels
|
||||
self.mw.mdlLabels = QStandardItemModel(self.mw)
|
||||
|
@ -378,7 +383,7 @@ class welcome(QWidget, Ui_welcome):
|
|||
parent=parent)
|
||||
if len(datas) == 2:
|
||||
item.setData(Outline.setGoal.value, datas[1][0])
|
||||
#parent.appendChild(item)
|
||||
# parent.appendChild(item)
|
||||
else:
|
||||
n = 0
|
||||
for i in range(datas[0][0]):
|
||||
|
@ -388,9 +393,8 @@ class welcome(QWidget, Ui_welcome):
|
|||
str(n)),
|
||||
_type="folder",
|
||||
parent=parent)
|
||||
#parent.appendChild(item)
|
||||
# parent.appendChild(item)
|
||||
addElement(item, datas[1:])
|
||||
|
||||
if self.template:
|
||||
addElement(root, self.template)
|
||||
|
Loading…
Reference in a new issue