export history fixed
This commit is contained in:
parent
f76a1c0fbe
commit
b428bd54c4
@ -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):
|
||||
|
@ -5,7 +5,7 @@ import sys
|
||||
import re
|
||||
|
||||
|
||||
program_version = '0.4.1'
|
||||
program_version = '0.4.2'
|
||||
|
||||
|
||||
def cached(func):
|
||||
|
Loading…
Reference in New Issue
Block a user