@@ -87,7 +87,7 @@ Synopsis Feature
|
|||||||
|
|
||||||
The "Synopsis" column of the Outline View takes its information from a specially formatted comment.
|
The "Synopsis" column of the Outline View takes its information from a specially formatted comment.
|
||||||
In order to flag a comment as a Synopsis, add the word "Synopsis:" as the first word of the comment.
|
In order to flag a comment as a Synopsis, add the word "Synopsis:" as the first word of the comment.
|
||||||
The ";" is required, and "synopsis" is not case sensitive.
|
The ":" is required, and "synopsis" is not case sensitive.
|
||||||
If it is correctly formatted, the syntax highlighter will indicate this by altering the colour of the word.
|
If it is correctly formatted, the syntax highlighter will indicate this by altering the colour of the word.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|||||||
+12
-6
@@ -309,11 +309,14 @@ class Config:
|
|||||||
"""Load preferences from file and replace default settings.
|
"""Load preferences from file and replace default settings.
|
||||||
"""
|
"""
|
||||||
logger.debug("Loading config file")
|
logger.debug("Loading config file")
|
||||||
|
if self.confPath is None:
|
||||||
|
return False
|
||||||
|
|
||||||
cnfParse = configparser.ConfigParser()
|
cnfParse = configparser.ConfigParser()
|
||||||
|
cnfPath = path.join(self.confPath, self.confFile)
|
||||||
try:
|
try:
|
||||||
cnfParse.read_file(
|
with open(cnfPath, mode="r", encoding="utf8") as inFile:
|
||||||
open(path.join(self.confPath,self.confFile),mode="r",encoding="utf8")
|
cnfParse.read_file(inFile)
|
||||||
)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Could not load config file")
|
logger.error("Could not load config file")
|
||||||
logger.error(str(e))
|
logger.error(str(e))
|
||||||
@@ -484,6 +487,9 @@ class Config:
|
|||||||
"""Save the current preferences to file.
|
"""Save the current preferences to file.
|
||||||
"""
|
"""
|
||||||
logger.debug("Saving config file")
|
logger.debug("Saving config file")
|
||||||
|
if self.confPath is None:
|
||||||
|
return False
|
||||||
|
|
||||||
cnfParse = configparser.ConfigParser()
|
cnfParse = configparser.ConfigParser()
|
||||||
|
|
||||||
# Set options
|
# Set options
|
||||||
@@ -562,10 +568,10 @@ class Config:
|
|||||||
cnfParse.set(cnfSec,"lastpath", str(self.lastPath))
|
cnfParse.set(cnfSec,"lastpath", str(self.lastPath))
|
||||||
|
|
||||||
# Write config file
|
# Write config file
|
||||||
|
cnfPath = path.join(self.confPath, self.confFile)
|
||||||
try:
|
try:
|
||||||
cnfParse.write(
|
with open(cnfPath, mode="w", encoding="utf8") as outFile:
|
||||||
open(path.join(self.confPath, self.confFile), mode="w", encoding="utf8")
|
cnfParse.write(outFile)
|
||||||
)
|
|
||||||
self.confChanged = False
|
self.confChanged = False
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Could not save config file")
|
logger.error("Could not save config file")
|
||||||
|
|||||||
+18
-15
@@ -187,8 +187,12 @@ class GuiDocTitleBar(QWidget):
|
|||||||
self.thePalette.setColor(QPalette.Window, QColor(*self.theTheme.colBack))
|
self.thePalette.setColor(QPalette.Window, QColor(*self.theTheme.colBack))
|
||||||
self.thePalette.setColor(QPalette.Text, QColor(*self.theTheme.colText))
|
self.thePalette.setColor(QPalette.Text, QColor(*self.theTheme.colText))
|
||||||
|
|
||||||
|
fPx = int(0.9*self.theTheme.fontPixelSize)
|
||||||
|
hSp = self.mainConf.pxInt(6)
|
||||||
|
self.buttonSize = fPx + hSp
|
||||||
|
|
||||||
# Main Widget Settings
|
# Main Widget Settings
|
||||||
self.setContentsMargins(0, 0, 0, 0)
|
self.setContentsMargins(2*self.buttonSize, 0, 0, 0)
|
||||||
self.setAutoFillBackground(True)
|
self.setAutoFillBackground(True)
|
||||||
self.setPalette(self.thePalette)
|
self.setPalette(self.thePalette)
|
||||||
|
|
||||||
@@ -197,10 +201,10 @@ class GuiDocTitleBar(QWidget):
|
|||||||
self.theTitle.setText("")
|
self.theTitle.setText("")
|
||||||
self.theTitle.setIndent(0)
|
self.theTitle.setIndent(0)
|
||||||
self.theTitle.setMargin(0)
|
self.theTitle.setMargin(0)
|
||||||
self.theTitle.setContentsMargins(10, 0, 0, 0)
|
self.theTitle.setContentsMargins(0, 0, 0, 0)
|
||||||
self.theTitle.setAutoFillBackground(True)
|
self.theTitle.setAutoFillBackground(True)
|
||||||
self.theTitle.setAlignment(Qt.AlignCenter)
|
self.theTitle.setAlignment(Qt.AlignHCenter | Qt.AlignTop)
|
||||||
self.theTitle.setWordWrap(True)
|
self.theTitle.setFixedHeight(fPx)
|
||||||
self.theTitle.setFrameShape(QFrame.NoFrame)
|
self.theTitle.setFrameShape(QFrame.NoFrame)
|
||||||
self.theTitle.setLineWidth(0)
|
self.theTitle.setLineWidth(0)
|
||||||
self.theTitle.setPalette(self.thePalette)
|
self.theTitle.setPalette(self.thePalette)
|
||||||
@@ -210,13 +214,11 @@ class GuiDocTitleBar(QWidget):
|
|||||||
self.theTitle.setFont(lblFont)
|
self.theTitle.setFont(lblFont)
|
||||||
|
|
||||||
# Buttons
|
# Buttons
|
||||||
iPx = self.theTheme.textIconSize
|
|
||||||
|
|
||||||
self.closeButton = QPushButton("")
|
self.closeButton = QPushButton("")
|
||||||
self.closeButton.setIcon(self.theTheme.getIcon("close"))
|
self.closeButton.setIcon(self.theTheme.getIcon("close"))
|
||||||
self.closeButton.setContentsMargins(0, 0, 0, 0)
|
self.closeButton.setContentsMargins(0, 0, 0, 0)
|
||||||
self.closeButton.setIconSize(QSize(iPx, iPx))
|
self.closeButton.setIconSize(QSize(fPx, fPx))
|
||||||
self.closeButton.setFixedSize(iPx, iPx)
|
self.closeButton.setFixedSize(fPx, fPx)
|
||||||
self.closeButton.setFlat(True)
|
self.closeButton.setFlat(True)
|
||||||
self.closeButton.setVisible(False)
|
self.closeButton.setVisible(False)
|
||||||
self.closeButton.clicked.connect(self._closeDocument)
|
self.closeButton.clicked.connect(self._closeDocument)
|
||||||
@@ -225,8 +227,8 @@ class GuiDocTitleBar(QWidget):
|
|||||||
self.minmaxButton = QPushButton("")
|
self.minmaxButton = QPushButton("")
|
||||||
self.minmaxButton.setIcon(self.theTheme.getIcon("maximise"))
|
self.minmaxButton.setIcon(self.theTheme.getIcon("maximise"))
|
||||||
self.minmaxButton.setContentsMargins(0, 0, 0, 0)
|
self.minmaxButton.setContentsMargins(0, 0, 0, 0)
|
||||||
self.minmaxButton.setIconSize(QSize(iPx, iPx))
|
self.minmaxButton.setIconSize(QSize(fPx, fPx))
|
||||||
self.minmaxButton.setFixedSize(iPx, iPx)
|
self.minmaxButton.setFixedSize(fPx, fPx)
|
||||||
self.minmaxButton.setFlat(True)
|
self.minmaxButton.setFlat(True)
|
||||||
self.minmaxButton.setVisible(False)
|
self.minmaxButton.setVisible(False)
|
||||||
self.minmaxButton.clicked.connect(self._minmaxDocument)
|
self.minmaxButton.clicked.connect(self._minmaxDocument)
|
||||||
@@ -234,17 +236,15 @@ class GuiDocTitleBar(QWidget):
|
|||||||
self.refreshButton = QPushButton("")
|
self.refreshButton = QPushButton("")
|
||||||
self.refreshButton.setIcon(self.theTheme.getIcon("refresh"))
|
self.refreshButton.setIcon(self.theTheme.getIcon("refresh"))
|
||||||
self.refreshButton.setContentsMargins(0, 0, 0, 0)
|
self.refreshButton.setContentsMargins(0, 0, 0, 0)
|
||||||
self.refreshButton.setIconSize(QSize(iPx, iPx))
|
self.refreshButton.setIconSize(QSize(fPx, fPx))
|
||||||
self.refreshButton.setFixedSize(iPx, iPx)
|
self.refreshButton.setFixedSize(fPx, fPx)
|
||||||
self.refreshButton.setFlat(True)
|
self.refreshButton.setFlat(True)
|
||||||
self.refreshButton.setVisible(False)
|
self.refreshButton.setVisible(False)
|
||||||
self.refreshButton.clicked.connect(self._refreshDocument)
|
self.refreshButton.clicked.connect(self._refreshDocument)
|
||||||
|
|
||||||
# Assemble Layout
|
# Assemble Layout
|
||||||
hSp = self.mainConf.pxInt(6)
|
|
||||||
self.outerBox = QHBoxLayout()
|
self.outerBox = QHBoxLayout()
|
||||||
self.outerBox.setSpacing(hSp)
|
self.outerBox.setSpacing(hSp)
|
||||||
self.outerBox.addSpacing(2*(iPx + hSp))
|
|
||||||
self.outerBox.addWidget(self.theTitle, 1)
|
self.outerBox.addWidget(self.theTitle, 1)
|
||||||
if self.isEditor:
|
if self.isEditor:
|
||||||
self.outerBox.addWidget(self.minmaxButton, 0)
|
self.outerBox.addWidget(self.minmaxButton, 0)
|
||||||
@@ -315,11 +315,14 @@ class GuiDocTitleBar(QWidget):
|
|||||||
"""Switch on or off zen mode.
|
"""Switch on or off zen mode.
|
||||||
"""
|
"""
|
||||||
self.theParent.theParent.toggleZenMode()
|
self.theParent.theParent.toggleZenMode()
|
||||||
self.closeButton.setVisible(not self.theParent.theParent.isZenMode)
|
|
||||||
if self.theParent.theParent.isZenMode:
|
if self.theParent.theParent.isZenMode:
|
||||||
self.minmaxButton.setIcon(self.theTheme.getIcon("minimise"))
|
self.minmaxButton.setIcon(self.theTheme.getIcon("minimise"))
|
||||||
|
self.setContentsMargins(self.buttonSize, 0, 0, 0)
|
||||||
|
self.closeButton.setVisible(False)
|
||||||
else:
|
else:
|
||||||
self.minmaxButton.setIcon(self.theTheme.getIcon("maximise"))
|
self.minmaxButton.setIcon(self.theTheme.getIcon("maximise"))
|
||||||
|
self.setContentsMargins(2*self.buttonSize, 0, 0, 0)
|
||||||
|
self.closeButton.setVisible(True)
|
||||||
return
|
return
|
||||||
|
|
||||||
def _refreshDocument(self):
|
def _refreshDocument(self):
|
||||||
|
|||||||
+8
-6
@@ -314,12 +314,14 @@ class GuiDocEditor(QTextEdit):
|
|||||||
just ensure the margins are set correctly.
|
just ensure the margins are set correctly.
|
||||||
"""
|
"""
|
||||||
cM = self.mainConf.getTextMargin()
|
cM = self.mainConf.getTextMargin()
|
||||||
|
|
||||||
|
vBar = self.verticalScrollBar()
|
||||||
|
if vBar.isVisible():
|
||||||
|
sW = vBar.width()
|
||||||
|
else:
|
||||||
|
sW = 0
|
||||||
|
|
||||||
if self.mainConf.textFixedW or self.theParent.isZenMode:
|
if self.mainConf.textFixedW or self.theParent.isZenMode:
|
||||||
vBar = self.verticalScrollBar()
|
|
||||||
if vBar.isVisible():
|
|
||||||
sW = vBar.width()
|
|
||||||
else:
|
|
||||||
sW = 0
|
|
||||||
if self.theParent.isZenMode:
|
if self.theParent.isZenMode:
|
||||||
tW = self.mainConf.getZenWidth()
|
tW = self.mainConf.getZenWidth()
|
||||||
else:
|
else:
|
||||||
@@ -332,7 +334,7 @@ class GuiDocEditor(QTextEdit):
|
|||||||
tM = cM
|
tM = cM
|
||||||
|
|
||||||
tB = self.lineWidth()
|
tB = self.lineWidth()
|
||||||
tW = self.width() - 2*tB
|
tW = self.width() - 2*tB - sW
|
||||||
tH = self.docTitle.height()
|
tH = self.docTitle.height()
|
||||||
tT = cM - tH
|
tT = cM - tH
|
||||||
self.docTitle.setGeometry(tB, tB, tW, tH)
|
self.docTitle.setGeometry(tB, tB, tW, tH)
|
||||||
|
|||||||
+7
-1
@@ -224,8 +224,14 @@ class GuiDocViewer(QTextBrowser):
|
|||||||
Config.textFixedW is enabled or we're in Zen mode. Otherwise,
|
Config.textFixedW is enabled or we're in Zen mode. Otherwise,
|
||||||
just ensure the margins are set correctly.
|
just ensure the margins are set correctly.
|
||||||
"""
|
"""
|
||||||
|
vBar = self.verticalScrollBar()
|
||||||
|
if vBar.isVisible():
|
||||||
|
sW = vBar.width()
|
||||||
|
else:
|
||||||
|
sW = 0
|
||||||
|
|
||||||
tB = self.lineWidth()
|
tB = self.lineWidth()
|
||||||
tW = self.width() - 2*tB
|
tW = self.width() - 2*tB - sW
|
||||||
tH = self.docTitle.height()
|
tH = self.docTitle.height()
|
||||||
tT = self.mainConf.getTextMargin() - tH
|
tT = self.mainConf.getTextMargin() - tH
|
||||||
self.docTitle.setGeometry(tB, tB, tW, tH)
|
self.docTitle.setGeometry(tB, tB, tW, tH)
|
||||||
|
|||||||
+12
-6
@@ -265,7 +265,8 @@ class GuiTheme:
|
|||||||
# Config File
|
# Config File
|
||||||
confParser = configparser.ConfigParser()
|
confParser = configparser.ConfigParser()
|
||||||
try:
|
try:
|
||||||
confParser.read_file(open(self.confFile,mode="r",encoding="utf8"))
|
with open(self.confFile, mode="r", encoding="utf8") as inFile:
|
||||||
|
confParser.read_file(inFile)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Could not load theme settings from: %s" % self.confFile)
|
logger.error("Could not load theme settings from: %s" % self.confFile)
|
||||||
return False
|
return False
|
||||||
@@ -319,7 +320,8 @@ class GuiTheme:
|
|||||||
|
|
||||||
confParser = configparser.ConfigParser()
|
confParser = configparser.ConfigParser()
|
||||||
try:
|
try:
|
||||||
confParser.read_file(open(self.syntaxFile, mode="r", encoding="utf8"))
|
with open(self.syntaxFile, mode="r", encoding="utf8") as inFile:
|
||||||
|
confParser.read_file(inFile)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Could not load syntax colours from: %s" % self.syntaxFile)
|
logger.error("Could not load syntax colours from: %s" % self.syntaxFile)
|
||||||
return False
|
return False
|
||||||
@@ -370,7 +372,8 @@ class GuiTheme:
|
|||||||
themeConf = path.join(self.mainConf.themeRoot, self.guiPath, themeDir, self.confName)
|
themeConf = path.join(self.mainConf.themeRoot, self.guiPath, themeDir, self.confName)
|
||||||
logger.verbose("Checking theme config for '%s'" % themeDir)
|
logger.verbose("Checking theme config for '%s'" % themeDir)
|
||||||
try:
|
try:
|
||||||
confParser.read_file(open(themeConf, mode="r", encoding="utf8"))
|
with open(themeConf, mode="r", encoding="utf8") as inFile:
|
||||||
|
confParser.read_file(inFile)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.theParent.makeAlert(
|
self.theParent.makeAlert(
|
||||||
["Could not load theme config file.",str(e)], nwAlert.ERROR
|
["Could not load theme config file.",str(e)], nwAlert.ERROR
|
||||||
@@ -402,7 +405,8 @@ class GuiTheme:
|
|||||||
continue
|
continue
|
||||||
logger.verbose("Checking theme syntax for '%s'" % syntaxFile)
|
logger.verbose("Checking theme syntax for '%s'" % syntaxFile)
|
||||||
try:
|
try:
|
||||||
confParser.read_file(open(syntaxPath, mode="r", encoding="utf8"))
|
with open(syntaxPath, mode="r", encoding="utf8") as inFile:
|
||||||
|
confParser.read_file(inFile)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.theParent.makeAlert(
|
self.theParent.makeAlert(
|
||||||
["Could not load syntax file.",str(e)], nwAlert.ERROR
|
["Could not load syntax file.",str(e)], nwAlert.ERROR
|
||||||
@@ -588,7 +592,8 @@ class GuiIcons:
|
|||||||
# Config File
|
# Config File
|
||||||
confParser = configparser.ConfigParser()
|
confParser = configparser.ConfigParser()
|
||||||
try:
|
try:
|
||||||
confParser.read_file(open(self.confFile, mode="r", encoding="utf8"))
|
with open(self.confFile, mode="r", encoding="utf8") as inFile:
|
||||||
|
confParser.read_file(inFile)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Could not load icon theme settings from: %s" % self.confFile)
|
logger.error("Could not load icon theme settings from: %s" % self.confFile)
|
||||||
return False
|
return False
|
||||||
@@ -682,7 +687,8 @@ class GuiIcons:
|
|||||||
themeConf = path.join(themePath, self.confName)
|
themeConf = path.join(themePath, self.confName)
|
||||||
logger.verbose("Checking icon theme config for '%s'" % themeDir)
|
logger.verbose("Checking icon theme config for '%s'" % themeDir)
|
||||||
try:
|
try:
|
||||||
confParser.read_file(open(themeConf, mode="r", encoding="utf8"))
|
with open(themeConf, mode="r", encoding="utf8") as inFile:
|
||||||
|
confParser.read_file(inFile)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.theParent.makeAlert(
|
self.theParent.makeAlert(
|
||||||
["Could not load theme config file.",str(e)], nwAlert.ERROR
|
["Could not load theme config file.",str(e)], nwAlert.ERROR
|
||||||
|
|||||||
Reference in New Issue
Block a user