Most of the pep8 changes finished. Be careful, things may be horribly broken.

This commit is contained in:
Storm Dragon
2025-07-03 13:22:00 -04:00
parent 7408951152
commit 21bb9c6083
344 changed files with 6374 additions and 6083 deletions

View File

@ -18,12 +18,12 @@ class command():
def shutdown(self):
pass
def getDescription(self):
def get_description(self):
return 'No Description found'
def run(self):
# enabled?
active = self.env['runtime']['settingsManager'].getSettingAsInt(
active = self.env['runtime']['SettingsManager'].get_setting_as_int(
'keyboard', 'charEchoMode')
# 0 = off
if active == 0:
@ -35,36 +35,36 @@ class command():
# big changes are no char (but the value is bigger than one maybe the
# differ needs longer than you can type, so a little strange random
# buffer for now)
xMove = abs(
self.env['screen']['newCursor']['x'] -
self.env['screen']['oldCursor']['x'])
if xMove > 3:
x_move = abs(
self.env['screen']['new_cursor']['x'] -
self.env['screen']['old_cursor']['x'])
if x_move > 3:
return
if self.env['runtime']['inputManager'].getShortcutType() in ['KEY']:
if self.env['runtime']['inputManager'].getLastDeepestInput() in [
if self.env['runtime']['InputManager'].get_shortcut_type() in ['KEY']:
if self.env['runtime']['InputManager'].get_last_deepest_input() in [
['KEY_TAB']]:
return
elif self.env['runtime']['inputManager'].getShortcutType() in ['BYTE']:
if self.env['runtime']['byteManager'].getLastByteKey() in [
elif self.env['runtime']['InputManager'].get_shortcut_type() in ['BYTE']:
if self.env['runtime']['ByteManager'].get_last_byte_key() in [
b' ', b'\t']:
return
# detect deletion or chilling
if self.env['screen']['newCursor']['x'] <= self.env['screen']['oldCursor']['x']:
if self.env['screen']['new_cursor']['x'] <= self.env['screen']['old_cursor']['x']:
return
# is there any change?
if not self.env['runtime']['screenManager'].isDelta():
if not self.env['runtime']['ScreenManager'].is_delta():
return
# filter unneded space on word begin
currDelta = self.env['screen']['newDelta']
if len(currDelta.strip()) != len(currDelta) and \
currDelta.strip() != '':
currDelta = currDelta.strip()
self.env['runtime']['outputManager'].presentText(
currDelta,
curr_delta = self.env['screen']['new_delta']
if len(curr_delta.strip()) != len(curr_delta) and \
curr_delta.strip() != '':
curr_delta = curr_delta.strip()
self.env['runtime']['OutputManager'].present_text(
curr_delta,
interrupt=True,
ignorePunctuation=True,
announceCapital=True,
ignore_punctuation=True,
announce_capital=True,
flush=False)
def setCallback(self, callback):
def set_callback(self, callback):
pass

View File

@ -20,49 +20,49 @@ class command():
def shutdown(self):
pass
def getDescription(self):
def get_description(self):
return 'No Description found'
def run(self):
# is it enabled?
if not self.env['runtime']['settingsManager'].getSettingAsBool(
if not self.env['runtime']['SettingsManager'].get_setting_as_bool(
'keyboard', 'wordEcho'):
return
# is naviation?
if self.env['screen']['newCursor']['x'] - \
self.env['screen']['oldCursor']['x'] != 1:
if self.env['screen']['new_cursor']['x'] - \
self.env['screen']['old_cursor']['x'] != 1:
return
# just when cursor move worddetection is needed
if not self.env['runtime']['cursorManager'].isCursorHorizontalMove():
if not self.env['runtime']['CursorManager'].is_cursor_horizontal_move():
return
# for now no new line
if self.env['runtime']['cursorManager'].isCursorVerticalMove():
if self.env['runtime']['CursorManager'].is_cursor_vertical_move():
return
# currently writing
if self.env['runtime']['screenManager'].isDelta():
if self.env['runtime']['ScreenManager'].is_delta():
return
# get the word
newContent = self.env['screen']['newContentText'].split(
'\n')[self.env['screen']['newCursor']['y']]
x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(
self.env['screen']['newCursor']['x'], 0, newContent)
new_content = self.env['screen']['new_content_text'].split(
'\n')[self.env['screen']['new_cursor']['y']]
x, y, curr_word, end_of_screen, line_break = word_utils.get_current_word(
self.env['screen']['new_cursor']['x'], 0, new_content)
# is there a word?
if currWord == '':
if curr_word == '':
return
# at the end of a word
if not newContent[self.env['screen']['newCursor']['x']].isspace():
if not new_content[self.env['screen']['new_cursor']['x']].isspace():
return
# at the end of a word
if (x +
len(currWord) != self.env['screen']['newCursor']['x']) and (x +
len(currWord) != self.env['screen']['newCursor']['x'] -
len(curr_word) != self.env['screen']['new_cursor']['x']) and (x +
len(curr_word) != self.env['screen']['new_cursor']['x'] -
1):
return
self.env['runtime']['outputManager'].presentText(
currWord, interrupt=True, flush=False)
self.env['runtime']['OutputManager'].present_text(
curr_word, interrupt=True, flush=False)
def setCallback(self, callback):
def set_callback(self, callback):
pass

View File

@ -25,84 +25,84 @@ class command():
def initialize(self, environment):
self.env = environment
self.updateSpellLanguage()
self.update_spell_language()
def shutdown(self):
pass
def getDescription(self):
def get_description(self):
return 'No Description found'
def updateSpellLanguage(self):
def update_spell_language(self):
if not initialized:
return
self.spellChecker = enchant.Dict(
self.env['runtime']['settingsManager'].getSetting(
self.env['runtime']['SettingsManager'].get_setting(
'general', 'spellCheckLanguage'))
self.language = self.env['runtime']['settingsManager'].getSetting(
self.language = self.env['runtime']['SettingsManager'].get_setting(
'general', 'spellCheckLanguage')
def run(self):
if not initialized:
return
if not self.env['runtime']['settingsManager'].getSettingAsBool(
if not self.env['runtime']['SettingsManager'].get_setting_as_bool(
'general', 'autoSpellCheck'):
return
if self.env['runtime']['settingsManager'].getSetting(
if self.env['runtime']['SettingsManager'].get_setting(
'general', 'spellCheckLanguage') != self.language:
try:
self.updateSpellLanguage()
self.update_spell_language()
except Exception as e:
return
# just when horizontal cursor move worddetection is needed
if not self.env['runtime']['cursorManager'].isCursorHorizontalMove():
if not self.env['runtime']['CursorManager'].is_cursor_horizontal_move():
return
# for now no new line
if self.env['runtime']['cursorManager'].isCursorVerticalMove():
if self.env['runtime']['CursorManager'].is_cursor_vertical_move():
return
# more than a keyecho?
if len(self.env['screen']['newDelta']) > 1:
if len(self.env['screen']['new_delta']) > 1:
return
# deletion
if self.env['runtime']['screenManager'].isNegativeDelta():
if self.env['runtime']['ScreenManager'].is_negative_delta():
return
# first place could not be the end of a word
if self.env['screen']['newCursor']['x'] == 0:
if self.env['screen']['new_cursor']['x'] == 0:
return
# get the word (just for speedup only look at current line
newContent = self.env['screen']['newContentText'].split(
'\n')[self.env['screen']['newCursor']['y']]
x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(
self.env['screen']['newCursor']['x'], 0, newContent)
new_content = self.env['screen']['new_content_text'].split(
'\n')[self.env['screen']['new_cursor']['y']]
x, y, curr_word, end_of_screen, line_break = word_utils.get_current_word(
self.env['screen']['new_cursor']['x'], 0, new_content)
# was this a typed word?
if self.env['runtime']['screenManager'].isDelta():
if not (newContent[self.env['screen']['oldCursor']['x']] in string.whitespace +
'!"#$%&()*+,-./:;<=>?@[\\]^_{|}~' and x != self.env['screen']['oldCursor']['x']):
if self.env['runtime']['ScreenManager'].is_delta():
if not (new_content[self.env['screen']['old_cursor']['x']] in string.whitespace +
'!"#$%&()*+,-./:;<=>?@[\\]^_{|}~' and x != self.env['screen']['old_cursor']['x']):
return
else:
currWord = currWord.strip(
curr_word = curr_word.strip(
string.whitespace + '!"#$%&()*+,-./:;<=>?@[\\]^_{|}~')
else:
# or just arrow arround?
if not newContent[self.env['screen']['newCursor']['x']].isspace():
if not new_content[self.env['screen']['new_cursor']['x']].isspace():
return
if (x +
len(currWord) != self.env['screen']['newCursor']['x']) and (x +
len(currWord) != self.env['screen']['newCursor']['x'] -
len(curr_word) != self.env['screen']['new_cursor']['x']) and (x +
len(curr_word) != self.env['screen']['new_cursor']['x'] -
1):
return
# just on end of word
if self.env['screen']['newCursor']['x'] > 0:
if not newContent[self.env['screen']['oldCursor']
if self.env['screen']['new_cursor']['x'] > 0:
if not new_content[self.env['screen']['old_cursor']
['x'] - 1].lower() in string.ascii_lowercase:
return
# ignore bash buildins
if currWord in [
if curr_word in [
'cd',
'fg',
'bg',
@ -130,46 +130,46 @@ class command():
'unalias']:
return
# ignore the application name
if currWord.upper() == 'FENRIR':
if curr_word.upper() == 'FENRIR':
return
if currWord[0] == '-':
if curr_word[0] == '-':
return
if currWord[0] == '/':
if curr_word[0] == '/':
return
if currWord[0] == '#':
if curr_word[0] == '#':
return
if currWord.startswith('./'):
if curr_word.startswith('./'):
return
if '@' in currWord and '.' in currWord:
if '@' in curr_word and '.' in curr_word:
return
if currWord[0] == '@':
if curr_word[0] == '@':
return
if currWord.isnumeric():
if curr_word.isnumeric():
return
if currWord.isdecimal():
if curr_word.isdecimal():
return
if currWord.isspace():
if curr_word.isspace():
return
try:
if os.path.exists("/bin/" + currWord):
if os.path.exists("/bin/" + curr_word):
return
except Exception as e:
pass
try:
if os.path.exists("/usr/bin/" + currWord):
if os.path.exists("/usr/bin/" + curr_word):
return
except Exception as e:
pass
try:
if os.path.exists("/sbin/" + currWord):
if os.path.exists("/sbin/" + curr_word):
return
except Exception as e:
pass
if not self.spellChecker.check(currWord):
self.env['runtime']['outputManager'].presentText(
_('misspelled'), soundIcon='mispell', interrupt=False, flush=False)
if not self.spellChecker.check(curr_word):
self.env['runtime']['OutputManager'].present_text(
_('misspelled'), sound_icon ='mispell', interrupt=False, flush=False)
def setCallback(self, callback):
def set_callback(self, callback):
pass

View File

@ -18,23 +18,23 @@ class command():
def shutdown(self):
pass
def getDescription(self):
def get_description(self):
return 'No Description found'
def run(self):
if not self.env['runtime']['settingsManager'].getSettingAsBool(
if not self.env['runtime']['SettingsManager'].get_setting_as_bool(
'keyboard', 'charDeleteEcho'):
return
# detect typing or chilling
if self.env['screen']['newCursor']['x'] >= self.env['screen']['oldCursor']['x']:
if self.env['screen']['new_cursor']['x'] >= self.env['screen']['old_cursor']['x']:
return
# More than just a deletion happend
if self.env['runtime']['screenManager'].isDelta(ignoreSpace=True):
if self.env['runtime']['ScreenManager'].is_delta(ignoreSpace=True):
return
# no deletion
if not self.env['runtime']['screenManager'].isNegativeDelta():
if not self.env['runtime']['ScreenManager'].is_negative_delta():
return
# too much for a single backspace...
@ -42,16 +42,16 @@ class command():
if len(self.env['screen']['newNegativeDelta']) > 2:
return
currNegativeDelta = self.env['screen']['newNegativeDelta']
if len(currNegativeDelta.strip()) != len(currNegativeDelta) and \
currNegativeDelta.strip() != '':
currNegativeDelta = currNegativeDelta.strip()
self.env['runtime']['outputManager'].presentText(
currNegativeDelta,
curr_negative_delta = self.env['screen']['newNegativeDelta']
if len(curr_negative_delta.strip()) != len(curr_negative_delta) and \
curr_negative_delta.strip() != '':
curr_negative_delta = curr_negative_delta.strip()
self.env['runtime']['OutputManager'].present_text(
curr_negative_delta,
interrupt=True,
ignorePunctuation=True,
announceCapital=True,
ignore_punctuation=True,
announce_capital=True,
flush=False)
def setCallback(self, callback):
def set_callback(self, callback):
pass

View File

@ -20,56 +20,56 @@ class command():
def shutdown(self):
pass
def getDescription(self):
def get_description(self):
return ''
def run(self):
if not self.env['runtime']['settingsManager'].getSettingAsBool(
if not self.env['runtime']['SettingsManager'].get_setting_as_bool(
'focus', 'cursor'):
return
if self.env['runtime']['screenManager'].isScreenChange():
if self.env['runtime']['ScreenManager'].is_screen_change():
return
# detect an change on the screen, we just want to cursor arround, so no
# change should appear
if self.env['runtime']['screenManager'].isDelta():
if self.env['runtime']['ScreenManager'].is_delta():
return
if self.env['runtime']['screenManager'].isNegativeDelta():
if self.env['runtime']['ScreenManager'].is_negative_delta():
return
# is a vertical change?
if self.env['runtime']['cursorManager'].isCursorVerticalMove():
if self.env['runtime']['CursorManager'].is_cursor_vertical_move():
return
# is it a horizontal change?
if not self.env['runtime']['cursorManager'].isCursorHorizontalMove():
if not self.env['runtime']['CursorManager'].is_cursor_horizontal_move():
return
# echo word insteed of char
if self.env['runtime']['settingsManager'].getSettingAsBool(
if self.env['runtime']['SettingsManager'].get_setting_as_bool(
'keyboard', 'wordEcho'):
if abs(self.env['screen']['oldCursor']['x'] -
self.env['screen']['newCursor']['x']) != 1:
if abs(self.env['screen']['old_cursor']['x'] -
self.env['screen']['new_cursor']['x']) != 1:
# get the word
newContent = self.env['screen']['newContentText'].split(
'\n')[self.env['screen']['newCursor']['y']]
x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(
self.env['screen']['newCursor']['x'], 0, newContent)
if self.env['screen']['newCursor']['x'] == x:
new_content = self.env['screen']['new_content_text'].split(
'\n')[self.env['screen']['new_cursor']['y']]
x, y, curr_word, end_of_screen, line_break = word_utils.get_current_word(
self.env['screen']['new_cursor']['x'], 0, new_content)
if self.env['screen']['new_cursor']['x'] == x:
return
x, y, currChar = char_utils.getCurrentChar(
self.env['screen']['newCursor']['x'], self.env['screen']['newCursor']['y'], self.env['screen']['newContentText'])
if currChar.isspace():
x, y, curr_char = char_utils.get_current_char(
self.env['screen']['new_cursor']['x'], self.env['screen']['new_cursor']['y'], self.env['screen']['new_content_text'])
if curr_char.isspace():
# Only announce spaces during pure navigation (arrow keys)
# Check if this is really navigation by looking at input history
if (self.env['runtime']['inputManager'].getShortcutType() in ['KEY'] and self.env['runtime'][
'inputManager'].getLastDeepestInput()[0] in ['KEY_LEFT', 'KEY_RIGHT', 'KEY_UP', 'KEY_DOWN']):
char_utils.presentCharForReview(
self.env, currChar, interrupt=True, announceCapital=True, flush=False)
if (self.env['runtime']['InputManager'].get_shortcut_type() in ['KEY'] and self.env['runtime'][
'InputManager'].get_last_deepest_input()[0] in ['KEY_LEFT', 'KEY_RIGHT', 'KEY_UP', 'KEY_DOWN']):
char_utils.present_char_for_review(
self.env, curr_char, interrupt=True, announce_capital=True, flush=False)
else:
self.env['runtime']['outputManager'].presentText(
currChar,
self.env['runtime']['OutputManager'].present_text(
curr_char,
interrupt=True,
ignorePunctuation=True,
announceCapital=True,
ignore_punctuation=True,
announce_capital=True,
flush=False)
def setCallback(self, callback):
def set_callback(self, callback):
pass

View File

@ -18,42 +18,42 @@ class command():
def shutdown(self):
pass
def getDescription(self):
def get_description(self):
return 'No Description found'
def run(self):
# try to detect the tab completion by cursor change
xMove = self.env['screen']['newCursor']['x'] - \
self.env['screen']['oldCursor']['x']
if xMove <= 0:
x_move = self.env['screen']['new_cursor']['x'] - \
self.env['screen']['old_cursor']['x']
if x_move <= 0:
return
if self.env['runtime']['inputManager'].getShortcutType() in ['KEY']:
if self.env['runtime']['InputManager'].get_shortcut_type() in ['KEY']:
if not (
self.env['runtime']['inputManager'].getLastDeepestInput() in [
self.env['runtime']['InputManager'].get_last_deepest_input() in [
['KEY_TAB']]):
if xMove < 5:
if x_move < 5:
return
elif self.env['runtime']['inputManager'].getShortcutType() in ['BYTE']:
elif self.env['runtime']['InputManager'].get_shortcut_type() in ['BYTE']:
found = False
for currByte in self.env['runtime']['byteManager'].getLastByteKey(
for currByte in self.env['runtime']['ByteManager'].get_last_byte_key(
):
if currByte == 9:
found = True
if not found:
if xMove < 5:
if x_move < 5:
return
# is there any change?
if not self.env['runtime']['screenManager'].isDelta():
if not self.env['runtime']['ScreenManager'].is_delta():
return
if not xMove == len(self.env['screen']['newDelta']):
if not x_move == len(self.env['screen']['new_delta']):
return
# filter unneded space on word begin
currDelta = self.env['screen']['newDelta']
if len(currDelta.strip()) != len(currDelta) and \
currDelta.strip() != '':
currDelta = currDelta.strip()
self.env['runtime']['outputManager'].presentText(
currDelta, interrupt=True, announceCapital=True, flush=False)
curr_delta = self.env['screen']['new_delta']
if len(curr_delta.strip()) != len(curr_delta) and \
curr_delta.strip() != '':
curr_delta = curr_delta.strip()
self.env['runtime']['OutputManager'].present_text(
curr_delta, interrupt=True, announce_capital=True, flush=False)
def setCallback(self, callback):
def set_callback(self, callback):
pass

View File

@ -20,42 +20,42 @@ class command():
def shutdown(self):
pass
def getDescription(self):
def get_description(self):
return 'No Description found'
def run(self):
# is navigation?
if not abs(self.env['screen']['oldCursor']['x'] -
self.env['screen']['newCursor']['x']) > 1:
if not abs(self.env['screen']['old_cursor']['x'] -
self.env['screen']['new_cursor']['x']) > 1:
return
# just when cursor move worddetection is needed
if not self.env['runtime']['cursorManager'].isCursorHorizontalMove():
if not self.env['runtime']['CursorManager'].is_cursor_horizontal_move():
return
# for now no new line
if self.env['runtime']['cursorManager'].isCursorVerticalMove():
if self.env['runtime']['CursorManager'].is_cursor_vertical_move():
return
# currently writing
if self.env['runtime']['screenManager'].isDelta():
if self.env['runtime']['ScreenManager'].is_delta():
return
# get the word
newContent = self.env['screen']['newContentText'].split(
'\n')[self.env['screen']['newCursor']['y']]
x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(
self.env['screen']['newCursor']['x'], 0, newContent)
new_content = self.env['screen']['new_content_text'].split(
'\n')[self.env['screen']['new_cursor']['y']]
x, y, curr_word, end_of_screen, line_break = word_utils.get_current_word(
self.env['screen']['new_cursor']['x'], 0, new_content)
# is there a word?
if currWord == '':
if curr_word == '':
return
# at the start of a word
if (x + len(currWord) != self.env['screen']['newCursor']['x']) and \
(self.env['screen']['newCursor']['x'] != x):
if (x + len(curr_word) != self.env['screen']['new_cursor']['x']) and \
(self.env['screen']['new_cursor']['x'] != x):
return
self.env['runtime']['outputManager'].presentText(
currWord, interrupt=True, flush=False)
self.env['runtime']['OutputManager'].present_text(
curr_word, interrupt=True, flush=False)
def setCallback(self, callback):
def set_callback(self, callback):
pass

View File

@ -20,60 +20,60 @@ class command():
def shutdown(self):
pass
def getDescription(self):
def get_description(self):
return ''
def run(self):
if not self.env['runtime']['settingsManager'].getSettingAsBool(
if not self.env['runtime']['SettingsManager'].get_setting_as_bool(
'focus', 'cursor'):
return
if self.env['runtime']['screenManager'].isScreenChange():
if self.env['runtime']['ScreenManager'].is_screen_change():
self.lastIdent = 0
return
# this leads to problems in vim -> status line change -> no
# announcement, so we do check the lengh as hack
if self.env['runtime']['screenManager'].isDelta():
if self.env['runtime']['ScreenManager'].is_delta():
return
# is a vertical change?
if not self.env['runtime']['cursorManager'].isCursorVerticalMove():
if not self.env['runtime']['CursorManager'].is_cursor_vertical_move():
return
x, y, currLine = line_utils.getCurrentLine(
self.env['screen']['newCursor']['x'], self.env['screen']['newCursor']['y'], self.env['screen']['newContentText'])
if currLine.isspace():
self.env['runtime']['outputManager'].presentText(
_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False)
x, y, curr_line = line_utils.get_current_line(
self.env['screen']['new_cursor']['x'], self.env['screen']['new_cursor']['y'], self.env['screen']['new_content_text'])
if curr_line.isspace():
self.env['runtime']['OutputManager'].present_text(
_("blank"), sound_icon ='EmptyLine', interrupt=True, flush=False)
else:
# ident
currIdent = len(currLine) - len(currLine.lstrip())
curr_ident = len(curr_line) - len(curr_line.lstrip())
if self.lastIdent == -1:
self.lastIdent = currIdent
doInterrupt = True
if self.env['runtime']['settingsManager'].getSettingAsBool(
self.lastIdent = curr_ident
do_interrupt = True
if self.env['runtime']['SettingsManager'].get_setting_as_bool(
'general', 'autoPresentIndent'):
if self.env['runtime']['settingsManager'].getSettingAsInt(
if self.env['runtime']['SettingsManager'].get_setting_as_int(
'general', 'autoPresentIndentMode') in [0, 1]:
self.env['runtime']['outputManager'].playFrequence(
currIdent * 50, 0.1, interrupt=doInterrupt)
if self.env['runtime']['settingsManager'].getSettingAsInt(
self.env['runtime']['OutputManager'].play_frequence(
curr_ident * 50, 0.1, interrupt=do_interrupt)
if self.env['runtime']['SettingsManager'].get_setting_as_int(
'general', 'autoPresentIndentMode') in [0, 2]:
if self.lastIdent != currIdent:
self.env['runtime']['outputManager'].presentText(
_('indented ') + str(currIdent) + ' ', interrupt=doInterrupt, flush=False)
doInterrupt = False
if self.lastIdent != curr_ident:
self.env['runtime']['OutputManager'].present_text(
_('indented ') + str(curr_ident) + ' ', interrupt=do_interrupt, flush=False)
do_interrupt = False
# barrier
sayLine = currLine
if self.env['runtime']['settingsManager'].getSettingAsBool(
say_line = curr_line
if self.env['runtime']['SettingsManager'].get_setting_as_bool(
'barrier', 'enabled'):
isBarrier, barrierLine = self.env['runtime']['barrierManager'].handleLineBarrier(
self.env['screen']['newContentText'].split('\n'), self.env['screen']['newCursor']['x'], self.env['screen']['newCursor']['y'])
if isBarrier:
sayLine = barrierLine
is_barrier, barrierLine = self.env['runtime']['BarrierManager'].handle_line_barrier(
self.env['screen']['new_content_text'].split('\n'), self.env['screen']['new_cursor']['x'], self.env['screen']['new_cursor']['y'])
if is_barrier:
say_line = barrierLine
# output
self.env['runtime']['outputManager'].presentText(
sayLine, interrupt=doInterrupt, flush=False)
self.lastIdent = currIdent
self.env['runtime']['OutputManager'].present_text(
say_line, interrupt=do_interrupt, flush=False)
self.lastIdent = curr_ident
def setCallback(self, callback):
def set_callback(self, callback):
pass

View File

@ -20,51 +20,51 @@ class command():
def shutdown(self):
pass
def getDescription(self):
def get_description(self):
return ''
def run(self):
if not self.env['runtime']['settingsManager'].getSettingAsBool(
if not self.env['runtime']['SettingsManager'].get_setting_as_bool(
'focus', 'cursor'):
return
if self.env['runtime']['screenManager'].isScreenChange():
if self.env['runtime']['ScreenManager'].is_screen_change():
self.lastIdent = 0
return
# is a vertical change?
if not self.env['runtime']['cursorManager'].isCursorHorizontalMove():
if not self.env['runtime']['CursorManager'].is_cursor_horizontal_move():
return
x, y, currLine = line_utils.getCurrentLine(
self.env['screen']['newCursor']['x'], self.env['screen']['newCursor']['y'], self.env['screen']['newContentText'])
currIdent = self.env['screen']['newCursor']['x']
x, y, curr_line = line_utils.get_current_line(
self.env['screen']['new_cursor']['x'], self.env['screen']['new_cursor']['y'], self.env['screen']['new_content_text'])
curr_ident = self.env['screen']['new_cursor']['x']
if not currLine.isspace():
if not curr_line.isspace():
# ident
lastIdent, lastY, lastLine = line_utils.getCurrentLine(
self.env['screen']['newCursor']['x'], self.env['screen']['newCursor']['y'], self.env['screen']['oldContentText'])
if currLine.strip() != lastLine.strip():
lastIdent, lastY, last_line = line_utils.get_current_line(
self.env['screen']['new_cursor']['x'], self.env['screen']['new_cursor']['y'], self.env['screen']['old_content_text'])
if curr_line.strip() != last_line.strip():
return
if len(currLine.lstrip()) == len(lastLine.lstrip()):
if len(curr_line.lstrip()) == len(last_line.lstrip()):
return
currIdent = len(currLine) - len(currLine.lstrip())
curr_ident = len(curr_line) - len(curr_line.lstrip())
if self.lastIdent == -1:
self.lastIdent = currIdent
if currIdent <= 0:
self.lastIdent = curr_ident
if curr_ident <= 0:
return
if self.env['runtime']['settingsManager'].getSettingAsBool(
if self.env['runtime']['SettingsManager'].get_setting_as_bool(
'general', 'autoPresentIndent'):
if self.env['runtime']['settingsManager'].getSettingAsInt(
if self.env['runtime']['SettingsManager'].get_setting_as_int(
'general', 'autoPresentIndentMode') in [0, 1]:
self.env['runtime']['outputManager'].playFrequence(
currIdent * 50, 0.1, interrupt=False)
if self.env['runtime']['settingsManager'].getSettingAsInt(
self.env['runtime']['OutputManager'].play_frequence(
curr_ident * 50, 0.1, interrupt=False)
if self.env['runtime']['SettingsManager'].get_setting_as_int(
'general', 'autoPresentIndentMode') in [0, 2]:
if self.lastIdent != currIdent:
self.env['runtime']['outputManager'].presentText(
_('indented ') + str(currIdent) + ' ', interrupt=False, flush=False)
self.lastIdent = currIdent
if self.lastIdent != curr_ident:
self.env['runtime']['OutputManager'].present_text(
_('indented ') + str(curr_ident) + ' ', interrupt=False, flush=False)
self.lastIdent = curr_ident
def setCallback(self, callback):
def set_callback(self, callback):
pass

View File

@ -19,26 +19,26 @@ class command():
def shutdown(self):
pass
def getDescription(self):
def get_description(self):
return _('Reads attributes of current cursor position')
def run(self):
# is it enabled?
if not self.env['runtime']['settingsManager'].getSettingAsBool(
'general', 'hasAttributes'):
if not self.env['runtime']['SettingsManager'].get_setting_as_bool(
'general', 'hasattributes'):
return
# is a vertical change?
if not (self.env['runtime']['cursorManager'].isCursorVerticalMove() or
self.env['runtime']['cursorManager'].isCursorHorizontalMove()):
if not (self.env['runtime']['CursorManager'].is_cursor_vertical_move() or
self.env['runtime']['CursorManager'].is_cursor_horizontal_move()):
return
cursorPos = self.env['screen']['newCursor']
cursor_pos = self.env['screen']['new_cursor']
if not self.env['runtime']['attributeManager'].hasAttributes(
cursorPos):
if not self.env['runtime']['AttributeManager'].has_attributes(
cursor_pos):
return
self.env['runtime']['outputManager'].presentText(
'has attribute', soundIcon='HasAttributes', interrupt=False)
self.env['runtime']['OutputManager'].present_text(
'has attribute', sound_icon ='HasAttributes', interrupt=False)
def setCallback(self, callback):
def set_callback(self, callback):
pass

View File

@ -18,15 +18,15 @@ class command():
def shutdown(self):
pass
def getDescription(self):
def get_description(self):
return _('exits review mode')
def run(self):
if not self.env['runtime']['settingsManager'].getSettingAsBool(
if not self.env['runtime']['SettingsManager'].get_setting_as_bool(
'review', 'leaveReviewOnCursorChange'):
return
if self.env['runtime']['cursorManager'].isReviewMode():
self.env['runtime']['cursorManager'].clearReviewCursor()
if self.env['runtime']['CursorManager'].is_review_mode():
self.env['runtime']['CursorManager'].clear_review_cursor()
def setCallback(self, callback):
def set_callback(self, callback):
pass