Merge pull request #94 from vkbo/gui_tweaks
GUI Tweaks: Expand Home + Clear Recent Projects
This commit is contained in:
@@ -340,6 +340,10 @@ class Config:
|
|||||||
self.recentList.insert(0,recentPath)
|
self.recentList.insert(0,recentPath)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def clearRecent(self):
|
||||||
|
self.recentList = [""]*10
|
||||||
|
return
|
||||||
|
|
||||||
def setConfPath(self, newPath):
|
def setConfPath(self, newPath):
|
||||||
if newPath is None:
|
if newPath is None:
|
||||||
return True
|
return True
|
||||||
|
|||||||
@@ -122,6 +122,15 @@ class GuiExport(QDialog):
|
|||||||
pFormat = self.tabPandoc.outputFormat.currentData()
|
pFormat = self.tabPandoc.outputFormat.currentData()
|
||||||
tFormat = GuiExportPandoc.FMT_VIA[pFormat]
|
tFormat = GuiExportPandoc.FMT_VIA[pFormat]
|
||||||
|
|
||||||
|
if saveTo.startswith("~"):
|
||||||
|
saveTo = path.expanduser(saveTo)
|
||||||
|
|
||||||
|
exportDir = path.dirname(saveTo)
|
||||||
|
if not path.isdir(exportDir):
|
||||||
|
self.theParent.makeAlert("The export folder does not exist.",nwAlert.ERROR)
|
||||||
|
self.exportStatus.setText("Export failed ...")
|
||||||
|
return False
|
||||||
|
|
||||||
nItems = len(self.theProject.treeOrder)
|
nItems = len(self.theProject.treeOrder)
|
||||||
if eFormat == GuiExportMain.FMT_PDOC:
|
if eFormat == GuiExportMain.FMT_PDOC:
|
||||||
nItems += int(0.2*nItems)
|
nItems += int(0.2*nItems)
|
||||||
@@ -288,6 +297,9 @@ class GuiExport(QDialog):
|
|||||||
hScene = self.tabMain.hideScene.isChecked()
|
hScene = self.tabMain.hideScene.isChecked()
|
||||||
hSection = self.tabMain.hideSection.isChecked()
|
hSection = self.tabMain.hideSection.isChecked()
|
||||||
|
|
||||||
|
if saveTo.startswith("~"):
|
||||||
|
saveTo = path.expanduser(saveTo)
|
||||||
|
|
||||||
self.optState.setSetting("wNovel", wNovel)
|
self.optState.setSetting("wNovel", wNovel)
|
||||||
self.optState.setSetting("wNotes", wNotes)
|
self.optState.setSetting("wNotes", wNotes)
|
||||||
self.optState.setSetting("eFormat", eFormat)
|
self.optState.setSetting("eFormat", eFormat)
|
||||||
@@ -563,6 +575,8 @@ class GuiExportMain(QWidget):
|
|||||||
|
|
||||||
def _checkFileExtension(self):
|
def _checkFileExtension(self):
|
||||||
saveTo = self.exportPath.text()
|
saveTo = self.exportPath.text()
|
||||||
|
if saveTo.startswith("~"):
|
||||||
|
saveTo = path.expanduser(saveTo)
|
||||||
fileBits = path.splitext(saveTo)
|
fileBits = path.splitext(saveTo)
|
||||||
if self.currFormat > 0 and fileBits[0].strip() != "":
|
if self.currFormat > 0 and fileBits[0].strip() != "":
|
||||||
saveTo = fileBits[0]+self.FMT_EXT[self.currFormat]
|
saveTo = fileBits[0]+self.FMT_EXT[self.currFormat]
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ class GuiMainMenu(QMenuBar):
|
|||||||
return
|
return
|
||||||
|
|
||||||
def updateRecentProjects(self):
|
def updateRecentProjects(self):
|
||||||
|
|
||||||
self.recentMenu.clear()
|
self.recentMenu.clear()
|
||||||
for n in range(len(self.mainConf.recentList)):
|
for n in range(len(self.mainConf.recentList)):
|
||||||
recentProject = self.mainConf.recentList[n]
|
recentProject = self.mainConf.recentList[n]
|
||||||
@@ -79,6 +80,13 @@ class GuiMainMenu(QMenuBar):
|
|||||||
menuItem = QAction("%s" % recentProject, self.projMenu)
|
menuItem = QAction("%s" % recentProject, self.projMenu)
|
||||||
menuItem.triggered.connect(lambda menuItem, n=n : self.openRecentProject(menuItem, n))
|
menuItem.triggered.connect(lambda menuItem, n=n : self.openRecentProject(menuItem, n))
|
||||||
self.recentMenu.addAction(menuItem)
|
self.recentMenu.addAction(menuItem)
|
||||||
|
|
||||||
|
self.recentMenu.addSeparator()
|
||||||
|
menuItem = QAction("Clear Recent Projects", self)
|
||||||
|
menuItem.setStatusTip("Clear the list of recent projects")
|
||||||
|
menuItem.triggered.connect(self._clearRecentProjects)
|
||||||
|
self.recentMenu.addAction(menuItem)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def updateSpellCheck(self):
|
def updateSpellCheck(self):
|
||||||
@@ -150,6 +158,11 @@ class GuiMainMenu(QMenuBar):
|
|||||||
QDesktopServices.openUrl(QUrl(nw.__docurl__))
|
QDesktopServices.openUrl(QUrl(nw.__docurl__))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def _clearRecentProjects(self):
|
||||||
|
self.mainConf.clearRecent()
|
||||||
|
self.updateRecentProjects()
|
||||||
|
return True
|
||||||
|
|
||||||
##
|
##
|
||||||
# Menu Builders
|
# Menu Builders
|
||||||
##
|
##
|
||||||
|
|||||||
@@ -358,6 +358,8 @@ class NWProject():
|
|||||||
if projPath is None or projPath == "":
|
if projPath is None or projPath == "":
|
||||||
self.projPath = None
|
self.projPath = None
|
||||||
else:
|
else:
|
||||||
|
if projPath.startswith("~"):
|
||||||
|
projPath = path.expanduser(projPath)
|
||||||
self.projPath = projPath
|
self.projPath = projPath
|
||||||
self.setProjectChanged(True)
|
self.setProjectChanged(True)
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user