handle exoort clipboard
This commit is contained in:
parent
2f189da4d0
commit
03ef4710fd
@ -28,7 +28,7 @@ command interrupt
|
|||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core import debug
|
||||||
from fenrirscreenreader.core.eventData import fenrirEventType
|
from fenrirscreenreader.core.eventData import fenrirEventType
|
||||||
import time
|
import time, os
|
||||||
|
|
||||||
class remoteManager():
|
class remoteManager():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -43,6 +43,8 @@ class remoteManager():
|
|||||||
self.defineWindowConst = 'WINDOW '
|
self.defineWindowConst = 'WINDOW '
|
||||||
self.resetWindowConst = 'RESETWINDOW'
|
self.resetWindowConst = 'RESETWINDOW'
|
||||||
self.setClipboardConst = 'CLIPBOARD '
|
self.setClipboardConst = 'CLIPBOARD '
|
||||||
|
self.exportConst = 'EXPORT'
|
||||||
|
self.readClipboard = 'READ'
|
||||||
# setting controll
|
# setting controll
|
||||||
self.settingConst = 'SETTING '
|
self.settingConst = 'SETTING '
|
||||||
self.setSettingConst = 'SET '
|
self.setSettingConst = 'SET '
|
||||||
@ -148,6 +150,34 @@ class remoteManager():
|
|||||||
self.env['runtime']['outputManager'].speakText(text)
|
self.env['runtime']['outputManager'].speakText(text)
|
||||||
def interruptSpeech(self):
|
def interruptSpeech(self):
|
||||||
self.env['runtime']['outputManager'].interruptOutput()
|
self.env['runtime']['outputManager'].interruptOutput()
|
||||||
|
def handleClipboard(self, parameter):
|
||||||
|
upperParameter = parameter.upper()
|
||||||
|
# export clipboard
|
||||||
|
if upperParameter.startswith(self.setSettingConst):
|
||||||
|
self.exportClipboard(parameterText)
|
||||||
|
# read clipboard
|
||||||
|
elif upperParameter.startswith(self.readClipboard):
|
||||||
|
self.setClipboard(parameterText)
|
||||||
|
elif:
|
||||||
|
self.setClipboard(parameterText)
|
||||||
|
def exportClipboard(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 saveSettings(self, settingConfigPath = None):
|
def saveSettings(self, settingConfigPath = None):
|
||||||
if not settingConfigPath:
|
if not settingConfigPath:
|
||||||
settingConfigPath = self.env['runtime']['settingsManager'].getSettingsFile()
|
settingConfigPath = self.env['runtime']['settingsManager'].getSettingsFile()
|
||||||
|
Loading…
Reference in New Issue
Block a user