Porting to Python 3

This commit is contained in:
Olivier Keshavjee 2015-06-07 22:06:57 +02:00
parent 417c3ccd88
commit dbce20c5f7
23 changed files with 98 additions and 90 deletions

View file

@ -1,6 +1,9 @@
Dépendances: Dépendances:
- Python 2 - Python 3
- PyQt - PyQt5
- lxml - lxml
Optional:
- pyenchant

View file

@ -3,7 +3,4 @@
Features Features
- Coach (entrer le nombre de mot viser, se fixer des objectifs quotidiens / hebdomadaires (en temps, ou en mots, min ou max), faire des statistiques) - Coach (entrer le nombre de mot viser, se fixer des objectifs quotidiens / hebdomadaires (en temps, ou en mots, min ou max), faire des statistiques)
- Différents modes: simple (que le outliner / rédacteur), snowflake strict (cache les éléments tant que le précédent n'a pas été accompli), snowflake souple (tout est affiché mais permet de naviger, avec conseils) - Différents modes: simple (que le outliner / rédacteur), snowflake strict (cache les éléments tant que le précédent n'a pas été accompli), snowflake souple (tout est affiché mais permet de naviger, avec conseils)
- Boîte à sable: endroit pour expérimenter, des scenes particulières ou des perso en situations spéciales. Avec suggestions de thèmes / lieux / ... - Boîte à sable: endroit pour expérimenter, des scenes particulières ou des perso en situations spéciales. Avec suggestions de thèmes / lieux / ...
Outline:
- Afficher le nombre de mots, et la cible, et une barre de progressions

View file

@ -5,7 +5,7 @@ UIs= $(UI:.ui=.py) $(UI:.qrc=_rc.py)
ui: $(UIs) ui: $(UIs)
run: $(UIs) run: $(UIs)
python src/main.py python3 src/main.py
debug: $(UIs) debug: $(UIs)
gdb --args python src/main.py gdb --args python src/main.py
@ -14,13 +14,13 @@ lineprof:
kernprof -l -v src/main.py kernprof -l -v src/main.py
profile: profile:
python -m cProfile -s 'cumtime' src/main.py | more python3 -m cProfile -s 'cumtime' src/main.py | more
compile: compile:
cd src && python setup.py build_ext --inplace cd src && python3 setup.py build_ext --inplace
%_rc.py : %.qrc %_rc.py : %.qrc
pyrcc4 "$<" -o "$@" pyrcc5 "$<" -o "$@"
%.py : %.ui %.py : %.ui
# pyuic4 "$<" > "$@" # pyuic4 "$<" > "$@"

View file

@ -1,8 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
#--!-- coding: utf8 --!-- #--!-- coding: utf8 --!--
from __future__ import print_function
from __future__ import unicode_literals
# As seen on http://stackoverflow.com/questions/36932/how-can-i-represent-an-enum-in-python # As seen on http://stackoverflow.com/questions/36932/how-can-i-represent-an-enum-in-python

View file

@ -1,8 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
#--!-- coding: utf8 --!-- #--!-- coding: utf8 --!--
from __future__ import print_function
from __future__ import unicode_literals
from qt import * from qt import *

View file

@ -1,8 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
#--!-- coding: utf8 --!-- #--!-- coding: utf8 --!--
from __future__ import print_function
from __future__ import unicode_literals
from qt import * from qt import *
@ -16,26 +16,26 @@ def saveStandardItemModelXML(mdl, xml):
vHeader = ET.SubElement(header, "vertical") vHeader = ET.SubElement(header, "vertical")
for x in range(mdl.rowCount()): for x in range(mdl.rowCount()):
vH = ET.SubElement(vHeader, "label") vH = ET.SubElement(vHeader, "label")
vH.attrib["row"] = unicode(x) vH.attrib["row"] = str(x)
vH.attrib["text"] = unicode(mdl.headerData(x, Qt.Vertical)) vH.attrib["text"] = str(mdl.headerData(x, Qt.Vertical))
hHeader = ET.SubElement(header, "horizontal") hHeader = ET.SubElement(header, "horizontal")
for y in range(mdl.columnCount()): for y in range(mdl.columnCount()):
hH = ET.SubElement(hHeader, "label") hH = ET.SubElement(hHeader, "label")
hH.attrib["row"] = unicode(y) hH.attrib["row"] = str(y)
hH.attrib["text"] = unicode(mdl.headerData(y, Qt.Horizontal)) hH.attrib["text"] = str(mdl.headerData(y, Qt.Horizontal))
# Data # Data
data = ET.SubElement(root, "data") data = ET.SubElement(root, "data")
for x in range(mdl.rowCount()): for x in range(mdl.rowCount()):
row = ET.SubElement(data, "row") row = ET.SubElement(data, "row")
row.attrib["row"] = unicode(x) row.attrib["row"] = str(x)
for y in range(mdl.columnCount()): for y in range(mdl.columnCount()):
col = ET.SubElement(row, "col") col = ET.SubElement(row, "col")
col.attrib["col"] = unicode(y) col.attrib["col"] = str(y)
if mdl.data(mdl.index(x, y)) <> "": if mdl.data(mdl.index(x, y)) != "":
col.text = mdl.data(mdl.index(x, y)) col.text = mdl.data(mdl.index(x, y))
print("Saving to {}.".format(xml)) print("Saving to {}.".format(xml))

View file

@ -4,7 +4,7 @@ import sys
from qt import * from qt import *
if __name__ == "__main__": def run():
app = QApplication(sys.argv) app = QApplication(sys.argv)
app.setOrganizationName("Theologeek") app.setOrganizationName("Theologeek")
app.setOrganizationDomain("www.theologeek.ch") app.setOrganizationDomain("www.theologeek.ch")
@ -20,3 +20,6 @@ if __name__ == "__main__":
app.exec_() app.exec_()
app.deleteLater() app.deleteLater()
if __name__ == "__main__":
run()

View file

@ -1,8 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
#--!-- coding: utf8 --!-- #--!-- coding: utf8 --!--
from __future__ import print_function
from __future__ import unicode_literals
from qt import * from qt import *
@ -23,7 +23,7 @@ except ImportError:
class MainWindow(QMainWindow, Ui_MainWindow): class MainWindow(QMainWindow, Ui_MainWindow):
dictChanged = pyqtSignal(unicode) dictChanged = pyqtSignal(str)
def __init__(self): def __init__(self):
QMainWindow.__init__(self) QMainWindow.__init__(self)
@ -228,8 +228,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.treeDebugOutline.setModel(self.mdlOutline) self.treeDebugOutline.setModel(self.mdlOutline)
# Playing with qStyle # Playing with qStyle
self.cmbStyle.addItems(QStyleFactory.keys()) self.cmbStyle.addItems(list(QStyleFactory.keys()))
self.cmbStyle.setCurrentIndex([i.lower() for i in QStyleFactory.keys()].index(qApp.style().objectName())) self.cmbStyle.setCurrentIndex([i.lower() for i in list(QStyleFactory.keys())].index(qApp.style().objectName()))
self.cmbStyle.currentIndexChanged[str].connect(qApp.setStyle) self.cmbStyle.currentIndexChanged[str].connect(qApp.setStyle)
self.loadProject("test_project") self.loadProject("test_project")
@ -264,7 +264,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
stretch = Outline.title.value stretch = Outline.title.value
w2 = 0 w2 = 0
for c in range(self.mdlOutline.columnCount()): for c in range(self.mdlOutline.columnCount()):
if not self.treePlanOutline.isColumnHidden(c) and c <> stretch: if not self.treePlanOutline.isColumnHidden(c) and c != stretch:
self.treePlanOutline.resizeColumnToContents(c) self.treePlanOutline.resizeColumnToContents(c)
w2 += self.treePlanOutline.columnWidth(c) w2 += self.treePlanOutline.columnWidth(c)
@ -321,7 +321,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
pid = self.mdlPersos.item(idx.row(), Perso.ID.value).text() pid = self.mdlPersos.item(idx.row(), Perso.ID.value).text()
for c in range(self.mdlPersosInfos.columnCount()): for c in range(self.mdlPersosInfos.columnCount()):
pid2 = self.mdlPersosInfos.item(0, c).text() pid2 = self.mdlPersosInfos.item(0, c).text()
self.tblPersoInfos.setColumnHidden(c, c <> 0 and pid <> pid2) self.tblPersoInfos.setColumnHidden(c, c != 0 and pid != pid2)
self.resizePersosInfos() self.resizePersosInfos()
@ -465,10 +465,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.menuDictGroup = QActionGroup(self) self.menuDictGroup = QActionGroup(self)
for i in enchant.list_dicts(): for i in enchant.list_dicts():
a = QAction(unicode(i[0]), self) a = QAction(str(i[0]), self)
a.setCheckable(True) a.setCheckable(True)
a.triggered.connect(self.setDictionary) a.triggered.connect(self.setDictionary)
if unicode(i[0]) == enchant.get_default_language(): # "fr_CH" if str(i[0]) == enchant.get_default_language(): # "fr_CH"
a.setChecked(True) a.setChecked(True)
self.menuDictGroup.addAction(a) self.menuDictGroup.addAction(a)
self.menuDict.addAction(a) self.menuDict.addAction(a)

View file

@ -1,8 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
#--!-- coding: utf8 --!-- #--!-- coding: utf8 --!--
from __future__ import print_function
from __future__ import unicode_literals
from qt import * from qt import *
from enums import * from enums import *
@ -199,7 +199,7 @@ class outlineModel(QAbstractItemModel):
if column > 0: if column > 0:
column = 0 column = 0
if row <> -1: if row != -1:
beginRow = row beginRow = row
elif parent.isValid(): elif parent.isValid():
beginRow = self.rowCount(parent) + 1 beginRow = self.rowCount(parent) + 1
@ -210,7 +210,7 @@ class outlineModel(QAbstractItemModel):
root = ET.XML(encodedData) root = ET.XML(encodedData)
if root.tag <> "outlineItems": if root.tag != "outlineItems":
return False return False
items = [] items = []
@ -234,7 +234,7 @@ class outlineModel(QAbstractItemModel):
else: else:
parentItem = parent.internalPointer() parentItem = parent.internalPointer()
if parent.isValid() and parent.column() <> 0: if parent.isValid() and parent.column() != 0:
parent = parentItem.index() parent = parentItem.index()
# Insert only if parent is folder # Insert only if parent is folder
@ -257,7 +257,7 @@ class outlineModel(QAbstractItemModel):
else: else:
parentItem = parent.internalPointer() parentItem = parent.internalPointer()
if parent.isValid() and parent.column() <> 0: if parent.isValid() and parent.column() != 0:
parent = parentItem.index() parent = parentItem.index()
# If parent is folder, write into # If parent is folder, write into
@ -418,7 +418,7 @@ class outlineItem():
updateWordCount = False 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.value]:
updateWordCount = not Outline(column) in self._data or self._data[Outline(column)] <> data updateWordCount = not Outline(column) in self._data or self._data[Outline(column)] != data
self._data[Outline(column)] = data self._data[Outline(column)] = data
@ -434,7 +434,7 @@ class outlineItem():
setGoal = toInt(self.data(Outline.setGoal.value)) setGoal = toInt(self.data(Outline.setGoal.value))
goal = toInt(self.data(Outline.goal.value)) goal = toInt(self.data(Outline.goal.value))
if goal <> setGoal: if goal != setGoal:
self._data[Outline.goal] = setGoal self._data[Outline.goal] = setGoal
if setGoal: if setGoal:
wc = toInt(self.data(Outline.wordCount.value)) wc = toInt(self.data(Outline.wordCount.value))
@ -450,7 +450,7 @@ class outlineItem():
goal = toInt(self.data(Outline.goal.value)) goal = toInt(self.data(Outline.goal.value))
if setGoal: if setGoal:
if goal <> setGoal: if goal != setGoal:
self._data[Outline.goal] = setGoal self._data[Outline.goal] = setGoal
else: else:
goal = 0 goal = 0
@ -540,7 +540,7 @@ class outlineItem():
if attrib in exclude: continue if attrib in exclude: continue
val = self.data(attrib.value) val = self.data(attrib.value)
if val or attrib in force: if val or attrib in force:
item.set(attrib.name, unicode(val)) item.set(attrib.name, str(val))
for i in self.childItems: for i in self.childItems:
item.append(ET.XML(i.toXML())) item.append(ET.XML(i.toXML()))
@ -555,7 +555,7 @@ class outlineItem():
#if k == Outline.compile: #if k == Outline.compile:
#self.setData(Outline.__members__[k].value, unicode(root.attrib[k]), Qt.CheckStateRole) #self.setData(Outline.__members__[k].value, unicode(root.attrib[k]), Qt.CheckStateRole)
#else: #else:
self.setData(Outline.__members__[k].value, unicode(root.attrib[k])) self.setData(Outline.__members__[k].value, str(root.attrib[k]))
for child in root: for child in root:
item = outlineItem(self._model, xml=ET.tostring(child)) item = outlineItem(self._model, xml=ET.tostring(child))

View file

@ -1,8 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
#--!-- coding: utf8 --!-- #--!-- coding: utf8 --!--
from __future__ import print_function
from __future__ import unicode_literals
from qt import * from qt import *
from enums import * from enums import *

View file

@ -1,8 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
#--!-- coding: utf8 --!-- #--!-- coding: utf8 --!--
from __future__ import print_function
from __future__ import unicode_literals
from qt import * from qt import *
from enums import * from enums import *

View file

@ -1,8 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
#--!-- coding: utf8 --!-- #--!-- coding: utf8 --!--
from __future__ import print_function
from __future__ import unicode_literals
from qt import * from qt import *
from enums import * from enums import *
@ -27,7 +27,7 @@ class cmbOutlinePersoChoser(QComboBox):
item = self.currentModelIndex.internalPointer() item = self.currentModelIndex.internalPointer()
POV = item.data(Outline.POV.value) POV = item.data(Outline.POV.value)
idx = self.findData(POV) idx = self.findData(POV)
if idx <> -1: if idx != -1:
self.setCurrentIndex(idx) self.setCurrentIndex(idx)
else: else:
self.setCurrentIndex(0) self.setCurrentIndex(0)

View file

@ -1,8 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
#--!-- coding: utf8 --!-- #--!-- coding: utf8 --!--
from __future__ import print_function
from __future__ import unicode_literals
from qt import * from qt import *
from enums import * from enums import *

View file

@ -1,8 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
#--!-- coding: utf8 --!-- #--!-- coding: utf8 --!--
from __future__ import print_function
from __future__ import unicode_literals
from qt import * from qt import *

View file

@ -1,8 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
#--!-- coding: utf8 --!-- #--!-- coding: utf8 --!--
from __future__ import print_function
from __future__ import unicode_literals
from qt import * from qt import *

View file

@ -1,8 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
#--!-- coding: utf8 --!-- #--!-- coding: utf8 --!--
from __future__ import print_function
from __future__ import unicode_literals
from qt import * from qt import *
from enums import * from enums import *
@ -54,9 +54,11 @@ class customTextEdit(QTextEdit):
# Spellchecking # Spellchecking
if enchant and self.spellcheck: if enchant and self.spellcheck:
self.dict = enchant.Dict(self.currentDict if self.currentDict else enchant.get_default_language()) self.dict = enchant.Dict(self.currentDict if self.currentDict else enchant.get_default_language())
else:
self.spellcheck = False
def submit(self): def submit(self):
if self.toPlainText() <> self.item.data(Outline.text.value): if self.toPlainText() != self.item.data(Outline.text.value):
#self._model.setData(self.item.index(), self.toPlainText(), Outline.text.value) #self._model.setData(self.item.index(), self.toPlainText(), Outline.text.value)
self.item.setData(Outline.text.value, self.toPlainText()) self.item.setData(Outline.text.value, self.toPlainText())
@ -66,7 +68,7 @@ class customTextEdit(QTextEdit):
def updateText(self): def updateText(self):
if self.item: if self.item:
if self.toPlainText() <> self.item.data(Outline.text.value): if self.toPlainText() != self.item.data(Outline.text.value):
self.document().setPlainText(self.item.data(Outline.text.value)) self.document().setPlainText(self.item.data(Outline.text.value))
def resizeEvent(self, e): def resizeEvent(self, e):
@ -102,13 +104,13 @@ class customTextEdit(QTextEdit):
class SpellAction(QAction): 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(unicode) correct = pyqtSignal(str)
def __init__(self, *args): def __init__(self, *args):
QAction.__init__(self, *args) QAction.__init__(self, *args)
self.triggered.connect(lambda x: self.correct.emit( self.triggered.connect(lambda x: self.correct.emit(
unicode(self.text()))) str(self.text())))
def contextMenuEvent(self, event): def contextMenuEvent(self, event):
# Based on http://john.nachtimwald.com/2009/08/22/qplaintextedit-with-in-line-spell-check/ # Based on http://john.nachtimwald.com/2009/08/22/qplaintextedit-with-in-line-spell-check/
@ -127,7 +129,7 @@ class customTextEdit(QTextEdit):
# Check if the selected word is misspelled and offer spelling # Check if the selected word is misspelled and offer spelling
# suggestions if it is. # suggestions if it is.
if self.textCursor().hasSelection(): if self.textCursor().hasSelection():
text = unicode(self.textCursor().selectedText()) text = str(self.textCursor().selectedText())
if not self.dict.check(text): if not self.dict.check(text):
spell_menu = QMenu('Spelling Suggestions') spell_menu = QMenu('Spelling Suggestions')
for word in self.dict.suggest(text): for word in self.dict.suggest(text):

View file

@ -1,8 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
#--!-- coding: utf8 --!-- #--!-- coding: utf8 --!--
from __future__ import print_function
from __future__ import unicode_literals
from qt import * from qt import *
from enums import * from enums import *
@ -142,7 +142,6 @@ class editorWidget(QWidget, Ui_editorWidget_ui):
currentScreen = qApp.desktop().screenNumber(self) currentScreen = qApp.desktop().screenNumber(self)
self.setParent(None) self.setParent(None)
mainWindow().hide() mainWindow().hide()
self.move(qApp.desktop().screenGeometry(currentScreen).topLeft())
self.stack.setStyleSheet(""" self.stack.setStyleSheet("""
QTextEdit {{ QTextEdit {{
@ -152,8 +151,12 @@ class editorWidget(QWidget, Ui_editorWidget_ui):
m=str((qApp.desktop().screenGeometry(currentScreen).width() - 800) / 2)) m=str((qApp.desktop().screenGeometry(currentScreen).width() - 800) / 2))
) )
self.move(qApp.desktop().screenGeometry(currentScreen).topLeft())
QWidget.showFullScreen(self) QWidget.showFullScreen(self)
#FIXME: too big?
print(qApp.desktop().screenGeometry(currentScreen), self.geometry())
def keyPressEvent(self, event): def keyPressEvent(self, event):

View file

@ -113,7 +113,7 @@ def translateSelectionToFormattedText(text, start, end):
def printArray(array): def printArray(array):
print("".join([str(j) for j in array])) print(("".join([str(j) for j in array])))
def printArrays(arrays): def printArrays(arrays):
@ -235,7 +235,7 @@ class State:
LIST_EMPTY = 42 LIST_EMPTY = 42
LIST_BULLET = 43 LIST_BULLET = 43
LIST_BULLET_ENDS = 44 LIST_BULLET_ENDS = 44
LIST = [40, 41, 42] + range(100, 201) LIST = [40, 41, 42] + list(range(100, 201))
# TABLE # TABLE
TABLE_LINE = 50 TABLE_LINE = 50
TABLE_HEADER = 51 TABLE_HEADER = 51

View file

@ -317,7 +317,7 @@ class t2tHighlighter (QSyntaxHighlighter):
# Spell checking # Spell checking
# Based on http://john.nachtimwald.com/2009/08/22/qplaintextedit-with-in-line-spell-check/ # Based on http://john.nachtimwald.com/2009/08/22/qplaintextedit-with-in-line-spell-check/
WORDS = u'(?iu)[\w\']+' WORDS = '(?iu)[\w\']+'
if state not in [State.SETTINGS_LINE]: if state not in [State.SETTINGS_LINE]:
if self.editor.spellcheck: if self.editor.spellcheck:
for word_object in re.finditer(WORDS, text): for word_object in re.finditer(WORDS, text):
@ -357,7 +357,7 @@ class t2tHighlighter (QSyntaxHighlighter):
blankLinesBefore = 0 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: if QRegExp(r'^\s*[-+:] [^ ].*[^-+]{1}\s*$').indexIn(text) != -1:
state = State.LIST_BEGINS state = State.LIST_BEGINS
# List stuff # List stuff
@ -390,7 +390,7 @@ class t2tHighlighter (QSyntaxHighlighter):
# Blank lines before (two = end of list) # Blank lines before (two = end of list)
blankLinesBefore = self.getBlankLines(block.previous()) blankLinesBefore = self.getBlankLines(block.previous())
if not QRegExp(r'^\s*$').indexIn(block.previous().text()) <> -1 and \ if not QRegExp(r'^\s*$').indexIn(block.previous().text()) != -1 and \
not blockUserData.getUserState(block.previous()) in [State.COMMENT_LINE, not blockUserData.getUserState(block.previous()) in [State.COMMENT_LINE,
State.COMMENT_AREA, State.COMMENT_AREA_BEGINS, State.COMMENT_AREA, State.COMMENT_AREA_BEGINS,
State.COMMENT_AREA_ENDS]: State.COMMENT_AREA_ENDS]:
@ -403,7 +403,7 @@ class t2tHighlighter (QSyntaxHighlighter):
# End of list. # End of list.
blankLinesBefore = 0 blankLinesBefore = 0
inList = False inList = False
if inList and QRegExp(r'^\s*$').indexIn(text) <> -1: if inList and QRegExp(r'^\s*$').indexIn(text) != -1:
state = State.LIST_EMPTY state = State.LIST_EMPTY
# Areas # Areas
@ -414,7 +414,7 @@ class t2tHighlighter (QSyntaxHighlighter):
(State.TAGGED_AREA_BEGINS, State.TAGGED_AREA, State.TAGGED_AREA_ENDS, '^\'\'\'\s*$'), (State.TAGGED_AREA_BEGINS, State.TAGGED_AREA, State.TAGGED_AREA_ENDS, '^\'\'\'\s*$'),
]: ]:
if QRegExp(marker).indexIn(text) <> -1: if QRegExp(marker).indexIn(text) != -1:
if blockUserData.getUserState(block.previous()) in [begins, middle]: if blockUserData.getUserState(block.previous()) in [begins, middle]:
state = ends state = ends
break break
@ -509,7 +509,7 @@ class t2tHighlighter (QSyntaxHighlighter):
d = QDir.cleanPath(QFileInfo(f).absoluteDir().absolutePath()+"/"+c) d = QDir.cleanPath(QFileInfo(f).absoluteDir().absolutePath()+"/"+c)
file = codecs.open(d, 'r', "utf-8") file = codecs.open(d, 'r', "utf-8")
except: except:
print("Error: cannot open {}.".format(c)) print(("Error: cannot open {}.".format(c)))
continue continue
# We add the content to the current lines of the current document # 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())
@ -520,7 +520,7 @@ class t2tHighlighter (QSyntaxHighlighter):
#while b.isValid(): #while b.isValid():
for l in lines: for l in lines:
text = l #b.text() text = l #b.text()
r = QRegExp(ur'^%!p[or][se]t?proc[^\s]*\s*:\s*(\'[^\']*\'|\"[^\"]*\")\s*(\'[^\']*\'|\"[^\"]*\")') r = QRegExp(r'^%!p[or][se]t?proc[^\s]*\s*:\s*(\'[^\']*\'|\"[^\"]*\")\s*(\'[^\']*\'|\"[^\"]*\")')
if r.indexIn(text) != -1: if r.indexIn(text) != -1:
rule = r.cap(1)[1:-1] rule = r.cap(1)[1:-1]
# Check if there was a color-comment above that post/preproc bloc # Check if there was a color-comment above that post/preproc bloc

View file

@ -1,8 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
#--!-- coding: utf8 --!-- #--!-- coding: utf8 --!--
from __future__ import print_function
from __future__ import unicode_literals
from qt import * from qt import *

View file

@ -1,8 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
#--!-- coding: utf8 --!-- #--!-- coding: utf8 --!--
from __future__ import print_function
from __future__ import unicode_literals
from qt import * from qt import *
@ -34,7 +34,7 @@ class sldImportance(QWidget, Ui_sldImportance):
self.importanceChanged.emit(str(v)) self.importanceChanged.emit(str(v))
def setValue(self, v): def setValue(self, v):
if v <> self.lastValue: if v != self.lastValue:
self.sld.setValue(int(v) if v else 0) self.sld.setValue(int(v) if v else 0)
self.changed(int(v) if v else 0) self.changed(int(v) if v else 0)
self.lastValue = v self.lastValue = v

View file

@ -1,8 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
#--!-- coding: utf8 --!-- #--!-- coding: utf8 --!--
from __future__ import print_function
from __future__ import unicode_literals
from qt import * from qt import *
from enums import * from enums import *

View file

@ -1,9 +1,9 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<outlineItem title="root" type="folder" compile="2" wordCount="573" setGoal="112"> <outlineItem title="root" type="folder" compile="2" wordCount="565" setGoal="112">
<outlineItem title="Nouveau" type="folder" compile="2" wordCount="15"> <outlineItem title="Nouveau" type="folder" compile="2" wordCount="15">
<outlineItem title="Nouveau" type="scene" compile="2" text="return QTextEdit.resizeEvent(self, e) ad ad ad ad adaasd ad adsdasd ad e drset" wordCount="15"/> <outlineItem title="Nouveau" type="scene" compile="2" text="return QTextEdit.resizeEvent(self, e) ad ad ad ad adaasd ad adsdasd ad e drset" wordCount="15"/>
</outlineItem> </outlineItem>
<outlineItem title="Parent" type="folder" status="TODO" compile="2" wordCount="254"> <outlineItem title="Parent" type="folder" status="TODO" compile="2" wordCount="275">
<outlineItem title="Nouveau" type="folder" summarySentance="asd asd asd " status="First draft" compile="2" wordCount="27"> <outlineItem title="Nouveau" type="folder" summarySentance="asd asd asd " status="First draft" compile="2" wordCount="27">
<outlineItem title="A" type="scene" compile="2" text="§Du texteDu texteDu text ad ad ad ad a Du texteDu te asd " wordCount="13" setGoal="10"/> <outlineItem title="A" type="scene" compile="2" text="§Du texteDu texteDu text ad ad ad ad a Du texteDu te asd " wordCount="13" setGoal="10"/>
<outlineItem title="B" type="scene" compile="2" setGoal="3"/> <outlineItem title="B" type="scene" compile="2" setGoal="3"/>
@ -15,12 +15,12 @@
</outlineItem> </outlineItem>
<outlineItem title="MOIMOIMOI" type="scene" POV="1" compile="2" text="ASDASd ASD ASDASd ASD ASDASd ASD **ssss**" wordCount="7" setGoal="10"/> <outlineItem title="MOIMOIMOI" type="scene" POV="1" compile="2" text="ASDASd ASD ASDASd ASD ASDASd ASD **ssss**" wordCount="7" setGoal="10"/>
<outlineItem title="Nouveau s" type="scene" POV="1" compile="2" text="ASDASd ASD ASDASd ASD asd sss ad ad ssss" wordCount="9" setGoal="10"/> <outlineItem title="Nouveau s" type="scene" POV="1" compile="2" text="ASDASd ASD ASDASd ASD asd sss ad ad ssss" wordCount="9" setGoal="10"/>
<outlineItem title="Nouveau" type="scene" compile="2" text="ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;" wordCount="199" setGoal="100"/> <outlineItem title="Nouveau" type="scene" compile="2" text="ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD **ASDASd** ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;ASDASd ASD ASDASd ASD &#10;asd asd &#10;" wordCount="199" setGoal="100"/>
<outlineItem title="B" type="scene" compile="2" text="asd asd asd asd asd asd asd asd asd asd asd" wordCount="12" setGoal="10"/> <outlineItem title="B" type="scene" compile="2" text="asd asd asd asd asd asd asd asd asd asd asd" wordCount="12" setGoal="10"/>
<outlineItem title="Nouveau" type="folder" compile="2"/> <outlineItem title="Nouveau" type="folder" compile="2"/>
<outlineItem title="MOIMOIMOI" type="scene" summaryFull="Là ça joue, et on est content. Pas de raison de se plaindre. **OK**?" status="Second draft" compile="2" text="Là ça joue, et on est content. Pas de raison de se plaindre. **OK**?&#10;&#10;Ben voilà, suffisait de demander ! " wordCount="21" setGoal="250"/>
</outlineItem> </outlineItem>
<outlineItem title="MOIMOIMOI" type="scene" summaryFull="Là ça joue, et on est content. Pas de raison de se plaindre. **OK**?" status="Second draft" compile="2" text="Là ça joue, et on est content. Pas de raison de se plaindre. **OK**?&#10;&#10;Ben voilà, suffisait de demander ! " wordCount="21" setGoal="250"/> <outlineItem title="A" type="scene" compile="2" text="asdasd asd asd asd asd asdasd asdaasd asdasdasdasd asd asd asd asd asdasd asdaasd asdasdasdasd asd asd asd asd asdasd asdaasd asdasdasdasd asd asd asd asd asdasd asdaasd asdasdasdasd asd asd asd asd asdasd asdaasd asdasdasdasd asd asd asd asd asdasd asdaasd asdasdasdasd asd asd asd asd asdasd asdaasd asdasd asd aasdasd asd asd asd asd asdasd asdaasd " wordCount="58" setGoal="50"/>
<outlineItem title="A" type="scene" compile="2" text="asdasd asd asd asd asd asdasd asdaasd asdasdasdasd asd asd asd asd asdasd asdaasd asdasdasdasd asd asd asd asd asdasd asdaasd asdasdasdasd asd asd asd asd asdasd asdaasd asdasdasdasd asd asd asd asd asdasd asdaasd asdasdasdasd asd asd asd asd asdasd asdaasd asdasdasdasd asd asd asd asd asdasd asdaasd asdasd asd aasdasd asd asd asd asd asdasd asdaasd asdasdasdasd asd aasdas dasd asd s" wordCount="66" setGoal="50"/>
<outlineItem title="Nouveau A" type="folder" compile="2" wordCount="217" setGoal="250"> <outlineItem title="Nouveau A" type="folder" compile="2" wordCount="217" setGoal="250">
<outlineItem title="Nouveau" type="scene" compile="2" text="ASDASd ASD ASDASd ASD " wordCount="4"/> <outlineItem title="Nouveau" type="scene" compile="2" text="ASDASd ASD ASDASd ASD " wordCount="4"/>
<outlineItem title="Nouveau" type="scene" compile="2" text="ASDASd ASD " wordCount="2"/> <outlineItem title="Nouveau" type="scene" compile="2" text="ASDASd ASD " wordCount="2"/>