From 38aeb4108285280be1ca706a88deec6bd9b8412b Mon Sep 17 00:00:00 2001 From: chrys Date: Mon, 11 Jun 2018 23:09:21 +0200 Subject: [PATCH] Revert "wire up most suff for export to X" This reverts commit f9e7827710ac564b016864a48a3c9e59bf8ca4c0. --- .../commands/commands/import_clipboard_from_x.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/fenrirscreenreader/commands/commands/import_clipboard_from_x.py b/src/fenrirscreenreader/commands/commands/import_clipboard_from_x.py index a4f6123b..65c9a28c 100644 --- a/src/fenrirscreenreader/commands/commands/import_clipboard_from_x.py +++ b/src/fenrirscreenreader/commands/commands/import_clipboard_from_x.py @@ -24,22 +24,25 @@ class command(): def _threadRun(self): try: - xClipboard = '' + if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'): + self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) + return + clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') for display in range(10): p = Popen('su ' + self.env['general']['currUser'] + ' -c "echo -n \\\"' + clipboard.replace('"','\\\\\\"') +'\\\" | xclip -d :' + str(display) + ' -o"' , stdout=PIPE, stderr=PIPE, shell=True) stdout, stderr = p.communicate() self.env['runtime']['outputManager'].interruptOutput() + #screenEncoding = self.env['runtime']['settingsManager'].getSetting('screen', 'encoding') stderr = stderr.decode('utf-8') - xClipboard = stdout.decode('utf-8') + stdout = stdout.decode('utf-8') if (stderr == ''): break - + #stderr = stderr.decode(screenEncoding, "replace").encode('utf-8').decode('utf-8') + #stdout = stdout.decode(screenEncoding, "replace").encode('utf-8').decode('utf-8') if stderr != '': self.env['runtime']['outputManager'].presentText(stderr , soundIcon='', interrupt=False) else: - self.env['runtime']['memoryManager'].addValueToFirstIndex('clipboardHistory', xClipboard) - self.env['runtime']['outputManager'].presentText('Import to Clipboard', soundIcon='CopyToClipboard', interrupt=True) - self.env['runtime']['outputManager'].presentText(imported, soundIcon='', interrupt=False) + self.env['runtime']['outputManager'].presentText('imported from the X session.', interrupt=True) except Exception as e: self.env['runtime']['outputManager'].presentText(e , soundIcon='', interrupt=False)