All fixed sizes should no be passed through the pxInt function

This commit is contained in:
Veronica K. B. Olsen
2020-06-04 21:58:35 +02:00
parent 0e467d5fb1
commit 8b22deb1f4
17 changed files with 164 additions and 134 deletions
+9 -7
View File
@@ -48,22 +48,24 @@ class GuiAbout(QDialog):
self.mainConf = nw.CONFIG self.mainConf = nw.CONFIG
self.theParent = theParent self.theParent = theParent
self.theTheme = theParent.theTheme
self.outerBox = QVBoxLayout() self.outerBox = QVBoxLayout()
self.innerBox = QHBoxLayout() self.innerBox = QHBoxLayout()
self.innerBox.setSpacing(16) self.innerBox.setSpacing(self.mainConf.pxInt(16))
self.setWindowTitle("About %s" % nw.__package__) self.setWindowTitle("About %s" % nw.__package__)
self.setMinimumWidth(700) self.setMinimumWidth(self.mainConf.pxInt(650))
self.setMinimumHeight(600) self.setMinimumHeight(self.mainConf.pxInt(600))
self.guiDeco = self.theParent.theTheme.loadDecoration("nwicon", (96, 96)) iPx = self.mainConf.pxInt(96)
self.guiDeco = self.theParent.theTheme.loadDecoration("nwicon", (iPx, iPx))
self.lblName = QLabel("<b>%s</b>" % nw.__package__) self.lblName = QLabel("<b>%s</b>" % nw.__package__)
self.lblVers = QLabel("v%s" % nw.__version__) self.lblVers = QLabel("v%s" % nw.__version__)
self.lblDate = QLabel(datetime.strptime(nw.__date__, "%Y-%m-%d").strftime("%x")) self.lblDate = QLabel(datetime.strptime(nw.__date__, "%Y-%m-%d").strftime("%x"))
self.leftBox = QVBoxLayout() self.leftBox = QVBoxLayout()
self.leftBox.setSpacing(4) self.leftBox.setSpacing(self.mainConf.pxInt(4))
self.leftBox.addWidget(self.guiDeco, 0, Qt.AlignCenter) self.leftBox.addWidget(self.guiDeco, 0, Qt.AlignCenter)
self.leftBox.addWidget(self.lblName, 0, Qt.AlignCenter) self.leftBox.addWidget(self.lblName, 0, Qt.AlignCenter)
self.leftBox.addWidget(self.lblVers, 0, Qt.AlignCenter) self.leftBox.addWidget(self.lblVers, 0, Qt.AlignCenter)
@@ -74,7 +76,7 @@ class GuiAbout(QDialog):
# Pages # Pages
self.pageAbout = QTextBrowser() self.pageAbout = QTextBrowser()
self.pageAbout.setOpenExternalLinks(True) self.pageAbout.setOpenExternalLinks(True)
self.pageAbout.document().setDocumentMargin(16) self.pageAbout.document().setDocumentMargin(self.mainConf.pxInt(16))
# self.pageCredit = QTextBrowser() # self.pageCredit = QTextBrowser()
# self.pageCredit.setOpenExternalLinks(True) # self.pageCredit.setOpenExternalLinks(True)
@@ -82,7 +84,7 @@ class GuiAbout(QDialog):
self.pageLicense = QTextBrowser() self.pageLicense = QTextBrowser()
self.pageLicense.setOpenExternalLinks(True) self.pageLicense.setOpenExternalLinks(True)
self.pageLicense.document().setDocumentMargin(16) self.pageLicense.document().setDocumentMargin(self.mainConf.pxInt(16))
# Main Tab Area # Main Tab Area
self.tabBox = QTabWidget() self.tabBox = QTabWidget()
+16 -12
View File
@@ -77,13 +77,17 @@ class GuiBuildNovel(QDialog):
self.htmlStyle = [] # List of html styles self.htmlStyle = [] # List of html styles
self.nwdText = [] # List of markdown documents 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.setWindowTitle("Build Novel Project")
self.setMinimumWidth(900) self.setMinimumWidth(x900)
self.setMinimumHeight(800) self.setMinimumHeight(x800)
self.resize( self.resize(
self.optState.getInt("GuiBuildNovel", "winWidth", 900), self.optState.getInt("GuiBuildNovel", "winWidth", x900),
self.optState.getInt("GuiBuildNovel", "winHeight", 800) self.optState.getInt("GuiBuildNovel", "winHeight", x800)
) )
self.outerBox = QHBoxLayout() self.outerBox = QHBoxLayout()
@@ -115,7 +119,7 @@ class GuiBuildNovel(QDialog):
self.fmtTitle = QLineEdit() self.fmtTitle = QLineEdit()
self.fmtTitle.setMaxLength(200) self.fmtTitle.setMaxLength(200)
self.fmtTitle.setFixedWidth(220) self.fmtTitle.setFixedWidth(xFmt)
self.fmtTitle.setToolTip(fmtHelp) self.fmtTitle.setToolTip(fmtHelp)
self.fmtTitle.setText( self.fmtTitle.setText(
self._reFmtCodes(self.theProject.titleFormat["title"]) self._reFmtCodes(self.theProject.titleFormat["title"])
@@ -123,7 +127,7 @@ class GuiBuildNovel(QDialog):
self.fmtChapter = QLineEdit() self.fmtChapter = QLineEdit()
self.fmtChapter.setMaxLength(200) self.fmtChapter.setMaxLength(200)
self.fmtChapter.setFixedWidth(220) self.fmtChapter.setFixedWidth(xFmt)
self.fmtChapter.setToolTip(fmtHelp) self.fmtChapter.setToolTip(fmtHelp)
self.fmtChapter.setText( self.fmtChapter.setText(
self._reFmtCodes(self.theProject.titleFormat["chapter"]) self._reFmtCodes(self.theProject.titleFormat["chapter"])
@@ -131,7 +135,7 @@ class GuiBuildNovel(QDialog):
self.fmtUnnumbered = QLineEdit() self.fmtUnnumbered = QLineEdit()
self.fmtUnnumbered.setMaxLength(200) self.fmtUnnumbered.setMaxLength(200)
self.fmtUnnumbered.setFixedWidth(220) self.fmtUnnumbered.setFixedWidth(xFmt)
self.fmtUnnumbered.setToolTip(fmtHelp) self.fmtUnnumbered.setToolTip(fmtHelp)
self.fmtUnnumbered.setText( self.fmtUnnumbered.setText(
self._reFmtCodes(self.theProject.titleFormat["unnumbered"]) self._reFmtCodes(self.theProject.titleFormat["unnumbered"])
@@ -139,7 +143,7 @@ class GuiBuildNovel(QDialog):
self.fmtScene = QLineEdit() self.fmtScene = QLineEdit()
self.fmtScene.setMaxLength(200) self.fmtScene.setMaxLength(200)
self.fmtScene.setFixedWidth(220) self.fmtScene.setFixedWidth(xFmt)
self.fmtScene.setToolTip(fmtHelp + fmtScHelp) self.fmtScene.setToolTip(fmtHelp + fmtScHelp)
self.fmtScene.setText( self.fmtScene.setText(
self._reFmtCodes(self.theProject.titleFormat["scene"]) self._reFmtCodes(self.theProject.titleFormat["scene"])
@@ -147,7 +151,7 @@ class GuiBuildNovel(QDialog):
self.fmtSection = QLineEdit() self.fmtSection = QLineEdit()
self.fmtSection.setMaxLength(200) self.fmtSection.setMaxLength(200)
self.fmtSection.setFixedWidth(220) self.fmtSection.setFixedWidth(xFmt)
self.fmtSection.setToolTip(fmtHelp + fmtScHelp) self.fmtSection.setToolTip(fmtHelp + fmtScHelp)
self.fmtSection.setText( self.fmtSection.setText(
self._reFmtCodes(self.theProject.titleFormat["section"]) self._reFmtCodes(self.theProject.titleFormat["section"])
@@ -176,7 +180,7 @@ class GuiBuildNovel(QDialog):
## Font Family ## Font Family
self.textFont = QLineEdit() self.textFont = QLineEdit()
self.textFont.setReadOnly(True) self.textFont.setReadOnly(True)
self.textFont.setFixedWidth(182) self.textFont.setFixedWidth(self.mainConf.pxInt(182))
self.textFont.setText( self.textFont.setText(
self.optState.getString("GuiBuildNovel", "textFont", self.mainConf.textFont) self.optState.getString("GuiBuildNovel", "textFont", self.mainConf.textFont)
) )
@@ -185,7 +189,7 @@ class GuiBuildNovel(QDialog):
self.fontButton.clicked.connect(self._selectFont) self.fontButton.clicked.connect(self._selectFont)
self.textSize = QSpinBox(self) self.textSize = QSpinBox(self)
self.textSize.setFixedWidth(60) self.textSize.setFixedWidth(5*self.theTheme.textNWidth)
self.textSize.setMinimum(6) self.textSize.setMinimum(6)
self.textSize.setMaximum(72) self.textSize.setMaximum(72)
self.textSize.setSingleStep(1) self.textSize.setSingleStep(1)
@@ -894,7 +898,7 @@ class GuiBuildNovelDocView(QTextBrowser):
self.theProject = theProject self.theProject = theProject
self.theParent = theParent self.theParent = theParent
self.setMinimumWidth(400) self.setMinimumWidth(40*self.theParent.theTheme.textNWidth)
self.setOpenExternalLinks(False) self.setOpenExternalLinks(False)
self.qDocument = self.document() self.qDocument = self.document()
+26 -22
View File
@@ -53,7 +53,7 @@ class GuiSearchBar(QFrame):
self.theTheme = theParent.theTheme self.theTheme = theParent.theTheme
self.repVisible = False self.repVisible = False
self.setContentsMargins(0,0,0,0) self.setContentsMargins(0, 0, 0, 0)
self.mainBox = QGridLayout(self) self.mainBox = QGridLayout(self)
self.setLayout(self.mainBox) self.setLayout(self.mainBox)
@@ -72,24 +72,25 @@ class GuiSearchBar(QFrame):
self.searchBox.returnPressed.connect(self._doSearch) self.searchBox.returnPressed.connect(self._doSearch)
self.replaceBox.returnPressed.connect(self._doSearch) self.replaceBox.returnPressed.connect(self._doSearch)
self.mainBox.addWidget(QLabel(""), 0,0) self.mainBox.addWidget(QLabel(""), 0, 0)
self.mainBox.addWidget(self.searchLabel, 0,1) self.mainBox.addWidget(self.searchLabel, 0, 1)
self.mainBox.addWidget(self.searchBox, 0,2) self.mainBox.addWidget(self.searchBox, 0, 2)
self.mainBox.addWidget(self.searchButton, 0,3) self.mainBox.addWidget(self.searchButton, 0, 3)
self.mainBox.addWidget(self.closeButton, 0,4) self.mainBox.addWidget(self.closeButton, 0, 4)
self.mainBox.addWidget(self.replaceLabel, 1,1) self.mainBox.addWidget(self.replaceLabel, 1, 1)
self.mainBox.addWidget(self.replaceBox, 1,2) self.mainBox.addWidget(self.replaceBox, 1, 2)
self.mainBox.addWidget(self.replaceButton, 1,3) self.mainBox.addWidget(self.replaceButton, 1, 3)
self.mainBox.setColumnStretch(0,1) self.mainBox.setColumnStretch(0, 1)
self.mainBox.setColumnStretch(1,0) self.mainBox.setColumnStretch(1, 0)
self.mainBox.setColumnStretch(2,0) self.mainBox.setColumnStretch(2, 0)
self.mainBox.setColumnStretch(3,0) self.mainBox.setColumnStretch(3, 0)
self.mainBox.setColumnStretch(4,0) self.mainBox.setColumnStretch(4, 0)
self.mainBox.setContentsMargins(0,0,0,0) self.mainBox.setContentsMargins(0, 0, 0, 0)
self.searchBox.setMinimumWidth(180) boxWidth = 16*self.theTheme.textNWidth
self.replaceBox.setMinimumWidth(180) self.searchBox.setMinimumWidth(boxWidth)
self.replaceBox.setMinimumWidth(boxWidth)
self._replaceVisible(False) self._replaceVisible(False)
@@ -175,15 +176,18 @@ class GuiNoticeBar(QFrame):
logger.debug("Initialising GuiNoticeBar ...") logger.debug("Initialising GuiNoticeBar ...")
self.mainConf = nw.CONFIG self.mainConf = nw.CONFIG
self.theParent = theParent self.theParent = theParent
self.theTheme = theParent.theTheme self.theTheme = theParent.theTheme
self.setContentsMargins(0,0,0,0) self.setContentsMargins(0, 0, 0, 0)
self.setFrameShape(QFrame.Box) self.setFrameShape(QFrame.Box)
m8 = self.mainConf.pxInt(8)
m2 = self.mainConf.pxInt(2)
self.mainBox = QHBoxLayout(self) self.mainBox = QHBoxLayout(self)
self.mainBox.setContentsMargins(8,2,2,2) self.mainBox.setContentsMargins(m8, m2, m2, m2)
self.noteLabel = QLabel("") self.noteLabel = QLabel("")
+10 -5
View File
@@ -44,12 +44,17 @@ class GuiDocViewDetails(QWidget):
self.mainConf = nw.CONFIG self.mainConf = nw.CONFIG
self.theParent = theParent self.theParent = theParent
self.theProject = theParent.theProject self.theProject = theParent.theProject
self.theTheme = theParent.theTheme
self.currHandle = None self.currHandle = None
x4 = self.mainConf.pxInt(4)
x80 = self.mainConf.pxInt(80)
iPx = self.theTheme.textIconSize
self.outerBox = QGridLayout(self) self.outerBox = QGridLayout(self)
self.outerBox.setContentsMargins(0,0,0,0) self.outerBox.setContentsMargins(0, 0, 0, 0)
self.outerBox.setHorizontalSpacing(0) self.outerBox.setHorizontalSpacing(0)
self.outerBox.setVerticalSpacing(4) self.outerBox.setVerticalSpacing(x4)
self.refLabel = QLabel("Referenced By", self) self.refLabel = QLabel("Referenced By", self)
@@ -58,7 +63,7 @@ class GuiDocViewDetails(QWidget):
self.showHide.setToolButtonStyle(Qt.ToolButtonIconOnly) self.showHide.setToolButtonStyle(Qt.ToolButtonIconOnly)
self.showHide.setArrowType(Qt.DownArrow) self.showHide.setArrowType(Qt.DownArrow)
self.showHide.setCheckable(True) self.showHide.setCheckable(True)
self.showHide.setIconSize(QSize(16,16)) self.showHide.setIconSize(QSize(iPx, iPx))
self.showHide.toggled.connect(self._doShowHide) self.showHide.toggled.connect(self._doShowHide)
self.isSticky = QCheckBox("Sticky") self.isSticky = QCheckBox("Sticky")
@@ -75,7 +80,7 @@ class GuiDocViewDetails(QWidget):
self.scrollBox.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.scrollBox.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.scrollBox.setFrameStyle(QFrame.NoFrame) self.scrollBox.setFrameStyle(QFrame.NoFrame)
self.scrollBox.setWidgetResizable(True) self.scrollBox.setWidgetResizable(True)
self.scrollBox.setFixedHeight(80) self.scrollBox.setFixedHeight(x80)
self.scrollBox.setWidget(self.refList) self.scrollBox.setWidget(self.refList)
self.outerBox.addWidget(self.showHide, 0, 0) self.outerBox.addWidget(self.showHide, 0, 0)
@@ -85,7 +90,7 @@ class GuiDocViewDetails(QWidget):
self.outerBox.setColumnStretch(1, 1) self.outerBox.setColumnStretch(1, 1)
self.setLayout(self.outerBox) self.setLayout(self.outerBox)
self.setContentsMargins(0,0,0,0) self.setContentsMargins(0, 0, 0, 0)
self._doShowHide(self.mainConf.showRefPanel) self._doShowHide(self.mainConf.showRefPanel)
+1 -1
View File
@@ -98,7 +98,7 @@ class GuiDocEditor(QTextEdit):
# Editor State # Editor State
self.hasSelection = False self.hasSelection = False
self.setMinimumWidth(300) self.setMinimumWidth(self.mainConf.pxInt(300))
self.setAcceptRichText(False) self.setAcceptRichText(False)
# Custom Shortcuts # Custom Shortcuts
+4 -4
View File
@@ -62,8 +62,8 @@ class GuiDocMerge(QDialog):
self.listBox = QListWidget() self.listBox = QListWidget()
self.listBox.setDragDropMode(QAbstractItemView.InternalMove) self.listBox.setDragDropMode(QAbstractItemView.InternalMove)
self.listBox.setMinimumWidth(400) self.listBox.setMinimumWidth(self.mainConf.pxInt(400))
self.listBox.setMinimumHeight(180) self.listBox.setMinimumHeight(self.mainConf.pxInt(180))
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
self.buttonBox.accepted.connect(self._doMerge) self.buttonBox.accepted.connect(self._doMerge)
@@ -72,9 +72,9 @@ class GuiDocMerge(QDialog):
self.outerBox.setSpacing(0) self.outerBox.setSpacing(0)
self.outerBox.addWidget(self.headLabel) self.outerBox.addWidget(self.headLabel)
self.outerBox.addWidget(self.helpLabel) self.outerBox.addWidget(self.helpLabel)
self.outerBox.addSpacing(8) self.outerBox.addSpacing(self.mainConf.pxInt(8))
self.outerBox.addWidget(self.listBox) self.outerBox.addWidget(self.listBox)
self.outerBox.addSpacing(12) self.outerBox.addSpacing(self.mainConf.pxInt(12))
self.outerBox.addWidget(self.buttonBox) self.outerBox.addWidget(self.buttonBox)
self.setLayout(self.outerBox) self.setLayout(self.outerBox)
+4 -4
View File
@@ -62,8 +62,8 @@ class GuiDocSplit(QDialog):
self.listBox = QListWidget() self.listBox = QListWidget()
self.listBox.setDragDropMode(QAbstractItemView.NoDragDrop) self.listBox.setDragDropMode(QAbstractItemView.NoDragDrop)
self.listBox.setMinimumWidth(400) self.listBox.setMinimumWidth(self.mainConf.pxInt(400))
self.listBox.setMinimumHeight(180) self.listBox.setMinimumHeight(self.mainConf.pxInt(180))
self.splitLevel = QComboBox(self) self.splitLevel = QComboBox(self)
self.splitLevel.addItem("Split on Header Level 1 (Title)", 1) self.splitLevel.addItem("Split on Header Level 1 (Title)", 1)
@@ -84,10 +84,10 @@ class GuiDocSplit(QDialog):
self.outerBox.setSpacing(0) self.outerBox.setSpacing(0)
self.outerBox.addWidget(self.headLabel) self.outerBox.addWidget(self.headLabel)
self.outerBox.addWidget(self.helpLabel) self.outerBox.addWidget(self.helpLabel)
self.outerBox.addSpacing(8) self.outerBox.addSpacing(self.mainConf.pxInt(8))
self.outerBox.addWidget(self.listBox) self.outerBox.addWidget(self.listBox)
self.outerBox.addWidget(self.splitLevel) self.outerBox.addWidget(self.splitLevel)
self.outerBox.addSpacing(12) self.outerBox.addSpacing(self.mainConf.pxInt(12))
self.outerBox.addWidget(self.buttonBox) self.outerBox.addWidget(self.buttonBox)
self.setLayout(self.outerBox) self.setLayout(self.outerBox)
+1 -1
View File
@@ -53,7 +53,7 @@ class GuiDocViewer(QTextBrowser):
self.theHandle = None self.theHandle = None
self.qDocument = self.document() self.qDocument = self.document()
self.setMinimumWidth(300) self.setMinimumWidth(self.mainConf.pxInt(300))
self.setOpenExternalLinks(False) self.setOpenExternalLinks(False)
self.initViewer() self.initViewer()
+5 -5
View File
@@ -170,11 +170,11 @@ class GuiItemDetails(QWidget):
self.mainBox.addWidget(self.pCountName, 3, 3, 1, 1) self.mainBox.addWidget(self.pCountName, 3, 3, 1, 1)
self.mainBox.addWidget(self.pCountData, 3, 4, 1, 1) self.mainBox.addWidget(self.pCountData, 3, 4, 1, 1)
self.mainBox.setColumnStretch(0,0) self.mainBox.setColumnStretch(0, 0)
self.mainBox.setColumnStretch(1,0) self.mainBox.setColumnStretch(1, 0)
self.mainBox.setColumnStretch(2,1) self.mainBox.setColumnStretch(2, 1)
self.mainBox.setColumnStretch(3,0) self.mainBox.setColumnStretch(3, 0)
self.mainBox.setColumnStretch(4,0) self.mainBox.setColumnStretch(4, 0)
# Make sure the columns for flags and counts don't resize too often # Make sure the columns for flags and counts don't resize too often
flagWidth = self.theTheme.getTextWidth("Mm", self.fntValue) flagWidth = self.theTheme.getTextWidth("Mm", self.fntValue)
+3 -3
View File
@@ -61,8 +61,8 @@ class GuiItemEditor(QDialog):
# Item Label # Item Label
self.editName = QLineEdit() self.editName = QLineEdit()
self.editName.setMinimumWidth(220) self.editName.setMinimumWidth(self.mainConf.pxInt(220))
self.editName.setMaxLength(200) self.editName.setMaxLength(self.mainConf.pxInt(200))
# Item Status # Item Status
self.editStatus = QComboBox() self.editStatus = QComboBox()
@@ -135,7 +135,7 @@ class GuiItemEditor(QDialog):
self.mainForm.addWidget(self.textExport, 3, 0, 1, 2) self.mainForm.addWidget(self.textExport, 3, 0, 1, 2)
self.mainForm.addWidget(self.editExport, 3, 2, 1, 1) self.mainForm.addWidget(self.editExport, 3, 2, 1, 1)
self.outerBox.setSpacing(16) self.outerBox.setSpacing(self.mainConf.pxInt(16))
self.outerBox.addLayout(self.mainForm) self.outerBox.addLayout(self.mainForm)
self.outerBox.addStretch(1) self.outerBox.addStretch(1)
self.outerBox.addWidget(self.buttonBox) self.outerBox.addWidget(self.buttonBox)
+2 -2
View File
@@ -63,8 +63,8 @@ class GuiOutlineDetails(QScrollArea):
minTitle = 30*self.theTheme.textNWidth minTitle = 30*self.theTheme.textNWidth
maxTitle = 40*self.theTheme.textNWidth maxTitle = 40*self.theTheme.textNWidth
wCount = self.theTheme.getTextWidth("999,999") wCount = self.theTheme.getTextWidth("999,999")
hSpace = int(0.8*self.theTheme.textNWidth) hSpace = int(self.mainConf.pxInt(10))
vSpace = int(0.2*self.theTheme.textNHeight) vSpace = int(self.mainConf.pxInt(4))
# Details Area # Details Area
self.titleLabel = QLabel("<b>Title</b>") self.titleLabel = QLabel("<b>Title</b>")
+11 -9
View File
@@ -143,7 +143,7 @@ class GuiConfigEditGeneralTab(QWidget):
## Select Theme ## Select Theme
self.selectTheme = QComboBox() self.selectTheme = QComboBox()
self.selectTheme.setMinimumWidth(200) self.selectTheme.setMinimumWidth(self.mainConf.pxInt(200))
self.theThemes = self.theTheme.listThemes() self.theThemes = self.theTheme.listThemes()
for themeDir, themeName in self.theThemes: for themeDir, themeName in self.theThemes:
self.selectTheme.addItem(themeName, themeDir) self.selectTheme.addItem(themeName, themeDir)
@@ -159,7 +159,7 @@ class GuiConfigEditGeneralTab(QWidget):
## Select Icon Theme ## Select Icon Theme
self.selectIcons = QComboBox() self.selectIcons = QComboBox()
self.selectIcons.setMinimumWidth(200) self.selectIcons.setMinimumWidth(self.mainConf.pxInt(200))
self.theIcons = self.theTheme.theIcons.listThemes() self.theIcons = self.theTheme.theIcons.listThemes()
for iconDir, iconName in self.theIcons: for iconDir, iconName in self.theIcons:
self.selectIcons.addItem(iconName, iconDir) self.selectIcons.addItem(iconName, iconDir)
@@ -185,7 +185,7 @@ class GuiConfigEditGeneralTab(QWidget):
## Font Family ## Font Family
self.guiFont = QLineEdit() self.guiFont = QLineEdit()
self.guiFont.setReadOnly(True) self.guiFont.setReadOnly(True)
self.guiFont.setFixedWidth(162) self.guiFont.setFixedWidth(self.mainConf.pxInt(162))
self.guiFont.setText(self.mainConf.guiFont) self.guiFont.setText(self.mainConf.guiFont)
self.fontButton = QPushButton("...") self.fontButton = QPushButton("...")
self.fontButton.setMaximumWidth(int(2.5*self.theTheme.getTextWidth("..."))) self.fontButton.setMaximumWidth(int(2.5*self.theTheme.getTextWidth("...")))
@@ -389,7 +389,7 @@ class GuiConfigEditLayoutTab(QWidget):
## Font Family ## Font Family
self.textStyleFont = QLineEdit() self.textStyleFont = QLineEdit()
self.textStyleFont.setReadOnly(True) self.textStyleFont.setReadOnly(True)
self.textStyleFont.setFixedWidth(162) self.textStyleFont.setFixedWidth(self.mainConf.pxInt(162))
self.textStyleFont.setText(self.mainConf.textFont) self.textStyleFont.setText(self.mainConf.textFont)
self.fontButton = QPushButton("...") self.fontButton = QPushButton("...")
self.fontButton.setMaximumWidth(int(2.5*self.theTheme.getTextWidth("..."))) self.fontButton.setMaximumWidth(int(2.5*self.theTheme.getTextWidth("...")))
@@ -575,7 +575,7 @@ class GuiConfigEditEditingTab(QWidget):
## Syntax Highlighting ## Syntax Highlighting
self.selectSyntax = QComboBox() self.selectSyntax = QComboBox()
self.selectSyntax.setMinimumWidth(200) self.selectSyntax.setMinimumWidth(self.mainConf.pxInt(200))
self.theSyntaxes = self.theTheme.listSyntax() self.theSyntaxes = self.theTheme.listSyntax()
for syntaxFile, syntaxName in self.theSyntaxes: for syntaxFile, syntaxName in self.theSyntaxes:
self.selectSyntax.addItem(syntaxName, syntaxFile) self.selectSyntax.addItem(syntaxName, syntaxFile)
@@ -789,10 +789,12 @@ class GuiConfigEditAutoReplaceTab(QWidget):
# =============== # ===============
self.mainForm.addGroupLabel("Quotation Style") self.mainForm.addGroupLabel("Quotation Style")
qWidth = self.mainConf.pxInt(40)
## Single Quote Style ## Single Quote Style
self.quoteSingleStyleO = QLineEdit() self.quoteSingleStyleO = QLineEdit()
self.quoteSingleStyleO.setMaxLength(1) self.quoteSingleStyleO.setMaxLength(1)
self.quoteSingleStyleO.setFixedWidth(40) self.quoteSingleStyleO.setFixedWidth(qWidth)
self.quoteSingleStyleO.setAlignment(Qt.AlignCenter) self.quoteSingleStyleO.setAlignment(Qt.AlignCenter)
self.quoteSingleStyleO.setText(self.mainConf.fmtSingleQuotes[0]) self.quoteSingleStyleO.setText(self.mainConf.fmtSingleQuotes[0])
self.mainForm.addRow( self.mainForm.addRow(
@@ -803,7 +805,7 @@ class GuiConfigEditAutoReplaceTab(QWidget):
self.quoteSingleStyleC = QLineEdit() self.quoteSingleStyleC = QLineEdit()
self.quoteSingleStyleC.setMaxLength(1) self.quoteSingleStyleC.setMaxLength(1)
self.quoteSingleStyleC.setFixedWidth(40) self.quoteSingleStyleC.setFixedWidth(qWidth)
self.quoteSingleStyleC.setAlignment(Qt.AlignCenter) self.quoteSingleStyleC.setAlignment(Qt.AlignCenter)
self.quoteSingleStyleC.setText(self.mainConf.fmtSingleQuotes[1]) self.quoteSingleStyleC.setText(self.mainConf.fmtSingleQuotes[1])
self.mainForm.addRow( self.mainForm.addRow(
@@ -815,7 +817,7 @@ class GuiConfigEditAutoReplaceTab(QWidget):
## Double Quote Style ## Double Quote Style
self.quoteDoubleStyleO = QLineEdit() self.quoteDoubleStyleO = QLineEdit()
self.quoteDoubleStyleO.setMaxLength(1) self.quoteDoubleStyleO.setMaxLength(1)
self.quoteDoubleStyleO.setFixedWidth(40) self.quoteDoubleStyleO.setFixedWidth(qWidth)
self.quoteDoubleStyleO.setAlignment(Qt.AlignCenter) self.quoteDoubleStyleO.setAlignment(Qt.AlignCenter)
self.quoteDoubleStyleO.setText(self.mainConf.fmtDoubleQuotes[0]) self.quoteDoubleStyleO.setText(self.mainConf.fmtDoubleQuotes[0])
self.mainForm.addRow( self.mainForm.addRow(
@@ -826,7 +828,7 @@ class GuiConfigEditAutoReplaceTab(QWidget):
self.quoteDoubleStyleC = QLineEdit() self.quoteDoubleStyleC = QLineEdit()
self.quoteDoubleStyleC.setMaxLength(1) self.quoteDoubleStyleC.setMaxLength(1)
self.quoteDoubleStyleC.setFixedWidth(40) self.quoteDoubleStyleC.setFixedWidth(qWidth)
self.quoteDoubleStyleC.setAlignment(Qt.AlignCenter) self.quoteDoubleStyleC.setAlignment(Qt.AlignCenter)
self.quoteDoubleStyleC.setText(self.mainConf.fmtDoubleQuotes[1]) self.quoteDoubleStyleC.setText(self.mainConf.fmtDoubleQuotes[1])
self.mainForm.addRow( self.mainForm.addRow(
+10 -7
View File
@@ -61,17 +61,20 @@ class GuiProjectLoad(QDialog):
self.openState = self.NONE_STATE self.openState = self.NONE_STATE
self.openPath = None self.openPath = None
xSp = self.mainConf.pxInt(16)
xIc = self.mainConf.pxInt(96)
self.outerBox = QVBoxLayout() self.outerBox = QVBoxLayout()
self.innerBox = QHBoxLayout() self.innerBox = QHBoxLayout()
self.outerBox.setSpacing(16) self.outerBox.setSpacing(xSp)
self.innerBox.setSpacing(16) self.innerBox.setSpacing(xSp)
self.setWindowTitle("Open Project") self.setWindowTitle("Open Project")
self.setMinimumWidth(650) self.setMinimumWidth(self.mainConf.pxInt(650))
self.setMinimumHeight(400) self.setMinimumHeight(self.mainConf.pxInt(400))
self.setModal(True) self.setModal(True)
self.guiDeco = self.theTheme.loadDecoration("nwicon", (96, 96)) self.guiDeco = self.theTheme.loadDecoration("nwicon", (xIc, xIc))
self.innerBox.addWidget(self.guiDeco, 0, Qt.AlignTop) self.innerBox.addWidget(self.guiDeco, 0, Qt.AlignTop)
self.projectForm = QGridLayout() self.projectForm = QGridLayout()
@@ -113,8 +116,8 @@ class GuiProjectLoad(QDialog):
self.projectForm.setColumnStretch(0, 0) self.projectForm.setColumnStretch(0, 0)
self.projectForm.setColumnStretch(1, 1) self.projectForm.setColumnStretch(1, 1)
self.projectForm.setColumnStretch(2, 0) self.projectForm.setColumnStretch(2, 0)
self.projectForm.setVerticalSpacing(4) self.projectForm.setVerticalSpacing(self.mainConf.pxInt(4))
self.projectForm.setHorizontalSpacing(8) self.projectForm.setHorizontalSpacing(self.mainConf.pxInt(8))
self.innerBox.addLayout(self.projectForm) self.innerBox.addLayout(self.projectForm)
+32 -21
View File
@@ -119,6 +119,7 @@ class GuiProjectEditMain(QWidget):
def __init__(self, theParent, theProject): def __init__(self, theParent, theProject):
QWidget.__init__(self, theParent) QWidget.__init__(self, theParent)
self.mainConf = nw.CONFIG
self.theParent = theParent self.theParent = theParent
self.theProject = theProject self.theProject = theProject
@@ -129,9 +130,12 @@ class GuiProjectEditMain(QWidget):
self.mainForm.addGroupLabel("Project Settings") self.mainForm.addGroupLabel("Project Settings")
xW = self.mainConf.pxInt(250)
xH = self.mainConf.pxInt(100)
self.editName = QLineEdit() self.editName = QLineEdit()
self.editName.setMaxLength(200) self.editName.setMaxLength(200)
self.editName.setFixedWidth(250) self.editName.setFixedWidth(xW)
self.editName.setText(self.theProject.projName) self.editName.setText(self.theProject.projName)
self.mainForm.addRow( self.mainForm.addRow(
"Working title", "Working title",
@@ -141,7 +145,7 @@ class GuiProjectEditMain(QWidget):
self.editTitle = QLineEdit() self.editTitle = QLineEdit()
self.editTitle.setMaxLength(200) self.editTitle.setMaxLength(200)
self.editTitle.setFixedWidth(250) self.editTitle.setFixedWidth(xW)
self.editTitle.setText(self.theProject.bookTitle) self.editTitle.setText(self.theProject.bookTitle)
self.mainForm.addRow( self.mainForm.addRow(
"Novel title", "Novel title",
@@ -154,8 +158,8 @@ class GuiProjectEditMain(QWidget):
for bookAuthor in self.theProject.bookAuthors: for bookAuthor in self.theProject.bookAuthors:
bookAuthors += bookAuthor+"\n" bookAuthors += bookAuthor+"\n"
self.editAuthors.setPlainText(bookAuthors) self.editAuthors.setPlainText(bookAuthors)
self.editAuthors.setFixedHeight(100) self.editAuthors.setFixedHeight(xH)
self.editAuthors.setFixedWidth(250) self.editAuthors.setFixedWidth(xW)
self.mainForm.addRow( self.mainForm.addRow(
"Author(s)", "Author(s)",
self.editAuthors, self.editAuthors,
@@ -179,9 +183,12 @@ class GuiProjectEditMeta(QWidget):
def __init__(self, theParent, theProject): def __init__(self, theParent, theProject):
QWidget.__init__(self, theParent) QWidget.__init__(self, theParent)
self.mainConf = nw.CONFIG
self.theParent = theParent self.theParent = theParent
self.theProject = theProject self.theProject = theProject
xInd = self.mainConf.pxInt(8)
# The Form # The Form
self.mainForm = QGridLayout() self.mainForm = QGridLayout()
self.setLayout(self.mainForm) self.setLayout(self.mainForm)
@@ -189,17 +196,17 @@ class GuiProjectEditMeta(QWidget):
self.headLabel = QLabel("<b>Project Details</b>") self.headLabel = QLabel("<b>Project Details</b>")
self.nameLabel = QLabel("Working title:") self.nameLabel = QLabel("Working title:")
self.nameLabel.setIndent(8) self.nameLabel.setIndent(xInd)
self.nameValue = QLabel(self.theProject.projName) self.nameValue = QLabel(self.theProject.projName)
self.nameValue.setWordWrap(True) self.nameValue.setWordWrap(True)
self.pathLabel = QLabel("Project path:") self.pathLabel = QLabel("Project path:")
self.pathLabel.setIndent(8) self.pathLabel.setIndent(xInd)
self.pathValue = QLabel(self.theProject.projPath) self.pathValue = QLabel(self.theProject.projPath)
self.pathValue.setWordWrap(True) self.pathValue.setWordWrap(True)
self.revLabel = QLabel("Revision count:") self.revLabel = QLabel("Revision count:")
self.revLabel.setIndent(8) self.revLabel.setIndent(xInd)
self.revValue = QLabel("{:n}".format(self.theProject.saveCount)) self.revValue = QLabel("{:n}".format(self.theProject.saveCount))
self.statsLabel = QLabel("<b>Project Stats</b>") self.statsLabel = QLabel("<b>Project Stats</b>")
@@ -207,19 +214,19 @@ class GuiProjectEditMeta(QWidget):
nR, nD, nF = self.theProject.projTree.countTypes() nR, nD, nF = self.theProject.projTree.countTypes()
self.nRootLabel = QLabel("Root folders:") self.nRootLabel = QLabel("Root folders:")
self.nRootLabel.setIndent(8) self.nRootLabel.setIndent(xInd)
self.nRootValue = QLabel("{:n}".format(nR)) self.nRootValue = QLabel("{:n}".format(nR))
self.nDirLabel = QLabel("Folders:") self.nDirLabel = QLabel("Folders:")
self.nDirLabel.setIndent(8) self.nDirLabel.setIndent(xInd)
self.nDirValue = QLabel("{:n}".format(nD)) self.nDirValue = QLabel("{:n}".format(nD))
self.nFileLabel = QLabel("Documents:") self.nFileLabel = QLabel("Documents:")
self.nFileLabel.setIndent(8) self.nFileLabel.setIndent(xInd)
self.nFileValue = QLabel("{:n}".format(nF)) self.nFileValue = QLabel("{:n}".format(nF))
self.wordsLabel = QLabel("Word count:") self.wordsLabel = QLabel("Word count:")
self.wordsLabel.setIndent(8) self.wordsLabel.setIndent(xInd)
self.wordsValue = QLabel("{:n}".format(self.theProject.currWCount)) self.wordsValue = QLabel("{:n}".format(self.theProject.currWCount))
self.mainForm.addWidget(self.headLabel, 0, 0, 1, 2, Qt.AlignTop) self.mainForm.addWidget(self.headLabel, 0, 0, 1, 2, Qt.AlignTop)
@@ -240,8 +247,8 @@ class GuiProjectEditMeta(QWidget):
self.mainForm.addWidget(self.wordsLabel, 8, 0, 1, 1, Qt.AlignTop) self.mainForm.addWidget(self.wordsLabel, 8, 0, 1, 1, Qt.AlignTop)
self.mainForm.addWidget(self.wordsValue, 8, 1, 1, 1, Qt.AlignTop) self.mainForm.addWidget(self.wordsValue, 8, 1, 1, 1, Qt.AlignTop)
self.mainForm.setVerticalSpacing(6) self.mainForm.setVerticalSpacing(self.mainConf.pxInt(6))
self.mainForm.setHorizontalSpacing(12) self.mainForm.setHorizontalSpacing(self.mainConf.pxInt(12))
self.mainForm.setColumnStretch(0, 0) self.mainForm.setColumnStretch(0, 0)
self.mainForm.setColumnStretch(1, 1) self.mainForm.setColumnStretch(1, 1)
self.mainForm.setRowStretch(10, 1) self.mainForm.setRowStretch(10, 1)
@@ -255,8 +262,10 @@ class GuiProjectEditStatus(QWidget):
def __init__(self, theParent, theProject, isStatus): def __init__(self, theParent, theProject, isStatus):
QWidget.__init__(self, theParent) QWidget.__init__(self, theParent)
self.mainConf = nw.CONFIG
self.theParent = theParent self.theParent = theParent
self.theProject = theProject self.theProject = theProject
self.theTheme = theParent.theTheme
if isStatus: if isStatus:
self.theStatus = self.theProject.statusItems self.theStatus = self.theProject.statusItems
else: else:
@@ -267,6 +276,8 @@ class GuiProjectEditStatus(QWidget):
self.colChanged = False self.colChanged = False
self.selColour = None self.selColour = None
self.iPx = self.theTheme.textIconSize
self.outerBox = QVBoxLayout() self.outerBox = QVBoxLayout()
self.mainBox = QHBoxLayout() self.mainBox = QHBoxLayout()
self.mainForm = QVBoxLayout() self.mainForm = QVBoxLayout()
@@ -285,8 +296,8 @@ class GuiProjectEditStatus(QWidget):
self.newButton = QPushButton("New") self.newButton = QPushButton("New")
self.delButton = QPushButton("Delete") self.delButton = QPushButton("Delete")
self.saveButton = QPushButton("Save") self.saveButton = QPushButton("Save")
self.colPixmap = QPixmap(16,16) self.colPixmap = QPixmap(self.iPx, self.iPx)
self.colPixmap.fill(QColor(120,120,120)) self.colPixmap.fill(QColor(120, 120, 120))
self.colButton = QPushButton(QIcon(self.colPixmap),"Colour") self.colButton = QPushButton(QIcon(self.colPixmap),"Colour")
self.colButton.setIconSize(self.colPixmap.rect().size()) self.colButton.setIconSize(self.colPixmap.rect().size())
@@ -339,7 +350,7 @@ class GuiProjectEditStatus(QWidget):
) )
if newCol: if newCol:
self.selColour = newCol self.selColour = newCol
colPixmap = QPixmap(16,16) colPixmap = QPixmap(self.iPx, self.iPx)
colPixmap.fill(newCol) colPixmap.fill(newCol)
self.colButton.setIcon(QIcon(colPixmap)) self.colButton.setIcon(QIcon(colPixmap))
self.colButton.setIconSize(colPixmap.rect().size()) self.colButton.setIconSize(colPixmap.rect().size())
@@ -348,7 +359,7 @@ class GuiProjectEditStatus(QWidget):
def _newItem(self): def _newItem(self):
logger.verbose("New item button clicked") logger.verbose("New item button clicked")
newItem = self._addItem("New Item", (0, 0, 0), None, 0) newItem = self._addItem("New Item", (0, 0, 0), None, 0)
newItem.setBackground(QBrush(QColor(0,255,0,80))) newItem.setBackground(QBrush(QColor(0, 255, 0, 80)))
self.colChanged = True self.colChanged = True
return return
@@ -387,14 +398,14 @@ class GuiProjectEditStatus(QWidget):
return return
def _addItem(self, iName, iCol, oName, nUse): def _addItem(self, iName, iCol, oName, nUse):
newIcon = QPixmap(16,16) newIcon = QPixmap(self.iPx, self.iPx)
newIcon.fill(QColor(*iCol)) newIcon.fill(QColor(*iCol))
newItem = QListWidgetItem() newItem = QListWidgetItem()
newItem.setText("%s [%d]" % (iName, nUse)) newItem.setText("%s [%d]" % (iName, nUse))
newItem.setIcon(QIcon(newIcon)) newItem.setIcon(QIcon(newIcon))
newItem.setData(Qt.UserRole, len(self.colData)) newItem.setData(Qt.UserRole, len(self.colData))
self.listBox.addItem(newItem) self.listBox.addItem(newItem)
self.colData.append((iName,iCol[0],iCol[1],iCol[2],oName)) self.colData.append((iName, iCol[0], iCol[1], iCol[2], oName))
self.colCounts.append(nUse) self.colCounts.append(nUse)
return newItem return newItem
@@ -404,8 +415,8 @@ class GuiProjectEditStatus(QWidget):
if selItem is not None: if selItem is not None:
selIdx = selItem.data(Qt.UserRole) selIdx = selItem.data(Qt.UserRole)
selVal = self.colData[selIdx] selVal = self.colData[selIdx]
self.selColour = QColor(selVal[1],selVal[2],selVal[3]) self.selColour = QColor(selVal[1], selVal[2], selVal[3])
newIcon = QPixmap(16,16) newIcon = QPixmap(self.iPx, self.iPx)
newIcon.fill(self.selColour) newIcon.fill(self.selColour)
self.editName.setText(selVal[0]) self.editName.setText(selVal[0])
self.colButton.setIcon(QIcon(newIcon)) self.colButton.setIcon(QIcon(newIcon))
+10 -16
View File
@@ -61,32 +61,26 @@ class GuiSessionLogView(QDialog):
self.bottomBox = QHBoxLayout() self.bottomBox = QHBoxLayout()
self.setWindowTitle("Session Log") self.setWindowTitle("Session Log")
self.setMinimumWidth(420) self.setMinimumWidth(self.mainConf.pxInt(420))
self.setMinimumHeight(400) self.setMinimumHeight(self.mainConf.pxInt(400))
widthCol0 = self.optState.validIntRange( widthCol0 = self.optState.getInt("GuiSession", "widthCol0", self.mainConf.pxInt(180))
self.optState.getInt("GuiSession", "widthCol0", 180), 30, 999, 180 widthCol1 = self.optState.getInt("GuiSession", "widthCol1", self.mainConf.pxInt(80))
) widthCol2 = self.optState.getInt("GuiSession", "widthCol2", self.mainConf.pxInt(80))
widthCol1 = self.optState.validIntRange(
self.optState.getInt("GuiSession", "widthCol1", 80), 30, 999, 80
)
widthCol2 = self.optState.validIntRange(
self.optState.getInt("GuiSession", "widthCol2", 80), 30, 999, 80
)
self.listBox = QTreeWidget() self.listBox = QTreeWidget()
self.listBox.setHeaderLabels(["Session Start","Length","Words",""]) self.listBox.setHeaderLabels(["Session Start","Length","Words",""])
self.listBox.setIndentation(0) self.listBox.setIndentation(0)
self.listBox.setColumnWidth(0,widthCol0) self.listBox.setColumnWidth(0, widthCol0)
self.listBox.setColumnWidth(1,widthCol1) self.listBox.setColumnWidth(1, widthCol1)
self.listBox.setColumnWidth(2,widthCol2) self.listBox.setColumnWidth(2, widthCol2)
self.listBox.setColumnWidth(3,0) self.listBox.setColumnWidth(3, 0)
hHeader = self.listBox.headerItem() hHeader = self.listBox.headerItem()
hHeader.setTextAlignment(1,Qt.AlignRight) hHeader.setTextAlignment(1,Qt.AlignRight)
hHeader.setTextAlignment(2,Qt.AlignRight) hHeader.setTextAlignment(2,Qt.AlignRight)
self.monoFont = QFont("Monospace",10) self.monoFont = QFont("Monospace", 10)
sortValid = (Qt.AscendingOrder, Qt.DescendingOrder) sortValid = (Qt.AscendingOrder, Qt.DescendingOrder)
sortCol = self.optState.validIntRange( sortCol = self.optState.validIntRange(
+6 -4
View File
@@ -66,12 +66,14 @@ class GuiMainStatus(QStatusBar):
# Permanent Widgets # Permanent Widgets
# ================= # =================
xM = self.mainConf.pxInt(8)
## The Spell Checker Language ## The Spell Checker Language
self.langIcon = QLabel("") self.langIcon = QLabel("")
self.langText = QLabel("None") self.langText = QLabel("None")
self.langIcon.setPixmap(self.theTheme.getPixmap("status_lang", (iPx, iPx))) self.langIcon.setPixmap(self.theTheme.getPixmap("status_lang", (iPx, iPx)))
self.langIcon.setContentsMargins(0, 0, 0, 0) self.langIcon.setContentsMargins(0, 0, 0, 0)
self.langText.setContentsMargins(0, 0, 8, 0) self.langText.setContentsMargins(0, 0, xM, 0)
self.addPermanentWidget(self.langIcon) self.addPermanentWidget(self.langIcon)
self.addPermanentWidget(self.langText) self.addPermanentWidget(self.langText)
@@ -79,7 +81,7 @@ class GuiMainStatus(QStatusBar):
self.docIcon = StatusLED(colNone, colTrue, colFalse, iPx, iPx, self) self.docIcon = StatusLED(colNone, colTrue, colFalse, iPx, iPx, self)
self.docText = QLabel("Editor") self.docText = QLabel("Editor")
self.docIcon.setContentsMargins(0, 0, 0, 0) self.docIcon.setContentsMargins(0, 0, 0, 0)
self.docText.setContentsMargins(0, 0, 8, 0) self.docText.setContentsMargins(0, 0, xM, 0)
self.addPermanentWidget(self.docIcon) self.addPermanentWidget(self.docIcon)
self.addPermanentWidget(self.docText) self.addPermanentWidget(self.docText)
@@ -87,7 +89,7 @@ class GuiMainStatus(QStatusBar):
self.projIcon = StatusLED(colNone, colTrue, colFalse, iPx, iPx, self) self.projIcon = StatusLED(colNone, colTrue, colFalse, iPx, iPx, self)
self.projText = QLabel("Project") self.projText = QLabel("Project")
self.projIcon.setContentsMargins(0, 0, 0, 0) self.projIcon.setContentsMargins(0, 0, 0, 0)
self.projText.setContentsMargins(0, 0, 8, 0) self.projText.setContentsMargins(0, 0, xM, 0)
self.addPermanentWidget(self.projIcon) self.addPermanentWidget(self.projIcon)
self.addPermanentWidget(self.projText) self.addPermanentWidget(self.projText)
@@ -96,7 +98,7 @@ class GuiMainStatus(QStatusBar):
self.statsText = QLabel("") self.statsText = QLabel("")
self.statsIcon.setPixmap(self.theTheme.getPixmap("status_stats", (iPx, iPx))) self.statsIcon.setPixmap(self.theTheme.getPixmap("status_stats", (iPx, iPx)))
self.statsIcon.setContentsMargins(0, 0, 0, 0) self.statsIcon.setContentsMargins(0, 0, 0, 0)
self.statsText.setContentsMargins(0, 0, 8, 0) self.statsText.setContentsMargins(0, 0, xM, 0)
self.addPermanentWidget(self.statsIcon) self.addPermanentWidget(self.statsIcon)
self.addPermanentWidget(self.statsText) self.addPermanentWidget(self.statsText)
+14 -11
View File
@@ -108,15 +108,15 @@ class GuiMain(QMainWindow):
# Assemble Main Window # Assemble Main Window
self.treePane = QWidget() self.treePane = QWidget()
self.treeBox = QVBoxLayout() self.treeBox = QVBoxLayout()
self.treeBox.setContentsMargins(0,0,0,0) self.treeBox.setContentsMargins(0, 0, 0, 0)
self.treeBox.addWidget(self.treeView) self.treeBox.addWidget(self.treeView)
self.treeBox.addWidget(self.treeMeta) self.treeBox.addWidget(self.treeMeta)
self.treePane.setLayout(self.treeBox) self.treePane.setLayout(self.treeBox)
self.editPane = QWidget() self.editPane = QWidget()
self.docEdit = QVBoxLayout() self.docEdit = QVBoxLayout()
self.docEdit.setContentsMargins(0,0,0,0) self.docEdit.setContentsMargins(0, 0, 0, 0)
self.docEdit.setSpacing(2) self.docEdit.setSpacing(self.mainConf.pxInt(2))
self.docEdit.addWidget(self.searchBar) self.docEdit.addWidget(self.searchBar)
self.docEdit.addWidget(self.noticeBar) self.docEdit.addWidget(self.noticeBar)
self.docEdit.addWidget(self.docEditor) self.docEdit.addWidget(self.docEditor)
@@ -124,8 +124,8 @@ class GuiMain(QMainWindow):
self.viewPane = QWidget() self.viewPane = QWidget()
self.docView = QVBoxLayout() self.docView = QVBoxLayout()
self.docView.setContentsMargins(0,0,0,0) self.docView.setContentsMargins(0, 0, 0, 0)
self.docView.setSpacing(2) self.docView.setSpacing(self.mainConf.pxInt(2))
self.docView.addWidget(self.docViewer) self.docView.addWidget(self.docViewer)
self.docView.addWidget(self.viewMeta) self.docView.addWidget(self.viewMeta)
self.docView.setStretch(0, 1) self.docView.setStretch(0, 1)
@@ -148,8 +148,9 @@ class GuiMain(QMainWindow):
self.tabWidget.addTab(self.splitOutline, "Outline") self.tabWidget.addTab(self.splitOutline, "Outline")
self.tabWidget.currentChanged.connect(self._mainTabChanged) self.tabWidget.currentChanged.connect(self._mainTabChanged)
xCM = self.mainConf.pxInt(4)
self.splitMain = QSplitter(Qt.Horizontal) self.splitMain = QSplitter(Qt.Horizontal)
self.splitMain.setContentsMargins(4,4,4,4) self.splitMain.setContentsMargins(xCM, xCM, xCM, xCM)
self.splitMain.setOpaqueResize(False) self.splitMain.setOpaqueResize(False)
self.splitMain.addWidget(self.treePane) self.splitMain.addWidget(self.treePane)
self.splitMain.addWidget(self.tabWidget) self.splitMain.addWidget(self.tabWidget)
@@ -513,9 +514,9 @@ class GuiMain(QMainWindow):
if not self.viewPane.isVisible(): if not self.viewPane.isVisible():
bPos = self.splitMain.sizes() bPos = self.splitMain.sizes()
self.viewPane.setVisible(True) self.viewPane.setVisible(True)
vPos = [0,0] vPos = [0, 0]
vPos[0] = int(bPos[1]/2) vPos[0] = int(bPos[1]/2)
vPos[1] = bPos[1]-vPos[0] vPos[1] = bPos[1] - vPos[0]
self.splitView.setSizes(vPos) self.splitView.setSizes(vPos)
self.docViewer.navigateTo(navLink) self.docViewer.navigateTo(navLink)
@@ -877,7 +878,7 @@ class GuiMain(QMainWindow):
self.theProject.setLastViewed(None) self.theProject.setLastViewed(None)
bPos = self.splitMain.sizes() bPos = self.splitMain.sizes()
self.viewPane.setVisible(False) self.viewPane.setVisible(False)
vPos = [bPos[1],0] vPos = [bPos[1], 0]
self.splitView.setSizes(vPos) self.splitView.setSizes(vPos)
return not self.viewPane.isVisible() return not self.viewPane.isVisible()
@@ -988,16 +989,18 @@ class GuiMain(QMainWindow):
def _makeStatusIcons(self): def _makeStatusIcons(self):
self.statusIcons = {} self.statusIcons = {}
iPx = self.mainConf.pxInt(32)
for sLabel, sCol, _ in self.theProject.statusItems: for sLabel, sCol, _ in self.theProject.statusItems:
theIcon = QPixmap(32,32) theIcon = QPixmap(iPx, iPx)
theIcon.fill(QColor(*sCol)) theIcon.fill(QColor(*sCol))
self.statusIcons[sLabel] = QIcon(theIcon) self.statusIcons[sLabel] = QIcon(theIcon)
return return
def _makeImportIcons(self): def _makeImportIcons(self):
self.importIcons = {} self.importIcons = {}
iPx = self.mainConf.pxInt(32)
for sLabel, sCol, _ in self.theProject.importItems: for sLabel, sCol, _ in self.theProject.importItems:
theIcon = QPixmap(32,32) theIcon = QPixmap(iPx, iPx)
theIcon.fill(QColor(*sCol)) theIcon.fill(QColor(*sCol))
self.importIcons[sLabel] = QIcon(theIcon) self.importIcons[sLabel] = QIcon(theIcon)
return return