From f80e9cf94afd50cbf17e3d13d7bcca9943d43c19 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Sat, 15 Jun 2019 23:10:15 +0200 Subject: [PATCH] Some tweaks to dialog design --- nw/config.py | 10 +++++-- nw/graphics/block.svg | 38 ------------------------- nw/graphics/gear.svg | 48 ++++++++++++++++++++++++++++++++ nw/graphics/gradient.svg | 60 ---------------------------------------- nw/gui/configeditor.py | 10 +++---- nw/gui/itemeditor.py | 8 ++++-- nw/gui/projecteditor.py | 12 ++++---- nw/gui/winmain.py | 2 +- 8 files changed, 72 insertions(+), 116 deletions(-) delete mode 100644 nw/graphics/block.svg create mode 100644 nw/graphics/gear.svg delete mode 100644 nw/graphics/gradient.svg diff --git a/nw/config.py b/nw/config.py index cb90cd48..50941257 100644 --- a/nw/config.py +++ b/nw/config.py @@ -14,9 +14,11 @@ import logging import configparser import nw -from os import path, mkdir, getcwd -from appdirs import user_config_dir -from datetime import datetime +from os import path, mkdir, getcwd +from appdirs import user_config_dir +from datetime import datetime + +from nw.constants import nwFiles logger = logging.getLogger(__name__) @@ -43,6 +45,7 @@ class Config: self.homePath = None self.appPath = None self.appRoot = None + self.appIcon = None self.guiPath = None self.themeRoot = None self.themePath = None @@ -111,6 +114,7 @@ class Config: self.guiPath = path.join(self.appPath,"gui") self.themeRoot = path.join(self.appPath,"themes") self.themePath = path.join(self.themeRoot) + self.appIcon = path.join(self.appRoot, nwFiles.APP_ICON) # If config folder does not exist, make it. # This assumes that the os config folder itself exists. diff --git a/nw/graphics/block.svg b/nw/graphics/block.svg deleted file mode 100644 index 6546646c..00000000 --- a/nw/graphics/block.svg +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - image/svg+xml - - - - - - - - - diff --git a/nw/graphics/gear.svg b/nw/graphics/gear.svg new file mode 100644 index 00000000..b5da5b7a --- /dev/null +++ b/nw/graphics/gear.svg @@ -0,0 +1,48 @@ + +image/svg+xml + + \ No newline at end of file diff --git a/nw/graphics/gradient.svg b/nw/graphics/gradient.svg deleted file mode 100644 index 28f83ef1..00000000 --- a/nw/graphics/gradient.svg +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - image/svg+xml - - - - - - - - - diff --git a/nw/gui/configeditor.py b/nw/gui/configeditor.py index 7b79ee6a..d90424f8 100644 --- a/nw/gui/configeditor.py +++ b/nw/gui/configeditor.py @@ -15,7 +15,7 @@ import nw from os import path -from PyQt5.QtCore import Qt +from PyQt5.QtCore import Qt, QSize from PyQt5.QtGui import QIcon, QPixmap, QColor, QBrush, QStandardItemModel, QFont from PyQt5.QtSvg import QSvgWidget from PyQt5.QtWidgets import ( @@ -43,9 +43,9 @@ class GuiConfigEditor(QDialog): self.setWindowTitle("Preferences") - self.gradPath = path.abspath(path.join(self.mainConf.appPath,"graphics","block.svg")) - self.svgGradient = QSvgWidget(self.gradPath) - self.svgGradient.setFixedWidth(80) + self.gradPath = path.abspath(path.join(self.mainConf.appPath,"graphics","gear.svg")) + self.svgGradient = QSvgWidget(path.join(self.gradPath)) + self.svgGradient.setFixedSize(QSize(64,64)) self.theProject.countStatus() self.tabMain = GuiConfigEditGeneral(self.theParent) @@ -56,7 +56,7 @@ class GuiConfigEditor(QDialog): self.tabWidget.addTab(self.tabEditor, "Editor") self.setLayout(self.outerBox) - self.outerBox.addWidget(self.svgGradient) + self.outerBox.addWidget(self.svgGradient, 0, Qt.AlignTop) self.outerBox.addLayout(self.innerBox) self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) diff --git a/nw/gui/itemeditor.py b/nw/gui/itemeditor.py index 06edf0fd..a049aaf2 100644 --- a/nw/gui/itemeditor.py +++ b/nw/gui/itemeditor.py @@ -15,6 +15,7 @@ import nw from os import path +from PyQt5.QtCore import Qt, QSize from PyQt5.QtWidgets import QDialog, QHBoxLayout, QVBoxLayout, QGroupBox, QFormLayout, QLineEdit, QPushButton, QComboBox from PyQt5.QtSvg import QSvgWidget @@ -40,11 +41,12 @@ class GuiItemEditor(QDialog): self.setWindowTitle("Item Settings") - self.gradPath = path.abspath(path.join(self.mainConf.appPath,"graphics","block.svg")) + self.gradPath = path.abspath(path.join(self.mainConf.appPath,"graphics","gear.svg")) self.svgGradient = QSvgWidget(self.gradPath) - self.svgGradient.setFixedWidth(80) + self.svgGradient.setFixedSize(QSize(64,64)) + self.setLayout(self.outerBox) - self.outerBox.addWidget(self.svgGradient) + self.outerBox.addWidget(self.svgGradient, 0, Qt.AlignTop) self.outerBox.addLayout(self.innerBox) self.mainGroup = QGroupBox("Item Settings") diff --git a/nw/gui/projecteditor.py b/nw/gui/projecteditor.py index c440dca4..8f5bf681 100644 --- a/nw/gui/projecteditor.py +++ b/nw/gui/projecteditor.py @@ -15,7 +15,7 @@ import nw from os import path -from PyQt5.QtCore import Qt +from PyQt5.QtCore import Qt, QSize from PyQt5.QtGui import QIcon, QPixmap, QColor, QBrush, QStandardItemModel from PyQt5.QtSvg import QSvgWidget from PyQt5.QtWidgets import ( @@ -37,14 +37,15 @@ class GuiProjectEditor(QDialog): self.mainConf = nw.CONFIG self.theParent = theParent self.theProject = theProject + self.outerBox = QHBoxLayout() self.innerBox = QVBoxLayout() - self.setWindowTitle("Project Settings") + self.setLayout(self.outerBox) - self.gradPath = path.abspath(path.join(self.mainConf.appPath,"graphics","block.svg")) + self.gradPath = path.abspath(path.join(self.mainConf.appPath,"graphics","gear.svg")) self.svgGradient = QSvgWidget(self.gradPath) - self.svgGradient.setFixedWidth(80) + self.svgGradient.setFixedSize(QSize(64,64)) self.theProject.countStatus() self.tabMain = GuiProjectEditMain(self.theParent, self.theProject) @@ -58,8 +59,7 @@ class GuiProjectEditor(QDialog): self.tabWidget.addTab(self.tabImport, "Importance") self.tabWidget.addTab(self.tabReplace,"Auto-Replace") - self.setLayout(self.outerBox) - self.outerBox.addWidget(self.svgGradient) + self.outerBox.addWidget(self.svgGradient, 0, Qt.AlignTop) self.outerBox.addLayout(self.innerBox) self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) diff --git a/nw/gui/winmain.py b/nw/gui/winmain.py index 944031be..374668a6 100644 --- a/nw/gui/winmain.py +++ b/nw/gui/winmain.py @@ -58,7 +58,7 @@ class GuiMain(QMainWindow): self.resize(*self.mainConf.winGeometry) self._setWindowTitle() - self.setWindowIcon(QIcon(path.join(self.mainConf.appRoot, nwFiles.APP_ICON))) + self.setWindowIcon(QIcon(path.join(self.mainConf.appIcon))) # Main GUI Elements self.statusBar = GuiMainStatus(self)