Optimization in storyline view (wip)

This commit is contained in:
Olivier Keshavjee 2016-03-31 15:58:13 +02:00
parent 3571ec3f16
commit 2cf7d99217
2 changed files with 11 additions and 3 deletions

View file

@ -16,7 +16,7 @@ lineprof:
kernprof -l -v manuskript/main.py
profile:
python3 -m cProfile -s 'cumtime' manuskript/main.py | more
python3 -m cProfile -s 'cumtime' bin/manuskript | more
compile:
cd manuskript && python3 setup.py build_ext --inplace

View file

@ -5,6 +5,7 @@ from PyQt5.QtGui import QBrush, QPen, QFontMetrics, QFontMetricsF, QColor
from PyQt5.QtWidgets import QWidget, QGraphicsScene, QGraphicsSimpleTextItem, QMenu, QAction, QGraphicsRectItem, \
QGraphicsLineItem, QGraphicsEllipseItem
from manuskript.enums import Outline
from manuskript.models import references
from manuskript.ui.views.storylineView_ui import Ui_storylineView
@ -50,11 +51,15 @@ class storylineView(QWidget, Ui_storylineView):
# self._mdlPlots.rowsInserted.connect(self.refresh)
self._mdlOutline = mdlOutline
self._mdlOutline.dataChanged.connect(self.reloadTimer.start)
self._mdlOutline.dataChanged.connect(self.updateMaybe)
self._mdlCharacter = mdlCharacter
self._mdlCharacter.dataChanged.connect(self.reloadTimer.start)
def updateMaybe(self, topLeft, bottomRight):
if topLeft.column() <= Outline.notes.value <= bottomRight.column():
self.reloadTimer.start
def plotReferences(self):
"Returns a list of plot references"
if not self._mdlPlots:
@ -85,7 +90,10 @@ class storylineView(QWidget, Ui_storylineView):
def refresh(self):
if not self._mdlPlots or not self._mdlOutline or not self._mdlCharacter:
pass
return
if not self.isVisible():
return
LINE_HEIGHT = 18
SPACING = 3