Gui sizes should now scale between high and low DPI screens
This commit is contained in:
+1
-6
@@ -64,7 +64,7 @@ class GuiAbout(QDialog):
|
||||
self.lblVers = QLabel("v%s" % nw.__version__)
|
||||
self.lblDate = QLabel(datetime.strptime(nw.__date__, "%Y-%m-%d").strftime("%x"))
|
||||
|
||||
self.leftBox = QVBoxLayout()
|
||||
self.leftBox = QVBoxLayout()
|
||||
self.leftBox.setSpacing(self.mainConf.pxInt(4))
|
||||
self.leftBox.addWidget(self.guiDeco, 0, Qt.AlignCenter)
|
||||
self.leftBox.addWidget(self.lblName, 0, Qt.AlignCenter)
|
||||
@@ -78,10 +78,6 @@ class GuiAbout(QDialog):
|
||||
self.pageAbout.setOpenExternalLinks(True)
|
||||
self.pageAbout.document().setDocumentMargin(self.mainConf.pxInt(16))
|
||||
|
||||
# self.pageCredit = QTextBrowser()
|
||||
# self.pageCredit.setOpenExternalLinks(True)
|
||||
# self.pageCredit.document().setDocumentMargin(16)
|
||||
|
||||
self.pageLicense = QTextBrowser()
|
||||
self.pageLicense.setOpenExternalLinks(True)
|
||||
self.pageLicense.document().setDocumentMargin(self.mainConf.pxInt(16))
|
||||
@@ -89,7 +85,6 @@ class GuiAbout(QDialog):
|
||||
# Main Tab Area
|
||||
self.tabBox = QTabWidget()
|
||||
self.tabBox.addTab(self.pageAbout, "About")
|
||||
# self.tabBox.addTab(self.pageCredit, "Credit")
|
||||
self.tabBox.addTab(self.pageLicense, "License")
|
||||
self.innerBox.addWidget(self.tabBox)
|
||||
|
||||
|
||||
+47
-30
@@ -77,17 +77,13 @@ class GuiBuildNovel(QDialog):
|
||||
self.htmlStyle = [] # List of html styles
|
||||
self.nwdText = [] # List of markdown documents
|
||||
|
||||
x800 = self.mainConf.pxInt(800)
|
||||
x900 = self.mainConf.pxInt(900)
|
||||
xFmt = self.mainConf.pxInt(220)
|
||||
|
||||
self.setWindowTitle("Build Novel Project")
|
||||
self.setMinimumWidth(x900)
|
||||
self.setMinimumHeight(x800)
|
||||
self.setMinimumWidth(self.mainConf.pxInt(900))
|
||||
self.setMinimumHeight(self.mainConf.pxInt(800))
|
||||
|
||||
self.resize(
|
||||
self.optState.getInt("GuiBuildNovel", "winWidth", x900),
|
||||
self.optState.getInt("GuiBuildNovel", "winHeight", x800)
|
||||
self.mainConf.pxInt(self.optState.getInt("GuiBuildNovel", "winWidth", 900)),
|
||||
self.mainConf.pxInt(self.optState.getInt("GuiBuildNovel", "winHeight", 800))
|
||||
)
|
||||
|
||||
self.outerBox = QHBoxLayout()
|
||||
@@ -116,6 +112,7 @@ class GuiBuildNovel(QDialog):
|
||||
r"be centred automatically and only appear between sections of "
|
||||
r"the same type."
|
||||
)
|
||||
xFmt = self.mainConf.pxInt(220)
|
||||
|
||||
self.fmtTitle = QLineEdit()
|
||||
self.fmtTitle.setMaxLength(200)
|
||||
@@ -240,26 +237,32 @@ class GuiBuildNovel(QDialog):
|
||||
self.includeSynopsis.setToolTip(
|
||||
"Include synopsis comments in the output."
|
||||
)
|
||||
self.includeSynopsis.setChecked(self.theProject.titleFormat["withSynopsis"])
|
||||
self.includeSynopsis.setChecked(
|
||||
self.optState.getBool("GuiBuildNovel", "incSynopsis", False)
|
||||
)
|
||||
|
||||
self.includeComments = QSwitch()
|
||||
self.includeComments.setToolTip(
|
||||
"Include plain comments in the output."
|
||||
)
|
||||
self.includeComments.setChecked(self.theProject.titleFormat["withComments"])
|
||||
self.includeComments.setChecked(
|
||||
self.optState.getBool("GuiBuildNovel", "incComments", False)
|
||||
)
|
||||
|
||||
self.includeKeywords = QSwitch()
|
||||
self.includeKeywords.setToolTip(
|
||||
"Include meta keywords (tags, references) in the output."
|
||||
)
|
||||
self.includeKeywords.setChecked(self.theProject.titleFormat["withKeywords"])
|
||||
self.includeKeywords.setChecked(
|
||||
self.optState.getBool("GuiBuildNovel", "incKeywords", False)
|
||||
)
|
||||
|
||||
self.includeBody = QSwitch()
|
||||
self.includeBody.setToolTip(
|
||||
"Include body text in the output."
|
||||
)
|
||||
self.includeBody.setChecked(
|
||||
self.optState.getBool("GuiBuildNovel", "includeBody", True)
|
||||
self.optState.getBool("GuiBuildNovel", "incBodyText", True)
|
||||
)
|
||||
|
||||
self.textForm.addWidget(QLabel("Include synopsis"), 0, 0, 1, 1, Qt.AlignLeft)
|
||||
@@ -851,27 +854,41 @@ class GuiBuildNovel(QDialog):
|
||||
|
||||
# Formatting
|
||||
self.theProject.setTitleFormat({
|
||||
"title" : self.fmtTitle.text().strip(),
|
||||
"chapter" : self.fmtChapter.text().strip(),
|
||||
"unnumbered" : self.fmtUnnumbered.text().strip(),
|
||||
"scene" : self.fmtScene.text().strip(),
|
||||
"section" : self.fmtSection.text().strip(),
|
||||
"withSynopsis" : self.includeSynopsis.isChecked(),
|
||||
"withComments" : self.includeComments.isChecked(),
|
||||
"withKeywords" : self.includeKeywords.isChecked(),
|
||||
"title" : self.fmtTitle.text().strip(),
|
||||
"chapter" : self.fmtChapter.text().strip(),
|
||||
"unnumbered" : self.fmtUnnumbered.text().strip(),
|
||||
"scene" : self.fmtScene.text().strip(),
|
||||
"section" : self.fmtSection.text().strip(),
|
||||
})
|
||||
|
||||
winWidth = self.mainConf.pxInt(self.width())
|
||||
winHeight = self.mainConf.pxInt(self.height())
|
||||
justifyText = self.justifyText.isChecked()
|
||||
noStyling = self.noStyling.isChecked()
|
||||
textFont = self.textFont.text()
|
||||
textSize = self.textSize.value()
|
||||
novelFiles = self.novelFiles.isChecked()
|
||||
noteFiles = self.noteFiles.isChecked()
|
||||
ignoreFlag = self.ignoreFlag.isChecked()
|
||||
incSynopsis = self.includeSynopsis.isChecked()
|
||||
incComments = self.includeComments.isChecked()
|
||||
incKeywords = self.includeKeywords.isChecked()
|
||||
incBodyText = self.includeBody.isChecked()
|
||||
|
||||
# GUI Settings
|
||||
self.optState.setValue("GuiBuildNovel", "winWidth", self.width())
|
||||
self.optState.setValue("GuiBuildNovel", "winHeight", self.height())
|
||||
self.optState.setValue("GuiBuildNovel", "justifyText", self.justifyText.isChecked())
|
||||
self.optState.setValue("GuiBuildNovel", "noStyling", self.noStyling.isChecked())
|
||||
self.optState.setValue("GuiBuildNovel", "textFont", self.textFont.text())
|
||||
self.optState.setValue("GuiBuildNovel", "textSize", self.textSize.value())
|
||||
self.optState.setValue("GuiBuildNovel", "addNovel", self.novelFiles.isChecked())
|
||||
self.optState.setValue("GuiBuildNovel", "addNotes", self.noteFiles.isChecked())
|
||||
self.optState.setValue("GuiBuildNovel", "ignoreFlag", self.ignoreFlag.isChecked())
|
||||
self.optState.setValue("GuiBuildNovel", "includeBody", self.includeBody.isChecked())
|
||||
self.optState.setValue("GuiBuildNovel", "winWidth", winWidth)
|
||||
self.optState.setValue("GuiBuildNovel", "winHeight", winHeight)
|
||||
self.optState.setValue("GuiBuildNovel", "justifyText", justifyText)
|
||||
self.optState.setValue("GuiBuildNovel", "noStyling", noStyling)
|
||||
self.optState.setValue("GuiBuildNovel", "textFont", textFont)
|
||||
self.optState.setValue("GuiBuildNovel", "textSize", textSize)
|
||||
self.optState.setValue("GuiBuildNovel", "addNovel", novelFiles)
|
||||
self.optState.setValue("GuiBuildNovel", "addNotes", noteFiles)
|
||||
self.optState.setValue("GuiBuildNovel", "ignoreFlag", ignoreFlag)
|
||||
self.optState.setValue("GuiBuildNovel", "incSynopsis", incSynopsis)
|
||||
self.optState.setValue("GuiBuildNovel", "incComments", incComments)
|
||||
self.optState.setValue("GuiBuildNovel", "incKeywords", incKeywords)
|
||||
self.optState.setValue("GuiBuildNovel", "incBodyText", incBodyText)
|
||||
self.optState.saveSettings()
|
||||
|
||||
return
|
||||
|
||||
+11
-11
@@ -81,7 +81,7 @@ class GuiDocEditor(QTextEdit):
|
||||
|
||||
# Core Elements
|
||||
self.qDocument = self.document()
|
||||
self.qDocument.setDocumentMargin(self.mainConf.textMargin)
|
||||
self.qDocument.setDocumentMargin(self.mainConf.getTextMargin())
|
||||
self.qDocument.contentsChange.connect(self._docChange)
|
||||
|
||||
# Document Title
|
||||
@@ -192,14 +192,13 @@ class GuiDocEditor(QTextEdit):
|
||||
self.setPalette(docPalette)
|
||||
|
||||
# Set default text margins
|
||||
self.qDocument.setDocumentMargin(self.mainConf.textMargin)
|
||||
self.qDocument.setDocumentMargin(self.mainConf.getTextMargin())
|
||||
|
||||
# Also set the document text options for the document text flow
|
||||
theOpt = QTextOption()
|
||||
|
||||
if self.mainConf.tabWidth is not None:
|
||||
if self.mainConf.verQtValue >= 51000:
|
||||
theOpt.setTabStopDistance(self.mainConf.tabWidth)
|
||||
if self.mainConf.verQtValue >= 51000:
|
||||
theOpt.setTabStopDistance(self.mainConf.getTabWidth())
|
||||
if self.mainConf.doJustify:
|
||||
theOpt.setAlignment(Qt.AlignJustify)
|
||||
if self.mainConf.showTabsNSpaces:
|
||||
@@ -319,6 +318,7 @@ class GuiDocEditor(QTextEdit):
|
||||
Config.textFixedW is enabled or we're in Zen mode. Otherwise,
|
||||
just ensure the margins are set correctly.
|
||||
"""
|
||||
cM = self.mainConf.getTextMargin()
|
||||
if self.mainConf.textFixedW or self.theParent.isZenMode:
|
||||
vBar = self.verticalScrollBar()
|
||||
if vBar.isVisible():
|
||||
@@ -326,20 +326,20 @@ class GuiDocEditor(QTextEdit):
|
||||
else:
|
||||
sW = 0
|
||||
if self.theParent.isZenMode:
|
||||
tW = self.mainConf.zenWidth
|
||||
tW = self.mainConf.getZenWidth()
|
||||
else:
|
||||
tW = self.mainConf.textWidth
|
||||
tW = self.mainConf.getTextWidth()
|
||||
wW = self.width()
|
||||
tM = int((wW - sW - tW)/2)
|
||||
if tM < self.mainConf.textMargin:
|
||||
tM = self.mainConf.textMargin
|
||||
if tM < cM:
|
||||
tM = cM
|
||||
else:
|
||||
tM = self.mainConf.textMargin
|
||||
tM = cM
|
||||
|
||||
tB = self.lineWidth()
|
||||
tW = self.width() - 2*tB
|
||||
tH = self.docTitle.height()
|
||||
tT = self.mainConf.textMargin - tH
|
||||
tT = cM - tH
|
||||
self.docTitle.setGeometry(tB, tB, tW, tH)
|
||||
self.setViewportMargins(0, tH, 0, 0)
|
||||
|
||||
|
||||
+2
-2
@@ -105,7 +105,7 @@ class GuiDocViewer(QTextBrowser):
|
||||
docPalette.setColor(QPalette.Text, QColor(*self.theTheme.colText))
|
||||
self.setPalette(docPalette)
|
||||
|
||||
self.qDocument.setDocumentMargin(self.mainConf.textMargin)
|
||||
self.qDocument.setDocumentMargin(self.mainConf.getTextMargin())
|
||||
theOpt = QTextOption()
|
||||
if self.mainConf.doJustify:
|
||||
theOpt.setAlignment(Qt.AlignJustify)
|
||||
@@ -216,7 +216,7 @@ class GuiDocViewer(QTextBrowser):
|
||||
tB = self.lineWidth()
|
||||
tW = self.width() - 2*tB
|
||||
tH = self.docTitle.height()
|
||||
tT = self.mainConf.textMargin - tH
|
||||
tT = self.mainConf.getTextMargin() - tH
|
||||
self.docTitle.setGeometry(tB, tB, tW, tH)
|
||||
self.setViewportMargins(0, tH, 0, 0)
|
||||
|
||||
|
||||
+3
-3
@@ -271,7 +271,7 @@ class GuiOutline(QTreeWidget):
|
||||
tmpWidth = self.optState.getValue("GuiOutline", "columnWidth", {})
|
||||
for hName in tmpWidth:
|
||||
try:
|
||||
self.colWidth[nwOutline[hName]] = tmpWidth[hName]
|
||||
self.colWidth[nwOutline[hName]] = self.mainConf.pxInt(tmpWidth[hName])
|
||||
except:
|
||||
logger.warning("Ignored unknown outline column '%s'" % str(hName))
|
||||
|
||||
@@ -301,7 +301,7 @@ class GuiOutline(QTreeWidget):
|
||||
colHidden = {}
|
||||
|
||||
for hItem in nwOutline:
|
||||
colWidth[hItem.name] = self.colWidth[hItem]
|
||||
colWidth[hItem.name] = self.mainConf.rpxInt(self.colWidth[hItem])
|
||||
colHidden[hItem.name] = self.colHidden[hItem]
|
||||
|
||||
for iCol in range(self.columnCount()):
|
||||
@@ -309,7 +309,7 @@ class GuiOutline(QTreeWidget):
|
||||
treeOrder.append(hName)
|
||||
|
||||
iLog = self.treeHead.logicalIndex(iCol)
|
||||
logWidth = self.columnWidth(iLog)
|
||||
logWidth = self.mainConf.rpxInt(self.columnWidth(iLog))
|
||||
logHidden = self.isColumnHidden(iLog)
|
||||
|
||||
colHidden[hName] = logHidden
|
||||
|
||||
+2
-1
@@ -270,8 +270,9 @@ class GuiProjectLoad(QDialog):
|
||||
newItem.setSelected(True)
|
||||
hasSelection = True
|
||||
|
||||
projColWidth = self.mainConf.getProjColWidths()
|
||||
for i in range(3):
|
||||
self.listBox.setColumnWidth(i, self.mainConf.projColWidth[i])
|
||||
self.listBox.setColumnWidth(i, projColWidth[i])
|
||||
|
||||
return
|
||||
|
||||
|
||||
+3
-2
@@ -112,8 +112,9 @@ class GuiProjectTree(QTreeWidget):
|
||||
# self.setSelectionBehavior(QAbstractItemView.SelectRows)
|
||||
|
||||
# Get user's column width preferences for NAME and COUNT
|
||||
if len(self.mainConf.treeColWidth) <= 4:
|
||||
for colN, colW in enumerate(self.mainConf.treeColWidth):
|
||||
treeColWidth = self.mainConf.getTreeColWidths()
|
||||
if len(treeColWidth) <= 4:
|
||||
for colN, colW in enumerate(treeColWidth):
|
||||
self.setColumnWidth(colN, colW)
|
||||
|
||||
# The last column should just auto-scale
|
||||
|
||||
+15
-15
@@ -64,16 +64,16 @@ class GuiSessionLogView(QDialog):
|
||||
self.setMinimumWidth(self.mainConf.pxInt(420))
|
||||
self.setMinimumHeight(self.mainConf.pxInt(400))
|
||||
|
||||
widthCol0 = self.optState.getInt("GuiSession", "widthCol0", self.mainConf.pxInt(180))
|
||||
widthCol1 = self.optState.getInt("GuiSession", "widthCol1", self.mainConf.pxInt(80))
|
||||
widthCol2 = self.optState.getInt("GuiSession", "widthCol2", self.mainConf.pxInt(80))
|
||||
wCol0 = self.mainConf.pxInt(self.optState.getInt("GuiSession", "widthCol0", 180))
|
||||
wCol1 = self.mainConf.pxInt(self.optState.getInt("GuiSession", "widthCol1", 80))
|
||||
wCol2 = self.mainConf.pxInt(self.optState.getInt("GuiSession", "widthCol2", 80))
|
||||
|
||||
self.listBox = QTreeWidget()
|
||||
self.listBox.setHeaderLabels(["Session Start","Length","Words",""])
|
||||
self.listBox.setIndentation(0)
|
||||
self.listBox.setColumnWidth(0, widthCol0)
|
||||
self.listBox.setColumnWidth(1, widthCol1)
|
||||
self.listBox.setColumnWidth(2, widthCol2)
|
||||
self.listBox.setColumnWidth(0, wCol0)
|
||||
self.listBox.setColumnWidth(1, wCol1)
|
||||
self.listBox.setColumnWidth(2, wCol2)
|
||||
self.listBox.setColumnWidth(3, 0)
|
||||
|
||||
hHeader = self.listBox.headerItem()
|
||||
@@ -220,20 +220,20 @@ class GuiSessionLogView(QDialog):
|
||||
|
||||
def _doClose(self):
|
||||
|
||||
widthCol0 = self.listBox.columnWidth(0)
|
||||
widthCol1 = self.listBox.columnWidth(1)
|
||||
widthCol2 = self.listBox.columnWidth(2)
|
||||
widthCol0 = self.mainConf.rpxInt(self.listBox.columnWidth(0))
|
||||
widthCol1 = self.mainConf.rpxInt(self.listBox.columnWidth(1))
|
||||
widthCol2 = self.mainConf.rpxInt(self.listBox.columnWidth(2))
|
||||
sortCol = self.listBox.sortColumn()
|
||||
sortOrder = self.listBox.header().sortIndicatorOrder()
|
||||
hideZeros = self.hideZeros.isChecked()
|
||||
hideNegative = self.hideNegative.isChecked()
|
||||
|
||||
self.optState.setValue("GuiSession", "widthCol0", widthCol0)
|
||||
self.optState.setValue("GuiSession", "widthCol1", widthCol1)
|
||||
self.optState.setValue("GuiSession", "widthCol2", widthCol2)
|
||||
self.optState.setValue("GuiSession", "sortCol", sortCol)
|
||||
self.optState.setValue("GuiSession", "sortOrder", sortOrder)
|
||||
self.optState.setValue("GuiSession", "hideZeros", hideZeros)
|
||||
self.optState.setValue("GuiSession", "widthCol0", widthCol0)
|
||||
self.optState.setValue("GuiSession", "widthCol1", widthCol1)
|
||||
self.optState.setValue("GuiSession", "widthCol2", widthCol2)
|
||||
self.optState.setValue("GuiSession", "sortCol", sortCol)
|
||||
self.optState.setValue("GuiSession", "sortOrder", sortOrder)
|
||||
self.optState.setValue("GuiSession", "hideZeros", hideZeros)
|
||||
self.optState.setValue("GuiSession", "hideNegative", hideNegative)
|
||||
|
||||
self.optState.saveSettings()
|
||||
|
||||
Reference in New Issue
Block a user