diff --git a/i18n/manuskript_fr.qm b/i18n/manuskript_fr.qm
index 5ebb7dd2..413f028b 100644
Binary files a/i18n/manuskript_fr.qm and b/i18n/manuskript_fr.qm differ
diff --git a/i18n/manuskript_fr.ts b/i18n/manuskript_fr.ts
index 30854c63..3204d477 100644
--- a/i18n/manuskript_fr.ts
+++ b/i18n/manuskript_fr.ts
@@ -1100,27 +1100,27 @@ des lignes:
Filtre
-
+
Minor
Mineur
-
+
Secondary
Secondaire
-
+
Main
Principal
-
+
Characters
Personnages
-
+
Texts
Textes
@@ -1346,47 +1346,47 @@ des lignes:
outlineModel
-
+
Title
Titre
-
+
POV
POV
-
+
Label
Label
-
+
Status
Status
-
+
Compile
Compilation
-
+
Word count
Nombre de mots
-
+
Goal
Goal
-
+
{} words / {} ({})
{} mots / {} ({})
-
+
{} words
{} mots
@@ -1542,24 +1542,109 @@ des lignes:
references
-
+
Unknown reference: {}.
Référence inconnue: {}.
-
+
Text: <b>{}</b>
Texte: <b>{}</b>
-
+
Character: <b>{}</b>
Personnage: <b>{}</b>
+
+
+ Basic infos
+ Informations générales
+
+
+
+ Detailed infos
+ Informations détaillées
+
+
+
+ POV of:
+ POV de:
+
+
+
+ Referenced in:
+ Référencé dans:
+
+
+
+ Motivation
+ Motivation
+
+
+
+ Goal
+ Goal
+
+
+
+ Conflict
+ Conflit
+
+
+
+ Epiphany
+ Épiphanie
+
+
+
+ Short summary
+ Résumé court
+
+
+
+ Longer summary
+ Résumé long
+
+
+
+ Path:
+ Chemin:
+
+
+
+ Stats:
+ Stats:
+
+
+
+ POV:
+ POV:
+
+
+
+ Status:
+ Status:
+
+
+
+ Label:
+ Label:
+
+
+
+ Short summary:
+ Résumé court:
+
+
+
+ Long summary:
+ Résumé long:
+
- None
- Aucun
+ Notes:
+ Notes:
diff --git a/src/models/outlineModel.py b/src/models/outlineModel.py
index 4209f136..53c889c1 100644
--- a/src/models/outlineModel.py
+++ b/src/models/outlineModel.py
@@ -55,6 +55,14 @@ class outlineModel(QAbstractItemModel):
item = index.internalPointer()
return item.ID()
+ def findItemsByPOV(self, POV):
+ "Returns a list of IDs of all items whose POV is ``POV``."
+ return self.rootItem.findItemsByPOV(POV)
+
+ def findItemsContaining(self, text, column):
+ "Returns a list of IDs of all items containing ``text`` in column ``column``."
+ return self.rootItem.findItemsContaining(text, column)
+
def getIndexByID(self, ID):
"Returns the index of item whose ID is ``ID``. If none, returns QModelIndex()."
def search(item):
@@ -630,6 +638,12 @@ class outlineItem():
def POV(self):
return self.data(Outline.POV.value)
+ def status(self):
+ return self.data(Outline.status.value)
+
+ def label(self):
+ return self.data(Outline.label.value)
+
def path(self):
"Returns path to item as string."
if self.parent().parent():
@@ -737,4 +751,28 @@ class outlineItem():
path = self.data(Outline.ID.value)
if self.parent().parent():
path = "{}:{}".format(self.parent().pathToItem(), path)
- return path
\ No newline at end of file
+ return path
+
+ def findItemsByPOV(self, POV):
+ "Returns a list of IDs of all subitems whose POV is ``POV``."
+ lst = []
+ if self.POV() == POV:
+ lst.append(self.ID())
+
+ for c in self.children():
+ lst.extend(c.findItemsByPOV(POV))
+
+ return lst
+
+ def findItemsContaining(self, text, column):
+ """Returns a list if IDs of all subitems
+ containing ``text`` in column ``column``.
+ """
+ lst = []
+ if text in self.data(column):
+ lst.append(self.ID())
+
+ for c in self.children():
+ lst.extend(c.findItemsContaining(text, column))
+
+ return lst
\ No newline at end of file
diff --git a/src/models/persosModel.py b/src/models/persosModel.py
index e5e86f87..270485bf 100644
--- a/src/models/persosModel.py
+++ b/src/models/persosModel.py
@@ -165,5 +165,13 @@ class persosModel(QStandardItemModel):
rm.reverse()
for r in rm:
perso.takeRow(r)
-
+
+ def listPersoInfos(self, index):
+ infos = []
+ for i in range(self.rowCount(index)):
+ name = self.data(index.child(i, Perso.infoName.value))
+ val = self.data(index.child(i, Perso.infoData.value))
+ infos.append((name, val))
+
+ return infos
\ No newline at end of file
diff --git a/src/models/references.py b/src/models/references.py
index 5e647ab3..c6b55e6d 100644
--- a/src/models/references.py
+++ b/src/models/references.py
@@ -22,15 +22,33 @@ def infoForRef(ref):
item = idx.internalPointer()
- #Status: {status}
- #Label: {label}
-
+ #Titles
+ pathTitle = qApp.translate("references", "Path:")
+ statsTitle = qApp.translate("references", "Stats:")
+ POVTitle = qApp.translate("references", "POV:")
+ statusTitle = qApp.translate("references", "Status:")
+ labelTitle = qApp.translate("references", "Label:")
+ ssTitle = qApp.translate("references", "Short summary:")
+ lsTitle = qApp.translate("references", "Long summary:")
+ notesTitle = qApp.translate("references", "Notes:")
+
+ POV = ""
if item.POV():
POV = "{text}".format(
ref="::C:{}::".format(item.POV()),
text=mainWindow().mdlPersos.getPersoNameByID(item.POV()))
+
+ status = item.status()
+ if status:
+ status = mainWindow().mdlStatus.item(int(status), 0).text()
else:
- POV = qApp.translate("references", "None")
+ status = ""
+
+ label = item.label()
+ if label:
+ label = mainWindow().mdlLabels.item(int(label), 0).text()
+ else:
+ label = ""
path = item.pathID()
pathStr = []
@@ -40,28 +58,125 @@ def infoForRef(ref):
text=title))
path = " > ".join(pathStr)
+ ss = item.data(Outline.summarySentance.value)
+ ls = item.data(Outline.summaryFull.value)
+ notes = item.data(Outline.notes.value)
+
text = """{title}
- Path: {path}
- Stats: {stats}
- POV: {POV}
- Short summary: {ss}
- Long summary: {ls}
- Notes: {notes}
+ {pathTitle} {path}
+ {statsTitle} {stats}
+ {POV}
+ {status}
+ {label}
+ {ss}
+ {ls}
+ {notes}
""".format(
title=item.title(),
+ pathTitle=pathTitle,
path=path,
+ statsTitle=statsTitle,
stats=item.stats(),
- POV=POV,
- ss=item.data(Outline.summarySentance.value).replace("\n", "
"),
- ls=item.data(Outline.summaryFull.value).replace("\n", "
"),
- notes=linkifyAllRefs(item.data(Outline.notes.value)).replace("\n", "
"))
+ POV="{POVTitle} {POV}
".format(
+ POVTitle=POVTitle,
+ POV=POV) if POV else "",
+ status="{statusTitle} {status}
".format(
+ statusTitle=statusTitle,
+ status=status) if status else "",
+ label="{labelTitle} {label}
".format(
+ labelTitle=labelTitle,
+ label=label) if label else "",
+ ss="{ssTitle} {ss}
".format(
+ ssTitle=ssTitle,
+ ss=ss.replace("\n", "
")) if ss else "",
+ ls="{lsTitle}
{ls}
".format(
+ lsTitle=lsTitle,
+ ls=ls.replace("\n", "
")) if ls else "",
+ notes="{notesTitle}
{notes}
".format(
+ notesTitle=notesTitle,
+ notes=linkifyAllRefs(notes).replace("\n", "
")) if notes else "",
+ )
return text
elif _type == "C":
m = mainWindow().mdlPersos
- name = m.item(int(_ref), Perso.name.value).text()
- return "{}
".format(name)
+ index = m.getIndexFromID(_ref)
+ name = m.name(index.row())
+
+ # Titles
+ basicTitle = qApp.translate("references", "Basic infos")
+ detailedTitle = qApp.translate("references", "Detailed infos")
+ POVof = qApp.translate("references", "POV of:")
+ referencedIn = qApp.translate("references", "Referenced in:")
+
+ # basic infos
+ basic = []
+ for i in [
+ (Perso.motivation, qApp.translate("references", "Motivation"), False),
+ (Perso.goal, qApp.translate("references", "Goal"), False),
+ (Perso.conflict, qApp.translate("references", "Conflict"), False),
+ (Perso.epiphany, qApp.translate("references", "Epiphany"), False),
+ (Perso.summarySentance, qApp.translate("references", "Short summary"), True),
+ (Perso.summaryPara, qApp.translate("references", "Longer summary"), True),
+ ]:
+ val = m.data(index.sibling(index.row(), i[0].value))
+ if val:
+ basic .append("{title}:{n}{val}".format(
+ title=i[1],
+ n = "\n" if i[2] else " ",
+ val=val))
+ basic = "
".join(basic)
+
+ # detailed infos
+ detailed = []
+ for _name, _val in m.listPersoInfos(index):
+ detailed.append("{}: {}".format(
+ _name,
+ _val))
+ detailed = "
".join(detailed)
+
+ # list scenes of which it is POV
+ oM = mainWindow().mdlOutline
+ lst = oM.findItemsByPOV(_ref)
+
+ listPOV = ""
+ for t in lst:
+ idx = oM.getIndexByID(t)
+ listPOV += "{text}".format(
+ link="::T:{}::".format(t),
+ text=oM.data(idx, Outline.title.value))
+
+ # List scences where character is referenced
+ listRefs = ""
+ lst = oM.findItemsContaining(ref, Outline.notes.value)
+ for t in lst:
+ idx = oM.getIndexByID(t)
+ listRefs += "{text}".format(
+ link="::T:{}::".format(t),
+ text=oM.data(idx, Outline.title.value))
+
+ text = """{name}
+ {basicInfos}
+ {detailedInfos}
+ {POV}
+ {references}
+ """.format(
+ name=name,
+ basicInfos="{basicTitle}
{basic}".format(
+ basicTitle=basicTitle,
+ basic=basic) if basic else "",
+ detailedInfos="{detailedTitle}
{detailed}".format(
+ detailedTitle=detailedTitle,
+ detailed=detailed) if detailed else "",
+ POV="{POVof}
".format(
+ POVof=POVof,
+ listPOV=listPOV) if listPOV else "",
+ references="{referencedIn}
".format(
+ referencedIn=referencedIn,
+ listRefs=listRefs) if listRefs else "",
+ )
+ return text
else:
return qApp.translate("references", "Unknown reference: {}.").format(ref)
diff --git a/src/ui/cheatSheet.py b/src/ui/cheatSheet.py
index 119a9700..6b393a2e 100644
--- a/src/ui/cheatSheet.py
+++ b/src/ui/cheatSheet.py
@@ -24,6 +24,7 @@ class cheatSheet(QWidget, Ui_cheatSheet):
self.list.setItemDelegate(self.listDelegate)
self.list.itemActivated.connect(self.showInfos)
self.view.linkActivated.connect(self.openLink)
+ self.view.linkHovered.connect(self.linkHovered)
self.outlineModel = None
self.persoModel = None
@@ -104,6 +105,10 @@ class cheatSheet(QWidget, Ui_cheatSheet):
def openLink(self, link):
openReference(link)
+ def linkHovered(self, link):
+ if link:
+ QToolTip.showText(QCursor.pos(), tooltipForRef(link))
+
def keyPressEvent(self, event):
if event.key() in [Qt.Key_Up, Qt.Key_Down]:
self.list.keyPressEvent(event)