Delete old recent project code
This commit is contained in:
@@ -396,10 +396,6 @@ class Config:
|
||||
self.lastPath = self._parseLine(
|
||||
cnfParse, cnfSec, "lastpath", self.CNF_STR, self.lastPath
|
||||
)
|
||||
for i in range(10):
|
||||
self.recentList[i] = self._parseLine(
|
||||
cnfParse, cnfSec, "recent%d" % i,self.CNF_STR, self.recentList[i]
|
||||
)
|
||||
|
||||
# Check Certain Values for None
|
||||
self.spellLanguage = self._checkNone(self.spellLanguage)
|
||||
@@ -478,8 +474,6 @@ class Config:
|
||||
cnfSec = "Path"
|
||||
cnfParse.add_section(cnfSec)
|
||||
cnfParse.set(cnfSec,"lastpath", str(self.lastPath))
|
||||
for i in range(10):
|
||||
cnfParse.set(cnfSec,"recent%d" % i, str(self.recentList[i]))
|
||||
|
||||
# Write config file
|
||||
try:
|
||||
@@ -567,17 +561,6 @@ class Config:
|
||||
# Setters and Getters
|
||||
##
|
||||
|
||||
def setRecent(self, recentPath):
|
||||
if recentPath == "": return
|
||||
if recentPath in self.recentList[0:10]:
|
||||
self.recentList.remove(recentPath)
|
||||
self.recentList.insert(0,recentPath)
|
||||
return
|
||||
|
||||
def clearRecent(self):
|
||||
self.recentList = [""]*10
|
||||
return
|
||||
|
||||
def setConfPath(self, newPath):
|
||||
if newPath is None:
|
||||
return True
|
||||
|
||||
@@ -48,11 +48,6 @@ class GuiMainMenu(QMenuBar):
|
||||
|
||||
return
|
||||
|
||||
def openRecentProject(self, menuItem, recentItem):
|
||||
logger.verbose("User requested opening recent project #%d" % recentItem)
|
||||
self.theParent.openProject(self.mainConf.recentList[recentItem])
|
||||
return True
|
||||
|
||||
def setAvailableRoot(self):
|
||||
for itemClass in nwItemClass:
|
||||
if itemClass == nwItemClass.NO_CLASS: continue
|
||||
@@ -66,30 +61,6 @@ class GuiMainMenu(QMenuBar):
|
||||
# Update Menu on Settings Changed
|
||||
##
|
||||
|
||||
def updateMenu(self):
|
||||
self.updateRecentProjects()
|
||||
return
|
||||
|
||||
def updateRecentProjects(self):
|
||||
|
||||
self.recentMenu.clear()
|
||||
for n in range(len(self.mainConf.recentList)):
|
||||
recentProject = self.mainConf.recentList[n]
|
||||
if recentProject == "": continue
|
||||
menuItem = QAction("%s" % recentProject, self.projMenu)
|
||||
menuItem.triggered.connect(
|
||||
lambda a1=menuItem, a2=n : self.openRecentProject(a1, a2)
|
||||
)
|
||||
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
|
||||
|
||||
def setSpellCheck(self, theMode):
|
||||
"""Set the spell check check box to theMode. This is controlled
|
||||
by the document editor class, which holds the master spell check
|
||||
@@ -166,11 +137,6 @@ class GuiMainMenu(QMenuBar):
|
||||
QDesktopServices.openUrl(QUrl(nw.__docurl__))
|
||||
return True
|
||||
|
||||
def _clearRecentProjects(self):
|
||||
self.mainConf.clearRecent()
|
||||
self.updateRecentProjects()
|
||||
return True
|
||||
|
||||
def _showDocumentLocation(self):
|
||||
self.theParent.docEditor.revealLocation()
|
||||
return True
|
||||
@@ -211,10 +177,6 @@ class GuiMainMenu(QMenuBar):
|
||||
self.aCloseProject.triggered.connect(lambda : self.theParent.closeProject(False))
|
||||
self.projMenu.addAction(self.aCloseProject)
|
||||
|
||||
# Project > Recent Projects
|
||||
self.recentMenu = self.projMenu.addMenu("Recent Projects")
|
||||
self.updateRecentProjects()
|
||||
|
||||
# Project > Project Settings
|
||||
self.aProjectSettings = QAction("Project Settings", self)
|
||||
self.aProjectSettings.setStatusTip("Project settings")
|
||||
|
||||
@@ -331,7 +331,6 @@ class GuiMain(QMainWindow):
|
||||
self.docEditor.setDictionaries()
|
||||
self.docEditor.setSpellCheck(self.theProject.spellCheck)
|
||||
self.statusBar.setRefTime(self.theProject.projOpened)
|
||||
self.mainMenu.updateMenu()
|
||||
|
||||
# Restore previously open documents, if any
|
||||
if self.theProject.lastEdited is not None:
|
||||
@@ -361,7 +360,6 @@ class GuiMain(QMainWindow):
|
||||
self.treeView.saveTreeOrder()
|
||||
self.theProject.saveProject()
|
||||
self.theIndex.saveIndex()
|
||||
self.mainMenu.updateRecentProjects()
|
||||
|
||||
return True
|
||||
|
||||
|
||||
@@ -297,7 +297,11 @@ class NWProject():
|
||||
self._appendItem(tHandle,pHandle,nwItem)
|
||||
|
||||
self.optState.loadSettings()
|
||||
self.mainConf.setRecent(self.projPath)
|
||||
|
||||
# Update recent projects
|
||||
self.mainConf.updateRecentCache(self.projPath, self.projName, self.lastWCount, time())
|
||||
self.mainConf.saveRecentCache()
|
||||
|
||||
self.theParent.setStatus("Opened Project: %s" % self.projName)
|
||||
|
||||
self._scanProjectFolder()
|
||||
@@ -391,7 +395,6 @@ class NWProject():
|
||||
self.optState.saveSettings()
|
||||
|
||||
# Update recent projects
|
||||
self.mainConf.setRecent(self.projPath)
|
||||
self.mainConf.updateRecentCache(self.projPath, self.projName, self.currWCount, saveTime)
|
||||
self.mainConf.saveRecentCache()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user