Clean up variables
This commit is contained in:
@@ -71,10 +71,10 @@ class GuiDocSplit(NDialog):
|
|||||||
vSp = CONFIG.pxInt(8)
|
vSp = CONFIG.pxInt(8)
|
||||||
bSp = CONFIG.pxInt(12)
|
bSp = CONFIG.pxInt(12)
|
||||||
|
|
||||||
pOptions = SHARED.project.options
|
options = SHARED.project.options
|
||||||
spLevel = pOptions.getInt("GuiDocSplit", "spLevel", 3)
|
spLevel = options.getInt("GuiDocSplit", "spLevel", 3)
|
||||||
intoFolder = pOptions.getBool("GuiDocSplit", "intoFolder", True)
|
intoFolder = options.getBool("GuiDocSplit", "intoFolder", True)
|
||||||
docHierarchy = pOptions.getBool("GuiDocSplit", "docHierarchy", True)
|
docHierarchy = options.getBool("GuiDocSplit", "docHierarchy", True)
|
||||||
|
|
||||||
# Heading Selection
|
# Heading Selection
|
||||||
self.listBox = QListWidget(self)
|
self.listBox = QListWidget(self)
|
||||||
@@ -171,10 +171,10 @@ class GuiDocSplit(NDialog):
|
|||||||
self._data["moveToTrash"] = moveToTrash
|
self._data["moveToTrash"] = moveToTrash
|
||||||
|
|
||||||
logger.debug("Saving State: GuiDocSplit")
|
logger.debug("Saving State: GuiDocSplit")
|
||||||
pOptions = SHARED.project.options
|
options = SHARED.project.options
|
||||||
pOptions.setValue("GuiDocSplit", "spLevel", spLevel)
|
options.setValue("GuiDocSplit", "spLevel", spLevel)
|
||||||
pOptions.setValue("GuiDocSplit", "intoFolder", intoFolder)
|
options.setValue("GuiDocSplit", "intoFolder", intoFolder)
|
||||||
pOptions.setValue("GuiDocSplit", "docHierarchy", docHierarchy)
|
options.setValue("GuiDocSplit", "docHierarchy", docHierarchy)
|
||||||
|
|
||||||
return self._data, self._text
|
return self._data, self._text
|
||||||
|
|
||||||
@@ -218,46 +218,46 @@ class GuiDocSplit(NDialog):
|
|||||||
if not self._text:
|
if not self._text:
|
||||||
self._text = SHARED.project.storage.getDocumentText(sHandle).splitlines()
|
self._text = SHARED.project.storage.getDocumentText(sHandle).splitlines()
|
||||||
|
|
||||||
for lineNo, aLine in enumerate(self._text):
|
for i, line in enumerate(self._text):
|
||||||
|
|
||||||
onLine = -1
|
pos = -1
|
||||||
hLevel = 0
|
level = 0
|
||||||
hLabel = aLine.strip()
|
label = line.strip()
|
||||||
if aLine.startswith("# ") and spLevel >= 1:
|
if line.startswith("# ") and spLevel >= 1:
|
||||||
onLine = lineNo
|
pos = i
|
||||||
hLevel = 1
|
level = 1
|
||||||
hLabel = aLine[2:].strip()
|
label = line[2:].strip()
|
||||||
elif aLine.startswith("## ") and spLevel >= 2:
|
elif line.startswith("## ") and spLevel >= 2:
|
||||||
onLine = lineNo
|
pos = i
|
||||||
hLevel = 2
|
level = 2
|
||||||
hLabel = aLine[3:].strip()
|
label = line[3:].strip()
|
||||||
elif aLine.startswith("### ") and spLevel >= 3:
|
elif line.startswith("### ") and spLevel >= 3:
|
||||||
onLine = lineNo
|
pos = i
|
||||||
hLevel = 3
|
level = 3
|
||||||
hLabel = aLine[4:].strip()
|
label = line[4:].strip()
|
||||||
elif aLine.startswith("#### ") and spLevel >= 4:
|
elif line.startswith("#### ") and spLevel >= 4:
|
||||||
onLine = lineNo
|
pos = i
|
||||||
hLevel = 4
|
level = 4
|
||||||
hLabel = aLine[5:].strip()
|
label = line[5:].strip()
|
||||||
elif aLine.startswith("#! ") and spLevel >= 1:
|
elif line.startswith("#! ") and spLevel >= 1:
|
||||||
onLine = lineNo
|
pos = i
|
||||||
hLevel = 1
|
level = 1
|
||||||
hLabel = aLine[3:].strip()
|
label = line[3:].strip()
|
||||||
elif aLine.startswith("##! ") and spLevel >= 2:
|
elif line.startswith("##! ") and spLevel >= 2:
|
||||||
onLine = lineNo
|
pos = i
|
||||||
hLevel = 2
|
level = 2
|
||||||
hLabel = aLine[4:].strip()
|
label = line[4:].strip()
|
||||||
elif aLine.startswith("###! ") and spLevel >= 3:
|
elif line.startswith("###! ") and spLevel >= 3:
|
||||||
onLine = lineNo
|
pos = i
|
||||||
hLevel = 3
|
level = 3
|
||||||
hLabel = aLine[5:].strip()
|
label = line[5:].strip()
|
||||||
|
|
||||||
if onLine >= 0 and hLevel > 0:
|
if pos >= 0 and level > 0:
|
||||||
newItem = QListWidgetItem()
|
trItem = QListWidgetItem()
|
||||||
newItem.setText(aLine.strip())
|
trItem.setText(line.strip())
|
||||||
newItem.setData(self.LINE_ROLE, onLine)
|
trItem.setData(self.LINE_ROLE, pos)
|
||||||
newItem.setData(self.LEVEL_ROLE, hLevel)
|
trItem.setData(self.LEVEL_ROLE, level)
|
||||||
newItem.setData(self.LABEL_ROLE, hLabel)
|
trItem.setData(self.LABEL_ROLE, label)
|
||||||
self.listBox.addItem(newItem)
|
self.listBox.addItem(trItem)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user