diff --git a/src/fenrir/commands/commands/WIP/00_init_commands.py b/src/fenrir/commands/commands/WIP/00_init_commands.py deleted file mode 100644 index 6ab81bb1..00000000 --- a/src/fenrir/commands/commands/WIP/00_init_commands.py +++ /dev/null @@ -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 diff --git a/src/fenrir/commands/commands/WIP/clear_clipboard.py b/src/fenrir/commands/commands/WIP/clear_clipboard.py deleted file mode 100644 index 781e6acf..00000000 --- a/src/fenrir/commands/commands/WIP/clear_clipboard.py +++ /dev/null @@ -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 diff --git a/src/fenrir/commands/commands/WIP/copy_last_echo_to_clipboard.py b/src/fenrir/commands/commands/WIP/copy_last_echo_to_clipboard.py deleted file mode 100644 index 061f4bc9..00000000 --- a/src/fenrir/commands/commands/WIP/copy_last_echo_to_clipboard.py +++ /dev/null @@ -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 diff --git a/src/fenrir/commands/commands/WIP/copy_marked_to_clipboard.py b/src/fenrir/commands/commands/WIP/copy_marked_to_clipboard.py deleted file mode 100644 index c83fdeb0..00000000 --- a/src/fenrir/commands/commands/WIP/copy_marked_to_clipboard.py +++ /dev/null @@ -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 diff --git a/src/fenrir/commands/commands/WIP/curr_clipboard.py b/src/fenrir/commands/commands/WIP/curr_clipboard.py deleted file mode 100644 index 9c2baf3e..00000000 --- a/src/fenrir/commands/commands/WIP/curr_clipboard.py +++ /dev/null @@ -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 diff --git a/src/fenrir/commands/commands/WIP/export_clipboard_to_file.py b/src/fenrir/commands/commands/WIP/export_clipboard_to_file.py deleted file mode 100644 index 914de532..00000000 --- a/src/fenrir/commands/commands/WIP/export_clipboard_to_file.py +++ /dev/null @@ -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 diff --git a/src/fenrir/commands/commands/WIP/export_clipboard_to_x.py b/src/fenrir/commands/commands/WIP/export_clipboard_to_x.py deleted file mode 100644 index 25175c1f..00000000 --- a/src/fenrir/commands/commands/WIP/export_clipboard_to_x.py +++ /dev/null @@ -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 diff --git a/src/fenrir/commands/commands/WIP/first_clipboard.py b/src/fenrir/commands/commands/WIP/first_clipboard.py deleted file mode 100644 index a4d98c87..00000000 --- a/src/fenrir/commands/commands/WIP/first_clipboard.py +++ /dev/null @@ -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 diff --git a/src/fenrir/commands/commands/WIP/import_clipboard_from_file.py b/src/fenrir/commands/commands/WIP/import_clipboard_from_file.py deleted file mode 100644 index 67b4f398..00000000 --- a/src/fenrir/commands/commands/WIP/import_clipboard_from_file.py +++ /dev/null @@ -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 diff --git a/src/fenrir/commands/commands/WIP/last_clipboard.py b/src/fenrir/commands/commands/WIP/last_clipboard.py deleted file mode 100644 index 2cf2f0bd..00000000 --- a/src/fenrir/commands/commands/WIP/last_clipboard.py +++ /dev/null @@ -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 diff --git a/src/fenrir/commands/commands/WIP/next_clipboard.py b/src/fenrir/commands/commands/WIP/next_clipboard.py deleted file mode 100644 index 01d5607a..00000000 --- a/src/fenrir/commands/commands/WIP/next_clipboard.py +++ /dev/null @@ -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 diff --git a/src/fenrir/commands/commands/WIP/paste_clipboard.py b/src/fenrir/commands/commands/WIP/paste_clipboard.py deleted file mode 100644 index 1223a54b..00000000 --- a/src/fenrir/commands/commands/WIP/paste_clipboard.py +++ /dev/null @@ -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 diff --git a/src/fenrir/commands/commands/WIP/prev_clipboard.py b/src/fenrir/commands/commands/WIP/prev_clipboard.py deleted file mode 100644 index 9fa6c575..00000000 --- a/src/fenrir/commands/commands/WIP/prev_clipboard.py +++ /dev/null @@ -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 diff --git a/src/fenrir/commands/commands/export_clipboard_to_file.py b/src/fenrir/commands/commands/export_clipboard_to_file.py index f0aec632..914de532 100644 --- a/src/fenrir/commands/commands/export_clipboard_to_file.py +++ b/src/fenrir/commands/commands/export_clipboard_to_file.py @@ -24,14 +24,14 @@ class command(): 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) + 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) diff --git a/src/fenrir/commands/commands/import_clipboard_from_file.py b/src/fenrir/commands/commands/import_clipboard_from_file.py index 8dde0bd4..67b4f398 100644 --- a/src/fenrir/commands/commands/import_clipboard_from_file.py +++ b/src/fenrir/commands/commands/import_clipboard_from_file.py @@ -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 diff --git a/src/fenrir/commands/commands/prev_clipboard.py b/src/fenrir/commands/commands/prev_clipboard.py index 9aaaeaf9..9fa6c575 100644 --- a/src/fenrir/commands/commands/prev_clipboard.py +++ b/src/fenrir/commands/commands/prev_clipboard.py @@ -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)