export history fixed

This commit is contained in:
ingvar1995 2018-01-30 18:45:55 +03:00
parent f76a1c0fbe
commit b428bd54c4
2 changed files with 12 additions and 9 deletions

View file

@ -660,15 +660,18 @@ class MainWindow(QtWidgets.QMainWindow, Singleton):
def export_history(self, num, as_text=True):
s = self.profile.export_history(num, as_text)
directory = QtWidgets.QFileDialog.getExistingDirectory(None,
extension = 'txt' if as_text else 'html'
file_name, _ = QtWidgets.QFileDialog.getSaveFileName(None,
QtWidgets.QApplication.translate("MainWindow",
'Choose folder'),
'Choose file name'),
curr_directory(),
QtWidgets.QFileDialog.ShowDirsOnly | QtWidgets.QFileDialog.DontUseNativeDialog)
filter=extension,
options=QtWidgets.QFileDialog.ShowDirsOnly | QtWidgets.QFileDialog.DontUseNativeDialog)
if directory:
name = 'exported_history_{}.{}'.format(convert_time(time.time()), 'txt' if as_text else 'html')
with open(directory + '/' + name, 'wt') as fl:
if file_name:
if not file_name.endswith('.' + extension):
file_name += '.' + extension
with open(file_name, 'wt') as fl:
fl.write(s)
def set_alias(self, num):

View file

@ -5,7 +5,7 @@ import sys
import re
program_version = '0.4.1'
program_version = '0.4.2'
def cached(func):