def get_file_content(self):
filename = QFileDialog.getOpenFileName(None, 'Open file')[0]
if filename is '':
return ''
try:
with open(filename, 'r') as file:
try:
return str(file.read())
except Exception as e:
QMessageBox.warning(None, 'Can not open file', 'Can not open file {}:\n{}'.format(filename, e))
return ''
except IOError:
return ''
##
# \brief Returns the remaining rate limit
#
# Returns -1 if an error occurred. This request do not xount against the rate limit.
#
# \return Rate limit or -1 if error occurred
评论列表
文章目录