Пример #1
0
    def update_recent_files(self):
        """Recreate the list with recent documents"""

        from libqtopensesame.actions import recent_action

        # Add the current path to the front of the list
        if self.current_path is not None and os.path.exists(self.current_path):
            if self.current_path in self.recent_files:
                self.recent_files.remove(self.current_path)
            self.recent_files.insert(0, self.current_path)

        # Trim the list
        self.recent_files = self.recent_files[:5]

        # Build the menu
        self.ui.menu_recent_files.clear()
        if len(self.recent_files) == 0:
            a = QtWidgets.QAction(_(u"(No recent files)"), \
             self.ui.menu_recent_files)
            a.setDisabled(True)
            self.ui.menu_recent_files.addAction(a)
        else:
            for path in self.recent_files:
                self.ui.menu_recent_files.addAction( \
                 recent_action.recent_action(path, self, \
                 self.ui.menu_recent_files))
Пример #2
0
	def update_recent_files(self):

		"""Recreate the list with recent documents"""

		from libqtopensesame.actions import recent_action

		# Add the current path to the front of the list
		if self.current_path != None and os.path.exists(self.current_path):
			if self.current_path in self.recent_files:
				self.recent_files.remove(self.current_path)
			self.recent_files.insert(0, self.current_path)

		# Trim the list
		self.recent_files = self.recent_files[:5]

		# Build the menu
		self.ui.menu_recent_files.clear()
		if len(self.recent_files) == 0:
			a = QtGui.QAction(_(u"(No recent files)"), \
				self.ui.menu_recent_files)
			a.setDisabled(True)
			self.ui.menu_recent_files.addAction(a)
		else:
			for path in self.recent_files:
				self.ui.menu_recent_files.addAction( \
					recent_action.recent_action(path, self, \
					self.ui.menu_recent_files))