Merge branch 'develop' into next_gen
This commit is contained in:
commit
68328d9846
8 changed files with 31 additions and 22 deletions
|
@ -657,15 +657,18 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||
|
||||
def export_history(self, num, as_text=True):
|
||||
s = self.profile.export_history(num, as_text)
|
||||
directory = QtWidgets.QFileDialog.getExistingDirectory(None,
|
||||
QtWidgets.QApplication.translate("MainWindow",
|
||||
'Choose folder'),
|
||||
curr_directory(),
|
||||
QtWidgets.QFileDialog.ShowDirsOnly | QtWidgets.QFileDialog.DontUseNativeDialog)
|
||||
extension = 'txt' if as_text else 'html'
|
||||
file_name, _ = QtWidgets.QFileDialog.getSaveFileName(None,
|
||||
QtWidgets.QApplication.translate("MainWindow",
|
||||
'Choose file name'),
|
||||
curr_directory(),
|
||||
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):
|
||||
|
|
|
@ -70,10 +70,18 @@ class MessageArea(QtWidgets.QPlainTextEdit):
|
|||
def pasteEvent(self, text=None):
|
||||
text = text or QtWidgets.QApplication.clipboard().text()
|
||||
if text.startswith('file://'):
|
||||
self.parent.profile.send_file(text[7:])
|
||||
file_name = self.parse_file_name(text)
|
||||
self.parent.profile.send_file(file_name)
|
||||
else:
|
||||
self.insertPlainText(text)
|
||||
|
||||
def parse_file_name(self, file_name):
|
||||
import urllib
|
||||
if file_name.endswith('\r\n'):
|
||||
file_name = file_name[:-2]
|
||||
file_name = urllib.parse.unquote(file_name)
|
||||
return file_name[8 if platform.system() == 'Windows' else 7:]
|
||||
|
||||
|
||||
class ScreenShotWindow(RubberBandWindow):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue