mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-10 16:02:33 +12:00
Adds: UI setting to change project format (single file, or directory)
This commit is contained in:
parent
824f15e54c
commit
2c0e3074ce
|
@ -20,8 +20,6 @@ def saveProject(version=None):
|
|||
else:
|
||||
v1.saveProject()
|
||||
|
||||
# FIXME: add settings to chose between saving as zip or not.
|
||||
|
||||
|
||||
def clearSaveCache():
|
||||
v1.cache = {}
|
||||
|
|
|
@ -105,8 +105,7 @@ def saveProject(zip=None):
|
|||
@return: Nothing
|
||||
"""
|
||||
if zip is None:
|
||||
zip = False
|
||||
# FIXME: use value from settings
|
||||
zip = settings.saveToZip
|
||||
|
||||
log("\n\nSaving to:", "zip" if zip else "folder")
|
||||
|
||||
|
@ -651,6 +650,9 @@ def loadProject(project, zip=None):
|
|||
else:
|
||||
errors.append("settings.txt")
|
||||
|
||||
# Just to be sure
|
||||
settings.saveToZip = zip
|
||||
|
||||
####################################################################################################################
|
||||
# Labels
|
||||
|
||||
|
|
|
@ -87,12 +87,14 @@ frequencyAnalyzer = {
|
|||
}
|
||||
|
||||
viewMode = "fiction"
|
||||
saveToZip = True
|
||||
|
||||
def save(filename=None, protocol=None):
|
||||
|
||||
global spellcheck, dict, corkSliderFactor, viewSettings, corkSizeFactor, folderView, lastTab, openIndexes, \
|
||||
autoSave, autoSaveDelay, saveOnQuit, autoSaveNoChanges, autoSaveNoChangesDelay, outlineViewColumns, \
|
||||
corkBackground, fullScreenTheme, defaultTextType, textEditor, revisions, frequencyAnalyzer, viewMode
|
||||
corkBackground, fullScreenTheme, defaultTextType, textEditor, revisions, frequencyAnalyzer, viewMode, \
|
||||
saveToZip
|
||||
|
||||
allSettings = {
|
||||
"viewSettings": viewSettings,
|
||||
|
@ -115,6 +117,7 @@ def save(filename=None, protocol=None):
|
|||
"revisions":revisions,
|
||||
"frequencyAnalyzer": frequencyAnalyzer,
|
||||
"viewMode": viewMode,
|
||||
"saveToZip": saveToZip,
|
||||
}
|
||||
|
||||
#pp=pprint.PrettyPrinter(indent=4, compact=False)
|
||||
|
@ -251,3 +254,6 @@ def load(string, fromString=False, protocol=None):
|
|||
global viewMode
|
||||
viewMode = allSettings["viewMode"]
|
||||
|
||||
if "saveToZip" in allSettings:
|
||||
global saveToZip
|
||||
saveToZip = allSettings["saveToZip"]
|
|
@ -68,9 +68,11 @@ class settingsWindow(QWidget, Ui_Settings):
|
|||
self.txtAutoSave.setText(str(settings.autoSaveDelay))
|
||||
self.txtAutoSaveNoChanges.setText(str(settings.autoSaveNoChangesDelay))
|
||||
self.chkSaveOnQuit.setChecked(settings.saveOnQuit)
|
||||
self.chkSaveToZip.setChecked(settings.saveToZip)
|
||||
self.chkAutoSave.stateChanged.connect(self.saveSettingsChanged)
|
||||
self.chkAutoSaveNoChanges.stateChanged.connect(self.saveSettingsChanged)
|
||||
self.chkSaveOnQuit.stateChanged.connect(self.saveSettingsChanged)
|
||||
self.chkSaveToZip.stateChanged.connect(self.saveSettingsChanged)
|
||||
self.txtAutoSave.textEdited.connect(self.saveSettingsChanged)
|
||||
self.txtAutoSaveNoChanges.textEdited.connect(self.saveSettingsChanged)
|
||||
autoLoad, last = self.mw.welcome.getAutoLoadValues()
|
||||
|
@ -241,11 +243,13 @@ class settingsWindow(QWidget, Ui_Settings):
|
|||
|
||||
sttgs = QSettings()
|
||||
sttgs.setValue("autoLoad", True if self.chkAutoLoad.checkState() else False)
|
||||
print("Setting Value:", True if self.chkAutoLoad.checkState() else False)
|
||||
sttgs.sync()
|
||||
|
||||
settings.autoSave = True if self.chkAutoSave.checkState() else False
|
||||
settings.autoSaveNoChanges = True if self.chkAutoSaveNoChanges.checkState() else False
|
||||
settings.saveOnQuit = True if self.chkSaveOnQuit.checkState() else False
|
||||
settings.saveToZip = True if self.chkSaveToZip.checkState() else False
|
||||
settings.autoSaveDelay = int(self.txtAutoSave.text())
|
||||
settings.autoSaveNoChangesDelay = int(self.txtAutoSaveNoChanges.text())
|
||||
self.mw.saveTimer.setInterval(settings.autoSaveDelay * 60 * 1000)
|
||||
|
|
|
@ -11,7 +11,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets
|
|||
class Ui_Settings(object):
|
||||
def setupUi(self, Settings):
|
||||
Settings.setObjectName("Settings")
|
||||
Settings.resize(658, 561)
|
||||
Settings.resize(658, 585)
|
||||
self.horizontalLayout_8 = QtWidgets.QHBoxLayout(Settings)
|
||||
self.horizontalLayout_8.setObjectName("horizontalLayout_8")
|
||||
self.lstMenu = QtWidgets.QListWidget(Settings)
|
||||
|
@ -205,6 +205,15 @@ class Ui_Settings(object):
|
|||
self.chkSaveOnQuit.setChecked(True)
|
||||
self.chkSaveOnQuit.setObjectName("chkSaveOnQuit")
|
||||
self.verticalLayout_6.addWidget(self.chkSaveOnQuit)
|
||||
self.chkSaveToZip = QtWidgets.QCheckBox(self.groupBox)
|
||||
font = QtGui.QFont()
|
||||
font.setBold(False)
|
||||
font.setWeight(50)
|
||||
self.chkSaveToZip.setFont(font)
|
||||
self.chkSaveToZip.setStatusTip("")
|
||||
self.chkSaveToZip.setChecked(True)
|
||||
self.chkSaveToZip.setObjectName("chkSaveToZip")
|
||||
self.verticalLayout_6.addWidget(self.chkSaveToZip)
|
||||
self.verticalLayout_7.addWidget(self.groupBox)
|
||||
self.groupBox_11 = QtWidgets.QGroupBox(self.stackedWidgetPage1)
|
||||
font = QtGui.QFont()
|
||||
|
@ -1662,6 +1671,8 @@ class Ui_Settings(object):
|
|||
self.chkAutoSaveNoChanges.setText(_translate("Settings", "If no changes during"))
|
||||
self.label_14.setText(_translate("Settings", "seconds."))
|
||||
self.chkSaveOnQuit.setText(_translate("Settings", "Save on quit"))
|
||||
self.chkSaveToZip.setToolTip(_translate("Settings", "<html><head/><body><p>If you check this option, your project will be save as one single file. Easier to copy or backup, but does not allow collaborative editing, or versionning.<br/>If this is unchecked, your project will be save as a folder containing many small files.</p></body></html>"))
|
||||
self.chkSaveToZip.setText(_translate("Settings", "Save to one single file"))
|
||||
self.groupBox_11.setTitle(_translate("Settings", "Default text format"))
|
||||
self.label_35.setText(_translate("Settings", "The format set by default when you create a new text item. You can change this on a per item basis."))
|
||||
self.lblTitleGeneral_2.setText(_translate("Settings", "Revisions"))
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>658</width>
|
||||
<height>561</height>
|
||||
<height>585</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -399,6 +399,28 @@ text-align:center;</string>
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkSaveToZip">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>If you check this option, your project will be save as one single file. Easier to copy or backup, but does not allow collaborative editing, or versionning.<br/>If this is unchecked, your project will be save as a folder containing many small files.</p></body></html></string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save to one single file</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -66,7 +66,7 @@ class welcome(QWidget, Ui_welcome):
|
|||
def getAutoLoadValues(self):
|
||||
sttgns = QSettings()
|
||||
if sttgns.contains("autoLoad"):
|
||||
autoLoad = True if sttgns.value("autoLoad") == "true" else False
|
||||
autoLoad = True if sttgns.value("autoLoad") in ["true", True] else False
|
||||
else:
|
||||
autoLoad = False
|
||||
if autoLoad and sttgns.contains("lastProject"):
|
||||
|
|
Loading…
Reference in a new issue