Updated configure_pipewire script. A bit more code refactor. Preparing to start moving everything over to pep8 compliance.
This commit is contained in:
@ -17,6 +17,8 @@ class screenManager():
|
||||
self.currScreenText = ''
|
||||
self.colums = None
|
||||
self.rows = None
|
||||
# Compile regex once for better performance
|
||||
self._space_normalize_regex = re.compile(' +')
|
||||
def getRows(self):
|
||||
return self.rows
|
||||
def getColumns(self):
|
||||
@ -124,11 +126,6 @@ class screenManager():
|
||||
# This code detects and categorizes screen content changes to provide appropriate
|
||||
# speech feedback (typing echo vs incoming text vs screen updates)
|
||||
|
||||
# Pre-process screen text for comparison - collapse multiple spaces to single space
|
||||
# This normalization prevents spurious diffs from spacing inconsistencies
|
||||
oldScreenText = re.sub(' +',' ',self.env['runtime']['screenManager'].getWindowAreaInText(self.env['screen']['oldContentText']))
|
||||
newScreenText = re.sub(' +',' ',self.env['runtime']['screenManager'].getWindowAreaInText(self.env['screen']['newContentText']))
|
||||
|
||||
# Track whether this appears to be typing (user input) vs other screen changes
|
||||
typing = False
|
||||
diffList = []
|
||||
@ -137,6 +134,10 @@ class screenManager():
|
||||
# Special case: Initial screen content (going from empty to populated)
|
||||
# This handles first screen load or TTY switch scenarios
|
||||
if self.env['screen']['newContentText'] != '' and self.env['screen']['oldContentText'] == '':
|
||||
# Pre-process screen text for comparison - collapse multiple spaces to single space
|
||||
# This normalization prevents spurious diffs from spacing inconsistencies
|
||||
oldScreenText = self._space_normalize_regex.sub(' ',self.env['runtime']['screenManager'].getWindowAreaInText(self.env['screen']['oldContentText']))
|
||||
newScreenText = self._space_normalize_regex.sub(' ',self.env['runtime']['screenManager'].getWindowAreaInText(self.env['screen']['newContentText']))
|
||||
if oldScreenText == '' and\
|
||||
newScreenText != '':
|
||||
self.env['screen']['newDelta'] = newScreenText
|
||||
@ -194,6 +195,12 @@ class screenManager():
|
||||
# GENERAL SCREEN CHANGE DETECTION
|
||||
# Not typing - handle as line-by-line content change
|
||||
# This catches: incoming messages, screen updates, application output, etc.
|
||||
|
||||
# Pre-process screen text for comparison - collapse multiple spaces to single space
|
||||
# This normalization prevents spurious diffs from spacing inconsistencies
|
||||
oldScreenText = self._space_normalize_regex.sub(' ',self.env['runtime']['screenManager'].getWindowAreaInText(self.env['screen']['oldContentText']))
|
||||
newScreenText = self._space_normalize_regex.sub(' ',self.env['runtime']['screenManager'].getWindowAreaInText(self.env['screen']['newContentText']))
|
||||
|
||||
diff = self.differ.compare(oldScreenText.split('\n'),\
|
||||
newScreenText.split('\n'))
|
||||
diffList = list(diff)
|
||||
|
Reference in New Issue
Block a user