本文整理汇总了Python中Windows.get_fixed_drives方法的典型用法代码示例。如果您正苦于以下问题:Python Windows.get_fixed_drives方法的具体用法?Python Windows.get_fixed_drives怎么用?Python Windows.get_fixed_drives使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Windows
的用法示例。
在下文中一共展示了Windows.get_fixed_drives方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_commands
# 需要导入模块: import Windows [as 别名]
# 或者: from Windows import get_fixed_drives [as 别名]
#.........这里部分代码省略.........
is_open = FileUtilities.openfiles.is_open(path)
ok = not is_open and os.path.isfile(path) and \
not os.path.islink(path) and \
FileUtilities.ego_owner(path) and \
not self.whitelisted(path)
if ok:
yield Command.Delete(path)
# temporary files
if 'nt' == os.name and 'tmp' == option_id:
dirname = os.path.expandvars(
"$USERPROFILE\\Local Settings\\Temp\\")
for filename in children_in_directory(dirname, True):
yield Command.Delete(filename)
dirname = os.path.expandvars("$windir\\temp\\")
for filename in children_in_directory(dirname, True):
yield Command.Delete(filename)
# trash
if 'posix' == os.name and 'trash' == option_id:
dirname = os.path.expanduser("~/.Trash")
for filename in children_in_directory(dirname, False):
yield Command.Delete(filename)
# fixme http://www.ramendik.ru/docs/trashspec.html
# http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html
# ~/.local/share/Trash
# * GNOME 2.22, Fedora 9
# * KDE 4.1.3, Ubuntu 8.10
dirname = os.path.expanduser("~/.local/share/Trash/files")
for filename in children_in_directory(dirname, True):
yield Command.Delete(filename)
dirname = os.path.expanduser("~/.local/share/Trash/info")
for filename in children_in_directory(dirname, True):
yield Command.Delete(filename)
dirname = os.path.expanduser("~/.local/share/Trash/expunged")
# [email protected] tells me that the trash
# backend puts files in here temporary, but in some situations
# the files are stuck.
for filename in children_in_directory(dirname, True):
yield Command.Delete(filename)
# clipboard
if HAVE_GTK and 'clipboard' == option_id:
def clear_clipboard():
gtk.gdk.threads_enter()
clipboard = gtk.clipboard_get()
clipboard.set_text("")
gtk.gdk.threads_leave()
return 0
yield Command.Function(None, clear_clipboard, _('Clipboard'))
# overwrite free space
shred_drives = options.get_list('shred_drives')
if 'free_disk_space' == option_id and shred_drives:
for pathname in shred_drives:
# TRANSLATORS: 'Free' means 'unallocated.'
# %s expands to a path such as C:\ or /tmp/
display = _("Overwrite free disk space %s") % pathname
def wipe_path_func():
for ret in FileUtilities.wipe_path(pathname, idle=True):
# Yield control to GTK idle because this process
# is very slow. Also display progress.
yield ret
yield 0
yield Command.Function(None, wipe_path_func, display)
# MUICache
if 'nt' == os.name and 'muicache' == option_id:
keys = (
'HKCU\\Software\\Microsoft\\Windows\\ShellNoRoam\\MUICache',
'HKCU\\Software\\Classes\\Local Settings\\Software\\Microsoft\\Windows\\Shell\\MuiCache')
for key in keys:
yield Command.Winreg(key, None)
# prefetch
if 'nt' == os.name and 'prefetch' == option_id:
for path in glob.iglob(os.path.expandvars('$windir\\Prefetch\\*.pf')):
yield Command.Delete(path)
# recycle bin
if 'nt' == os.name and 'recycle_bin' == option_id:
for drive in Windows.get_fixed_drives():
# TRANSLATORS: %s expands to a drive letter such as C:\ or D:\
label = _("Recycle bin %s") % drive
def emptyrecyclebin():
return Windows.empty_recycle_bin(drive, True)
# fixme: enable size preview
yield Command.Function(None, emptyrecyclebin, label)
# Windows Updates
if 'nt' == os.name and 'updates' == option_id:
for wu in Windows.delete_updates():
yield wu
# return queued files
for filename in files:
if os.path.lexists(filename):
yield Command.Delete(filename)