+1
-1
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
+56
-132
@@ -8,12 +8,8 @@
|
|||||||
File History:
|
File History:
|
||||||
Created: 2020-05-03 [0.4.5]
|
Created: 2020-05-03 [0.4.5]
|
||||||
|
|
||||||
This class is based on Stack Overflow code by Stefan Scherfke, based
|
The core code of this class is based on Stack Overflow example by
|
||||||
again on contribution by IMAN4K, published under license CC BY-SA 4.0.
|
Stefan Scherfke: https://stackoverflow.com/a/51825815/5825851
|
||||||
https://stackoverflow.com/a/51825815/5825851
|
|
||||||
|
|
||||||
The above code has been modified to integrate with novelWriter, and
|
|
||||||
re-released under compatible GPLv3 (see creativecommons.org).
|
|
||||||
|
|
||||||
This file is a part of novelWriter
|
This file is a part of novelWriter
|
||||||
Copyright 2020, Veronica Berglyd Olsen
|
Copyright 2020, Veronica Berglyd Olsen
|
||||||
@@ -29,7 +25,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
@@ -50,55 +46,9 @@ class QSwitch(QAbstractButton):
|
|||||||
|
|
||||||
self.setCheckable(True)
|
self.setCheckable(True)
|
||||||
self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
|
self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
|
||||||
|
self.setFixedWidth(40)
|
||||||
self._trackRadius = 10
|
self.setFixedHeight(20)
|
||||||
self._thumbRadius = 8
|
self._offset = 10
|
||||||
|
|
||||||
self._margin = max(0, self._thumbRadius - self._trackRadius)
|
|
||||||
self._baseOffset = max(self._thumbRadius, self._trackRadius)
|
|
||||||
self._endOffset = {
|
|
||||||
True: lambda: self.width() - self._baseOffset,
|
|
||||||
False: lambda: self._baseOffset,
|
|
||||||
}
|
|
||||||
self._offset = self._baseOffset
|
|
||||||
|
|
||||||
palette = self.palette()
|
|
||||||
if self._thumbRadius > self._trackRadius:
|
|
||||||
self._trackColor = {
|
|
||||||
True: palette.highlight(),
|
|
||||||
False: palette.dark(),
|
|
||||||
}
|
|
||||||
self._thumbColor = {
|
|
||||||
True: palette.highlight(),
|
|
||||||
False: palette.light(),
|
|
||||||
}
|
|
||||||
self._textColor = {
|
|
||||||
True: palette.highlightedText().color(),
|
|
||||||
False: palette.dark().color(),
|
|
||||||
}
|
|
||||||
self._thumbText = {
|
|
||||||
True: '',
|
|
||||||
False: '',
|
|
||||||
}
|
|
||||||
self._trackOpacity = 0.5
|
|
||||||
else:
|
|
||||||
self._thumbColor = {
|
|
||||||
True: palette.highlightedText(),
|
|
||||||
False: palette.light(),
|
|
||||||
}
|
|
||||||
self._trackColor = {
|
|
||||||
True: palette.highlight(),
|
|
||||||
False: palette.dark(),
|
|
||||||
}
|
|
||||||
self._textColor = {
|
|
||||||
True: palette.highlight().color(),
|
|
||||||
False: palette.dark().color(),
|
|
||||||
}
|
|
||||||
self._thumbText = {
|
|
||||||
True: nwUnicode.U_CHECK,
|
|
||||||
False: nwUnicode.U_MULT,
|
|
||||||
}
|
|
||||||
self._trackOpacity = 1.0
|
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -111,8 +61,8 @@ class QSwitch(QAbstractButton):
|
|||||||
return self._offset
|
return self._offset
|
||||||
|
|
||||||
@offset.setter
|
@offset.setter
|
||||||
def offset(self, value):
|
def offset(self, theOffset):
|
||||||
self._offset = value
|
self._offset = theOffset
|
||||||
self.update()
|
self.update()
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -120,114 +70,88 @@ class QSwitch(QAbstractButton):
|
|||||||
# Getters and Setters
|
# Getters and Setters
|
||||||
##
|
##
|
||||||
|
|
||||||
def trackRadius(self):
|
def setChecked(self, isChecked):
|
||||||
return self._trackRadius
|
"""Overload setChecked to also alter the offset.
|
||||||
|
"""
|
||||||
def setTrackRadius(self, theValue):
|
super().setChecked(isChecked)
|
||||||
if isinstance(theValue, int):
|
if isChecked:
|
||||||
if theValue > 0:
|
self.offset = 30
|
||||||
self._trackRadius = theValue
|
else:
|
||||||
return
|
self.offset = 10
|
||||||
raise ValueError("trackRadius must be an integer > 0")
|
|
||||||
self.update()
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def thumbRadius(self):
|
|
||||||
return self._thumbRadius
|
|
||||||
|
|
||||||
def setThumbRadius(self, theValue):
|
|
||||||
if isinstance(theValue, int):
|
|
||||||
if theValue > 0:
|
|
||||||
self._thumbRadius = theValue
|
|
||||||
return
|
|
||||||
raise ValueError("thumbRadius must be an integer > 0")
|
|
||||||
self.update()
|
|
||||||
return
|
|
||||||
|
|
||||||
def setChecked(self, checked):
|
|
||||||
super().setChecked(checked)
|
|
||||||
self.offset = self._endOffset[checked]()
|
|
||||||
|
|
||||||
def sizeHint(self):
|
|
||||||
return QSize(
|
|
||||||
4 * self._trackRadius + 2 * self._margin,
|
|
||||||
2 * self._trackRadius + 2 * self._margin,
|
|
||||||
)
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Events
|
# Events
|
||||||
##
|
##
|
||||||
|
|
||||||
def resizeEvent(self, event):
|
def resizeEvent(self, theEvent):
|
||||||
"""Overload resize to ensure correct offset.
|
"""Overload resize to ensure correct offset.
|
||||||
"""
|
"""
|
||||||
super().resizeEvent(event)
|
super().resizeEvent(theEvent)
|
||||||
self.offset = self._endOffset[self.isChecked()]()
|
if self.isChecked():
|
||||||
|
self.offset = 30
|
||||||
|
else:
|
||||||
|
self.offset = 10
|
||||||
return
|
return
|
||||||
|
|
||||||
def paintEvent(self, event):
|
def paintEvent(self, event):
|
||||||
"""Drawing the switch itself.
|
"""Drawing the switch itself.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
qPaint = QPainter(self)
|
qPaint = QPainter(self)
|
||||||
qPaint.setRenderHint(QPainter.Antialiasing, True)
|
qPaint.setRenderHint(QPainter.Antialiasing, True)
|
||||||
qPaint.setPen(Qt.NoPen)
|
qPaint.setPen(Qt.NoPen)
|
||||||
trackOpacity = self._trackOpacity
|
|
||||||
thumbOpacity = 1.0
|
qPalette = self.palette()
|
||||||
textOpacity = 1.0
|
if self.isChecked():
|
||||||
if self.isEnabled():
|
trackBrush = qPalette.highlight()
|
||||||
trackBrush = self._trackColor[self.isChecked()]
|
thumbBrush = qPalette.highlightedText()
|
||||||
thumbBrush = self._thumbColor[self.isChecked()]
|
textColor = qPalette.highlight().color()
|
||||||
textColor = self._textColor[self.isChecked()]
|
thumbText = nwUnicode.U_CHECK
|
||||||
else:
|
else:
|
||||||
trackOpacity *= 0.8
|
trackBrush = qPalette.dark()
|
||||||
trackBrush = self.palette().shadow()
|
thumbBrush = qPalette.light()
|
||||||
thumbBrush = self.palette().mid()
|
textColor = qPalette.dark().color()
|
||||||
textColor = self.palette().shadow().color()
|
thumbText = nwUnicode.U_MULT
|
||||||
|
|
||||||
|
if self.isEnabled():
|
||||||
|
trackOpacity = 1.0
|
||||||
|
else:
|
||||||
|
trackOpacity = 0.6
|
||||||
|
trackBrush = qPalette.shadow()
|
||||||
|
thumbBrush = qPalette.mid()
|
||||||
|
textColor = qPalette.shadow().color()
|
||||||
|
|
||||||
qPaint.setBrush(trackBrush)
|
qPaint.setBrush(trackBrush)
|
||||||
qPaint.setOpacity(trackOpacity)
|
qPaint.setOpacity(trackOpacity)
|
||||||
qPaint.drawRoundedRect(
|
qPaint.drawRoundedRect(0, 0, 40, 20, 10, 10)
|
||||||
self._margin,
|
|
||||||
self._margin,
|
|
||||||
self.width() - 2*self._margin,
|
|
||||||
self.height() - 2*self._margin,
|
|
||||||
self._trackRadius,
|
|
||||||
self._trackRadius,
|
|
||||||
)
|
|
||||||
qPaint.setBrush(thumbBrush)
|
qPaint.setBrush(thumbBrush)
|
||||||
qPaint.setOpacity(thumbOpacity)
|
qPaint.drawEllipse(self.offset - 8, 2, 16, 16)
|
||||||
qPaint.drawEllipse(
|
|
||||||
self.offset - self._thumbRadius,
|
|
||||||
self._baseOffset - self._thumbRadius,
|
|
||||||
2*self._thumbRadius,
|
|
||||||
2*self._thumbRadius,
|
|
||||||
)
|
|
||||||
qPaint.setPen(textColor)
|
|
||||||
qPaint.setOpacity(textOpacity)
|
|
||||||
theFont = qPaint.font()
|
theFont = qPaint.font()
|
||||||
theFont.setPixelSize(1.5*self._thumbRadius)
|
theFont.setPixelSize(12)
|
||||||
|
qPaint.setPen(textColor)
|
||||||
qPaint.setFont(theFont)
|
qPaint.setFont(theFont)
|
||||||
qPaint.drawText(
|
qPaint.drawText(
|
||||||
QRectF(
|
QRectF(self.offset - 8, 2, 16, 16),
|
||||||
self.offset - self._thumbRadius,
|
Qt.AlignCenter, thumbText
|
||||||
self._baseOffset - self._thumbRadius,
|
|
||||||
2*self._thumbRadius,
|
|
||||||
2*self._thumbRadius,
|
|
||||||
),
|
|
||||||
Qt.AlignCenter,
|
|
||||||
self._thumbText[self.isChecked()],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def mouseReleaseEvent(self, event):
|
def mouseReleaseEvent(self, event):
|
||||||
"""Animate the switch.
|
"""Animate the switch on mouse release.
|
||||||
"""
|
"""
|
||||||
super().mouseReleaseEvent(event)
|
super().mouseReleaseEvent(event)
|
||||||
if event.button() == Qt.LeftButton:
|
if event.button() == Qt.LeftButton:
|
||||||
doAnim = QPropertyAnimation(self, b'offset', self)
|
doAnim = QPropertyAnimation(self, b'offset', self)
|
||||||
doAnim.setDuration(120)
|
doAnim.setDuration(120)
|
||||||
doAnim.setStartValue(self.offset)
|
doAnim.setStartValue(self.offset)
|
||||||
doAnim.setEndValue(self._endOffset[self.isChecked()]())
|
if self.isChecked():
|
||||||
|
doAnim.setEndValue(30)
|
||||||
|
else:
|
||||||
|
doAnim.setEndValue(10)
|
||||||
doAnim.start()
|
doAnim.start()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from nw.constants.enum import nwItemClass, nwItemLayout, nwOutline
|
from nw.constants.enum import nwItemClass, nwItemLayout, nwOutline
|
||||||
@@ -237,10 +237,14 @@ class nwUnicode:
|
|||||||
U_MULT = "\u2715" # Multiplication x
|
U_MULT = "\u2715" # Multiplication x
|
||||||
|
|
||||||
## Arrows
|
## Arrows
|
||||||
U_UTRI = "\u2bc5" # Up-pointing triangle
|
U_UTRI = "\u25b2" # Up-pointing triangle
|
||||||
U_DTRI = "\u2bc6" # Down-pointing triangle
|
U_UTRIS = "\u25b4" # Up-pointing triangle, small
|
||||||
U_LTRI = "\u2bc7" # Left-pointing triangle
|
U_RTRI = "\u25b6" # Right-pointing triangle
|
||||||
U_RTRI = "\u2bc8" # Right-pointing triangle
|
U_RTRIS = "\u25b8" # Right-pointing triangle, small
|
||||||
|
U_DTRI = "\u25bc" # Down-pointing triangle
|
||||||
|
U_DTRIS = "\u25be" # Down-pointing triangle, small
|
||||||
|
U_LTRI = "\u25c0" # Left-pointing triangle
|
||||||
|
U_LTRIS = "\u25c2" # Left-pointing triangle, small
|
||||||
|
|
||||||
# HTML Equivalents
|
# HTML Equivalents
|
||||||
|
|
||||||
@@ -276,9 +280,13 @@ class nwUnicode:
|
|||||||
H_MULT = "✕"
|
H_MULT = "✕"
|
||||||
|
|
||||||
## Arrows
|
## Arrows
|
||||||
H_UTRI = "⯅"
|
H_UTRI = "▲"
|
||||||
H_DTRI = "⯆"
|
H_UTRIS = "▴"
|
||||||
H_LTRI = "⯇"
|
H_RTRI = "▶"
|
||||||
H_RTRI = "⯈"
|
H_RTRIS = "▸"
|
||||||
|
H_DTRI = "▼"
|
||||||
|
H_DTRIS = "▾"
|
||||||
|
H_LTRI = "◀"
|
||||||
|
H_LTRIS = "◂"
|
||||||
|
|
||||||
# END Class nwUnicode
|
# END Class nwUnicode
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
@@ -120,7 +120,7 @@ class GuiConfigEditor(QDialog):
|
|||||||
msgBox = QMessageBox()
|
msgBox = QMessageBox()
|
||||||
msgBox.information(
|
msgBox.information(
|
||||||
self, "Preferences",
|
self, "Preferences",
|
||||||
"Some changes will not be applied until<br>%s has been restarted" % nw.__package__
|
"Some changes will not be applied until %s has been restarted." % nw.__package__
|
||||||
)
|
)
|
||||||
|
|
||||||
if validEntries:
|
if validEntries:
|
||||||
@@ -166,7 +166,7 @@ class GuiConfigEditGeneralTab(QWidget):
|
|||||||
self.mainForm.addRow(
|
self.mainForm.addRow(
|
||||||
"Main GUI theme",
|
"Main GUI theme",
|
||||||
self.selectTheme,
|
self.selectTheme,
|
||||||
"Changing this requires restarting %s" % nw.__package__
|
"Changing this requires restarting %s." % nw.__package__
|
||||||
)
|
)
|
||||||
|
|
||||||
## Syntax Highlighting
|
## Syntax Highlighting
|
||||||
@@ -190,7 +190,7 @@ class GuiConfigEditGeneralTab(QWidget):
|
|||||||
self.mainForm.addRow(
|
self.mainForm.addRow(
|
||||||
"Prefer icons for dark backgrounds",
|
"Prefer icons for dark backgrounds",
|
||||||
self.preferDarkIcons,
|
self.preferDarkIcons,
|
||||||
"May improve the look of icons on dark themes"
|
"This may improve the look of icons on dark themes."
|
||||||
)
|
)
|
||||||
|
|
||||||
# GUI Settings
|
# GUI Settings
|
||||||
@@ -253,12 +253,14 @@ class GuiConfigEditGeneralTab(QWidget):
|
|||||||
self.mainForm.addRow(
|
self.mainForm.addRow(
|
||||||
"Run backup when closing project",
|
"Run backup when closing project",
|
||||||
self.backupOnClose,
|
self.backupOnClose,
|
||||||
"This option can be overridden in project settings"
|
"This option can be overridden in project settings."
|
||||||
)
|
)
|
||||||
|
|
||||||
## Ask before backup
|
## Ask before backup
|
||||||
|
## Only enabled when "Run when closing" is checked
|
||||||
self.askBeforeBackup = QSwitch()
|
self.askBeforeBackup = QSwitch()
|
||||||
self.askBeforeBackup.setChecked(self.mainConf.askBeforeBackup)
|
self.askBeforeBackup.setChecked(self.mainConf.askBeforeBackup)
|
||||||
|
self.askBeforeBackup.setEnabled(self.mainConf.backupOnClose)
|
||||||
self.mainForm.addRow(
|
self.mainForm.addRow(
|
||||||
"Ask before running backup",
|
"Ask before running backup",
|
||||||
self.askBeforeBackup
|
self.askBeforeBackup
|
||||||
@@ -355,7 +357,7 @@ class GuiConfigEditLayoutTab(QWidget):
|
|||||||
self.mainForm.addRow(
|
self.mainForm.addRow(
|
||||||
"Font family",
|
"Font family",
|
||||||
self.textStyleFont,
|
self.textStyleFont,
|
||||||
"For the document editor and viewer"
|
"Font for the document editor and viewer."
|
||||||
)
|
)
|
||||||
|
|
||||||
## Font Size
|
## Font Size
|
||||||
@@ -381,7 +383,7 @@ class GuiConfigEditLayoutTab(QWidget):
|
|||||||
self.textFlowMax.setSingleStep(10)
|
self.textFlowMax.setSingleStep(10)
|
||||||
self.textFlowMax.setValue(self.mainConf.textWidth)
|
self.textFlowMax.setValue(self.mainConf.textWidth)
|
||||||
self.mainForm.addRow(
|
self.mainForm.addRow(
|
||||||
"Maximum text width in Normal mode",
|
"Maximum text width in \"Normal Mode\"",
|
||||||
self.textFlowMax,
|
self.textFlowMax,
|
||||||
theUnit="px"
|
theUnit="px"
|
||||||
)
|
)
|
||||||
@@ -393,7 +395,7 @@ class GuiConfigEditLayoutTab(QWidget):
|
|||||||
self.zenDocWidth.setSingleStep(10)
|
self.zenDocWidth.setSingleStep(10)
|
||||||
self.zenDocWidth.setValue(self.mainConf.zenWidth)
|
self.zenDocWidth.setValue(self.mainConf.zenWidth)
|
||||||
self.mainForm.addRow(
|
self.mainForm.addRow(
|
||||||
"Maximum text width in Zen mode",
|
"Maximum text width in \"Zen Mode\"",
|
||||||
self.zenDocWidth,
|
self.zenDocWidth,
|
||||||
theUnit="px"
|
theUnit="px"
|
||||||
)
|
)
|
||||||
@@ -402,9 +404,9 @@ class GuiConfigEditLayoutTab(QWidget):
|
|||||||
self.textFlowFixed = QSwitch()
|
self.textFlowFixed = QSwitch()
|
||||||
self.textFlowFixed.setChecked(not self.mainConf.textFixedW)
|
self.textFlowFixed.setChecked(not self.mainConf.textFixedW)
|
||||||
self.mainForm.addRow(
|
self.mainForm.addRow(
|
||||||
"Disable maximum text width in Normal mode",
|
"Disable maximum text width in \"Normal Mode\"",
|
||||||
self.textFlowFixed,
|
self.textFlowFixed,
|
||||||
"Only fixed margins are applied to the document"
|
"If disabled, minimum text width is defined by the margin setting."
|
||||||
)
|
)
|
||||||
|
|
||||||
## Justify Text
|
## Justify Text
|
||||||
@@ -424,7 +426,7 @@ class GuiConfigEditLayoutTab(QWidget):
|
|||||||
self.mainForm.addRow(
|
self.mainForm.addRow(
|
||||||
"Document text margin",
|
"Document text margin",
|
||||||
self.textMargin,
|
self.textMargin,
|
||||||
"The minimum horizontal text margin if max with is enabled",
|
"If max width is enabled, this is the minimum margin.",
|
||||||
theUnit="px"
|
theUnit="px"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -437,7 +439,7 @@ class GuiConfigEditLayoutTab(QWidget):
|
|||||||
self.mainForm.addRow(
|
self.mainForm.addRow(
|
||||||
"Editor tab width",
|
"Editor tab width",
|
||||||
self.tabWidth,
|
self.tabWidth,
|
||||||
"This feature requires Qt 5.9 or later",
|
"This feature requires Qt 5.9 or later.",
|
||||||
theUnit="px"
|
theUnit="px"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -536,7 +538,7 @@ class GuiConfigEditEditingTab(QWidget):
|
|||||||
self.mainForm.addRow(
|
self.mainForm.addRow(
|
||||||
"Spell check provider",
|
"Spell check provider",
|
||||||
self.spellToolList,
|
self.spellToolList,
|
||||||
"Note that the internal spell check tool is quite slow"
|
"Note that the internal spell check tool is quite slow."
|
||||||
)
|
)
|
||||||
self.mainForm.addRow(
|
self.mainForm.addRow(
|
||||||
"Spell check language",
|
"Spell check language",
|
||||||
@@ -552,7 +554,7 @@ class GuiConfigEditEditingTab(QWidget):
|
|||||||
self.mainForm.addRow(
|
self.mainForm.addRow(
|
||||||
"Big document limit",
|
"Big document limit",
|
||||||
self.bigDocLimit,
|
self.bigDocLimit,
|
||||||
"Disables full spell checking over the size limit",
|
"Disables full spell checking over the size limit.",
|
||||||
theUnit="kb"
|
theUnit="kb"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -638,7 +640,7 @@ class GuiConfigEditAutoReplaceTab(QWidget):
|
|||||||
self.mainForm.addRow(
|
self.mainForm.addRow(
|
||||||
"Auto-select word under cursor",
|
"Auto-select word under cursor",
|
||||||
self.autoSelect,
|
self.autoSelect,
|
||||||
"Apply formatting to word under cursor if no selection is made"
|
"Apply formatting to word under cursor if no selection is made."
|
||||||
)
|
)
|
||||||
|
|
||||||
## Auto-Replace as You Type Main Switch
|
## Auto-Replace as You Type Main Switch
|
||||||
@@ -648,7 +650,7 @@ class GuiConfigEditAutoReplaceTab(QWidget):
|
|||||||
self.mainForm.addRow(
|
self.mainForm.addRow(
|
||||||
"Auto-replace text as you type",
|
"Auto-replace text as you type",
|
||||||
self.autoReplaceMain,
|
self.autoReplaceMain,
|
||||||
"Apply formatting to word under cursor if no selection is made"
|
"Apply formatting to word under cursor if no selection is made."
|
||||||
)
|
)
|
||||||
|
|
||||||
# Auto-Replace
|
# Auto-Replace
|
||||||
@@ -658,37 +660,41 @@ class GuiConfigEditAutoReplaceTab(QWidget):
|
|||||||
## Auto-Replace Single Quotes
|
## Auto-Replace Single Quotes
|
||||||
self.autoReplaceSQ = QSwitch()
|
self.autoReplaceSQ = QSwitch()
|
||||||
self.autoReplaceSQ.setChecked(self.mainConf.doReplaceSQuote)
|
self.autoReplaceSQ.setChecked(self.mainConf.doReplaceSQuote)
|
||||||
|
self.autoReplaceSQ.setEnabled(self.mainConf.doReplace)
|
||||||
self.mainForm.addRow(
|
self.mainForm.addRow(
|
||||||
"Auto-replace single quotes",
|
"Auto-replace single quotes",
|
||||||
self.autoReplaceSQ,
|
self.autoReplaceSQ,
|
||||||
"The feature will try to guess opening or closing single quote"
|
"The feature will try to guess opening or closing single quote."
|
||||||
)
|
)
|
||||||
|
|
||||||
## Auto-Replace Double Quotes
|
## Auto-Replace Double Quotes
|
||||||
self.autoReplaceDQ = QSwitch()
|
self.autoReplaceDQ = QSwitch()
|
||||||
self.autoReplaceDQ.setChecked(self.mainConf.doReplaceDQuote)
|
self.autoReplaceDQ.setChecked(self.mainConf.doReplaceDQuote)
|
||||||
|
self.autoReplaceDQ.setEnabled(self.mainConf.doReplace)
|
||||||
self.mainForm.addRow(
|
self.mainForm.addRow(
|
||||||
"Auto-replace double quotes",
|
"Auto-replace double quotes",
|
||||||
self.autoReplaceDQ,
|
self.autoReplaceDQ,
|
||||||
"The feature will try to guess opening or closing quote quote"
|
"The feature will try to guess opening or closing quote quote."
|
||||||
)
|
)
|
||||||
|
|
||||||
## Auto-Replace Hyphens
|
## Auto-Replace Hyphens
|
||||||
self.autoReplaceDash = QSwitch()
|
self.autoReplaceDash = QSwitch()
|
||||||
self.autoReplaceDash.setChecked(self.mainConf.doReplaceDash)
|
self.autoReplaceDash.setChecked(self.mainConf.doReplaceDash)
|
||||||
|
self.autoReplaceDash.setEnabled(self.mainConf.doReplace)
|
||||||
self.mainForm.addRow(
|
self.mainForm.addRow(
|
||||||
"Auto-replace dashes",
|
"Auto-replace dashes",
|
||||||
self.autoReplaceDash,
|
self.autoReplaceDash,
|
||||||
"Auto-replace double and triple hyphens with short and long dash"
|
"Auto-replace double and triple hyphens with short and long dash."
|
||||||
)
|
)
|
||||||
|
|
||||||
## Auto-Replace Dots
|
## Auto-Replace Dots
|
||||||
self.autoReplaceDots = QSwitch()
|
self.autoReplaceDots = QSwitch()
|
||||||
self.autoReplaceDots.setChecked(self.mainConf.doReplaceDots)
|
self.autoReplaceDots.setChecked(self.mainConf.doReplaceDots)
|
||||||
|
self.autoReplaceDots.setEnabled(self.mainConf.doReplace)
|
||||||
self.mainForm.addRow(
|
self.mainForm.addRow(
|
||||||
"Auto-replace dots",
|
"Auto-replace dots",
|
||||||
self.autoReplaceDots,
|
self.autoReplaceDots,
|
||||||
"Auto-replace three dots with ellipsis"
|
"Auto-replace three dots with ellipsis."
|
||||||
)
|
)
|
||||||
|
|
||||||
# Quotation Style
|
# Quotation Style
|
||||||
@@ -704,7 +710,7 @@ class GuiConfigEditAutoReplaceTab(QWidget):
|
|||||||
self.mainForm.addRow(
|
self.mainForm.addRow(
|
||||||
"Single quote open style",
|
"Single quote open style",
|
||||||
self.quoteSingleStyleO,
|
self.quoteSingleStyleO,
|
||||||
"Auto-replaces apostrophe before words"
|
"Auto-replaces apostrophe before words."
|
||||||
)
|
)
|
||||||
|
|
||||||
self.quoteSingleStyleC = QLineEdit()
|
self.quoteSingleStyleC = QLineEdit()
|
||||||
@@ -715,7 +721,7 @@ class GuiConfigEditAutoReplaceTab(QWidget):
|
|||||||
self.mainForm.addRow(
|
self.mainForm.addRow(
|
||||||
"Single quote close style",
|
"Single quote close style",
|
||||||
self.quoteSingleStyleC,
|
self.quoteSingleStyleC,
|
||||||
"Auto-replaces apostrophe after words"
|
"Auto-replaces apostrophe after words."
|
||||||
)
|
)
|
||||||
|
|
||||||
## Double Quote Style
|
## Double Quote Style
|
||||||
@@ -727,7 +733,7 @@ class GuiConfigEditAutoReplaceTab(QWidget):
|
|||||||
self.mainForm.addRow(
|
self.mainForm.addRow(
|
||||||
"Double quote open style",
|
"Double quote open style",
|
||||||
self.quoteDoubleStyleO,
|
self.quoteDoubleStyleO,
|
||||||
"Auto-replaces straight quotes before words"
|
"Auto-replaces straight quotes before words."
|
||||||
)
|
)
|
||||||
|
|
||||||
self.quoteDoubleStyleC = QLineEdit()
|
self.quoteDoubleStyleC = QLineEdit()
|
||||||
@@ -738,7 +744,7 @@ class GuiConfigEditAutoReplaceTab(QWidget):
|
|||||||
self.mainForm.addRow(
|
self.mainForm.addRow(
|
||||||
"Double quote close style",
|
"Double quote close style",
|
||||||
self.quoteDoubleStyleC,
|
self.quoteDoubleStyleC,
|
||||||
"Auto-replaces straight quotes after words"
|
"Auto-replaces straight quotes after words."
|
||||||
)
|
)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
@@ -92,7 +92,7 @@ class GuiDocTitleBar(QLabel):
|
|||||||
nwItem = self.theProject.getItem(aHandle)
|
nwItem = self.theProject.getItem(aHandle)
|
||||||
if nwItem is not None:
|
if nwItem is not None:
|
||||||
tTitle.append(nwItem.itemName)
|
tTitle.append(nwItem.itemName)
|
||||||
sSep = " %s " % nwUnicode.U_RTRI
|
sSep = " %s " % nwUnicode.U_RSAQUO
|
||||||
self.setText(sSep.join(tTitle))
|
self.setText(sSep.join(tTitle))
|
||||||
else:
|
else:
|
||||||
nwItem = self.theProject.getItem(tHandle)
|
nwItem = self.theProject.getItem(tHandle)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
+19
-9
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
@@ -46,16 +46,25 @@ class NWBackup():
|
|||||||
|
|
||||||
def zipIt(self):
|
def zipIt(self):
|
||||||
|
|
||||||
if self.mainConf.backupPath is None:
|
if self.mainConf.backupPath is None or self.mainConf.backupPath == "":
|
||||||
self.theParent.makeAlert(
|
self.theParent.makeAlert((
|
||||||
"Cannot backup project because no backup path is set.",nwAlert.WARN
|
"Cannot backup project because no backup path is set. "
|
||||||
)
|
"Please set a valid backup location in Tools > Preferences."
|
||||||
|
), nwAlert.WARN)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if self.theProject.projName is None:
|
if self.theProject.projName is None or self.theProject.projName == "":
|
||||||
self.theParent.makeAlert(
|
self.theParent.makeAlert((
|
||||||
"Cannot backup project because no project name is set.",nwAlert.WARN
|
"Cannot backup project because no project name is set. "
|
||||||
)
|
"Please set a Working Title in Project > Project Settings."
|
||||||
|
), nwAlert.WARN)
|
||||||
|
return False
|
||||||
|
|
||||||
|
if not path.isdir(self.mainConf.backupPath):
|
||||||
|
self.theParent.makeAlert((
|
||||||
|
"Cannot backup project because the backup path does not exist. "
|
||||||
|
"Please set a valid backup location in Tools > Preferences."
|
||||||
|
), nwAlert.WARN)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
logger.info("Backing up project")
|
logger.info("Backing up project")
|
||||||
@@ -75,6 +84,7 @@ class NWBackup():
|
|||||||
self.theProject._clearLockFile()
|
self.theProject._clearLockFile()
|
||||||
make_archive(baseName, "zip", self.theProject.projPath, ".")
|
make_archive(baseName, "zip", self.theProject.projPath, ".")
|
||||||
self.theProject._writeLockFile()
|
self.theProject._writeLockFile()
|
||||||
|
logger.info("Backup written to: %s" % archName)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.theParent.makeAlert(
|
self.theParent.makeAlert(
|
||||||
["Could not write backup archive.",str(e)],
|
["Could not write backup archive.",str(e)],
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
Reference in New Issue
Block a user