Differences between revisions 11 and 13 (spanning 2 versions)
Revision 11 as of 2004-10-16 03:28:53
Size: 670
Editor: limodou
Comment:
Revision 13 as of 2009-12-25 07:17:09
Size: 2816
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 9: Line 9:
[[TableOfContents]] <<TableOfContents>>
Line 21: Line 21:
  *[http://wiki.woodpecker.org.cn/moin.cgi/NewEdit_e8_a1_a5_e5_85_85_e6_8f_92_e4_bb_b6?action=AttachFile&do=get&target=RemoveAllRecentFiles.rar RemoveAllRecentFiles] 源代码   *[[http://wiki.woodpecker.org.cn/moin.cgi/NewEdit_e8_a1_a5_e5_85_85_e6_8f_92_e4_bb_b6?action=AttachFile&do=get&target=RemoveAllRecentFiles.rar|RemoveAllRecentFiles]] 源代码
Line 25: Line 25:
{ {{{
[info]
author=TianYu263
date=2004/10/16
version=1.0
description=Remove All Recent Files
}}}

== RemoveAllRecentFiles.py 源代码 ==

{{{
# Programmer: tianyu263
# E-mail: [email protected]
#
# Copyleft 2004 tianyu263
#
# Distributed under the terms of the GPL (GNU Public License)
#
# NewEdit is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id: RemoveAllRecentFiles.py,v 1.0 2004/10/16 08:05:28 tianyu Studio WorkShop $
__doc__ = 'Plugin: Remove All Recent Files'

from modules import Mixin
import wx
import os
import os.path
import sys
from modules import makemenu


menulist = [('IDM_FILE_RECENTFILES', #parent menu id
 [
  (105, 'IDM_REMOVE_RECENTFILES', tr('Remove All Recent Files'), wx.ITEM_NORMAL, 'OnDelRecentMenus', tr('Remove All Recent Files.')),
  (106, '', '-', wx.ITEM_SEPARATOR, None, ''),
 ]),
]

Mixin.setMixin('mainframe', 'menulist', menulist)

def OnDelRecentMenus(win, event):
 menu=makemenu.findmenu(win.menuitems, 'IDM_FILE_RECENTFILES')
 for id in win.recentmenu_ids:
  menu.Delete(id)
 win.recentmenu_ids = []
 
 fileCount = len(win.pref.recent_files)
 for i in range(0,fileCount):
  del win.pref.recent_files[0]
 win.pref.recent_files=[]
 
 id = win.IDM_FILE_RECENTFILES_ITEMS
 menu.Append(id, tr('(empty)'))
 menu.Enable(id, False)
 win.recentmenu_ids.append(id)

Mixin.setMixin('mainframe', 'OnDelRecentMenus', OnDelRecentMenus)

}}}

== Discuss ==

Good! -- Limodou

Author:tianyu263(望月) EMail: [email protected]


"Python 项目 NewEdit 补充插件"

清除所有最近使用过的文件

说明

用于 NewEdit 清除所有最近使用过的文件名称。 使用方法:

  • 只需将下面文件的源代码拷贝到相应的文件,并将文件复制到 NewEdit 的 plugins 目录即可。

源代码下载

RemoveAllRecentFiles.pin 源代码

[info]
author=TianYu263
date=2004/10/16
version=1.0
description=Remove All Recent Files

RemoveAllRecentFiles.py 源代码

#       Programmer:     tianyu263
#       E-mail:         [email protected]
#
#       Copyleft 2004 tianyu263
#
#       Distributed under the terms of the GPL (GNU Public License)
#
#   NewEdit is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#       $Id: RemoveAllRecentFiles.py,v 1.0 2004/10/16 08:05:28 tianyu Studio WorkShop $
__doc__ = 'Plugin: Remove All Recent Files'

from modules import     Mixin
import wx
import os
import os.path
import sys
from modules import     makemenu


menulist = [('IDM_FILE_RECENTFILES', #parent menu id
        [
                (105, 'IDM_REMOVE_RECENTFILES', tr('Remove All Recent Files'), wx.ITEM_NORMAL, 'OnDelRecentMenus', tr('Remove All Recent Files.')),
                (106, '', '-', wx.ITEM_SEPARATOR, None, ''),
        ]),
]

Mixin.setMixin('mainframe',     'menulist',     menulist)

def     OnDelRecentMenus(win, event):
        menu=makemenu.findmenu(win.menuitems, 'IDM_FILE_RECENTFILES')
        for     id in win.recentmenu_ids:
                menu.Delete(id)
        win.recentmenu_ids = []
        
        fileCount =     len(win.pref.recent_files)
        for     i in range(0,fileCount):
                del     win.pref.recent_files[0]
        win.pref.recent_files=[]
        
        id = win.IDM_FILE_RECENTFILES_ITEMS
        menu.Append(id, tr('(empty)'))
        menu.Enable(id, False)
        win.recentmenu_ids.append(id)

Mixin.setMixin('mainframe',     'OnDelRecentMenus',     OnDelRecentMenus)

== Discuss ==

Good! -- Limodou

NewEdit补充插件 (last edited 2009-12-25 07:17:09 by localhost)