def __init__(self, parent=None, files=None, max_files=10): super(RecentFilesMenu, self).__init__(parent) self._actions = [] self.status = getPlugin('status') for i in range(max_files): action = QAction( parent=self, visible=False, triggered=lambda: actions.program.load(self.sender().data()), ) self._actions.append(action) self.addAction(action) self.addSeparator() action = QAction( parent=self, text='Browse for files ...', triggered=lambda: showDialog('open_file'), ) self.addAction(action) self.update(files or self.status.recent_files()) self.status.recent_files.notify(self.update)
def showDialog(self, dialog_name): showDialog(dialog_name)
def showDialog(self): showDialog(self._dialog_name)
def openFile(self): showDialog('open_file')