write to fenrirClipboard file with 666 and create Import_clipboard_from_file
This commit is contained in:
parent
7dee80f20f
commit
4988365b25
@ -105,6 +105,7 @@ KEY_FENRIR,KEY_PAGEDOWN=next_clipboard
|
||||
KEY_FENRIR,KEY_SHIFT,KEY_C=curr_clipboard
|
||||
KEY_FENRIR,KEY_C=copy_marked_to_clipboard
|
||||
KEY_FENRIR,KEY_V=paste_clipboard
|
||||
KEY_FENRIR,KEY_P=import_clipboard_from_file
|
||||
KEY_FENRIR,KEY_W=export_clipboard_to_file
|
||||
KEY_FENRIR,KEY_CTRL,KEY_SHIFT,KEY_X=remove_marks
|
||||
KEY_FENRIR,KEY_X=set_mark
|
||||
|
@ -105,6 +105,7 @@ KEY_FENRIR,KEY_PAGEDOWN=next_clipboard
|
||||
KEY_FENRIR,KEY_SHIFT,KEY_C=curr_clipboard
|
||||
KEY_FENRIR,KEY_C=copy_marked_to_clipboard
|
||||
KEY_FENRIR,KEY_V=paste_clipboard
|
||||
#=import_clipboard_from_file
|
||||
KEY_FENRIR,KEY_W=export_clipboard_to_file
|
||||
KEY_FENRIR,KEY_CTRL,KEY_SHIFT,KEY_X=remove_marks
|
||||
KEY_FENRIR,KEY_X=set_mark
|
||||
|
@ -108,6 +108,7 @@ KEY_FENRIR,KEY_X=set_mark
|
||||
KEY_FENRIR,KEY_SHIFT,KEY_X=marked_text
|
||||
KEY_FENRIR,KEY_C=copy_marked_to_clipboard
|
||||
#KEY_FENRIR,KEY_V=paste_clipboard
|
||||
#=import_clipboard_from_file
|
||||
KEY_FENRIR,KEY_W=export_clipboard_to_file
|
||||
# linux specific
|
||||
KEY_FENRIR,KEY_V=export_clipboard_to_x
|
||||
|
@ -5,6 +5,7 @@
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
import os
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
@ -38,6 +39,7 @@ class command():
|
||||
return
|
||||
clipboardFile.write(self.env['commandBuffer']['clipboard'][currClipboard])
|
||||
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)
|
||||
|
40
src/fenrir/commands/commands/import_clipboard_from_file.py
Normal file
40
src/fenrir/commands/commands/import_clipboard_from_file.py
Normal file
@ -0,0 +1,40 @@
|
||||
#!/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['commandBuffer']['clipboard'] = [imported] + self.env['commandBuffer']['clipboard'][:self.env['runtime']['settingsManager'].getSettingAsInt('general', 'numberOfClipboards') -1]
|
||||
self.env['commandBuffer']['currClipboard'] = 0
|
||||
|
||||
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
|
Loading…
Reference in New Issue
Block a user