def _open_file_or_folder(self, path):
import os, subprocess
if not os.path.exists(path):
logger.warning("File/path does not exist: " + path)
msg = translate('statusbar', "File/path does not exist: ") + path
self.show_statusbar_warning_msg_slot(msg)
return
try:
QDesktopServices.openUrl(QUrl.fromLocalFile(path))
# if sys.platform.startswith('darwin'):
# subprocess.call(('open', path))
# elif os.name == 'nt':
# os.startfile(path)
# elif os.name == 'posix':
# subprocess.call(('xdg-open', path))
except:
self.show_statusbar_warning_msg_slot((translate('statusbar',"Cannot open file: %s")) % path)
评论列表
文章目录