【发布时间】:2020-02-14 23:13:51
【问题描述】:
我正在尝试模仿 shell 命令 gio mount 的行为,该命令会卸载所有 gphoto2 相机
gio mount -s gphoto2
如何检测音量是否为gphoto2?我尝试获取音量类型,但似乎没有保持它的变量,
from gi.repository import Gio, GObject
def main():
mo = Gio.MountOperation()
mo.set_anonymous(True)
vl = Gio.VolumeMonitor.get()
loop = GObject.MainLoop()
for v in vl.get_mounts():
print(dir(v))
print(v.get_name(), v.get_uuid(), v.g_type_instance, v.get_drive(),
v.get_volume(),
v.get_root(),
v.get_drive(),
v.get_sort_key(),
v.get_uuid())
【问题讨论】: