def icon(self): fnisPath = self.__organizer.pluginSetting(self.name(), "fnis-path") if os.path.exists(fnisPath): # We can't directly grab the icon from an executable, but this seems like the simplest alternative. fin = QFileInfo(fnisPath) model = QFileSystemModel() model.setRootPath(fin.path()) return model.fileIcon(model.index(fin.filePath())) else: # Fall back to where the user might have put an icon manually. return QIcon("plugins/FNIS.ico")