export_clipboard_to_file

This commit is contained in:
chrys 2017-06-03 23:24:37 +02:00
parent 64e96f3a54
commit 7dee80f20f
7 changed files with 59 additions and 0 deletions

View File

@ -105,6 +105,7 @@ KEY_FENRIR,KEY_PAGEDOWN=next_clipboard
KEY_FENRIR,KEY_SHIFT,KEY_C=curr_clipboard KEY_FENRIR,KEY_SHIFT,KEY_C=curr_clipboard
KEY_FENRIR,KEY_C=copy_marked_to_clipboard KEY_FENRIR,KEY_C=copy_marked_to_clipboard
KEY_FENRIR,KEY_V=paste_clipboard KEY_FENRIR,KEY_V=paste_clipboard
KEY_FENRIR,KEY_W=export_clipboard_to_file
KEY_FENRIR,KEY_CTRL,KEY_SHIFT,KEY_X=remove_marks KEY_FENRIR,KEY_CTRL,KEY_SHIFT,KEY_X=remove_marks
KEY_FENRIR,KEY_X=set_mark KEY_FENRIR,KEY_X=set_mark
KEY_FENRIR,KEY_SHIFT,KEY_X=marked_text KEY_FENRIR,KEY_SHIFT,KEY_X=marked_text

View File

@ -105,6 +105,7 @@ KEY_FENRIR,KEY_PAGEDOWN=next_clipboard
KEY_FENRIR,KEY_SHIFT,KEY_C=curr_clipboard KEY_FENRIR,KEY_SHIFT,KEY_C=curr_clipboard
KEY_FENRIR,KEY_C=copy_marked_to_clipboard KEY_FENRIR,KEY_C=copy_marked_to_clipboard
KEY_FENRIR,KEY_V=paste_clipboard KEY_FENRIR,KEY_V=paste_clipboard
KEY_FENRIR,KEY_W=export_clipboard_to_file
KEY_FENRIR,KEY_CTRL,KEY_SHIFT,KEY_X=remove_marks KEY_FENRIR,KEY_CTRL,KEY_SHIFT,KEY_X=remove_marks
KEY_FENRIR,KEY_X=set_mark KEY_FENRIR,KEY_X=set_mark
KEY_FENRIR,KEY_SHIFT,KEY_X=marked_text KEY_FENRIR,KEY_SHIFT,KEY_X=marked_text

View File

@ -108,5 +108,6 @@ KEY_FENRIR,KEY_X=set_mark
KEY_FENRIR,KEY_SHIFT,KEY_X=marked_text KEY_FENRIR,KEY_SHIFT,KEY_X=marked_text
KEY_FENRIR,KEY_C=copy_marked_to_clipboard KEY_FENRIR,KEY_C=copy_marked_to_clipboard
#KEY_FENRIR,KEY_V=paste_clipboard #KEY_FENRIR,KEY_V=paste_clipboard
KEY_FENRIR,KEY_W=export_clipboard_to_file
# linux specific # linux specific
KEY_FENRIR,KEY_V=export_clipboard_to_x KEY_FENRIR,KEY_V=export_clipboard_to_x

View File

@ -151,6 +151,9 @@ punctuationLevel=some
respectPunctuationPause=True respectPunctuationPause=True
newLinePause=True newLinePause=True
numberOfClipboards=10 numberOfClipboards=10
# used path for "export_clipboard_to_file"
# $user is replaced by username
clipboardExportPath=/tmp/fenrirClipboard
emoticons=True emoticons=True
# define the current fenrir key # define the current fenrir key
fenrirKeys=KEY_KP0,KEY_META fenrirKeys=KEY_KP0,KEY_META

View File

@ -153,6 +153,10 @@ punctuationLevel=some
respectPunctuationPause=True respectPunctuationPause=True
newLinePause=True newLinePause=True
numberOfClipboards=10 numberOfClipboards=10
# used path for "export_clipboard_to_file"
# $user is replaced by username
#clipboardExportPath=/home/$user/fenrirClipboard
clipboardExportPath=/tmp/fenrirClipboard
emoticons=True emoticons=True
# define the current fenrir key # define the current fenrir key
fenrirKeys=KEY_KP0,KEY_META,KEY_INSERT fenrirKeys=KEY_KP0,KEY_META,KEY_INSERT

View File

@ -104,6 +104,9 @@ punctuationLevel=some
respectPunctuationPause=True respectPunctuationPause=True
newLinePause=True newLinePause=True
numberOfClipboards=10 numberOfClipboards=10
# used path for "export_clipboard_to_file"
# $user is replaced by username
clipboardExportPath=/tmp/fenrirClipboard
emoticons=True emoticons=True
fenrirKeys=KEY_KP0,KEY_META fenrirKeys=KEY_KP0,KEY_META
scriptKey=KEY_COMPOSE scriptKey=KEY_COMPOSE

View File

@ -0,0 +1,46 @@
#!/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, 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:
currClipboard = self.env['commandBuffer']['currClipboard']
if currClipboard < 0:
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
return
if not self.env['commandBuffer']['clipboard']:
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
return
if not self.env['commandBuffer']['clipboard'][currClipboard]:
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
return
if self.env['commandBuffer']['clipboard'][currClipboard] == '':
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
return
clipboardFile.write(self.env['commandBuffer']['clipboard'][currClipboard])
clipboardFile.close()
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