mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-04 04:52:33 +12:00
Changes Outline enums to IntEnum
This commit is contained in:
parent
805d7adaba
commit
9e95196cc5
|
@ -170,7 +170,7 @@ def outlineItemColors(item):
|
|||
|
||||
# POV
|
||||
colors["POV"] = QColor(Qt.transparent)
|
||||
POV = item.data(Outline.POV.value)
|
||||
POV = item.data(Outline.POV)
|
||||
if POV == "":
|
||||
col = QColor(Qt.transparent)
|
||||
else:
|
||||
|
@ -179,7 +179,7 @@ def outlineItemColors(item):
|
|||
colors["POV"] = iconColor(mw.mdlCharacter.icon(i))
|
||||
|
||||
# Label
|
||||
lbl = item.data(Outline.label.value)
|
||||
lbl = item.data(Outline.label)
|
||||
if lbl == "":
|
||||
col = QColor(Qt.transparent)
|
||||
else:
|
||||
|
@ -190,7 +190,7 @@ def outlineItemColors(item):
|
|||
colors["Label"] = col
|
||||
|
||||
# Progress
|
||||
pg = item.data(Outline.goalPercentage.value)
|
||||
pg = item.data(Outline.goalPercentage)
|
||||
colors["Progress"] = colorFromProgress(pg)
|
||||
|
||||
# Compile
|
||||
|
|
|
@ -114,18 +114,18 @@ class mindMapImporter(abstractImporter):
|
|||
# If there is one line, we use it as title.
|
||||
# Otherwise we leave it to be inserted as a note.
|
||||
if len(lines) == 1:
|
||||
item.setData(Outline.title.value, "".join(lines))
|
||||
item.setData(Outline.title, "".join(lines))
|
||||
content = ""
|
||||
|
||||
if content:
|
||||
# Set the note content as text value
|
||||
content = HTML2MD(content)
|
||||
item.setData(Outline.notes.value, content)
|
||||
item.setData(Outline.notes, content)
|
||||
|
||||
if url:
|
||||
# Set the url in notes
|
||||
item.setData(Outline.notes.value,
|
||||
item.data(Outline.notes.value) + "\n\n" + url)
|
||||
item.setData(Outline.notes,
|
||||
item.data(Outline.notes) + "\n\n" + url)
|
||||
|
||||
children = underElement.findall('node')
|
||||
|
||||
|
@ -137,10 +137,10 @@ class mindMapImporter(abstractImporter):
|
|||
# Process if no children
|
||||
elif self.getSetting("importTipAs").value() == "Text":
|
||||
# Transform item to text
|
||||
item.setData(Outline.type.value, 'md')
|
||||
item.setData(Outline.type, 'md')
|
||||
# Move notes to text
|
||||
if item.data(Outline.notes.value):
|
||||
item.setData(Outline.text.value, item.data(Outline.notes.value))
|
||||
item.setData(Outline.notes.value, "")
|
||||
if item.data(Outline.notes):
|
||||
item.setData(Outline.text.value, item.data(Outline.notes))
|
||||
item.setData(Outline.notes, "")
|
||||
|
||||
return items
|
||||
|
|
|
@ -90,8 +90,8 @@ class opmlImporter(abstractImporter):
|
|||
for el in children:
|
||||
items.extend(cls.parseItems(el, card))
|
||||
else:
|
||||
card.setData(Outline.type.value, 'md')
|
||||
card.setData(Outline.text.value, body)
|
||||
card.setData(Outline.type, 'md')
|
||||
card.setData(Outline.text, body)
|
||||
|
||||
return items
|
||||
|
||||
|
|
|
@ -603,7 +603,7 @@ def outlineToMMD(item):
|
|||
content += formatMetaData(attrib.name, str(val), 15)
|
||||
|
||||
content += "\n\n"
|
||||
content += item.data(Outline.text.value)
|
||||
content += item.data(Outline.text)
|
||||
|
||||
return content
|
||||
|
||||
|
@ -929,18 +929,18 @@ def outlineFromMMD(text, parent):
|
|||
# Store metadata
|
||||
for k in md:
|
||||
if k in Outline.__members__:
|
||||
item.setData(Outline.__members__[k].value, str(md[k]))
|
||||
item.setData(Outline.__members__[k], str(md[k]))
|
||||
|
||||
# Store body
|
||||
item.setData(Outline.text.value, str(body))
|
||||
item.setData(Outline.text, str(body))
|
||||
|
||||
# Set file format to "md"
|
||||
# (Old version of manuskript had different file formats: text, t2t, html and md)
|
||||
# If file format is html, convert to plain text:
|
||||
if item.type() == "html":
|
||||
item.setData(Outline.text.value, HTML2PlainText(body))
|
||||
item.setData(Outline.text, HTML2PlainText(body))
|
||||
if item.type() in ["txt", "t2t", "html"]:
|
||||
item.setData(Outline.type.value, "md")
|
||||
item.setData(Outline.type, "md")
|
||||
|
||||
return item
|
||||
|
||||
|
|
|
@ -1386,8 +1386,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
w.cmbPOV.setVisible(val)
|
||||
|
||||
# POV in outline view
|
||||
if Outline.POV.value in settings.outlineViewColumns:
|
||||
settings.outlineViewColumns.remove(Outline.POV.value)
|
||||
if Outline.POV in settings.outlineViewColumns:
|
||||
settings.outlineViewColumns.remove(Outline.POV)
|
||||
|
||||
from manuskript.ui.views.outlineView import outlineView
|
||||
for w in findWidgetsOfClass(outlineView):
|
||||
|
|
|
@ -77,21 +77,21 @@ class abstractItem():
|
|||
# print("Data: ", column, role)
|
||||
|
||||
if role == Qt.DisplayRole or role == Qt.EditRole:
|
||||
# if column == Outline.compile.value:
|
||||
# if column == Outline.compile:
|
||||
# return self.data(column, Qt.CheckStateRole)
|
||||
|
||||
if Outline(column) in self._data:
|
||||
return self._data[Outline(column)]
|
||||
|
||||
elif column == Outline.revisions.value:
|
||||
elif column == Outline.revisions:
|
||||
return []
|
||||
|
||||
else:
|
||||
return ""
|
||||
|
||||
elif role == Qt.DecorationRole and column == Outline.title.value:
|
||||
elif role == Qt.DecorationRole and column == Outline.title:
|
||||
if self.customIcon():
|
||||
return QIcon.fromTheme(self.data(Outline.customIcon.value))
|
||||
return QIcon.fromTheme(self.data(Outline.customIcon))
|
||||
if self.isFolder():
|
||||
return QIcon.fromTheme("folder")
|
||||
elif self.isMD():
|
||||
|
@ -101,7 +101,7 @@ class abstractItem():
|
|||
# if self.isCompile() in [0, "0"]:
|
||||
# return QBrush(Qt.gray)
|
||||
|
||||
elif role == Qt.CheckStateRole and column == Outline.compile.value:
|
||||
elif role == Qt.CheckStateRole and column == Outline.compile:
|
||||
# print(self.title(), self.compile())
|
||||
# if self._data[Outline(column)] and not self.compile():
|
||||
# return Qt.PartiallyChecked
|
||||
|
@ -110,9 +110,9 @@ class abstractItem():
|
|||
|
||||
elif role == Qt.FontRole:
|
||||
f = QFont()
|
||||
if column == Outline.wordCount.value and self.isFolder():
|
||||
if column == Outline.wordCount and self.isFolder():
|
||||
f.setItalic(True)
|
||||
elif column == Outline.goal.value and self.isFolder() and self.data(Outline.setGoal) == None:
|
||||
elif column == Outline.goal and self.isFolder() and self.data(Outline.setGoal) == None:
|
||||
f.setItalic(True)
|
||||
if self.isFolder():
|
||||
f.setBold(True)
|
||||
|
@ -120,41 +120,41 @@ class abstractItem():
|
|||
|
||||
def setData(self, column, data, role=Qt.DisplayRole):
|
||||
if role not in [Qt.DisplayRole, Qt.EditRole, Qt.CheckStateRole]:
|
||||
print(column, column == Outline.text.value, data, role)
|
||||
print(column, column == Outline.text, data, role)
|
||||
return
|
||||
|
||||
if column == Outline.text.value and self.isFolder():
|
||||
if column == Outline.text and self.isFolder():
|
||||
# Folder have no text
|
||||
return
|
||||
|
||||
if column == Outline.goal.value:
|
||||
if column == Outline.goal:
|
||||
self._data[Outline.setGoal] = toInt(data) if toInt(data) > 0 else ""
|
||||
|
||||
# Checking if we will have to recount words
|
||||
updateWordCount = False
|
||||
if column in [Outline.wordCount.value, Outline.goal.value, Outline.setGoal.value]:
|
||||
if column in [Outline.wordCount.value, Outline.goal.value, Outline.setGoal]:
|
||||
updateWordCount = not Outline(column) in self._data or self._data[Outline(column)] != data
|
||||
|
||||
# Stuff to do before
|
||||
if column == Outline.text.value:
|
||||
if column == Outline.text:
|
||||
self.addRevision()
|
||||
|
||||
# Setting data
|
||||
self._data[Outline(column)] = data
|
||||
|
||||
# Stuff to do afterwards
|
||||
if column == Outline.text.value:
|
||||
if column == Outline.text:
|
||||
wc = wordCount(data)
|
||||
self.setData(Outline.wordCount.value, wc)
|
||||
self.emitDataChanged(cols=[Outline.text.value]) # new in 0.5.0
|
||||
self.setData(Outline.wordCount, wc)
|
||||
self.emitDataChanged(cols=[Outline.text]) # new in 0.5.0
|
||||
|
||||
if column == Outline.compile.value:
|
||||
self.emitDataChanged(cols=[Outline.title.value, Outline.compile.value], recursive=True)
|
||||
if column == Outline.compile:
|
||||
self.emitDataChanged(cols=[Outline.title.value, Outline.compile], recursive=True)
|
||||
|
||||
if column == Outline.customIcon.value:
|
||||
if column == Outline.customIcon:
|
||||
# If custom icon changed, we tell views to update title (so that icons
|
||||
# will be updated as well)
|
||||
self.emitDataChanged(cols=[Outline.title.value])
|
||||
self.emitDataChanged(cols=[Outline.title])
|
||||
|
||||
if updateWordCount:
|
||||
self.updateWordCount()
|
||||
|
@ -163,23 +163,23 @@ class abstractItem():
|
|||
"""Update word count for item and parents.
|
||||
If emit is False, no signal is emitted (sometimes cause segfault)"""
|
||||
if not self.isFolder():
|
||||
setGoal = toInt(self.data(Outline.setGoal.value))
|
||||
goal = toInt(self.data(Outline.goal.value))
|
||||
setGoal = toInt(self.data(Outline.setGoal))
|
||||
goal = toInt(self.data(Outline.goal))
|
||||
|
||||
if goal != setGoal:
|
||||
self._data[Outline.goal] = setGoal
|
||||
if setGoal:
|
||||
wc = toInt(self.data(Outline.wordCount.value))
|
||||
self.setData(Outline.goalPercentage.value, wc / float(setGoal))
|
||||
wc = toInt(self.data(Outline.wordCount))
|
||||
self.setData(Outline.goalPercentage, wc / float(setGoal))
|
||||
|
||||
else:
|
||||
wc = 0
|
||||
for c in self.children():
|
||||
wc += toInt(c.data(Outline.wordCount.value))
|
||||
wc += toInt(c.data(Outline.wordCount))
|
||||
self._data[Outline.wordCount] = wc
|
||||
|
||||
setGoal = toInt(self.data(Outline.setGoal.value))
|
||||
goal = toInt(self.data(Outline.goal.value))
|
||||
setGoal = toInt(self.data(Outline.setGoal))
|
||||
goal = toInt(self.data(Outline.goal))
|
||||
|
||||
if setGoal:
|
||||
if goal != setGoal:
|
||||
|
@ -188,17 +188,17 @@ class abstractItem():
|
|||
else:
|
||||
goal = 0
|
||||
for c in self.children():
|
||||
goal += toInt(c.data(Outline.goal.value))
|
||||
goal += toInt(c.data(Outline.goal))
|
||||
self._data[Outline.goal] = goal
|
||||
|
||||
if goal:
|
||||
self.setData(Outline.goalPercentage.value, wc / float(goal))
|
||||
self.setData(Outline.goalPercentage, wc / float(goal))
|
||||
else:
|
||||
self.setData(Outline.goalPercentage.value, "")
|
||||
self.setData(Outline.goalPercentage, "")
|
||||
|
||||
if emit:
|
||||
self.emitDataChanged([Outline.goal.value, Outline.setGoal.value,
|
||||
Outline.wordCount.value, Outline.goalPercentage.value])
|
||||
self.emitDataChanged([Outline.goal.value, Outline.setGoal,
|
||||
Outline.wordCount.value, Outline.goalPercentage])
|
||||
|
||||
if self.parent():
|
||||
self.parent().updateWordCount(emit)
|
||||
|
@ -214,7 +214,7 @@ class abstractItem():
|
|||
self.childItems.insert(row, child)
|
||||
child._parent = self
|
||||
child.setModel(self._model)
|
||||
if not child.data(Outline.ID.value):
|
||||
if not child.data(Outline.ID):
|
||||
child.getUniqueID()
|
||||
self.updateWordCount()
|
||||
|
||||
|
@ -275,13 +275,13 @@ class abstractItem():
|
|||
return self._data[Outline.type] == "md"
|
||||
|
||||
def customIcon(self):
|
||||
return self.data(Outline.customIcon.value)
|
||||
return self.data(Outline.customIcon)
|
||||
|
||||
def setCustomIcon(self, customIcon):
|
||||
self.setData(Outline.customIcon.value, customIcon)
|
||||
self.setData(Outline.customIcon, customIcon)
|
||||
|
||||
def text(self):
|
||||
return self.data(Outline.text.value)
|
||||
return self.data(Outline.text)
|
||||
|
||||
def compile(self):
|
||||
if self._data[Outline.compile] in ["0", 0]:
|
||||
|
@ -298,16 +298,16 @@ class abstractItem():
|
|||
return ""
|
||||
|
||||
def ID(self):
|
||||
return self.data(Outline.ID.value)
|
||||
return self.data(Outline.ID)
|
||||
|
||||
def POV(self):
|
||||
return self.data(Outline.POV.value)
|
||||
return self.data(Outline.POV)
|
||||
|
||||
def status(self):
|
||||
return self.data(Outline.status.value)
|
||||
return self.data(Outline.status)
|
||||
|
||||
def label(self):
|
||||
return self.data(Outline.label.value)
|
||||
return self.data(Outline.label)
|
||||
|
||||
def path(self):
|
||||
"Returns path to item as string."
|
||||
|
@ -331,9 +331,9 @@ class abstractItem():
|
|||
return -1
|
||||
|
||||
def stats(self):
|
||||
wc = self.data(Outline.wordCount.value)
|
||||
goal = self.data(Outline.goal.value)
|
||||
progress = self.data(Outline.goalPercentage.value)
|
||||
wc = self.data(Outline.wordCount)
|
||||
goal = self.data(Outline.goal)
|
||||
progress = self.data(Outline.goalPercentage)
|
||||
if not wc:
|
||||
wc = 0
|
||||
if goal:
|
||||
|
@ -350,7 +350,7 @@ class abstractItem():
|
|||
Returns a copy of item, with no parent, and no ID.
|
||||
"""
|
||||
item = outlineItem(xml=self.toXML())
|
||||
item.setData(Outline.ID.value, None)
|
||||
item.setData(Outline.ID, None)
|
||||
return item
|
||||
|
||||
def split(self, splitMark, recursive=True):
|
||||
|
@ -374,7 +374,7 @@ class abstractItem():
|
|||
else:
|
||||
|
||||
# Stores the new text
|
||||
self.setData(Outline.text.value, txt[0])
|
||||
self.setData(Outline.text, txt[0])
|
||||
|
||||
k = 1
|
||||
for subTxt in txt[1:]:
|
||||
|
@ -382,11 +382,11 @@ class abstractItem():
|
|||
item = self.copy()
|
||||
|
||||
# Change title adding _k
|
||||
item.setData(Outline.title.value,
|
||||
item.setData(Outline.title,
|
||||
"{}_{}".format(item.title(), k+1))
|
||||
|
||||
# Set text
|
||||
item.setData(Outline.text.value, subTxt)
|
||||
item.setData(Outline.text, subTxt)
|
||||
|
||||
# Inserting item
|
||||
#self.parent().insertChild(self.row()+k, item)
|
||||
|
@ -404,7 +404,7 @@ class abstractItem():
|
|||
txt = self.text()
|
||||
|
||||
# Stores the new text
|
||||
self.setData(Outline.text.value, txt[:position])
|
||||
self.setData(Outline.text, txt[:position])
|
||||
|
||||
# Create a copy
|
||||
item = self.copy()
|
||||
|
@ -414,10 +414,10 @@ class abstractItem():
|
|||
title = txt[position:position+length].replace("\n", "")
|
||||
else:
|
||||
title = "{}_{}".format(item.title(), 2)
|
||||
item.setData(Outline.title.value, title)
|
||||
item.setData(Outline.title, title)
|
||||
|
||||
# Set text
|
||||
item.setData(Outline.text.value, txt[position+length:])
|
||||
item.setData(Outline.text, txt[position+length:])
|
||||
|
||||
# Inserting item using the model to signal views
|
||||
self._model.insertItem(item, self.row()+1, self.parent().index())
|
||||
|
@ -434,7 +434,7 @@ class abstractItem():
|
|||
# Merges the texts
|
||||
text = [self.text()]
|
||||
text.extend([i.text() for i in items])
|
||||
self.setData(Outline.text.value, sep.join(text))
|
||||
self.setData(Outline.text, sep.join(text))
|
||||
|
||||
# Removes other items
|
||||
self._model.removeIndexes([i.index() for i in items])
|
||||
|
@ -479,21 +479,21 @@ class abstractItem():
|
|||
for k in root.attrib:
|
||||
if k in Outline.__members__:
|
||||
# if k == Outline.compile:
|
||||
# self.setData(Outline.__members__[k].value, unicode(root.attrib[k]), Qt.CheckStateRole)
|
||||
# self.setData(Outline.__members__[k], unicode(root.attrib[k]), Qt.CheckStateRole)
|
||||
# else:
|
||||
self.setData(Outline.__members__[k].value, str(root.attrib[k]))
|
||||
self.setData(Outline.__members__[k], str(root.attrib[k]))
|
||||
|
||||
if "lastPath" in root.attrib:
|
||||
self._lastPath = root.attrib["lastPath"]
|
||||
|
||||
# If loading from an old file format, convert to md and remove html markup
|
||||
if self.type() in ["txt", "t2t"]:
|
||||
self.setData(Outline.type.value, "md")
|
||||
self.setData(Outline.type, "md")
|
||||
|
||||
elif self.type() == "html":
|
||||
self.setData(Outline.type.value, "md")
|
||||
self.setData(Outline.text.value, HTML2PlainText(self.data(Outline.text.value)))
|
||||
self.setData(Outline.notes.value, HTML2PlainText(self.data(Outline.notes.value)))
|
||||
self.setData(Outline.type, "md")
|
||||
self.setData(Outline.text.value, HTML2PlainText(self.data(Outline.text)))
|
||||
self.setData(Outline.notes.value, HTML2PlainText(self.data(Outline.notes)))
|
||||
|
||||
for child in root:
|
||||
if child.tag == "outlineItem":
|
||||
|
@ -506,7 +506,7 @@ class abstractItem():
|
|||
###############################################################################
|
||||
|
||||
def getUniqueID(self, recursive=False):
|
||||
self.setData(Outline.ID.value, self._model.rootItem.findUniqueID())
|
||||
self.setData(Outline.ID, self._model.rootItem.findUniqueID())
|
||||
|
||||
if recursive:
|
||||
for c in self.children():
|
||||
|
@ -524,7 +524,7 @@ class abstractItem():
|
|||
|
||||
def checkChildren(item):
|
||||
for c in item.children():
|
||||
_id = c.data(Outline.ID.value)
|
||||
_id = c.data(Outline.ID)
|
||||
if not _id or _id == "0":
|
||||
c.getUniqueID()
|
||||
checkChildren(c)
|
||||
|
@ -532,7 +532,7 @@ class abstractItem():
|
|||
checkChildren(self)
|
||||
|
||||
def listAllIDs(self):
|
||||
IDs = [self.data(Outline.ID.value)]
|
||||
IDs = [self.data(Outline.ID)]
|
||||
for c in self.children():
|
||||
IDs.extend(c.listAllIDs())
|
||||
return IDs
|
||||
|
@ -546,7 +546,7 @@ class abstractItem():
|
|||
return str(k)
|
||||
|
||||
def pathToItem(self):
|
||||
path = self.data(Outline.ID.value)
|
||||
path = self.data(Outline.ID)
|
||||
if self.parent().parent():
|
||||
path = "{}:{}".format(self.parent().pathToItem(), path)
|
||||
return path
|
||||
|
@ -580,7 +580,7 @@ class abstractItem():
|
|||
text = text.lower() if not caseSensitive else text
|
||||
for c in columns:
|
||||
|
||||
if c == Outline.POV.value and self.POV():
|
||||
if c == Outline.POV and self.POV():
|
||||
c = mainWindow.mdlCharacter.getCharacterByID(self.POV())
|
||||
if c:
|
||||
searchIn = c.name()
|
||||
|
@ -588,10 +588,10 @@ class abstractItem():
|
|||
searchIn = ""
|
||||
print("Character POV not found:", self.POV())
|
||||
|
||||
elif c == Outline.status.value:
|
||||
elif c == Outline.status:
|
||||
searchIn = mainWindow.mdlStatus.item(toInt(self.status()), 0).text()
|
||||
|
||||
elif c == Outline.label.value:
|
||||
elif c == Outline.label:
|
||||
searchIn = mainWindow.mdlLabels.item(toInt(self.label()), 0).text()
|
||||
|
||||
else:
|
||||
|
@ -610,7 +610,7 @@ class abstractItem():
|
|||
###############################################################################
|
||||
|
||||
def revisions(self):
|
||||
return self.data(Outline.revisions.value)
|
||||
return self.data(Outline.revisions)
|
||||
|
||||
def appendRevision(self, ts, text):
|
||||
if not Outline.revisions in self._data:
|
||||
|
@ -634,15 +634,15 @@ class abstractItem():
|
|||
if settings.revisions["smartremove"]:
|
||||
self.cleanRevisions()
|
||||
|
||||
self.emitDataChanged([Outline.revisions.value])
|
||||
self.emitDataChanged([Outline.revisions])
|
||||
|
||||
def deleteRevision(self, ts):
|
||||
self._data[Outline.revisions] = [r for r in self._data[Outline.revisions] if r[0] != ts]
|
||||
self.emitDataChanged([Outline.revisions.value])
|
||||
self.emitDataChanged([Outline.revisions])
|
||||
|
||||
def clearAllRevisions(self):
|
||||
self._data[Outline.revisions] = []
|
||||
self.emitDataChanged([Outline.revisions.value])
|
||||
self.emitDataChanged([Outline.revisions])
|
||||
|
||||
def cleanRevisions(self):
|
||||
"Keep only one some the revisions."
|
||||
|
@ -676,4 +676,4 @@ class abstractItem():
|
|||
|
||||
if rev2 != rev:
|
||||
self._data[Outline.revisions] = rev2
|
||||
self.emitDataChanged([Outline.revisions.value])
|
||||
self.emitDataChanged([Outline.revisions])
|
||||
|
|
|
@ -160,39 +160,39 @@ class abstractModel(QAbstractItemModel):
|
|||
# print("Model emit", index.row(), index.column())
|
||||
self.dataChanged.emit(index, index)
|
||||
|
||||
if index.column() == Outline.type.value:
|
||||
if index.column() == Outline.type:
|
||||
# If type changed, then the icon of title changed.
|
||||
# Some views might be glad to know it.
|
||||
self.dataChanged.emit(index.sibling(index.row(), Outline.title.value),
|
||||
index.sibling(index.row(), Outline.title.value))
|
||||
self.dataChanged.emit(index.sibling(index.row(), Outline.title),
|
||||
index.sibling(index.row(), Outline.title))
|
||||
|
||||
return True
|
||||
|
||||
def headerData(self, section, orientation, role=Qt.DisplayRole):
|
||||
if orientation == Qt.Horizontal and role in [Qt.DisplayRole, Qt.ToolTipRole]:
|
||||
if section == Outline.title.value:
|
||||
if section == Outline.title:
|
||||
return self.tr("Title")
|
||||
elif section == Outline.POV.value:
|
||||
elif section == Outline.POV:
|
||||
return self.tr("POV")
|
||||
elif section == Outline.label.value:
|
||||
elif section == Outline.label:
|
||||
return self.tr("Label")
|
||||
elif section == Outline.status.value:
|
||||
elif section == Outline.status:
|
||||
return self.tr("Status")
|
||||
elif section == Outline.compile.value:
|
||||
elif section == Outline.compile:
|
||||
return self.tr("Compile")
|
||||
elif section == Outline.wordCount.value:
|
||||
elif section == Outline.wordCount:
|
||||
return self.tr("Word count")
|
||||
elif section == Outline.goal.value:
|
||||
elif section == Outline.goal:
|
||||
return self.tr("Goal")
|
||||
elif section == Outline.goalPercentage.value:
|
||||
elif section == Outline.goalPercentage:
|
||||
return "%"
|
||||
else:
|
||||
return [i.name for i in Outline][section]
|
||||
|
||||
elif role == Qt.SizeHintRole:
|
||||
if section == Outline.compile.value:
|
||||
if section == Outline.compile:
|
||||
return QSize(40, 30)
|
||||
elif section == Outline.goalPercentage.value:
|
||||
elif section == Outline.goalPercentage:
|
||||
return QSize(100, 30)
|
||||
else:
|
||||
return QVariant()
|
||||
|
@ -230,7 +230,7 @@ class abstractModel(QAbstractItemModel):
|
|||
elif not index.isValid():
|
||||
flags |= Qt.ItemIsDropEnabled
|
||||
|
||||
if index.isValid() and index.column() == Outline.compile.value:
|
||||
if index.isValid() and index.column() == Outline.compile:
|
||||
flags |= Qt.ItemIsUserCheckable
|
||||
|
||||
if index.column() in [i.value for i in [Outline.wordCount, Outline.goalPercentage]]:
|
||||
|
@ -410,7 +410,7 @@ class abstractModel(QAbstractItemModel):
|
|||
if item.ID() in IDs:
|
||||
# Recursively remove ID. So will get a new one when inserted.
|
||||
def stripID(item):
|
||||
item.setData(Outline.ID.value, None)
|
||||
item.setData(Outline.ID, None)
|
||||
for c in item.children():
|
||||
stripID(c)
|
||||
|
||||
|
|
|
@ -140,9 +140,9 @@ def infos(ref):
|
|||
path = " > ".join(pathStr)
|
||||
|
||||
# Summaries and notes
|
||||
ss = item.data(Outline.summarySentence.value)
|
||||
ls = item.data(Outline.summaryFull.value)
|
||||
notes = item.data(Outline.notes.value)
|
||||
ss = item.data(Outline.summarySentence)
|
||||
ls = item.data(Outline.summaryFull)
|
||||
notes = item.data(Outline.notes)
|
||||
|
||||
text = """<h1>{title}</h1>
|
||||
<p><b>{pathTitle}</b> {path}</p>
|
||||
|
@ -237,7 +237,7 @@ def infos(ref):
|
|||
idx = oM.getIndexByID(t)
|
||||
listPOV += "<li><a href='{link}'>{text}</a></li>".format(
|
||||
link=textReference(t),
|
||||
text=oM.data(idx, Outline.title.value))
|
||||
text=oM.data(idx, Outline.title))
|
||||
|
||||
text = """<h1>{name}</h1>
|
||||
{goto}
|
||||
|
@ -570,8 +570,8 @@ def findReferencesTo(ref, parent=None, recursive=True):
|
|||
ref2 = ref[:-1] + "}"
|
||||
|
||||
# Since it's a simple search (no regex), we search for both.
|
||||
lst = parent.findItemsContaining(ref, [Outline.notes.value], recursive=recursive)
|
||||
lst += parent.findItemsContaining(ref2, [Outline.notes.value], recursive=recursive)
|
||||
lst = parent.findItemsContaining(ref, [Outline.notes], recursive=recursive)
|
||||
lst += parent.findItemsContaining(ref2, [Outline.notes], recursive=recursive)
|
||||
|
||||
return lst
|
||||
|
||||
|
@ -585,7 +585,7 @@ def listReferences(ref, title=qApp.translate("references", "Referenced in:")):
|
|||
idx = oM.getIndexByID(t)
|
||||
listRefs += "<li><a href='{link}'>{text}</a></li>".format(
|
||||
link=textReference(t),
|
||||
text=oM.data(idx, Outline.title.value))
|
||||
text=oM.data(idx, Outline.title))
|
||||
|
||||
return "<h2>{title}</h2><ul>{ref}</ul>".format(
|
||||
title=title,
|
||||
|
|
|
@ -46,9 +46,9 @@ autoSaveDelay = 5
|
|||
autoSaveNoChanges = True
|
||||
autoSaveNoChangesDelay = 5
|
||||
saveOnQuit = True
|
||||
outlineViewColumns = [Outline.title.value, Outline.POV.value, Outline.status.value,
|
||||
Outline.compile.value, Outline.wordCount.value, Outline.goal.value,
|
||||
Outline.goalPercentage.value, Outline.label.value]
|
||||
outlineViewColumns = [Outline.title.value, Outline.POV.value, Outline.status,
|
||||
Outline.compile.value, Outline.wordCount.value, Outline.goal,
|
||||
Outline.goalPercentage.value, Outline.label]
|
||||
corkBackground = {
|
||||
"color": "#926239",
|
||||
"image": "writingdesk"
|
||||
|
|
|
@ -355,14 +355,14 @@ class settingsWindow(QWidget, Ui_Settings):
|
|||
|
||||
def outlineColumnsData(self):
|
||||
return {
|
||||
self.chkOutlineTitle: Outline.title.value,
|
||||
self.chkOutlinePOV: Outline.POV.value,
|
||||
self.chkOutlineLabel: Outline.label.value,
|
||||
self.chkOutlineStatus: Outline.status.value,
|
||||
self.chkOutlineCompile: Outline.compile.value,
|
||||
self.chkOutlineWordCount: Outline.wordCount.value,
|
||||
self.chkOutlineGoal: Outline.goal.value,
|
||||
self.chkOutlinePercentage: Outline.goalPercentage.value,
|
||||
self.chkOutlineTitle: Outline.title,
|
||||
self.chkOutlinePOV: Outline.POV,
|
||||
self.chkOutlineLabel: Outline.label,
|
||||
self.chkOutlineStatus: Outline.status,
|
||||
self.chkOutlineCompile: Outline.compile,
|
||||
self.chkOutlineWordCount: Outline.wordCount,
|
||||
self.chkOutlineGoal: Outline.goal,
|
||||
self.chkOutlinePercentage: Outline.goalPercentage,
|
||||
}
|
||||
|
||||
def outlineColumnsChanged(self):
|
||||
|
|
|
@ -273,9 +273,9 @@ class fullScreenEditor(QWidget):
|
|||
if self._index:
|
||||
item = self._index.internalPointer()
|
||||
|
||||
wc = item.data(Outline.wordCount.value)
|
||||
goal = item.data(Outline.goal.value)
|
||||
pg = item.data(Outline.goalPercentage.value)
|
||||
wc = item.data(Outline.wordCount)
|
||||
goal = item.data(Outline.goal)
|
||||
pg = item.data(Outline.goalPercentage)
|
||||
|
||||
if goal:
|
||||
rect = self.lblProgress.geometry()
|
||||
|
|
|
@ -301,9 +301,9 @@ class mainEditor(QWidget, Ui_mainEditor):
|
|||
if not item:
|
||||
item = self.mw.mdlOutline.rootItem
|
||||
|
||||
wc = item.data(Outline.wordCount.value)
|
||||
goal = item.data(Outline.goal.value)
|
||||
progress = item.data(Outline.goalPercentage.value)
|
||||
wc = item.data(Outline.wordCount)
|
||||
goal = item.data(Outline.goal)
|
||||
progress = item.data(Outline.goalPercentage)
|
||||
# mw = qApp.activeWindow()
|
||||
|
||||
if not wc:
|
||||
|
|
|
@ -45,7 +45,7 @@ class textFormat(QWidget, Ui_textFormat):
|
|||
self.setVisible(False)
|
||||
return
|
||||
|
||||
if index.column() not in [Outline.text.value, Outline.notes.value]:
|
||||
if index.column() not in [Outline.text.value, Outline.notes]:
|
||||
self.setVisible(False)
|
||||
return
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ class generalSettings(QWidget, Ui_generalSettings):
|
|||
# TreeView to select parent
|
||||
# We use a proxy to display only folders
|
||||
proxy = QSortFilterProxyModel()
|
||||
proxy.setFilterKeyColumn(Outline.type.value)
|
||||
proxy.setFilterKeyColumn(Outline.type)
|
||||
proxy.setFilterFixedString("folder")
|
||||
proxy.setSourceModel(self.mw.mdlOutline)
|
||||
self.treeGeneralParent.setModel(proxy)
|
||||
|
|
|
@ -312,7 +312,7 @@ class importerDialog(QWidget, Ui_importer):
|
|||
if self.settingsWidget.trimLongTitles():
|
||||
for item in items:
|
||||
if len(item.title()) > 32:
|
||||
item.setData(Outline.title.value, item.title()[:32])
|
||||
item.setData(Outline.title, item.title()[:32])
|
||||
|
||||
# Split at
|
||||
if self.settingsWidget.splitScenes():
|
||||
|
|
|
@ -84,7 +84,7 @@ class revisions(QWidget, Ui_revisions):
|
|||
|
||||
def updateMaybe(self, topLeft, bottomRight):
|
||||
if self._index and \
|
||||
topLeft.column() <= Outline.revisions.value <= bottomRight.column() and \
|
||||
topLeft.column() <= Outline.revisions <= bottomRight.column() and \
|
||||
topLeft.row() <= self._index.row() <= bottomRight.row():
|
||||
# self.update()
|
||||
self.updateTimer.start()
|
||||
|
@ -228,9 +228,9 @@ class revisions(QWidget, Ui_revisions):
|
|||
ts = i.data(Qt.UserRole)
|
||||
item = self._index.internalPointer()
|
||||
textBefore = [r[1] for r in item.revisions() if r[0] == ts][0]
|
||||
index = self._index.sibling(self._index.row(), Outline.text.value)
|
||||
index = self._index.sibling(self._index.row(), Outline.text)
|
||||
self._index.model().setData(index, textBefore)
|
||||
# item.setData(Outline.text.value, textBefore)
|
||||
# item.setData(Outline.text, textBefore)
|
||||
|
||||
def delete(self):
|
||||
i = self.list.currentItem()
|
||||
|
|
|
@ -86,14 +86,14 @@ class search(QWidget, Ui_search):
|
|||
|
||||
# Chosing the right columns
|
||||
lstColumns = [
|
||||
("Title", Outline.title.value),
|
||||
("Text", Outline.text.value),
|
||||
("Summary", Outline.summarySentence.value),
|
||||
("Summary", Outline.summaryFull.value),
|
||||
("Notes", Outline.notes.value),
|
||||
("POV", Outline.POV.value),
|
||||
("Status", Outline.status.value),
|
||||
("Label", Outline.label.value),
|
||||
("Title", Outline.title),
|
||||
("Text", Outline.text),
|
||||
("Summary", Outline.summarySentence),
|
||||
("Summary", Outline.summaryFull),
|
||||
("Notes", Outline.notes),
|
||||
("POV", Outline.POV),
|
||||
("Status", Outline.status),
|
||||
("Label", Outline.label),
|
||||
]
|
||||
columns = [c[1] for c in lstColumns if self.options[c[0]] or self.options["All"]]
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@ class basicItemView(QWidget, Ui_basicItemView):
|
|||
def __init__(self, parent=None):
|
||||
QWidget.__init__(self)
|
||||
self.setupUi(self)
|
||||
self.txtSummarySentence.setColumn(Outline.summarySentence.value)
|
||||
self.txtSummaryFull.setColumn(Outline.summaryFull.value)
|
||||
self.txtGoal.setColumn(Outline.setGoal.value)
|
||||
self.txtSummarySentence.setColumn(Outline.summarySentence)
|
||||
self.txtSummaryFull.setColumn(Outline.summaryFull)
|
||||
self.txtGoal.setColumn(Outline.setGoal)
|
||||
|
||||
def setModels(self, mdlOutline, mdlCharacter, mdlLabels, mdlStatus):
|
||||
self.cmbPOV.setModels(mdlCharacter, mdlOutline)
|
||||
|
|
|
@ -14,7 +14,7 @@ class chkOutlineCompile(QCheckBox):
|
|||
def __init__(self, parent=None):
|
||||
QCheckBox.__init__(self, parent)
|
||||
self.stateChanged.connect(self.submit)
|
||||
self._column = Outline.compile.value
|
||||
self._column = Outline.compile
|
||||
self._index = None
|
||||
self._indexes = None
|
||||
self._model = None
|
||||
|
|
|
@ -13,7 +13,7 @@ class cmbOutlineCharacterChoser(QComboBox):
|
|||
def __init__(self, parent=None):
|
||||
QComboBox.__init__(self, parent)
|
||||
self.activated[int].connect(self.submit)
|
||||
self._column = Outline.POV.value
|
||||
self._column = Outline.POV
|
||||
self._index = None
|
||||
self._indexes = None
|
||||
self._updating = False
|
||||
|
|
|
@ -11,7 +11,7 @@ class cmbOutlineLabelChoser(QComboBox):
|
|||
def __init__(self, parent=None):
|
||||
QComboBox.__init__(self, parent)
|
||||
self.activated[int].connect(self.submit)
|
||||
self._column = Outline.label.value
|
||||
self._column = Outline.label
|
||||
self._index = None
|
||||
self._indexes = None
|
||||
self._updating = False
|
||||
|
|
|
@ -11,7 +11,7 @@ class cmbOutlineStatusChoser(QComboBox):
|
|||
def __init__(self, parent=None):
|
||||
QComboBox.__init__(self, parent)
|
||||
self.activated[int].connect(self.submit)
|
||||
self._column = Outline.status.value
|
||||
self._column = Outline.status
|
||||
self._index = None
|
||||
self._indexes = None
|
||||
self._updating = False
|
||||
|
|
|
@ -114,7 +114,7 @@ class corkDelegate(QStyledItemDelegate):
|
|||
|
||||
if self.editing == Outline.summarySentence:
|
||||
# One line summary
|
||||
editor.setText(item.data(Outline.summarySentence.value))
|
||||
editor.setText(item.data(Outline.summarySentence))
|
||||
|
||||
elif self.editing == Outline.title:
|
||||
# Title
|
||||
|
@ -122,21 +122,21 @@ class corkDelegate(QStyledItemDelegate):
|
|||
|
||||
elif self.editing == Outline.summaryFull:
|
||||
# Summary
|
||||
editor.setPlainText(item.data(Outline.summaryFull.value))
|
||||
editor.setPlainText(item.data(Outline.summaryFull))
|
||||
|
||||
def setModelData(self, editor, model, index):
|
||||
|
||||
if self.editing == Outline.summarySentence:
|
||||
# One line summary
|
||||
model.setData(index.sibling(index.row(), Outline.summarySentence.value), editor.text())
|
||||
model.setData(index.sibling(index.row(), Outline.summarySentence), editor.text())
|
||||
|
||||
elif self.editing == Outline.title:
|
||||
# Title
|
||||
model.setData(index, editor.text(), Outline.title.value)
|
||||
model.setData(index, editor.text(), Outline.title)
|
||||
|
||||
elif self.editing == Outline.summaryFull:
|
||||
# Summary
|
||||
model.setData(index.sibling(index.row(), Outline.summaryFull.value), editor.toPlainText())
|
||||
model.setData(index.sibling(index.row(), Outline.summaryFull), editor.toPlainText())
|
||||
|
||||
def updateRects(self, option, index):
|
||||
if self.newStyle():
|
||||
|
@ -173,7 +173,7 @@ class corkDelegate(QStyledItemDelegate):
|
|||
self.mainRect.topRight() + QPoint(0, h))
|
||||
self.mainTextRect = QRect(self.mainLineRect.bottomLeft() + QPoint(0, margin),
|
||||
self.mainRect.bottomRight())
|
||||
if not item.data(Outline.summarySentence.value):
|
||||
if not item.data(Outline.summarySentence):
|
||||
self.mainTextRect.setTopLeft(self.mainLineRect.topLeft())
|
||||
|
||||
def updateRects_v1(self, option, index):
|
||||
|
@ -194,9 +194,9 @@ 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.summarySentence.value):
|
||||
if not item.data(Outline.summarySentence):
|
||||
self.mainTextRect.setTopLeft(self.mainLineRect.topLeft())
|
||||
if item.data(Outline.label.value) in ["", "0", 0]:
|
||||
if item.data(Outline.label) in ["", "0", 0]:
|
||||
self.titleRect.setBottomRight(self.labelRect.bottomRight() - QPoint(self.margin, self.margin))
|
||||
|
||||
def paint(self, p, option, index):
|
||||
|
@ -340,8 +340,8 @@ class corkDelegate(QStyledItemDelegate):
|
|||
p.restore()
|
||||
|
||||
# One line summary background
|
||||
lineSummary = item.data(Outline.summarySentence.value)
|
||||
fullSummary = item.data(Outline.summaryFull.value)
|
||||
lineSummary = item.data(Outline.summarySentence)
|
||||
fullSummary = item.data(Outline.summaryFull)
|
||||
|
||||
# Border
|
||||
if settings.viewSettings["Cork"]["Border"] != "Nothing":
|
||||
|
@ -359,7 +359,7 @@ class corkDelegate(QStyledItemDelegate):
|
|||
p.restore()
|
||||
|
||||
# Draw status
|
||||
status = item.data(Outline.status.value)
|
||||
status = item.data(Outline.status)
|
||||
if status:
|
||||
it = mainWindow().mdlStatus.item(int(status), 0)
|
||||
if it != None:
|
||||
|
@ -476,8 +476,8 @@ class corkDelegate(QStyledItemDelegate):
|
|||
p.drawLine(self.labelRect.topLeft(), self.labelRect.bottomLeft())
|
||||
|
||||
# One line summary background
|
||||
lineSummary = item.data(Outline.summarySentence.value)
|
||||
fullSummary = item.data(Outline.summaryFull.value)
|
||||
lineSummary = item.data(Outline.summarySentence)
|
||||
fullSummary = item.data(Outline.summaryFull)
|
||||
if lineSummary or not fullSummary:
|
||||
m = self.margin
|
||||
r = self.mainLineRect.adjusted(-m, -m, m, m / 2)
|
||||
|
@ -556,7 +556,7 @@ class corkDelegate(QStyledItemDelegate):
|
|||
|
||||
# Draw status
|
||||
mainRect = self.mainRect
|
||||
status = item.data(Outline.status.value)
|
||||
status = item.data(Outline.status)
|
||||
if status:
|
||||
it = mainWindow().mdlStatus.item(int(status), 0)
|
||||
if it != None:
|
||||
|
|
|
@ -9,7 +9,7 @@ from manuskript.functions import toString
|
|||
class lineEditView(QLineEdit):
|
||||
def __init__(self, parent=None):
|
||||
QLineEdit.__init__(self, parent)
|
||||
self._column = Outline.title.value
|
||||
self._column = Outline.title
|
||||
self._indexes = None
|
||||
self._index = None
|
||||
self._placeholderText = None
|
||||
|
|
|
@ -12,9 +12,9 @@ class metadataView(QWidget, Ui_metadataView):
|
|||
QWidget.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
self._lastIndexes = None
|
||||
self.txtSummarySentence.setColumn(Outline.summarySentence.value)
|
||||
self.txtSummaryFull.setColumn(Outline.summaryFull.value)
|
||||
self.txtNotes.setColumn(Outline.notes.value)
|
||||
self.txtSummarySentence.setColumn(Outline.summarySentence)
|
||||
self.txtSummaryFull.setColumn(Outline.summaryFull)
|
||||
self.txtNotes.setColumn(Outline.notes)
|
||||
self.revisions.setEnabled(False)
|
||||
|
||||
self.txtSummarySentence.setStyleSheet(style.lineEditSS())
|
||||
|
|
|
@ -414,15 +414,15 @@ class outlineBasics(QAbstractItemView):
|
|||
|
||||
def setPOV(self, POV):
|
||||
for i in self.getSelection():
|
||||
self.model().setData(i.sibling(i.row(), Outline.POV.value), str(POV))
|
||||
self.model().setData(i.sibling(i.row(), Outline.POV), str(POV))
|
||||
|
||||
def setStatus(self, status):
|
||||
for i in self.getSelection():
|
||||
self.model().setData(i.sibling(i.row(), Outline.status.value), str(status))
|
||||
self.model().setData(i.sibling(i.row(), Outline.status), str(status))
|
||||
|
||||
def setLabel(self, label):
|
||||
for i in self.getSelection():
|
||||
self.model().setData(i.sibling(i.row(), Outline.label.value), str(label))
|
||||
self.model().setData(i.sibling(i.row(), Outline.label), str(label))
|
||||
|
||||
def setCustomIcon(self, customIcon):
|
||||
for i in self.getSelection():
|
||||
|
|
|
@ -179,7 +179,7 @@ class outlineCharacterDelegate(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) not in ["", None]:
|
||||
if itemIndex.isValid() and self.mdlCharacter.data(itemIndex) not in ["", None]:
|
||||
opt = QStyleOptionComboBox()
|
||||
opt.rect = option.rect
|
||||
|
@ -215,12 +215,12 @@ class outlineGoalPercentageDelegate(QStyledItemDelegate):
|
|||
|
||||
item = index.internalPointer()
|
||||
|
||||
if not item.data(Outline.goal.value):
|
||||
if not item.data(Outline.goal):
|
||||
return
|
||||
|
||||
p = toFloat(item.data(Outline.goalPercentage.value))
|
||||
p = toFloat(item.data(Outline.goalPercentage))
|
||||
|
||||
typ = item.data(Outline.type.value)
|
||||
typ = item.data(Outline.type)
|
||||
|
||||
level = item.level()
|
||||
if self.rootIndex and self.rootIndex.isValid():
|
||||
|
@ -271,7 +271,7 @@ class outlineStatusDelegate(QStyledItemDelegate):
|
|||
for i in range(self.mdlStatus.rowCount()):
|
||||
editor.addItem(self.mdlStatus.item(i, 0).text())
|
||||
|
||||
val = index.internalPointer().data(Outline.status.value)
|
||||
val = index.internalPointer().data(Outline.status)
|
||||
if not val: val = 0
|
||||
editor.setCurrentIndex(int(val))
|
||||
editor.showPopup()
|
||||
|
@ -289,7 +289,7 @@ class outlineStatusDelegate(QStyledItemDelegate):
|
|||
def paint(self, painter, option, index):
|
||||
QStyledItemDelegate.paint(self, painter, option, index)
|
||||
|
||||
if index.isValid() and index.internalPointer().data(Outline.status.value) not in ["", None, "0", 0]:
|
||||
if index.isValid() and index.internalPointer().data(Outline.status) not in ["", None, "0", 0]:
|
||||
opt = QStyleOptionComboBox()
|
||||
opt.rect = option.rect
|
||||
r = qApp.style().subControlRect(QStyle.CC_ComboBox, opt, QStyle.SC_ComboBoxArrow)
|
||||
|
@ -329,7 +329,7 @@ class outlineLabelDelegate(QStyledItemDelegate):
|
|||
editor.addItem(self.mdlLabels.item(i, 0).icon(),
|
||||
self.mdlLabels.item(i, 0).text())
|
||||
|
||||
val = index.internalPointer().data(Outline.label.value)
|
||||
val = index.internalPointer().data(Outline.label)
|
||||
if not val: val = 0
|
||||
editor.setCurrentIndex(int(val))
|
||||
editor.showPopup()
|
||||
|
@ -355,7 +355,7 @@ class outlineLabelDelegate(QStyledItemDelegate):
|
|||
qApp.style().drawControl(QStyle.CE_ItemViewItem, opt, painter)
|
||||
|
||||
# Drop down indicator
|
||||
if index.isValid() and index.internalPointer().data(Outline.label.value) not in ["", None, "0", 0]:
|
||||
if index.isValid() and index.internalPointer().data(Outline.label) not in ["", None, "0", 0]:
|
||||
opt = QStyleOptionComboBox()
|
||||
opt.rect = option.rect
|
||||
r = qApp.style().subControlRect(QStyle.CC_ComboBox, opt, QStyle.SC_ComboBoxArrow)
|
||||
|
|
|
@ -40,29 +40,29 @@ class outlineView(QTreeView, dndView, outlineBasics):
|
|||
# Setting delegates
|
||||
self.outlineTitleDelegate = outlineTitleDelegate(self)
|
||||
# self.outlineTitleDelegate.setView(self)
|
||||
self.setItemDelegateForColumn(Outline.title.value, self.outlineTitleDelegate)
|
||||
self.setItemDelegateForColumn(Outline.title, self.outlineTitleDelegate)
|
||||
self.outlineCharacterDelegate = outlineCharacterDelegate(self.modelCharacters)
|
||||
self.setItemDelegateForColumn(Outline.POV.value, self.outlineCharacterDelegate)
|
||||
self.setItemDelegateForColumn(Outline.POV, self.outlineCharacterDelegate)
|
||||
self.outlineCompileDelegate = outlineCompileDelegate()
|
||||
self.setItemDelegateForColumn(Outline.compile.value, self.outlineCompileDelegate)
|
||||
self.setItemDelegateForColumn(Outline.compile, self.outlineCompileDelegate)
|
||||
self.outlineStatusDelegate = outlineStatusDelegate(self.modelStatus)
|
||||
self.setItemDelegateForColumn(Outline.status.value, self.outlineStatusDelegate)
|
||||
self.setItemDelegateForColumn(Outline.status, self.outlineStatusDelegate)
|
||||
self.outlineGoalPercentageDelegate = outlineGoalPercentageDelegate()
|
||||
self.setItemDelegateForColumn(Outline.goalPercentage.value, self.outlineGoalPercentageDelegate)
|
||||
self.setItemDelegateForColumn(Outline.goalPercentage, self.outlineGoalPercentageDelegate)
|
||||
self.outlineLabelDelegate = outlineLabelDelegate(self.modelLabels)
|
||||
self.setItemDelegateForColumn(Outline.label.value, self.outlineLabelDelegate)
|
||||
self.setItemDelegateForColumn(Outline.label, self.outlineLabelDelegate)
|
||||
|
||||
# Hiding columns
|
||||
self.hideColumns()
|
||||
|
||||
self.header().setSectionResizeMode(Outline.title.value, QHeaderView.Stretch)
|
||||
self.header().setSectionResizeMode(Outline.POV.value, QHeaderView.ResizeToContents)
|
||||
self.header().setSectionResizeMode(Outline.status.value, QHeaderView.ResizeToContents)
|
||||
self.header().setSectionResizeMode(Outline.label.value, QHeaderView.ResizeToContents)
|
||||
self.header().setSectionResizeMode(Outline.compile.value, QHeaderView.ResizeToContents)
|
||||
self.header().setSectionResizeMode(Outline.wordCount.value, QHeaderView.ResizeToContents)
|
||||
self.header().setSectionResizeMode(Outline.goal.value, QHeaderView.ResizeToContents)
|
||||
self.header().setSectionResizeMode(Outline.goalPercentage.value, QHeaderView.ResizeToContents)
|
||||
self.header().setSectionResizeMode(Outline.title, QHeaderView.Stretch)
|
||||
self.header().setSectionResizeMode(Outline.POV, QHeaderView.ResizeToContents)
|
||||
self.header().setSectionResizeMode(Outline.status, QHeaderView.ResizeToContents)
|
||||
self.header().setSectionResizeMode(Outline.label, QHeaderView.ResizeToContents)
|
||||
self.header().setSectionResizeMode(Outline.compile, QHeaderView.ResizeToContents)
|
||||
self.header().setSectionResizeMode(Outline.wordCount, QHeaderView.ResizeToContents)
|
||||
self.header().setSectionResizeMode(Outline.goal, QHeaderView.ResizeToContents)
|
||||
self.header().setSectionResizeMode(Outline.goalPercentage, QHeaderView.ResizeToContents)
|
||||
|
||||
def hideColumns(self):
|
||||
if not self.model():
|
||||
|
@ -77,7 +77,7 @@ class outlineView(QTreeView, dndView, outlineBasics):
|
|||
def setRootIndex(self, index):
|
||||
QTreeView.setRootIndex(self, index)
|
||||
self.outlineGoalPercentageDelegate = outlineGoalPercentageDelegate(index)
|
||||
self.setItemDelegateForColumn(Outline.goalPercentage.value, self.outlineGoalPercentageDelegate)
|
||||
self.setItemDelegateForColumn(Outline.goalPercentage, self.outlineGoalPercentageDelegate)
|
||||
|
||||
def dragMoveEvent(self, event):
|
||||
dndView.dragMoveEvent(self, event)
|
||||
|
|
|
@ -11,7 +11,7 @@ class propertiesView(QWidget, Ui_propertiesView):
|
|||
def __init__(self, parent=None):
|
||||
QWidget.__init__(self)
|
||||
self.setupUi(self)
|
||||
self.txtGoal.setColumn(Outline.setGoal.value)
|
||||
self.txtGoal.setColumn(Outline.setGoal)
|
||||
|
||||
def setModels(self, mdlOutline, mdlCharacter, mdlLabels, mdlStatus):
|
||||
self.cmbPOV.setModels(mdlCharacter, mdlOutline)
|
||||
|
|
|
@ -61,7 +61,7 @@ class storylineView(QWidget, Ui_storylineView):
|
|||
self._mdlCharacter.dataChanged.connect(self.reloadTimer.start)
|
||||
|
||||
def updateMaybe(self, topLeft, bottomRight):
|
||||
if topLeft.column() <= Outline.notes.value <= bottomRight.column():
|
||||
if topLeft.column() <= Outline.notes <= bottomRight.column():
|
||||
self.reloadTimer.start
|
||||
|
||||
def plotReferences(self):
|
||||
|
|
|
@ -27,7 +27,7 @@ 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._column = Outline.text
|
||||
self._index = None
|
||||
self._indexes = None
|
||||
self._model = None
|
||||
|
@ -180,7 +180,7 @@ class textEditView(QTextEdit):
|
|||
return
|
||||
|
||||
# what type of text are we editing?
|
||||
if self._column not in [Outline.text.value, Outline.notes.value]:
|
||||
if self._column not in [Outline.text.value, Outline.notes]:
|
||||
self._textFormat = "text"
|
||||
|
||||
else:
|
||||
|
@ -189,7 +189,7 @@ class textEditView(QTextEdit):
|
|||
# Setting highlighter
|
||||
if self._highlighting:
|
||||
item = index.internalPointer()
|
||||
if self._column in [Outline.text.value, Outline.notes.value]:
|
||||
if self._column in [Outline.text.value, Outline.notes]:
|
||||
self.highlighter = MMDHighlighter(self)
|
||||
else:
|
||||
self.highlighter = basicHighlighter(self)
|
||||
|
@ -200,7 +200,7 @@ class textEditView(QTextEdit):
|
|||
if self._fromTheme or \
|
||||
not self._index or \
|
||||
type(self._index.model()) != outlineModel or \
|
||||
self._column != Outline.text.value:
|
||||
self._column != Outline.text:
|
||||
return
|
||||
|
||||
opt = settings.textEditor
|
||||
|
|
|
@ -109,27 +109,27 @@ class treeTitleDelegate(QStyledItemDelegate):
|
|||
extraText = item.childCount()
|
||||
extraText = " [{}]".format(extraText)
|
||||
elif settings.viewSettings["Tree"]["InfoFolder"] == "WC":
|
||||
extraText = item.data(Outline.wordCount.value)
|
||||
extraText = item.data(Outline.wordCount)
|
||||
extraText = " ({})".format(extraText)
|
||||
elif settings.viewSettings["Tree"]["InfoFolder"] == "Progress":
|
||||
extraText = int(toFloat(item.data(Outline.goalPercentage.value)) * 100)
|
||||
extraText = int(toFloat(item.data(Outline.goalPercentage)) * 100)
|
||||
if extraText:
|
||||
extraText = " ({}%)".format(extraText)
|
||||
elif settings.viewSettings["Tree"]["InfoFolder"] == "Summary":
|
||||
extraText = item.data(Outline.summarySentence.value)
|
||||
extraText = item.data(Outline.summarySentence)
|
||||
if extraText:
|
||||
extraText = " - {}".format(extraText)
|
||||
|
||||
if item.isText() and settings.viewSettings["Tree"]["InfoText"] != "Nothing":
|
||||
if settings.viewSettings["Tree"]["InfoText"] == "WC":
|
||||
extraText = item.data(Outline.wordCount.value)
|
||||
extraText = item.data(Outline.wordCount)
|
||||
extraText = " ({})".format(extraText)
|
||||
elif settings.viewSettings["Tree"]["InfoText"] == "Progress":
|
||||
extraText = int(toFloat(item.data(Outline.goalPercentage.value)) * 100)
|
||||
extraText = int(toFloat(item.data(Outline.goalPercentage)) * 100)
|
||||
if extraText:
|
||||
extraText = " ({}%)".format(extraText)
|
||||
elif settings.viewSettings["Tree"]["InfoText"] == "Summary":
|
||||
extraText = item.data(Outline.summarySentence.value)
|
||||
extraText = item.data(Outline.summarySentence)
|
||||
if extraText:
|
||||
extraText = " - {}".format(extraText)
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ class treeView(QTreeView, dndView, outlineBasics):
|
|||
|
||||
# Setting delegate
|
||||
self.titleDelegate = treeTitleDelegate()
|
||||
self.setItemDelegateForColumn(Outline.title.value, self.titleDelegate)
|
||||
self.setItemDelegateForColumn(Outline.title, self.titleDelegate)
|
||||
|
||||
def makePopupMenu(self):
|
||||
menu = outlineBasics.makePopupMenu(self)
|
||||
|
|
|
@ -445,7 +445,7 @@ class welcome(QWidget, Ui_welcome):
|
|||
_type=_type,
|
||||
parent=parent)
|
||||
if len(datas) == 2:
|
||||
item.setData(Outline.setGoal.value, datas[1][0])
|
||||
item.setData(Outline.setGoal, datas[1][0])
|
||||
# parent.appendChild(item)
|
||||
else:
|
||||
n = 0
|
||||
|
|
Loading…
Reference in a new issue