Merge branch '1.5'
This commit is contained in:
		| @@ -20,45 +20,40 @@ class command(): | ||||
|     def getDescription(self): | ||||
|         return _('export the current fenrir clipboard to X clipboard') | ||||
|     def run(self):                        | ||||
|        print('drin') | ||||
|        _thread.start_new_thread(self._threadRun , ()) | ||||
|  | ||||
|     def _threadRun(self): | ||||
|         print('jo') | ||||
|         try: | ||||
|             currClipboard = self.env['commandBuffer']['currClipboard'] | ||||
|             print(currClipboard) | ||||
|              | ||||
|             if currClipboard < 0: | ||||
|                 self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) | ||||
|                 print('1') | ||||
|                 return | ||||
|             if not self.env['commandBuffer']['clipboard']: | ||||
|                 self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) | ||||
|                 print('2') | ||||
|                 return | ||||
|             if not self.env['commandBuffer']['clipboard'][currClipboard]: | ||||
|                 self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) | ||||
|                 print('3') | ||||
|                 return  | ||||
|             if self.env['commandBuffer']['clipboard'][currClipboard] == '': | ||||
|                 self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) | ||||
|                 print('4') | ||||
|                 return                                          | ||||
|             print('doit') | ||||
|             p = Popen('su -c "echo -n \"' + self.env['commandBuffer']['clipboard'][currClipboard] +'\" | xclip -d :0 -selection c' + self.env['general']['currUser'] , stdout=PIPE, stderr=PIPE, shell=True) | ||||
|             for display in range(10): | ||||
|                 p = Popen('su ' + self.env['general']['currUser'] + ' -c  "echo -n \\\"' + self.env['commandBuffer']['clipboard'][currClipboard].replace('"','\\\\\\"')  +'\\\" | xclip -d :' + str(display) + ' -selection c"' , 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(screenEncoding, "replace").encode('utf-8').decode('utf-8') | ||||
|             stdout = stdout.decode(screenEncoding, "replace").encode('utf-8').decode('utf-8') | ||||
|             print('test:',stderr,stdout) | ||||
|                 #screenEncoding = self.env['runtime']['settingsManager'].getSetting('screen', 'encoding') | ||||
|                 stderr = stderr.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(stdout , soundIcon='', interrupt=False) | ||||
|                 self.env['runtime']['outputManager'].presentText(stderr , soundIcon='', interrupt=False) | ||||
|             else: | ||||
|                 self.env['runtime']['outputManager'].presentText('export clipboard', soundIcon='PasteClipboardOnScreen', interrupt=True)                 | ||||
|                 self.env['runtime']['outputManager'].presentText('exported to the X session.', interrupt=True)                 | ||||
|         except Exception as e: | ||||
|                 print(e) | ||||
|             self.env['runtime']['outputManager'].presentText(e , soundIcon='', interrupt=False) | ||||
|          | ||||
|     def setCallback(self, callback): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user