clean up for merge
This commit is contained in:
parent
4b30e9894c
commit
5921463782
@ -1,26 +0,0 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
|
||||
# this command is just to initialize stuff.
|
||||
# like init index lists in memoryManager
|
||||
# it is not useful to execute it
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
# clipboard
|
||||
self.env['runtime']['memoryManager'].addIndexList(self, 'clipboardHistory', self.env['runtime']['settingsManager'].getSettingAsInt('general', 'numberOfClipboards'))
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'No description found'
|
||||
def run(self):
|
||||
pass
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -1,24 +0,0 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return _('clears the currently selected clipboard')
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['memoryManager'].clearCurrentIndexList('clipboardHistory')
|
||||
self.env['runtime']['outputManager'].presentText(_('clipboard cleared'), interrupt=True)
|
||||
return
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -1,26 +0,0 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
from utils import mark_utils
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return _('copies last presented text to the clipboard')
|
||||
|
||||
def run(self):
|
||||
lastEcho = self.env['runtime']['outputManager'].getLastEcho()
|
||||
self.env['runtime']['memoryManager'].addValueToFirstIndex('clipboardHistory', lastEcho)
|
||||
self.env['runtime']['outputManager'].presentText(lastEcho, soundIcon='CopyToClipboard', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -1,39 +0,0 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
from utils import mark_utils
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return _('copies marked text to the currently selected clipboard')
|
||||
|
||||
def run(self):
|
||||
if not self.env['commandBuffer']['Marks']['1']:
|
||||
self.env['runtime']['outputManager'].presentText(_("one or two marks needed"), interrupt=True)
|
||||
return
|
||||
if not self.env['commandBuffer']['Marks']['2']:
|
||||
self.env['runtime']['cursorManager'].setMark()
|
||||
|
||||
# use the last first and the last setted mark as range
|
||||
startMark = self.env['commandBuffer']['Marks']['1'].copy()
|
||||
endMark = self.env['commandBuffer']['Marks']['2'].copy()
|
||||
|
||||
marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screen']['newContentText'])
|
||||
self.env['runtime']['memoryManager'].addValueToFirstIndex('clipboardHistory', marked)
|
||||
# reset marks
|
||||
self.env['runtime']['cursorManager'].clearMarks()
|
||||
|
||||
self.env['runtime']['outputManager'].presentText(marked, soundIcon='CopyToClipboard', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -1,27 +0,0 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return _('speaks the contents of the currently selected clipboard')
|
||||
|
||||
def run(self):
|
||||
if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'):
|
||||
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
|
||||
return
|
||||
clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory')
|
||||
self.env['runtime']['outputManager'].presentText(clipboard , interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -1,39 +0,0 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
import os
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment, scriptPath=''):
|
||||
self.env = environment
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return _('export the current fenrir clipboard to a file')
|
||||
def run(self):
|
||||
clipboardFilePath = self.env['runtime']['settingsManager'].getSetting('general', 'clipboardExportPath')
|
||||
clipboardFilePath = clipboardFilePath.replace('$user',self.env['general']['currUser'])
|
||||
clipboardFilePath = clipboardFilePath.replace('$USER',self.env['general']['currUser'])
|
||||
clipboardFilePath = clipboardFilePath.replace('$User',self.env['general']['currUser'])
|
||||
clipboardFile = open(clipboardFilePath,'w')
|
||||
try:
|
||||
if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'):
|
||||
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
|
||||
return
|
||||
clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory')
|
||||
clipboardFile.write(clipboard)
|
||||
clipboardFile.close()
|
||||
os.chmod(clipboardFilePath, 0o666)
|
||||
self.env['runtime']['outputManager'].presentText(_('clipboard exported to file'), interrupt=True)
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('export_clipboard_to_file:run: Filepath:'+ clipboardFile +' trace:' + str(e),debug.debugLevel.ERROR)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -1,50 +0,0 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
import subprocess, os
|
||||
from subprocess import Popen, PIPE
|
||||
import _thread
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment, scriptPath=''):
|
||||
self.env = environment
|
||||
self.scriptPath = scriptPath
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return _('export the current fenrir clipboard to X clipboard')
|
||||
def run(self):
|
||||
_thread.start_new_thread(self._threadRun , ())
|
||||
|
||||
def _threadRun(self):
|
||||
try:
|
||||
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) + ' -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('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']['outputManager'].presentText('exported to the X session.', interrupt=True)
|
||||
except Exception as e:
|
||||
self.env['runtime']['outputManager'].presentText(e , soundIcon='', interrupt=False)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -1,28 +0,0 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return _('selects the first clipboard')
|
||||
|
||||
def run(self):
|
||||
if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'):
|
||||
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
|
||||
return
|
||||
self.env['runtime']['memoryManager'].setFirstIndex('clipboardHistory')
|
||||
clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory')
|
||||
self.env['runtime']['outputManager'].presentText(clipboard, interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -1,39 +0,0 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
from utils import mark_utils
|
||||
import os
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return _('imports text from clipboard file to the clipboard')
|
||||
|
||||
def run(self):
|
||||
clipboardFilePath = self.env['runtime']['settingsManager'].getSetting('general', 'clipboardExportPath')
|
||||
clipboardFilePath = clipboardFilePath.replace('$user',self.env['general']['currUser'])
|
||||
clipboardFilePath = clipboardFilePath.replace('$USER',self.env['general']['currUser'])
|
||||
clipboardFilePath = clipboardFilePath.replace('$User',self.env['general']['currUser'])
|
||||
if not os.path.exists(clipboardFilePath):
|
||||
self.env['runtime']['outputManager'].presentText(_('File does not exist'), soundIcon='', interrupt=True)
|
||||
return
|
||||
clipboardFile = open(clipboardFilePath,'r')
|
||||
imported = clipboardFile.read()
|
||||
clipboardFile.close()
|
||||
self.env['runtime']['memoryManager'].addValueToFirstIndex('clipboardHistory', imported)
|
||||
|
||||
self.env['runtime']['outputManager'].presentText('Import to Clipboard', soundIcon='CopyToClipboard', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(imported, soundIcon='', interrupt=False)
|
||||
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -1,28 +0,0 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return _('selects the last clipboard')
|
||||
|
||||
def run(self):
|
||||
if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'):
|
||||
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
|
||||
return
|
||||
self.env['runtime']['memoryManager'].setLastIndex('clipboardHistory')
|
||||
clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory')
|
||||
self.env['runtime']['outputManager'].presentText(clipboard, interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -1,36 +0,0 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return _('selects the next clipboard')
|
||||
|
||||
def run(self):
|
||||
if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'):
|
||||
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
|
||||
return
|
||||
self.env['runtime']['memoryManager'].getNextIndex('clipboardHistory')
|
||||
isFirst = self.env['runtime']['memoryManager'].isFirstIndex('clipboardHistory')
|
||||
isLast = self.env['runtime']['memoryManager'].isLastIndex('clipboardHistory')
|
||||
clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory')
|
||||
if isFirst:
|
||||
self.env['runtime']['outputManager'].presentText(_('First clipboard '), interrupt=True)
|
||||
if isLast:
|
||||
self.env['runtime']['outputManager'].presentText(_('Last clipboard '), interrupt=True)
|
||||
|
||||
speechInterrupt = not(isLast or isFirst)
|
||||
self.env['runtime']['outputManager'].presentText(clipboard, interrupt = speechInterrupt)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -1,30 +0,0 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
import time
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.env['runtime']['memoryManager'].addIndexList('clipboardHistory', self.env['runtime']['settingsManager'].getSettingAsInt('general', 'numberOfClipboards'))
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return _('pastes the text from the currently selected clipboard')
|
||||
|
||||
def run(self):
|
||||
if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'):
|
||||
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
|
||||
return
|
||||
self.env['runtime']['outputManager'].presentText('paste clipboard', soundIcon='PasteClipboardOnScreen', interrupt=True)
|
||||
clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory')
|
||||
self.env['runtime']['screenManager'].injectTextToScreen(clipboard)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -1,35 +0,0 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return _('selects the previous clipboard')
|
||||
|
||||
def run(self):
|
||||
if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'):
|
||||
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
|
||||
return
|
||||
self.env['runtime']['memoryManager'].setPrefIndex('clipboardHistory')
|
||||
isFirst = self.env['runtime']['memoryManager'].isFirstIndex('clipboardHistory')
|
||||
isLast = self.env['runtime']['memoryManager'].isLastIndex('clipboardHistory')
|
||||
clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory')
|
||||
if isFirst:
|
||||
self.env['runtime']['outputManager'].presentText(_('First clipboard '), interrupt=True)
|
||||
if isLast:
|
||||
self.env['runtime']['outputManager'].presentText(_('Last clipboard '), interrupt=True)
|
||||
speechInterrupt = not(isLast or isFirst)
|
||||
self.env['runtime']['outputManager'].presentText(clipboard, interrupt = speechInterrupt)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -7,12 +7,7 @@
|
||||
from core import debug
|
||||
from utils import mark_utils
|
||||
import os
|
||||
if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'):
|
||||
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
|
||||
return
|
||||
self.env['runtime']['memoryManager'].isFirstIndex('clipboardHistory')
|
||||
clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory')
|
||||
self.env['runtime']['outputManager'].presentText(clipboard, interrupt=True)
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
@ -28,7 +28,6 @@ class command():
|
||||
self.env['runtime']['outputManager'].presentText(_('First clipboard '), interrupt=True)
|
||||
if isLast:
|
||||
self.env['runtime']['outputManager'].presentText(_('Last clipboard '), interrupt=True)
|
||||
|
||||
speechInterrupt = not(isLast or isFirst)
|
||||
self.env['runtime']['outputManager'].presentText(clipboard, interrupt = speechInterrupt)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user