write to fenrirClipboard file with 666 and create Import_clipboard_from_file
This commit is contained in:
@ -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
|
Reference in New Issue
Block a user