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):
|
def export_history(self, num, as_text=True):
|
||||||
s = self.profile.export_history(num, as_text)
|
s = self.profile.export_history(num, as_text)
|
||||||
directory = QtWidgets.QFileDialog.getExistingDirectory(None,
|
extension = 'txt' if as_text else 'html'
|
||||||
QtWidgets.QApplication.translate("MainWindow",
|
file_name, _ = QtWidgets.QFileDialog.getSaveFileName(None,
|
||||||
'Choose folder'),
|
QtWidgets.QApplication.translate("MainWindow",
|
||||||
curr_directory(),
|
'Choose file name'),
|
||||||
QtWidgets.QFileDialog.ShowDirsOnly | QtWidgets.QFileDialog.DontUseNativeDialog)
|
curr_directory(),
|
||||||
|
filter=extension,
|
||||||
|
options=QtWidgets.QFileDialog.ShowDirsOnly | QtWidgets.QFileDialog.DontUseNativeDialog)
|
||||||
|
|
||||||
if directory:
|
if file_name:
|
||||||
name = 'exported_history_{}.{}'.format(convert_time(time.time()), 'txt' if as_text else 'html')
|
if not file_name.endswith('.' + extension):
|
||||||
with open(directory + '/' + name, 'wt') as fl:
|
file_name += '.' + extension
|
||||||
|
with open(file_name, 'wt') as fl:
|
||||||
fl.write(s)
|
fl.write(s)
|
||||||
|
|
||||||
def set_alias(self, num):
|
def set_alias(self, num):
|
||||||
|
@ -5,7 +5,7 @@ import sys
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
program_version = '0.4.1'
|
program_version = '0.4.2'
|
||||||
|
|
||||||
|
|
||||||
def cached(func):
|
def cached(func):
|
||||||
|
Loading…
Reference in New Issue
Block a user