Improve the manuscript GUIs a bit

This commit is contained in:
Veronica Berglyd Olsen
2023-06-05 00:25:02 +02:00
parent 2f0ac4fe17
commit ee9da2bdf1
4 changed files with 83 additions and 34 deletions
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<svg width="24" height="24" version="1.2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> <svg width="24" height="24" version="1.2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="m6.4444 16.444v0.55556c1.8789-2.8644 4-4.3922 6.6667-4.4444v3.3333c0 0.61222 0.56778 1.1111 1.27 1.1111 0.40444 0 0.75-0.17556 0.98111-0.43444 2.1478-2.2544 6.6378-6.7878 6.6378-6.7878s-4.49-4.5356-6.6389-6.8189c-0.23111-0.22778-0.57556-0.40333-0.98-0.40333-0.70222 0-1.27 0.49667-1.27 1.1111v3.3333c-5.1778 0-6.6667 5.4122-6.6667 9.4444zm-3.3333 5h15.556c0.61444 0 1.1111-0.49778 1.1111-1.1111v-6.7178c-0.73778 0.75111-1.5156 1.5478-2.2222 2.2744v3.3322h-13.333v-13.333h7.7778v-2.2222h-8.8889c-0.61444 0-1.1111 0.49778-1.1111 1.1111v15.556c0 0.61333 0.49667 1.1111 1.1111 1.1111z" fill="#aeaeae" stroke-width="1.1111"/> <path d="m6.4444 16.444v0.55556c1.8789-2.8644 4-4.3922 6.6667-4.4444v3.3333c0 0.61222 0.56778 1.1111 1.27 1.1111 0.40444 0 0.75-0.17556 0.98111-0.43444 2.1478-2.2544 6.6378-6.7878 6.6378-6.7878s-4.49-4.5356-6.6389-6.8189c-0.23111-0.22778-0.57556-0.40333-0.98-0.40333-0.70222 0-1.27 0.49667-1.27 1.1111v3.3333c-5.1778 0-6.6667 5.4122-6.6667 9.4444zm-3.3333 5h15.556c0.61444 0 1.1111-0.49778 1.1111-1.1111v-6.7178c-0.73778 0.75111-1.5156 1.5478-2.2222 2.2744v3.3322h-13.333v-13.333h7.7778v-2.2222h-8.8889c-0.61444 0-1.1111 0.49778-1.1111 1.1111v15.556c0 0.61333 0.49667 1.1111 1.1111 1.1111z" fill="#69c" stroke-width="1.1111"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 775 B

After

Width:  |  Height:  |  Size: 772 B

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<svg width="24" height="24" version="1.2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> <svg width="24" height="24" version="1.2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="m6.4444 16.444v0.55556c1.8789-2.8644 4-4.3922 6.6667-4.4444v3.3333c0 0.61222 0.56778 1.1111 1.27 1.1111 0.40444 0 0.75-0.17556 0.98111-0.43444 2.1478-2.2544 6.6378-6.7878 6.6378-6.7878s-4.49-4.5356-6.6389-6.8189c-0.23111-0.22778-0.57556-0.40333-0.98-0.40333-0.70222 0-1.27 0.49667-1.27 1.1111v3.3333c-5.1778 0-6.6667 5.4122-6.6667 9.4444zm-3.3333 5h15.556c0.61444 0 1.1111-0.49778 1.1111-1.1111v-6.7178c-0.73778 0.75111-1.5156 1.5478-2.2222 2.2744v3.3322h-13.333v-13.333h7.7778v-2.2222h-8.8889c-0.61444 0-1.1111 0.49778-1.1111 1.1111v15.556c0 0.61333 0.49667 1.1111 1.1111 1.1111z" fill-opacity=".72157" stroke-width="1.1111"/> <path d="m6.4444 16.444v0.55556c1.8789-2.8644 4-4.3922 6.6667-4.4444v3.3333c0 0.61222 0.56778 1.1111 1.27 1.1111 0.40444 0 0.75-0.17556 0.98111-0.43444 2.1478-2.2544 6.6378-6.7878 6.6378-6.7878s-4.49-4.5356-6.6389-6.8189c-0.23111-0.22778-0.57556-0.40333-0.98-0.40333-0.70222 0-1.27 0.49667-1.27 1.1111v3.3333c-5.1778 0-6.6667 5.4122-6.6667 9.4444zm-3.3333 5h15.556c0.61444 0 1.1111-0.49778 1.1111-1.1111v-6.7178c-0.73778 0.75111-1.5156 1.5478-2.2222 2.2744v3.3322h-13.333v-13.333h7.7778v-2.2222h-8.8889c-0.61444 0-1.1111 0.49778-1.1111 1.1111v15.556c0 0.61333 0.49667 1.1111 1.1111 1.1111z" fill="#4271ae" stroke-width="1.1111"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 782 B

After

Width:  |  Height:  |  Size: 775 B

+31 -15
View File
@@ -53,6 +53,8 @@ class GuiManuscriptBuild(QDialog):
independently of the Manuscript Build Tool. independently of the Manuscript Build Tool.
""" """
D_KEY = Qt.ItemDataRole.UserRole
def __init__(self, parent: QWidget, mainGui: GuiMain, build: BuildSettings): def __init__(self, parent: QWidget, mainGui: GuiMain, build: BuildSettings):
super().__init__(parent=parent) super().__init__(parent=parent)
@@ -71,7 +73,7 @@ class GuiManuscriptBuild(QDialog):
self.setMinimumHeight(CONFIG.pxInt(250)) self.setMinimumHeight(CONFIG.pxInt(250))
wWin = CONFIG.pxInt(660) wWin = CONFIG.pxInt(660)
hWin = CONFIG.pxInt(350) hWin = CONFIG.pxInt(390)
pOptions = self.theProject.options pOptions = self.theProject.options
self.resize( self.resize(
@@ -88,7 +90,7 @@ class GuiManuscriptBuild(QDialog):
for key, (_, label) in nwLabels.BUILD_FORMATS.items(): for key, (_, label) in nwLabels.BUILD_FORMATS.items():
item = QListWidgetItem() item = QListWidgetItem()
item.setText(label) item.setText(label)
item.setData(Qt.UserRole, key) item.setData(self.D_KEY, key)
self.listFormats.addItem(item) self.listFormats.addItem(item)
if key == self._build.lastFormat: if key == self._build.lastFormat:
current = item current = item
@@ -130,6 +132,18 @@ class GuiManuscriptBuild(QDialog):
# Dialog Controls # Dialog Controls
# =============== # ===============
font = self.font()
font.setBold(True)
font.setUnderline(True)
font.setPointSizeF(1.5*font.pointSizeF())
self.lblMain = QLabel(self._build.name)
self.lblMain.setWordWrap(True)
self.lblMain.setFont(font)
self.spaceWidget = QWidget()
self.spaceWidget.setFixedHeight(CONFIG.pxInt(8))
# Build Path # Build Path
self.lblPath = QLabel(self.tr("Build Folder")) self.lblPath = QLabel(self.tr("Build Folder"))
self.buildPath = QLineEdit() self.buildPath = QLineEdit()
@@ -156,11 +170,9 @@ class GuiManuscriptBuild(QDialog):
self.buildProgress = QProgressBar() self.buildProgress = QProgressBar()
# Dialog Buttons # Dialog Buttons
self.btnBuild = QPushButton(self.mainTheme.getIcon("export"), self.tr("&Build"))
self.dlgButtons = QDialogButtonBox(QDialogButtonBox.Close) self.dlgButtons = QDialogButtonBox(QDialogButtonBox.Close)
self.dlgButtons.addButton( self.dlgButtons.addButton(self.btnBuild, QDialogButtonBox.ActionRole)
QPushButton(self.mainTheme.getIcon("export"), self.tr("&Build")),
QDialogButtonBox.ActionRole
)
self.dlgButtons.clicked.connect(self._dialogButtonClicked) self.dlgButtons.clicked.connect(self._dialogButtonClicked)
# Assemble GUI # Assemble GUI
@@ -178,14 +190,16 @@ class GuiManuscriptBuild(QDialog):
]) ])
self.outerBox = QGridLayout() self.outerBox = QGridLayout()
self.outerBox.addWidget(self.mainSplit, 0, 0, 1, 2) self.outerBox.addWidget(self.lblMain, 0, 0, 1, 2, Qt.AlignCenter)
self.outerBox.addWidget(self.lblPath, 1, 0, 1, 1) self.outerBox.addWidget(self.spaceWidget, 1, 0, 1, 2)
self.outerBox.addLayout(self.pathBox, 1, 1, 1, 1) self.outerBox.addWidget(self.mainSplit, 2, 0, 1, 2)
self.outerBox.addWidget(self.lblName, 2, 0, 1, 1) self.outerBox.addWidget(self.lblPath, 3, 0, 1, 1)
self.outerBox.addLayout(self.nameBox, 2, 1, 1, 1) self.outerBox.addLayout(self.pathBox, 3, 1, 1, 1)
self.outerBox.addWidget(self.lblProgress, 3, 0, 1, 1) self.outerBox.addWidget(self.lblName, 4, 0, 1, 1)
self.outerBox.addWidget(self.buildProgress, 3, 1, 1, 1) self.outerBox.addLayout(self.nameBox, 4, 1, 1, 1)
self.outerBox.addWidget(self.dlgButtons, 4, 0, 1, 2) self.outerBox.addWidget(self.lblProgress, 5, 0, 1, 1)
self.outerBox.addWidget(self.buildProgress, 5, 1, 1, 1)
self.outerBox.addWidget(self.dlgButtons, 6, 0, 1, 2)
self.setLayout(self.outerBox) self.setLayout(self.outerBox)
@@ -194,6 +208,8 @@ class GuiManuscriptBuild(QDialog):
else: else:
self._doResetBuildName() self._doResetBuildName()
self.btnBuild.setFocus()
logger.debug("Ready: GuiManuscriptBuild") logger.debug("Ready: GuiManuscriptBuild")
return return
@@ -267,7 +283,7 @@ class GuiManuscriptBuild(QDialog):
"""Get the currently selected format.""" """Get the currently selected format."""
items = self.listFormats.selectedItems() items = self.listFormats.selectedItems()
if items and isinstance(items[0], QListWidgetItem): if items and isinstance(items[0], QListWidgetItem):
return str(items[0].data(Qt.UserRole)) return str(items[0].data(self.D_KEY))
return None return None
def _saveSettings(self): def _saveSettings(self):
+50 -17
View File
@@ -31,10 +31,10 @@ from typing import TYPE_CHECKING
from datetime import datetime from datetime import datetime
from PyQt5.QtGui import QColor, QCursor, QFont, QPalette, QResizeEvent from PyQt5.QtGui import QColor, QCursor, QFont, QPalette, QResizeEvent
from PyQt5.QtCore import QTimer, Qt, pyqtSlot from PyQt5.QtCore import QSize, QTimer, Qt, pyqtSlot
from PyQt5.QtWidgets import ( from PyQt5.QtWidgets import (
QDialog, QHBoxLayout, QLabel, QListWidget, QListWidgetItem, QMenu, QDialog, QHBoxLayout, QLabel, QListWidget, QListWidgetItem, QMenu,
QProgressBar, QPushButton, QSplitter, QTextBrowser, QVBoxLayout, QWidget, QProgressBar, QPushButton, QSplitter, QTextBrowser, QToolButton, QVBoxLayout, QWidget,
qApp qApp
) )
@@ -80,6 +80,7 @@ class GuiManuscript(QDialog):
self.setMinimumWidth(CONFIG.pxInt(600)) self.setMinimumWidth(CONFIG.pxInt(600))
self.setMinimumHeight(CONFIG.pxInt(500)) self.setMinimumHeight(CONFIG.pxInt(500))
iPx = self.mainTheme.baseIconSize
wWin = CONFIG.pxInt(900) wWin = CONFIG.pxInt(900)
hWin = CONFIG.pxInt(600) hWin = CONFIG.pxInt(600)
@@ -92,15 +93,52 @@ class GuiManuscript(QDialog):
# Build Controls # Build Controls
# ============== # ==============
qPalette = self.palette()
qPalette.setBrush(QPalette.Window, qPalette.base())
self.setPalette(qPalette)
fadeCol = qPalette.text().color()
buttonStyle = (
"QToolButton {{padding: {0}px; border: none; background: transparent;}} "
"QToolButton:hover {{border: none; background: rgba({1},{2},{3},0.2);}}"
).format(CONFIG.pxInt(2), fadeCol.red(), fadeCol.green(), fadeCol.blue())
self.tbAdd = QToolButton(self)
self.tbAdd.setIcon(self.mainTheme.getIcon("add"))
self.tbAdd.setIconSize(QSize(iPx, iPx))
self.tbAdd.setToolTip(self.tr("Add New Build"))
self.tbAdd.setStyleSheet(buttonStyle)
self.tbAdd.clicked.connect(self._createNewBuild)
self.tbDel = QToolButton(self)
self.tbDel.setIcon(self.mainTheme.getIcon("remove"))
self.tbDel.setIconSize(QSize(iPx, iPx))
self.tbDel.setToolTip(self.tr("Remove Selected Build"))
self.tbDel.setStyleSheet(buttonStyle)
self.tbEdit = QToolButton(self)
self.tbEdit.setIcon(self.mainTheme.getIcon("edit"))
self.tbEdit.setIconSize(QSize(iPx, iPx))
self.tbEdit.setToolTip(self.tr("Edit Selected Build"))
self.tbEdit.setStyleSheet(buttonStyle)
self.tbEdit.clicked.connect(self._editSelectedBuild)
self.lblBuilds = QLabel("<b>{0}</b>".format(self.tr("Builds")))
self.buildList = QListWidget() self.buildList = QListWidget()
self.btnNew = QPushButton(self.tr("New")) self.tbMore = QToolButton(self)
self.btnNew.clicked.connect(self._createNewBuild) self.tbMore.setIcon(self.mainTheme.getIcon("menu"))
self.tbMore.setIconSize(QSize(iPx, iPx))
self.tbMore.setStyleSheet(buttonStyle)
self.btnEdit = QPushButton(self.tr("Edit")) self.listToolBox = QHBoxLayout()
self.btnEdit.clicked.connect(self._editSelectedBuild) self.listToolBox.addWidget(self.lblBuilds)
self.listToolBox.addStretch(1)
self.btnDelete = QPushButton(self.tr("Delete")) self.listToolBox.addWidget(self.tbAdd)
self.listToolBox.addWidget(self.tbDel)
self.listToolBox.addWidget(self.tbEdit)
self.listToolBox.addWidget(self.tbMore)
self.listToolBox.setSpacing(0)
# Process Controls # Process Controls
# ================ # ================
@@ -123,22 +161,17 @@ class GuiManuscript(QDialog):
self.btnClose = QPushButton(self.tr("Close")) self.btnClose = QPushButton(self.tr("Close"))
self.btnClose.clicked.connect(self._doClose) self.btnClose.clicked.connect(self._doClose)
# Assemble GUI
# ============
self.buildBox = QHBoxLayout()
self.buildBox.addWidget(self.btnNew)
self.buildBox.addWidget(self.btnEdit)
self.buildBox.addWidget(self.btnDelete)
self.processBox = QHBoxLayout() self.processBox = QHBoxLayout()
self.processBox.addWidget(self.btnBuild) self.processBox.addWidget(self.btnBuild)
self.processBox.addWidget(self.btnPrint) self.processBox.addWidget(self.btnPrint)
self.processBox.addWidget(self.btnClose) self.processBox.addWidget(self.btnClose)
# Assemble GUI
# ============
self.controlBox = QVBoxLayout() self.controlBox = QVBoxLayout()
self.controlBox.addLayout(self.listToolBox)
self.controlBox.addWidget(self.buildList) self.controlBox.addWidget(self.buildList)
self.controlBox.addLayout(self.buildBox)
self.controlBox.addWidget(self.buildProgress) self.controlBox.addWidget(self.buildProgress)
self.controlBox.addWidget(self.btnPreview) self.controlBox.addWidget(self.btnPreview)
self.controlBox.addLayout(self.processBox) self.controlBox.addLayout(self.processBox)