- changed the order of the menu entries in the FIle -> Open ...

- organized the list of recent files so the Project entries are to the top and separated from the other types of file
This commit is contained in:
Marius Stanciu
2019-07-31 17:17:08 +03:00
committed by Marius
parent 0d1e960c1c
commit 6242d1809b
3 changed files with 41 additions and 15 deletions

View File

@@ -8293,20 +8293,42 @@ class App(QtCore.QObject):
self.ui.recent.clear()
# Create menu items
# First add tbe projects
for recent in self.recent:
filename = recent['filename'].split('/')[-1].split('\\')[-1]
try:
action = QtWidgets.QAction(QtGui.QIcon(icons[recent["kind"]]), filename, self)
if recent['kind'] == 'project':
try:
action = QtWidgets.QAction(QtGui.QIcon(icons[recent["kind"]]), filename, self)
# Attach callback
o = make_callback(openers[recent["kind"]], recent['filename'])
action.triggered.connect(o)
# Attach callback
o = make_callback(openers[recent["kind"]], recent['filename'])
action.triggered.connect(o)
self.ui.recent.addAction(action)
self.ui.recent.addAction(action)
except KeyError:
App.log.error("Unsupported file type: %s" % recent["kind"])
except KeyError:
App.log.error("Unsupported file type: %s" % recent["kind"])
# Second, add a separator in the menu
self.ui.recent.addSeparator()
# Then add tbe rest of the files
for recent in self.recent:
filename = recent['filename'].split('/')[-1].split('\\')[-1]
if recent['kind'] != 'project':
try:
action = QtWidgets.QAction(QtGui.QIcon(icons[recent["kind"]]), filename, self)
# Attach callback
o = make_callback(openers[recent["kind"]], recent['filename'])
action.triggered.connect(o)
self.ui.recent.addAction(action)
except KeyError:
App.log.error("Unsupported file type: %s" % recent["kind"])
# Last action in Recent Files menu is one that Clear the content
clear_action = QtWidgets.QAction(QtGui.QIcon('share/trash32.png'), (_("Clear Recent files")), self)