Merge branch '1.5'
This commit is contained in:
commit
153610adaa
@ -20,46 +20,41 @@ class command():
|
|||||||
def getDescription(self):
|
def getDescription(self):
|
||||||
return _('export the current fenrir clipboard to X clipboard')
|
return _('export the current fenrir clipboard to X clipboard')
|
||||||
def run(self):
|
def run(self):
|
||||||
print('drin')
|
|
||||||
_thread.start_new_thread(self._threadRun , ())
|
_thread.start_new_thread(self._threadRun , ())
|
||||||
|
|
||||||
def _threadRun(self):
|
def _threadRun(self):
|
||||||
print('jo')
|
|
||||||
try:
|
try:
|
||||||
currClipboard = self.env['commandBuffer']['currClipboard']
|
currClipboard = self.env['commandBuffer']['currClipboard']
|
||||||
print(currClipboard)
|
|
||||||
|
|
||||||
if currClipboard < 0:
|
if currClipboard < 0:
|
||||||
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
|
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
|
||||||
print('1')
|
|
||||||
return
|
return
|
||||||
if not self.env['commandBuffer']['clipboard']:
|
if not self.env['commandBuffer']['clipboard']:
|
||||||
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
|
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
|
||||||
print('2')
|
|
||||||
return
|
return
|
||||||
if not self.env['commandBuffer']['clipboard'][currClipboard]:
|
if not self.env['commandBuffer']['clipboard'][currClipboard]:
|
||||||
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
|
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
|
||||||
print('3')
|
|
||||||
return
|
return
|
||||||
if self.env['commandBuffer']['clipboard'][currClipboard] == '':
|
if self.env['commandBuffer']['clipboard'][currClipboard] == '':
|
||||||
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
|
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
|
||||||
print('4')
|
|
||||||
return
|
return
|
||||||
print('doit')
|
for display in range(10):
|
||||||
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)
|
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()
|
stdout, stderr = p.communicate()
|
||||||
self.env['runtime']['outputManager'].interruptOutput()
|
self.env['runtime']['outputManager'].interruptOutput()
|
||||||
screenEncoding = self.env['runtime']['settingsManager'].getSetting('screen', 'encoding')
|
#screenEncoding = self.env['runtime']['settingsManager'].getSetting('screen', 'encoding')
|
||||||
stderr = stderr.decode(screenEncoding, "replace").encode('utf-8').decode('utf-8')
|
stderr = stderr.decode('utf-8')
|
||||||
stdout = stdout.decode(screenEncoding, "replace").encode('utf-8').decode('utf-8')
|
stdout = stdout.decode('utf-8')
|
||||||
print('test:',stderr,stdout)
|
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 != '':
|
if stderr != '':
|
||||||
self.env['runtime']['outputManager'].presentText(stdout , soundIcon='', interrupt=False)
|
self.env['runtime']['outputManager'].presentText(stderr , soundIcon='', interrupt=False)
|
||||||
else:
|
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:
|
except Exception as e:
|
||||||
print(e)
|
self.env['runtime']['outputManager'].presentText(e , soundIcon='', interrupt=False)
|
||||||
self.env['runtime']['outputManager'].presentText(e , soundIcon='', interrupt=False)
|
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user