Compare commits
No commits in common. "master" and "2025.04.14" have entirely different histories.
master
...
2025.04.14
@ -4,7 +4,7 @@
|
|||||||
# the entrys are seperated with :===: in words colon tripple equal colon ( to not collide with substitutions)
|
# the entrys are seperated with :===: in words colon tripple equal colon ( to not collide with substitutions)
|
||||||
[levelDict]
|
[levelDict]
|
||||||
none:===:
|
none:===:
|
||||||
some:===:-$~+*-/\@#_
|
some:===:-$~+*-/\@#
|
||||||
most:===:.,:-$~+*-/\@!#%^&*()[]}{<>;
|
most:===:.,:-$~+*-/\@!#%^&*()[]}{<>;
|
||||||
all:===:!"#$%& \'()*+,-./:;<=>?@[\\]^_`{|}~
|
all:===:!"#$%& \'()*+,-./:;<=>?@[\\]^_`{|}~
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# the entrys are seperated with :===: in words colon tripple equal colon ( to not collide with substitutions)
|
# the entrys are seperated with :===: in words colon tripple equal colon ( to not collide with substitutions)
|
||||||
[levelDict]
|
[levelDict]
|
||||||
none:===:
|
none:===:
|
||||||
some:===:-$~+*-/\@_
|
some:===:-$~+*-/\@
|
||||||
most:===:.,:-$~+*-/\@!#%^&*()[]}{<>;
|
most:===:.,:-$~+*-/\@!#%^&*()[]}{<>;
|
||||||
all:===:!"#$%& \'()*+,-./:;<=>?@[\\]^_`{|}~
|
all:===:!"#$%& \'()*+,-./:;<=>?@[\\]^_`{|}~
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# the entrys are seperated with :===: in words colon tripple equal colon ( to not collide with substitutions)
|
# the entrys are seperated with :===: in words colon tripple equal colon ( to not collide with substitutions)
|
||||||
[levelDict]
|
[levelDict]
|
||||||
none:===:
|
none:===:
|
||||||
some:===:-$~+*-/\@_
|
some:===:-$~+*-/\@
|
||||||
most:===:.,:-$~+*-/\@!#%^&*()[]}{<>;
|
most:===:.,:-$~+*-/\@!#%^&*()[]}{<>;
|
||||||
all:===:!"#$%& \'()*+,-./:;<=>?@[\\]^_`{|}~
|
all:===:!"#$%& \'()*+,-./:;<=>?@[\\]^_`{|}~
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ theme=default
|
|||||||
|
|
||||||
# Sound volume controls how loud the sounds for your selected soundpack are.
|
# Sound volume controls how loud the sounds for your selected soundpack are.
|
||||||
# 0 is quietest, 1.0 is loudest.
|
# 0 is quietest, 1.0 is loudest.
|
||||||
volume=0.7
|
volume=1.0
|
||||||
|
|
||||||
# shell commands for generic sound driver
|
# shell commands for generic sound driver
|
||||||
# the folowing variable are substituted
|
# the folowing variable are substituted
|
||||||
@ -92,8 +92,8 @@ fenrirMaxRate=450
|
|||||||
driver=vcsaDriver
|
driver=vcsaDriver
|
||||||
encoding=auto
|
encoding=auto
|
||||||
screenUpdateDelay=0.05
|
screenUpdateDelay=0.05
|
||||||
ignoreScreen=
|
suspendingScreen=
|
||||||
autodetectIgnoreScreen=True
|
autodetectSuspendingScreen=True
|
||||||
|
|
||||||
[keyboard]
|
[keyboard]
|
||||||
driver=evdevDriver
|
driver=evdevDriver
|
||||||
@ -131,7 +131,7 @@ punctuationProfile=default
|
|||||||
punctuationLevel=some
|
punctuationLevel=some
|
||||||
respectPunctuationPause=True
|
respectPunctuationPause=True
|
||||||
newLinePause=True
|
newLinePause=True
|
||||||
numberOfClipboards=50
|
numberOfClipboards=10
|
||||||
# used path for "export_clipboard_to_file"
|
# used path for "export_clipboard_to_file"
|
||||||
# $user is replaced by username
|
# $user is replaced by username
|
||||||
#clipboardExportPath=/home/$user/fenrirClipboard
|
#clipboardExportPath=/home/$user/fenrirClipboard
|
||||||
@ -190,7 +190,7 @@ enableSettingsRemote=True
|
|||||||
enableCommandRemote=True
|
enableCommandRemote=True
|
||||||
|
|
||||||
[barrier]
|
[barrier]
|
||||||
enabled=False
|
enabled=True
|
||||||
leftBarriers=│└┌─
|
leftBarriers=│└┌─
|
||||||
rightBarriers=│┘┐─
|
rightBarriers=│┘┐─
|
||||||
|
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
daemonize
|
evdev>=1.1.2
|
||||||
evdev
|
daemonize>=2.5.0
|
||||||
|
dbus-python>=1.2.8
|
||||||
|
pyudev>=0.21.0
|
||||||
pexpect
|
pexpect
|
||||||
pyenchant
|
|
||||||
pyperclip
|
pyperclip
|
||||||
pyte
|
pyte>=0.7.0
|
||||||
pyudev
|
rapidfuzz>=2.0.0
|
||||||
pyxdg
|
|
||||||
setproctitle
|
|
||||||
|
8
setup.py
8
setup.py
@ -101,8 +101,8 @@ setup(
|
|||||||
"dbus-python>=1.2.8",
|
"dbus-python>=1.2.8",
|
||||||
"pyperclip",
|
"pyperclip",
|
||||||
"pyudev>=0.21.0",
|
"pyudev>=0.21.0",
|
||||||
|
"rapidfuzz>=2.0.0",
|
||||||
"setuptools",
|
"setuptools",
|
||||||
"setproctitle",
|
|
||||||
"pexpect",
|
"pexpect",
|
||||||
"pyte>=0.7.0",
|
"pyte>=0.7.0",
|
||||||
],
|
],
|
||||||
@ -113,10 +113,10 @@ if not forceSettingsFlag:
|
|||||||
# create settings file from example if not exist
|
# create settings file from example if not exist
|
||||||
if not os.path.isfile('/etc/fenrirscreenreader/settings/settings.conf'):
|
if not os.path.isfile('/etc/fenrirscreenreader/settings/settings.conf'):
|
||||||
try:
|
try:
|
||||||
copyfile('config/fenrirscreenreader/settings/settings.conf', '/etc/fenrirscreenreader/settings/settings.conf')
|
copyfile('/etc/fenrirscreenreader/settings/settings.conf.example', '/etc/fenrirscreenreader/settings/settings.conf')
|
||||||
print('create settings file in /etc/fenrirscreenreader/settings/settings.conf')
|
print('create settings file in /etc/fenrirscreenreader/settings/settings.conf')
|
||||||
except OSError as e:
|
except:
|
||||||
print(f"Could not copy settings file to destination: {e}")
|
pass
|
||||||
else:
|
else:
|
||||||
print('settings.conf file found. It is not overwritten automatical')
|
print('settings.conf file found. It is not overwritten automatical')
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core import debug
|
||||||
import os
|
import os
|
||||||
import importlib
|
|
||||||
import _thread
|
import _thread
|
||||||
import pyperclip
|
import pyperclip
|
||||||
|
|
||||||
@ -43,7 +42,6 @@ class command():
|
|||||||
# Set display environment variable
|
# Set display environment variable
|
||||||
os.environ['DISPLAY'] = display
|
os.environ['DISPLAY'] = display
|
||||||
# Attempt to set clipboard content
|
# Attempt to set clipboard content
|
||||||
importlib.reload(pyperclip) # Weird workaround for some distros
|
|
||||||
pyperclip.copy(clipboard)
|
pyperclip.copy(clipboard)
|
||||||
# If we get here without exception, we found a working display
|
# If we get here without exception, we found a working display
|
||||||
success = True
|
success = True
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core import debug
|
||||||
import importlib
|
|
||||||
import _thread
|
import _thread
|
||||||
import pyperclip
|
import pyperclip
|
||||||
import os
|
import os
|
||||||
@ -35,7 +34,6 @@ class command():
|
|||||||
# Set display environment variable
|
# Set display environment variable
|
||||||
os.environ['DISPLAY'] = display
|
os.environ['DISPLAY'] = display
|
||||||
# Attempt to get clipboard content
|
# Attempt to get clipboard content
|
||||||
importlib.reload(pyperclip) # Weird workaround for some distros
|
|
||||||
clipboardContent = pyperclip.paste()
|
clipboardContent = pyperclip.paste()
|
||||||
# If we get here without exception, we found a working display
|
# If we get here without exception, we found a working display
|
||||||
if clipboardContent:
|
if clipboardContent:
|
||||||
|
@ -176,7 +176,7 @@ class commandManager():
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
def executeSwitchTrigger(self, trigger, unLoadScript, loadScript):
|
def executeSwitchTrigger(self, trigger, unLoadScript, loadScript):
|
||||||
if self.env['runtime']['screenManager'].isIgnoredScreen():
|
if self.env['runtime']['screenManager'].isSuspendingScreen():
|
||||||
return
|
return
|
||||||
#unload
|
#unload
|
||||||
oldScript = unLoadScript
|
oldScript = unLoadScript
|
||||||
@ -199,7 +199,7 @@ class commandManager():
|
|||||||
|
|
||||||
def executeDefaultTrigger(self, trigger, force=False):
|
def executeDefaultTrigger(self, trigger, force=False):
|
||||||
if not force:
|
if not force:
|
||||||
if self.env['runtime']['screenManager'].isIgnoredScreen():
|
if self.env['runtime']['screenManager'].isSuspendingScreen():
|
||||||
return
|
return
|
||||||
for command in sorted(self.env['commands'][trigger]):
|
for command in sorted(self.env['commands'][trigger]):
|
||||||
if self.commandExists(command, trigger):
|
if self.commandExists(command, trigger):
|
||||||
@ -214,7 +214,7 @@ class commandManager():
|
|||||||
self.env['runtime']['debug'].writeDebugOut("Executing trigger:" + trigger + "." + command + str(e) ,debug.debugLevel.ERROR)
|
self.env['runtime']['debug'].writeDebugOut("Executing trigger:" + trigger + "." + command + str(e) ,debug.debugLevel.ERROR)
|
||||||
|
|
||||||
def executeCommand(self, command, section = 'commands'):
|
def executeCommand(self, command, section = 'commands'):
|
||||||
if self.env['runtime']['screenManager'].isIgnoredScreen():
|
if self.env['runtime']['screenManager'].isSuspendingScreen():
|
||||||
return
|
return
|
||||||
if self.commandExists(command, section):
|
if self.commandExists(command, section):
|
||||||
try:
|
try:
|
||||||
|
@ -52,15 +52,12 @@ class debugManager():
|
|||||||
else:
|
else:
|
||||||
if not self._fileOpened and fileMode:
|
if not self._fileOpened and fileMode:
|
||||||
self.openDebugFile()
|
self.openDebugFile()
|
||||||
timestamp = str(datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f'))
|
|
||||||
if onAnyLevel:
|
if onAnyLevel:
|
||||||
levelInfo = 'INFO ANY'
|
msg = 'ANY '+ str(level) + ' ' + str(datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f'))
|
||||||
else:
|
else:
|
||||||
levelInfo = str(level)
|
msg = str(level) +' ' + str(datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f')
|
||||||
|
)
|
||||||
# Changed order: text comes first, then level and timestamp
|
msg += ': ' + text
|
||||||
msg = text + ' - ' + levelInfo + ' ' + timestamp
|
|
||||||
|
|
||||||
if printMode:
|
if printMode:
|
||||||
print(msg)
|
print(msg)
|
||||||
if fileMode:
|
if fileMode:
|
||||||
|
@ -55,7 +55,7 @@ class fenrirManager():
|
|||||||
if self.environment['runtime']['inputManager'].noKeyPressed():
|
if self.environment['runtime']['inputManager'].noKeyPressed():
|
||||||
self.environment['runtime']['inputManager'].clearLastDeepInput()
|
self.environment['runtime']['inputManager'].clearLastDeepInput()
|
||||||
|
|
||||||
if self.environment['runtime']['screenManager'].isIgnoredScreen():
|
if self.environment['runtime']['screenManager'].isSuspendingScreen():
|
||||||
self.environment['runtime']['inputManager'].writeEventBuffer()
|
self.environment['runtime']['inputManager'].writeEventBuffer()
|
||||||
else:
|
else:
|
||||||
if self.environment['runtime']['helpManager'].isTutorialMode():
|
if self.environment['runtime']['helpManager'].isTutorialMode():
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core import debug
|
||||||
from fenrirscreenreader.utils import screen_utils
|
from fenrirscreenreader.utils import screen_utils
|
||||||
import time, os, re, difflib
|
import time, os, re, difflib
|
||||||
|
from rapidfuzz.distance import Levenshtein
|
||||||
|
|
||||||
class screenManager():
|
class screenManager():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -59,7 +60,7 @@ class screenManager():
|
|||||||
if self.isCurrScreenIgnoredChanged():
|
if self.isCurrScreenIgnoredChanged():
|
||||||
self.env['runtime']['inputManager'].setExecuteDeviceGrab()
|
self.env['runtime']['inputManager'].setExecuteDeviceGrab()
|
||||||
self.env['runtime']['inputManager'].handleDeviceGrab()
|
self.env['runtime']['inputManager'].handleDeviceGrab()
|
||||||
if not self.isIgnoredScreen(self.env['screen']['newTTY']):
|
if not self.isSuspendingScreen(self.env['screen']['newTTY']):
|
||||||
self.update(eventData, 'onScreenChange')
|
self.update(eventData, 'onScreenChange')
|
||||||
self.env['screen']['lastScreenUpdate'] = time.time()
|
self.env['screen']['lastScreenUpdate'] = time.time()
|
||||||
else:
|
else:
|
||||||
@ -81,7 +82,8 @@ class screenManager():
|
|||||||
return self.prevScreenIgnored
|
return self.prevScreenIgnored
|
||||||
def updateScreenIgnored(self):
|
def updateScreenIgnored(self):
|
||||||
self.prevScreenIgnored = self.currScreenIgnored
|
self.prevScreenIgnored = self.currScreenIgnored
|
||||||
self.currScreenIgnored = self.isIgnoredScreen(self.env['screen']['newTTY'])
|
self.currScreenIgnored = self.isSuspendingScreen(self.env['screen']['newTTY'])
|
||||||
|
|
||||||
def update(self, eventData, trigger='onUpdate'):
|
def update(self, eventData, trigger='onUpdate'):
|
||||||
# set new "old" values
|
# set new "old" values
|
||||||
self.env['screen']['oldContentBytes'] = self.env['screen']['newContentBytes']
|
self.env['screen']['oldContentBytes'] = self.env['screen']['newContentBytes']
|
||||||
@ -144,8 +146,11 @@ class screenManager():
|
|||||||
cursorLineEndOffset = cursorLineStart + self.env['screen']['newCursor']['x'] + 3
|
cursorLineEndOffset = cursorLineStart + self.env['screen']['newCursor']['x'] + 3
|
||||||
oldScreenText = self.env['screen']['oldContentText'][cursorLineStartOffset:cursorLineEndOffset]
|
oldScreenText = self.env['screen']['oldContentText'][cursorLineStartOffset:cursorLineEndOffset]
|
||||||
newScreenText = self.env['screen']['newContentText'][cursorLineStartOffset:cursorLineEndOffset]
|
newScreenText = self.env['screen']['newContentText'][cursorLineStartOffset:cursorLineEndOffset]
|
||||||
|
|
||||||
|
# Use the original differ for typing mode to preserve behavior
|
||||||
diff = self.differ.compare(oldScreenText, newScreenText)
|
diff = self.differ.compare(oldScreenText, newScreenText)
|
||||||
diffList = list(diff)
|
diffList = list(diff)
|
||||||
|
|
||||||
typing = True
|
typing = True
|
||||||
tempNewDelta = ''.join(x[2:] for x in diffList if x[0] == '+')
|
tempNewDelta = ''.join(x[2:] for x in diffList if x[0] == '+')
|
||||||
if tempNewDelta.strip() != '':
|
if tempNewDelta.strip() != '':
|
||||||
@ -153,9 +158,28 @@ class screenManager():
|
|||||||
diffList = ['+ ' + self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] +'\n']
|
diffList = ['+ ' + self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] +'\n']
|
||||||
typing = False
|
typing = False
|
||||||
else:
|
else:
|
||||||
diff = self.differ.compare(oldScreenText.split('\n'),\
|
# For screen changes, use the original differ
|
||||||
newScreenText.split('\n'))
|
if self.isScreenChange() or trigger == 'onScreenChange':
|
||||||
diffList = list(diff)
|
diff = self.differ.compare(oldScreenText.split('\n'),
|
||||||
|
newScreenText.split('\n'))
|
||||||
|
diffList = list(diff)
|
||||||
|
else:
|
||||||
|
# Use rapidfuzz for normal updates - not for screen changes
|
||||||
|
try:
|
||||||
|
# Process line by line using rapidfuzz
|
||||||
|
old_lines = oldScreenText.split('\n')
|
||||||
|
new_lines = newScreenText.split('\n')
|
||||||
|
|
||||||
|
# Use standard differ for better word grouping
|
||||||
|
diff = self.differ.compare(old_lines, new_lines)
|
||||||
|
diffList = list(diff)
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
# Fall back to standard differ if there's any issue
|
||||||
|
self.env['runtime']['debug'].writeDebugOut('screenManager:update:rapidfuzz: ' + str(e), debug.debugLevel.ERROR)
|
||||||
|
diff = self.differ.compare(oldScreenText.split('\n'),
|
||||||
|
newScreenText.split('\n'))
|
||||||
|
diffList = list(diff)
|
||||||
|
|
||||||
if not typing:
|
if not typing:
|
||||||
self.env['screen']['newDelta'] = '\n'.join(x[2:] for x in diffList if x[0] == '+')
|
self.env['screen']['newDelta'] = '\n'.join(x[2:] for x in diffList if x[0] == '+')
|
||||||
@ -174,18 +198,18 @@ class screenManager():
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.env['runtime']['debug'].writeDebugOut('screenManager:update:highlight: ' + str(e),debug.debugLevel.ERROR)
|
self.env['runtime']['debug'].writeDebugOut('screenManager:update:highlight: ' + str(e),debug.debugLevel.ERROR)
|
||||||
|
|
||||||
def isIgnoredScreen(self, screen = None):
|
def isSuspendingScreen(self, screen = None):
|
||||||
if screen == None:
|
if screen == None:
|
||||||
screen = self.env['screen']['newTTY']
|
screen = self.env['screen']['newTTY']
|
||||||
ignoreScreens = []
|
ignoreScreens = []
|
||||||
fixIgnoreScreens = self.env['runtime']['settingsManager'].getSetting('screen', 'ignoreScreen')
|
fixIgnoreScreens = self.env['runtime']['settingsManager'].getSetting('screen', 'suspendingScreen')
|
||||||
if fixIgnoreScreens != '':
|
if fixIgnoreScreens != '':
|
||||||
ignoreScreens.extend(fixIgnoreScreens.split(','))
|
ignoreScreens.extend(fixIgnoreScreens.split(','))
|
||||||
if self.env['runtime']['settingsManager'].getSettingAsBool('screen', 'autodetectIgnoreScreen'):
|
if self.env['runtime']['settingsManager'].getSettingAsBool('screen', 'autodetectSuspendingScreen'):
|
||||||
ignoreScreens.extend(self.env['screen']['autoIgnoreScreens'])
|
ignoreScreens.extend(self.env['screen']['autoIgnoreScreens'])
|
||||||
self.env['runtime']['debug'].writeDebugOut('screenManager:isIgnoredScreen ignore:' + str(ignoreScreens) + ' current:'+ str(screen ), debug.debugLevel.INFO)
|
self.env['runtime']['debug'].writeDebugOut('screenManager:isSuspendingScreen ignore:' + str(ignoreScreens) + ' current:'+ str(screen ), debug.debugLevel.INFO)
|
||||||
return (screen in ignoreScreens)
|
return (screen in ignoreScreens)
|
||||||
|
|
||||||
def isScreenChange(self):
|
def isScreenChange(self):
|
||||||
if not self.env['screen']['oldTTY']:
|
if not self.env['screen']['oldTTY']:
|
||||||
return False
|
return False
|
||||||
|
@ -40,8 +40,8 @@ settingsData = {
|
|||||||
'driver': 'vcsaDriver',
|
'driver': 'vcsaDriver',
|
||||||
'encoding': 'auto',
|
'encoding': 'auto',
|
||||||
'screenUpdateDelay': 0.1,
|
'screenUpdateDelay': 0.1,
|
||||||
'ignoreScreen': '',
|
'suspendingScreen': '',
|
||||||
'autodetectIgnoreScreen': False,
|
'autodetectSuspendingScreen': False,
|
||||||
},
|
},
|
||||||
'general':{
|
'general':{
|
||||||
'debugLevel': debug.debugLevel.DEACTIVE,
|
'debugLevel': debug.debugLevel.DEACTIVE,
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
version = "2025.04.28"
|
version = "2025.04.14"
|
||||||
codeName = "master"
|
codeName = "master"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user