I'm using pyqt treview and QFileSystemModel to display my computer files and plugged in USB devices. What I want is to be able to detect when devices are connected to the computer and show only those in the treeview. For example, on windows, when I do model.setRootPath('')
, it shows me the connected devices and the C: drive. I only want the connected devices to show. And if there is none, the treeview should be blank until a device connected for it to update.
After some searches, I've already written the code for detecting connected devices (for both windows and Linux). Using QTimer, the code checks every 0.5 seconds for new/removed devices. I just need a way to filter out everything else and only show the connected devices. I need this for both Linux and Windows, if possible.
Thanks in advance for every help