To make Fenrir easier to approach for new developer, start code migration to be pep8 compliant.
This commit is contained in:
@ -1 +1 @@
|
||||
# Fenrir Configuration VMenu Profile
|
||||
# Fenrir Configuration VMenu Profile
|
||||
|
@ -4,35 +4,39 @@
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
import configparser
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class ConfigCommand():
|
||||
"""Base class for configuration management commands"""
|
||||
|
||||
|
||||
def __init__(self):
|
||||
self.env = None
|
||||
self.settingsFile = None
|
||||
self.config = None
|
||||
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.settingsFile = self.env['runtime']['settingsManager'].settingsFile
|
||||
self.config = self.env['runtime']['settingsManager'].settings
|
||||
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
|
||||
def presentText(self, text, interrupt=True, flush=True):
|
||||
"""Present text to user with proper speech handling"""
|
||||
self.env['runtime']['outputManager'].presentText(text, interrupt=interrupt, flush=flush)
|
||||
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
text, interrupt=interrupt, flush=flush)
|
||||
|
||||
def playSound(self, soundName):
|
||||
"""Play system sound"""
|
||||
soundIcon = ''
|
||||
@ -42,10 +46,11 @@ class ConfigCommand():
|
||||
soundIcon = 'ErrorSound'
|
||||
elif soundName == 'Cancel':
|
||||
soundIcon = 'Cancel'
|
||||
|
||||
|
||||
if soundIcon:
|
||||
self.env['runtime']['outputManager'].presentText('', soundIcon=soundIcon, interrupt=False)
|
||||
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
'', soundIcon=soundIcon, interrupt=False)
|
||||
|
||||
def backupConfig(self, announce=True):
|
||||
"""Create backup of current configuration file"""
|
||||
try:
|
||||
@ -54,24 +59,24 @@ class ConfigCommand():
|
||||
if announce:
|
||||
self.presentText(message)
|
||||
return False, message
|
||||
|
||||
|
||||
# Create backup with timestamp
|
||||
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||
backup_path = f"{self.settingsFile}.backup_{timestamp}"
|
||||
|
||||
|
||||
shutil.copy2(self.settingsFile, backup_path)
|
||||
|
||||
|
||||
message = f"Configuration backed up to {backup_path}"
|
||||
if announce:
|
||||
self.presentText("Configuration backup created successfully")
|
||||
return True, message
|
||||
|
||||
|
||||
except Exception as e:
|
||||
message = f"Failed to backup configuration: {str(e)}"
|
||||
if announce:
|
||||
self.presentText(message)
|
||||
return False, message
|
||||
|
||||
|
||||
def reloadConfig(self):
|
||||
"""Reload configuration from file"""
|
||||
try:
|
||||
@ -79,56 +84,63 @@ class ConfigCommand():
|
||||
self.env['runtime']['settingsManager'].loadSettings()
|
||||
self.config = self.env['runtime']['settingsManager'].settings
|
||||
return True
|
||||
|
||||
|
||||
except Exception as e:
|
||||
self.presentText(f"Failed to reload configuration: {str(e)}")
|
||||
return False
|
||||
|
||||
|
||||
def findDefaultConfig(self):
|
||||
"""Find default configuration file path"""
|
||||
# Look for default config in multiple locations
|
||||
default_paths = [
|
||||
'/etc/fenrir/settings/settings.conf.default',
|
||||
'/usr/share/fenrir/settings/settings.conf',
|
||||
os.path.join(os.path.dirname(self.settingsFile), 'settings.conf.default'),
|
||||
os.path.join(os.path.dirname(os.path.dirname(self.settingsFile)), 'settings', 'settings.conf.default')
|
||||
]
|
||||
|
||||
os.path.join(
|
||||
os.path.dirname(
|
||||
self.settingsFile),
|
||||
'settings.conf.default'),
|
||||
os.path.join(
|
||||
os.path.dirname(
|
||||
os.path.dirname(
|
||||
self.settingsFile)),
|
||||
'settings',
|
||||
'settings.conf.default')]
|
||||
|
||||
for path in default_paths:
|
||||
if os.path.exists(path):
|
||||
return path
|
||||
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def createBasicDefaults(self):
|
||||
"""Create basic default configuration manually"""
|
||||
try:
|
||||
# Create a new config with basic defaults
|
||||
self.config = configparser.ConfigParser()
|
||||
|
||||
|
||||
# Add basic sections and settings
|
||||
self.config.add_section('speech')
|
||||
self.config.set('speech', 'driver', 'speechdDriver')
|
||||
self.config.set('speech', 'rate', '0.75')
|
||||
self.config.set('speech', 'pitch', '0.5')
|
||||
self.config.set('speech', 'volume', '1.0')
|
||||
|
||||
|
||||
self.config.add_section('sound')
|
||||
self.config.set('sound', 'driver', 'genericDriver')
|
||||
self.config.set('sound', 'volume', '0.7')
|
||||
|
||||
|
||||
self.config.add_section('keyboard')
|
||||
self.config.set('keyboard', 'driver', 'evdevDriver')
|
||||
self.config.set('keyboard', 'keyboardLayout', 'desktop')
|
||||
|
||||
|
||||
self.config.add_section('screen')
|
||||
self.config.set('screen', 'driver', 'vcsaDriver')
|
||||
|
||||
|
||||
self.config.add_section('general')
|
||||
self.config.set('general', 'debugMode', 'Off')
|
||||
|
||||
|
||||
return True
|
||||
|
||||
|
||||
except Exception as e:
|
||||
self.presentText(f"Failed to create basic defaults: {str(e)}")
|
||||
return False
|
||||
return False
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
|
||||
@ -10,16 +12,17 @@ _module = importlib.util.module_from_spec(_spec)
|
||||
_spec.loader.exec_module(_module)
|
||||
ConfigCommand = _module.ConfigCommand
|
||||
|
||||
|
||||
class command(ConfigCommand):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
|
||||
def getDescription(self):
|
||||
return "Set punctuation verbosity level"
|
||||
|
||||
|
||||
def run(self):
|
||||
currentLevel = self.getSetting('general', 'punctuationLevel', 'some')
|
||||
|
||||
|
||||
# Present current level
|
||||
levelDescriptions = {
|
||||
'none': 'None - no punctuation spoken',
|
||||
@ -27,10 +30,10 @@ class command(ConfigCommand):
|
||||
'most': 'Most - detailed punctuation',
|
||||
'all': 'All - every punctuation mark'
|
||||
}
|
||||
|
||||
|
||||
currentDescription = levelDescriptions.get(currentLevel, 'Unknown')
|
||||
self.presentText(f"Current punctuation level: {currentDescription}")
|
||||
|
||||
|
||||
# Cycle through the four levels
|
||||
levels = ['none', 'some', 'most', 'all']
|
||||
try:
|
||||
@ -39,13 +42,13 @@ class command(ConfigCommand):
|
||||
newLevel = levels[nextIndex]
|
||||
except ValueError:
|
||||
newLevel = 'some' # Default to some
|
||||
|
||||
|
||||
success = self.setSetting('general', 'punctuationLevel', newLevel)
|
||||
|
||||
|
||||
if success:
|
||||
newDescription = levelDescriptions[newLevel]
|
||||
self.presentText(f"Punctuation level set to: {newDescription}")
|
||||
self.playSound('Accept')
|
||||
else:
|
||||
self.presentText("Failed to change punctuation level")
|
||||
self.playSound('Error')
|
||||
self.playSound('Error')
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
|
||||
@ -10,16 +12,17 @@ _module = importlib.util.module_from_spec(_spec)
|
||||
_spec.loader.exec_module(_module)
|
||||
ConfigCommand = _module.ConfigCommand
|
||||
|
||||
|
||||
class command(ConfigCommand):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
|
||||
def getDescription(self):
|
||||
return "Toggle debug mode"
|
||||
|
||||
|
||||
def run(self):
|
||||
currentLevel = self.getSetting('general', 'debugLevel', '0')
|
||||
|
||||
|
||||
# Present current debug level
|
||||
if currentLevel == '0':
|
||||
self.presentText("Current debug mode: disabled")
|
||||
@ -29,18 +32,19 @@ class command(ConfigCommand):
|
||||
self.presentText(f"Current debug level: {currentLevel}")
|
||||
newLevel = '0'
|
||||
stateText = "disabled"
|
||||
|
||||
|
||||
success = self.setSetting('general', 'debugLevel', newLevel)
|
||||
|
||||
|
||||
if success:
|
||||
self.presentText(f"Debug mode {stateText}")
|
||||
if newLevel != '0':
|
||||
debugMode = self.getSetting('general', 'debugMode', 'File')
|
||||
if debugMode == 'File':
|
||||
self.presentText("Debug output will be written to log file")
|
||||
self.presentText(
|
||||
"Debug output will be written to log file")
|
||||
else:
|
||||
self.presentText("Debug output will be printed to console")
|
||||
self.playSound('Accept')
|
||||
else:
|
||||
self.presentText("Failed to change debug mode")
|
||||
self.playSound('Error')
|
||||
self.playSound('Error')
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
|
||||
@ -10,27 +12,33 @@ _module = importlib.util.module_from_spec(_spec)
|
||||
_spec.loader.exec_module(_module)
|
||||
ConfigCommand = _module.ConfigCommand
|
||||
|
||||
|
||||
class command(ConfigCommand):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
|
||||
def getDescription(self):
|
||||
return "Select keyboard layout (desktop or laptop)"
|
||||
|
||||
|
||||
def run(self):
|
||||
currentLayout = self.getSetting('keyboard', 'keyboardLayout', 'desktop')
|
||||
|
||||
currentLayout = self.getSetting(
|
||||
'keyboard', 'keyboardLayout', 'desktop')
|
||||
|
||||
# Present current layout
|
||||
self.presentText(f"Current keyboard layout: {currentLayout}")
|
||||
|
||||
|
||||
# Find available keyboard layouts
|
||||
keyboardPath = '/etc/fenrirscreenreader/keyboard'
|
||||
if not os.path.isdir(keyboardPath):
|
||||
# Development path
|
||||
keyboardPath = os.path.join(os.path.dirname(self.settingsFile), '..', 'keyboard')
|
||||
|
||||
keyboardPath = os.path.join(
|
||||
os.path.dirname(
|
||||
self.settingsFile),
|
||||
'..',
|
||||
'keyboard')
|
||||
|
||||
availableLayouts = self.getAvailableLayouts(keyboardPath)
|
||||
|
||||
|
||||
if len(availableLayouts) > 1:
|
||||
# Cycle through available layouts
|
||||
try:
|
||||
@ -40,12 +48,13 @@ class command(ConfigCommand):
|
||||
except ValueError:
|
||||
# Current layout not found, use first available
|
||||
newLayout = availableLayouts[0]
|
||||
|
||||
|
||||
success = self.setSetting('keyboard', 'keyboardLayout', newLayout)
|
||||
|
||||
|
||||
if success:
|
||||
self.presentText(f"Keyboard layout changed to: {newLayout}")
|
||||
self.presentText("Please restart Fenrir for this change to take effect.")
|
||||
self.presentText(
|
||||
"Please restart Fenrir for this change to take effect.")
|
||||
self.playSound('Accept')
|
||||
else:
|
||||
self.presentText("Failed to change keyboard layout")
|
||||
@ -53,11 +62,11 @@ class command(ConfigCommand):
|
||||
else:
|
||||
self.presentText("Only default keyboard layout is available")
|
||||
self.playSound('Cancel')
|
||||
|
||||
|
||||
def getAvailableLayouts(self, keyboardPath):
|
||||
"""Find available keyboard layout files"""
|
||||
layouts = []
|
||||
|
||||
|
||||
if os.path.isdir(keyboardPath):
|
||||
try:
|
||||
for file in os.listdir(keyboardPath):
|
||||
@ -66,9 +75,9 @@ class command(ConfigCommand):
|
||||
layouts.append(layoutName)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
# Ensure we have at least the default layouts
|
||||
if not layouts:
|
||||
layouts = ['desktop', 'laptop']
|
||||
|
||||
return sorted(layouts)
|
||||
|
||||
return sorted(layouts)
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
|
||||
@ -10,26 +12,27 @@ _module = importlib.util.module_from_spec(_spec)
|
||||
_spec.loader.exec_module(_module)
|
||||
ConfigCommand = _module.ConfigCommand
|
||||
|
||||
|
||||
class command(ConfigCommand):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
|
||||
def getDescription(self):
|
||||
return "Set character echo mode"
|
||||
|
||||
|
||||
def run(self):
|
||||
currentMode = self.getSetting('keyboard', 'charEchoMode', '1')
|
||||
|
||||
|
||||
# Present current mode
|
||||
modeDescriptions = {
|
||||
'0': 'None - no character echo',
|
||||
'1': 'Always - echo all typed characters',
|
||||
'2': 'Caps Lock - echo only when caps lock is on'
|
||||
}
|
||||
|
||||
|
||||
currentDescription = modeDescriptions.get(currentMode, 'Unknown')
|
||||
self.presentText(f"Current character echo mode: {currentDescription}")
|
||||
|
||||
|
||||
# Cycle through the three modes
|
||||
modes = ['0', '1', '2']
|
||||
try:
|
||||
@ -38,13 +41,13 @@ class command(ConfigCommand):
|
||||
newMode = modes[nextIndex]
|
||||
except ValueError:
|
||||
newMode = '1' # Default to always
|
||||
|
||||
|
||||
success = self.setSetting('keyboard', 'charEchoMode', newMode)
|
||||
|
||||
|
||||
if success:
|
||||
newDescription = modeDescriptions[newMode]
|
||||
self.presentText(f"Character echo mode set to: {newDescription}")
|
||||
self.playSound('Accept')
|
||||
else:
|
||||
self.presentText("Failed to change character echo mode")
|
||||
self.playSound('Error')
|
||||
self.playSound('Error')
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
|
||||
@ -10,26 +12,30 @@ _module = importlib.util.module_from_spec(_spec)
|
||||
_spec.loader.exec_module(_module)
|
||||
ConfigCommand = _module.ConfigCommand
|
||||
|
||||
|
||||
class command(ConfigCommand):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
|
||||
def getDescription(self):
|
||||
return "Toggle exclusive keyboard access"
|
||||
|
||||
|
||||
def run(self):
|
||||
currentState = self.getBooleanSetting('keyboard', 'grabDevices', True)
|
||||
newState = self.toggleBooleanSetting('keyboard', 'grabDevices')
|
||||
|
||||
|
||||
if newState != currentState:
|
||||
stateText = "enabled" if newState else "disabled"
|
||||
self.presentText(f"Exclusive keyboard access {stateText}")
|
||||
if newState:
|
||||
self.presentText("Fenrir will have exclusive control of keyboard input")
|
||||
self.presentText(
|
||||
"Fenrir will have exclusive control of keyboard input")
|
||||
else:
|
||||
self.presentText("Fenrir will share keyboard input with other applications")
|
||||
self.presentText("Please restart Fenrir for this change to take effect")
|
||||
self.presentText(
|
||||
"Fenrir will share keyboard input with other applications")
|
||||
self.presentText(
|
||||
"Please restart Fenrir for this change to take effect")
|
||||
self.playSound('Accept')
|
||||
else:
|
||||
self.presentText("Failed to change keyboard grab setting")
|
||||
self.playSound('Error')
|
||||
self.playSound('Error')
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
|
||||
@ -10,25 +12,27 @@ _module = importlib.util.module_from_spec(_spec)
|
||||
_spec.loader.exec_module(_module)
|
||||
ConfigCommand = _module.ConfigCommand
|
||||
|
||||
|
||||
class command(ConfigCommand):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
|
||||
def getDescription(self):
|
||||
return "Toggle word echo when pressing space"
|
||||
|
||||
|
||||
def run(self):
|
||||
currentState = self.getBooleanSetting('keyboard', 'wordEcho', False)
|
||||
newState = self.toggleBooleanSetting('keyboard', 'wordEcho')
|
||||
|
||||
|
||||
if newState != currentState:
|
||||
stateText = "enabled" if newState else "disabled"
|
||||
self.presentText(f"Word echo {stateText}")
|
||||
if newState:
|
||||
self.presentText("Words will be spoken when you press space")
|
||||
else:
|
||||
self.presentText("Words will not be spoken when you press space")
|
||||
self.presentText(
|
||||
"Words will not be spoken when you press space")
|
||||
self.playSound('Accept')
|
||||
else:
|
||||
self.presentText("Failed to change word echo setting")
|
||||
self.playSound('Error')
|
||||
self.playSound('Error')
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
|
||||
@ -10,20 +12,23 @@ _module = importlib.util.module_from_spec(_spec)
|
||||
_spec.loader.exec_module(_module)
|
||||
ConfigCommand = _module.ConfigCommand
|
||||
|
||||
|
||||
class command(ConfigCommand):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
|
||||
def getDescription(self):
|
||||
return "Create backup of current configuration"
|
||||
|
||||
|
||||
def run(self):
|
||||
self.presentText("Creating configuration backup...")
|
||||
|
||||
|
||||
success, message = self.backupConfig(announce=False)
|
||||
|
||||
|
||||
if success:
|
||||
# Force the message to be queued and spoken
|
||||
self.env['runtime']['outputManager'].presentText("Configuration backup created successfully", interrupt=False, flush=False)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
"Configuration backup created successfully", interrupt=False, flush=False)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText("Failed to create configuration backup", interrupt=False, flush=False)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
"Failed to create configuration backup", interrupt=False, flush=False)
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
|
||||
@ -10,21 +12,22 @@ _module = importlib.util.module_from_spec(_spec)
|
||||
_spec.loader.exec_module(_module)
|
||||
ConfigCommand = _module.ConfigCommand
|
||||
|
||||
|
||||
class command(ConfigCommand):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
|
||||
def getDescription(self):
|
||||
return "Reload configuration from file"
|
||||
|
||||
|
||||
def run(self):
|
||||
self.presentText("Reloading configuration from file...")
|
||||
|
||||
|
||||
success = self.reloadConfig()
|
||||
|
||||
|
||||
if success:
|
||||
self.presentText("Configuration reloaded successfully")
|
||||
self.playSound('Accept')
|
||||
else:
|
||||
self.presentText("Failed to reload configuration")
|
||||
self.playSound('Error')
|
||||
self.playSound('Error')
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
import shutil
|
||||
@ -11,65 +13,89 @@ _module = importlib.util.module_from_spec(_spec)
|
||||
_spec.loader.exec_module(_module)
|
||||
ConfigCommand = _module.ConfigCommand
|
||||
|
||||
|
||||
class command(ConfigCommand):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
|
||||
def getDescription(self):
|
||||
return "Reset configuration to default settings"
|
||||
|
||||
|
||||
def run(self):
|
||||
self.presentText("WARNING: This will reset all settings to defaults")
|
||||
self.presentText("Creating backup before reset...")
|
||||
|
||||
|
||||
# Create backup first
|
||||
backupSuccess, backupMessage = self.backupConfig(announce=False)
|
||||
if not backupSuccess:
|
||||
self.presentText("Failed to create backup. Reset cancelled for safety.", interrupt=False)
|
||||
self.presentText(
|
||||
"Failed to create backup. Reset cancelled for safety.",
|
||||
interrupt=False)
|
||||
self.playSound('Error')
|
||||
return
|
||||
|
||||
|
||||
# Find default configuration file
|
||||
defaultConfigPath = self.findDefaultConfig()
|
||||
|
||||
|
||||
if defaultConfigPath and os.path.isfile(defaultConfigPath):
|
||||
try:
|
||||
# Copy default configuration over current
|
||||
shutil.copy2(defaultConfigPath, self.settingsFile)
|
||||
|
||||
|
||||
# Reload the configuration
|
||||
self.reloadConfig()
|
||||
|
||||
self.presentText("Configuration reset to defaults successfully", interrupt=False, flush=False)
|
||||
self.presentText("Please restart Fenrir for all changes to take effect", interrupt=False, flush=False)
|
||||
|
||||
|
||||
self.presentText(
|
||||
"Configuration reset to defaults successfully",
|
||||
interrupt=False,
|
||||
flush=False)
|
||||
self.presentText(
|
||||
"Please restart Fenrir for all changes to take effect",
|
||||
interrupt=False,
|
||||
flush=False)
|
||||
|
||||
except Exception as e:
|
||||
self.presentText(f"Failed to reset configuration: {str(e)}", interrupt=False, flush=False)
|
||||
self.presentText(
|
||||
f"Failed to reset configuration: {
|
||||
str(e)}", interrupt=False, flush=False)
|
||||
else:
|
||||
# Manually create basic default configuration
|
||||
self.createBasicDefaults()
|
||||
|
||||
|
||||
def findDefaultConfig(self):
|
||||
"""Find the default configuration file"""
|
||||
possiblePaths = [
|
||||
'/usr/share/fenrirscreenreader/config/settings/settings.conf',
|
||||
'/etc/fenrirscreenreader/settings/settings.conf.default',
|
||||
os.path.join(os.path.dirname(self.settingsFile), 'settings.conf.default'),
|
||||
os.path.join(
|
||||
os.path.dirname(
|
||||
self.settingsFile),
|
||||
'settings.conf.default'),
|
||||
# Development path
|
||||
os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..', '..', 'config', 'settings', 'settings.conf')
|
||||
os.path.join(
|
||||
os.path.dirname(__file__),
|
||||
'..',
|
||||
'..',
|
||||
'..',
|
||||
'..',
|
||||
'..',
|
||||
'..',
|
||||
'config',
|
||||
'settings',
|
||||
'settings.conf')
|
||||
]
|
||||
|
||||
|
||||
for path in possiblePaths:
|
||||
if os.path.isfile(path):
|
||||
return path
|
||||
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def createBasicDefaults(self):
|
||||
"""Create basic default configuration manually"""
|
||||
try:
|
||||
self.config.clear()
|
||||
|
||||
|
||||
# Basic speech defaults
|
||||
self.config['speech'] = {
|
||||
'enabled': 'True',
|
||||
@ -79,7 +105,7 @@ class command(ConfigCommand):
|
||||
'volume': '1.0',
|
||||
'autoReadIncoming': 'True'
|
||||
}
|
||||
|
||||
|
||||
# Basic sound defaults
|
||||
self.config['sound'] = {
|
||||
'enabled': 'True',
|
||||
@ -87,7 +113,7 @@ class command(ConfigCommand):
|
||||
'theme': 'default',
|
||||
'volume': '0.7'
|
||||
}
|
||||
|
||||
|
||||
# Basic keyboard defaults
|
||||
self.config['keyboard'] = {
|
||||
'driver': 'evdevDriver',
|
||||
@ -97,26 +123,34 @@ class command(ConfigCommand):
|
||||
'wordEcho': 'False',
|
||||
'charDeleteEcho': 'True'
|
||||
}
|
||||
|
||||
|
||||
# Basic screen defaults
|
||||
self.config['screen'] = {
|
||||
'driver': 'vcsaDriver',
|
||||
'encoding': 'auto'
|
||||
}
|
||||
|
||||
|
||||
# Basic general defaults
|
||||
self.config['general'] = {
|
||||
'punctuationLevel': 'some',
|
||||
'debugLevel': '0',
|
||||
'numberOfClipboards': '50'
|
||||
}
|
||||
|
||||
|
||||
# Write the configuration
|
||||
with open(self.settingsFile, 'w') as configfile:
|
||||
self.config.write(configfile)
|
||||
|
||||
self.presentText("Basic default configuration created", interrupt=False, flush=False)
|
||||
self.presentText("Please restart Fenrir for changes to take effect", interrupt=False, flush=False)
|
||||
|
||||
|
||||
self.presentText(
|
||||
"Basic default configuration created",
|
||||
interrupt=False,
|
||||
flush=False)
|
||||
self.presentText(
|
||||
"Please restart Fenrir for changes to take effect",
|
||||
interrupt=False,
|
||||
flush=False)
|
||||
|
||||
except Exception as e:
|
||||
self.presentText(f"Failed to create default configuration: {str(e)}", interrupt=False, flush=False)
|
||||
self.presentText(
|
||||
f"Failed to create default configuration: {
|
||||
str(e)}", interrupt=False, flush=False)
|
||||
|
@ -1,26 +1,30 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
|
||||
def getDescription(self):
|
||||
return "Discard temporary changes and revert to saved settings"
|
||||
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['outputManager'].presentText("Reverting to saved configuration...", interrupt=True)
|
||||
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
"Reverting to saved configuration...", interrupt=True)
|
||||
|
||||
try:
|
||||
# Reload settings from file, discarding runtime changes
|
||||
settingsManager = self.env['runtime']['settingsManager']
|
||||
settingsManager.loadSettings()
|
||||
|
||||
|
||||
# Reinitialize speech system with restored settings
|
||||
if 'speechDriver' in self.env['runtime']:
|
||||
try:
|
||||
@ -28,23 +32,31 @@ class command():
|
||||
speechDriver.shutdown()
|
||||
speechDriver.initialize(self.env)
|
||||
except Exception as e:
|
||||
print(f'revert_to_saved speechDriver: Error reinitializing speech driver: {str(e)}')
|
||||
|
||||
# Reinitialize sound system with restored settings
|
||||
print(
|
||||
f'revert_to_saved speechDriver: Error reinitializing speech driver: {
|
||||
str(e)}')
|
||||
|
||||
# Reinitialize sound system with restored settings
|
||||
if 'soundDriver' in self.env['runtime']:
|
||||
try:
|
||||
soundDriver = self.env['runtime']['soundDriver']
|
||||
soundDriver.shutdown()
|
||||
soundDriver.initialize(self.env)
|
||||
except Exception as e:
|
||||
print(f'revert_to_saved soundDriver: Error reinitializing sound driver: {str(e)}')
|
||||
|
||||
self.env['runtime']['outputManager'].presentText("Successfully reverted to saved settings", interrupt=False, flush=False)
|
||||
self.env['runtime']['outputManager'].presentText("All temporary changes have been discarded", interrupt=False, flush=False)
|
||||
|
||||
print(
|
||||
f'revert_to_saved soundDriver: Error reinitializing sound driver: {
|
||||
str(e)}')
|
||||
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
"Successfully reverted to saved settings", interrupt=False, flush=False)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
"All temporary changes have been discarded", interrupt=False, flush=False)
|
||||
|
||||
except Exception as e:
|
||||
self.env['runtime']['outputManager'].presentText(f"Error reverting settings: {str(e)}", interrupt=False, flush=False)
|
||||
self.env['runtime']['outputManager'].presentText("You may need to restart Fenrir", interrupt=False, flush=False)
|
||||
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
f"Error reverting settings: {str(e)}", interrupt=False, flush=False)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
"You may need to restart Fenrir", interrupt=False, flush=False)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
pass
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
|
||||
@ -10,27 +12,28 @@ _module = importlib.util.module_from_spec(_spec)
|
||||
_spec.loader.exec_module(_module)
|
||||
ConfigCommand = _module.ConfigCommand
|
||||
|
||||
|
||||
class command(ConfigCommand):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
|
||||
def getDescription(self):
|
||||
return "Save current configuration to file"
|
||||
|
||||
|
||||
def run(self):
|
||||
self.presentText("Saving current configuration...")
|
||||
|
||||
|
||||
try:
|
||||
# Force reload and save of current configuration
|
||||
self.reloadConfig()
|
||||
|
||||
|
||||
# Write the configuration file
|
||||
with open(self.settingsFile, 'w') as configfile:
|
||||
self.config.write(configfile)
|
||||
|
||||
|
||||
self.presentText("Configuration saved successfully")
|
||||
self.playSound('Accept')
|
||||
|
||||
|
||||
except Exception as e:
|
||||
self.presentText(f"Failed to save configuration: {str(e)}")
|
||||
self.playSound('Error')
|
||||
self.playSound('Error')
|
||||
|
@ -1,30 +1,38 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
|
||||
def getDescription(self):
|
||||
return "Save current session settings to configuration file"
|
||||
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['outputManager'].presentText("Saving current session settings to configuration file...", interrupt=True)
|
||||
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
"Saving current session settings to configuration file...", interrupt=True)
|
||||
|
||||
try:
|
||||
# This calls the settings manager's save method which writes current runtime settings to file
|
||||
# This calls the settings manager's save method which writes
|
||||
# current runtime settings to file
|
||||
self.env['runtime']['settingsManager'].saveSettings()
|
||||
|
||||
self.env['runtime']['outputManager'].presentText("Session settings saved successfully!", interrupt=False, flush=False)
|
||||
self.env['runtime']['outputManager'].presentText("All temporary changes are now permanent.", interrupt=False, flush=False)
|
||||
|
||||
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
"Session settings saved successfully!", interrupt=False, flush=False)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
"All temporary changes are now permanent.", interrupt=False, flush=False)
|
||||
|
||||
except Exception as e:
|
||||
self.env['runtime']['outputManager'].presentText(f"Failed to save settings: {str(e)}", interrupt=False, flush=False)
|
||||
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
f"Failed to save settings: {str(e)}", interrupt=False, flush=False)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
pass
|
||||
|
@ -1,37 +1,46 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import configparser
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
|
||||
def getDescription(self):
|
||||
return "Show temporary changes not yet saved to file"
|
||||
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['outputManager'].presentText("Checking for unsaved changes...", interrupt=True)
|
||||
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
"Checking for unsaved changes...", interrupt=True)
|
||||
|
||||
try:
|
||||
# Read the current config file
|
||||
settingsFile = self.env['runtime']['settingsManager'].settingsFile
|
||||
fileConfig = configparser.ConfigParser(interpolation=None)
|
||||
fileConfig.read(settingsFile)
|
||||
|
||||
|
||||
# Compare with runtime settings
|
||||
runtimeSettings = self.env['runtime']['settingsManager'].settings
|
||||
|
||||
|
||||
changes = []
|
||||
|
||||
|
||||
# Check speech settings specifically
|
||||
speechSections = ['speech', 'sound', 'keyboard', 'screen', 'general']
|
||||
|
||||
speechSections = [
|
||||
'speech',
|
||||
'sound',
|
||||
'keyboard',
|
||||
'screen',
|
||||
'general']
|
||||
|
||||
for section in speechSections:
|
||||
if section in runtimeSettings and section in fileConfig:
|
||||
for option in runtimeSettings[section]:
|
||||
@ -40,27 +49,34 @@ class command():
|
||||
fileValue = fileConfig[section][option]
|
||||
except Exception as e:
|
||||
fileValue = ""
|
||||
|
||||
|
||||
if runtimeValue != fileValue:
|
||||
changes.append(f"{section}.{option}: {fileValue} → {runtimeValue}")
|
||||
|
||||
changes.append(
|
||||
f"{section}.{option}: {fileValue} → {runtimeValue}")
|
||||
|
||||
if changes:
|
||||
self.env['runtime']['outputManager'].presentText(f"Found {len(changes)} unsaved changes:", interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
f"Found {len(changes)} unsaved changes:", interrupt=True)
|
||||
for change in changes[:5]: # Limit to first 5 changes
|
||||
self.env['runtime']['outputManager'].presentText(change, interrupt=True)
|
||||
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
change, interrupt=True)
|
||||
|
||||
if len(changes) > 5:
|
||||
self.env['runtime']['outputManager'].presentText(f"... and {len(changes) - 5} more changes", interrupt=True)
|
||||
|
||||
self.env['runtime']['outputManager'].presentText("Use save command to make these changes permanent", interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
f"... and {len(changes) - 5} more changes", interrupt=True)
|
||||
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
"Use save command to make these changes permanent", interrupt=True)
|
||||
self.env['runtime']['outputManager'].playSound('Accept')
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText("No unsaved changes found", interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
"No unsaved changes found", interrupt=True)
|
||||
self.env['runtime']['outputManager'].playSound('Cancel')
|
||||
|
||||
|
||||
except Exception as e:
|
||||
self.env['runtime']['outputManager'].presentText(f"Error checking for changes: {str(e)}", interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
f"Error checking for changes: {str(e)}", interrupt=True)
|
||||
self.env['runtime']['outputManager'].playSound('Error')
|
||||
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
pass
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
|
||||
@ -10,16 +12,17 @@ _module = importlib.util.module_from_spec(_spec)
|
||||
_spec.loader.exec_module(_module)
|
||||
ConfigCommand = _module.ConfigCommand
|
||||
|
||||
|
||||
class command(ConfigCommand):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
|
||||
def getDescription(self):
|
||||
return "Select screen driver"
|
||||
|
||||
|
||||
def run(self):
|
||||
currentDriver = self.getSetting('screen', 'driver', 'vcsaDriver')
|
||||
|
||||
|
||||
# Present current driver
|
||||
driverDescriptions = {
|
||||
'vcsaDriver': 'VCSA Driver - Linux TTY console access',
|
||||
@ -27,10 +30,11 @@ class command(ConfigCommand):
|
||||
'dummyDriver': 'Dummy Driver - for testing only',
|
||||
'debugDriver': 'Debug Driver - development/debugging'
|
||||
}
|
||||
|
||||
currentDescription = driverDescriptions.get(currentDriver, 'Unknown driver')
|
||||
|
||||
currentDescription = driverDescriptions.get(
|
||||
currentDriver, 'Unknown driver')
|
||||
self.presentText(f"Current screen driver: {currentDescription}")
|
||||
|
||||
|
||||
# Cycle through the available drivers
|
||||
drivers = ['vcsaDriver', 'ptyDriver', 'dummyDriver', 'debugDriver']
|
||||
try:
|
||||
@ -39,14 +43,15 @@ class command(ConfigCommand):
|
||||
newDriver = drivers[nextIndex]
|
||||
except ValueError:
|
||||
newDriver = 'vcsaDriver' # Default to VCSA
|
||||
|
||||
|
||||
success = self.setSetting('screen', 'driver', newDriver)
|
||||
|
||||
|
||||
if success:
|
||||
newDescription = driverDescriptions[newDriver]
|
||||
self.presentText(f"Screen driver changed to: {newDescription}")
|
||||
self.presentText("Please restart Fenrir for this change to take effect.")
|
||||
self.presentText(
|
||||
"Please restart Fenrir for this change to take effect.")
|
||||
self.playSound('Accept')
|
||||
else:
|
||||
self.presentText("Failed to change screen driver")
|
||||
self.playSound('Error')
|
||||
self.playSound('Error')
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
|
||||
@ -10,19 +12,20 @@ _module = importlib.util.module_from_spec(_spec)
|
||||
_spec.loader.exec_module(_module)
|
||||
ConfigCommand = _module.ConfigCommand
|
||||
|
||||
|
||||
class command(ConfigCommand):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
|
||||
def getDescription(self):
|
||||
return "Set screen text encoding"
|
||||
|
||||
|
||||
def run(self):
|
||||
currentEncoding = self.getSetting('screen', 'encoding', 'auto')
|
||||
|
||||
|
||||
# Present current encoding
|
||||
self.presentText(f"Current screen encoding: {currentEncoding}")
|
||||
|
||||
|
||||
# Cycle through available encodings
|
||||
encodings = ['auto', 'utf-8', 'cp1252', 'iso-8859-1']
|
||||
try:
|
||||
@ -31,16 +34,17 @@ class command(ConfigCommand):
|
||||
newEncoding = encodings[nextIndex]
|
||||
except ValueError:
|
||||
newEncoding = 'auto' # Default to auto
|
||||
|
||||
|
||||
success = self.setSetting('screen', 'encoding', newEncoding)
|
||||
|
||||
|
||||
if success:
|
||||
self.presentText(f"Screen encoding set to: {newEncoding}")
|
||||
if newEncoding == 'auto':
|
||||
self.presentText("Fenrir will automatically detect text encoding")
|
||||
self.presentText(
|
||||
"Fenrir will automatically detect text encoding")
|
||||
else:
|
||||
self.presentText(f"Fenrir will use {newEncoding} encoding")
|
||||
self.playSound('Accept')
|
||||
else:
|
||||
self.presentText("Failed to change screen encoding")
|
||||
self.playSound('Error')
|
||||
self.playSound('Error')
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
|
||||
@ -10,34 +12,40 @@ _module = importlib.util.module_from_spec(_spec)
|
||||
_spec.loader.exec_module(_module)
|
||||
ConfigCommand = _module.ConfigCommand
|
||||
|
||||
|
||||
class command(ConfigCommand):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
|
||||
def getDescription(self):
|
||||
return "Adjust sound volume"
|
||||
|
||||
|
||||
def run(self):
|
||||
currentVolume = self.getFloatSetting('sound', 'volume', 0.7)
|
||||
|
||||
|
||||
# Present current volume
|
||||
volumePercent = int(currentVolume * 100)
|
||||
self.presentText(f"Current sound volume: {volumePercent} percent")
|
||||
|
||||
|
||||
# Adjust volume by 10%
|
||||
newVolume = self.adjustFloatSetting('sound', 'volume', 0.1, 0.0, 1.0)
|
||||
|
||||
|
||||
if newVolume != currentVolume:
|
||||
newPercent = int(newVolume * 100)
|
||||
self.presentText(f"Sound volume set to {newPercent} percent", interrupt=False)
|
||||
self.presentText(
|
||||
f"Sound volume set to {newPercent} percent",
|
||||
interrupt=False)
|
||||
self.playSound('Accept')
|
||||
else:
|
||||
# If we hit the maximum, try decreasing instead
|
||||
newVolume = self.adjustFloatSetting('sound', 'volume', -0.1, 0.0, 1.0)
|
||||
newVolume = self.adjustFloatSetting(
|
||||
'sound', 'volume', -0.1, 0.0, 1.0)
|
||||
if newVolume != currentVolume:
|
||||
newPercent = int(newVolume * 100)
|
||||
self.presentText(f"Sound volume set to {newPercent} percent", interrupt=False)
|
||||
self.presentText(
|
||||
f"Sound volume set to {newPercent} percent",
|
||||
interrupt=False)
|
||||
self.playSound('Accept')
|
||||
else:
|
||||
self.presentText("Sound volume unchanged", interrupt=False)
|
||||
self.playSound('Cancel')
|
||||
self.playSound('Cancel')
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
|
||||
@ -10,19 +12,20 @@ _module = importlib.util.module_from_spec(_spec)
|
||||
_spec.loader.exec_module(_module)
|
||||
ConfigCommand = _module.ConfigCommand
|
||||
|
||||
|
||||
class command(ConfigCommand):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
|
||||
def getDescription(self):
|
||||
return "Select sound driver (genericDriver or gstreamerDriver)"
|
||||
|
||||
|
||||
def run(self):
|
||||
currentDriver = self.getSetting('sound', 'driver', 'genericDriver')
|
||||
|
||||
|
||||
# Present current driver
|
||||
self.presentText(f"Current sound driver: {currentDriver}")
|
||||
|
||||
|
||||
# Toggle between the two available drivers
|
||||
if currentDriver == 'genericDriver':
|
||||
newDriver = 'gstreamerDriver'
|
||||
@ -30,13 +33,15 @@ class command(ConfigCommand):
|
||||
else:
|
||||
newDriver = 'genericDriver'
|
||||
driverDescription = "Generic Driver - uses SOX for audio playback"
|
||||
|
||||
|
||||
success = self.setSetting('sound', 'driver', newDriver)
|
||||
|
||||
|
||||
if success:
|
||||
self.presentText(f"Sound driver changed to {newDriver}. {driverDescription}")
|
||||
self.presentText("Please restart Fenrir for this change to take effect.")
|
||||
self.presentText(
|
||||
f"Sound driver changed to {newDriver}. {driverDescription}")
|
||||
self.presentText(
|
||||
"Please restart Fenrir for this change to take effect.")
|
||||
self.playSound('Accept')
|
||||
else:
|
||||
self.presentText("Failed to change sound driver")
|
||||
self.playSound('Error')
|
||||
self.playSound('Error')
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
|
||||
@ -10,28 +12,29 @@ _module = importlib.util.module_from_spec(_spec)
|
||||
_spec.loader.exec_module(_module)
|
||||
ConfigCommand = _module.ConfigCommand
|
||||
|
||||
|
||||
class command(ConfigCommand):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
|
||||
def getDescription(self):
|
||||
return "Select sound theme"
|
||||
|
||||
|
||||
def run(self):
|
||||
currentTheme = self.getSetting('sound', 'theme', 'default')
|
||||
|
||||
|
||||
# Present current theme
|
||||
self.presentText(f"Current sound theme: {currentTheme}")
|
||||
|
||||
|
||||
# Look for available sound themes
|
||||
soundPaths = [
|
||||
'/usr/share/sounds',
|
||||
'/usr/share/fenrirscreenreader/sounds',
|
||||
os.path.expanduser('~/.local/share/fenrirscreenreader/sounds')
|
||||
]
|
||||
|
||||
|
||||
availableThemes = self.getAvailableThemes(soundPaths)
|
||||
|
||||
|
||||
if len(availableThemes) > 1:
|
||||
# For this implementation, cycle through available themes
|
||||
try:
|
||||
@ -41,9 +44,9 @@ class command(ConfigCommand):
|
||||
except ValueError:
|
||||
# Current theme not found in available themes, use first one
|
||||
newTheme = availableThemes[0]
|
||||
|
||||
|
||||
success = self.setSetting('sound', 'theme', newTheme)
|
||||
|
||||
|
||||
if success:
|
||||
self.presentText(f"Sound theme changed to: {newTheme}")
|
||||
self.playSound('Accept')
|
||||
@ -53,25 +56,27 @@ class command(ConfigCommand):
|
||||
else:
|
||||
self.presentText("Only default sound theme is available")
|
||||
self.playSound('Cancel')
|
||||
|
||||
|
||||
def getAvailableThemes(self, searchPaths):
|
||||
"""Find available sound themes in the search paths"""
|
||||
themes = ['default'] # Always include default
|
||||
|
||||
|
||||
for path in searchPaths:
|
||||
if os.path.isdir(path):
|
||||
try:
|
||||
for item in os.listdir(path):
|
||||
fullPath = os.path.join(path, item)
|
||||
if os.path.isdir(fullPath) and item != 'default' and item not in themes:
|
||||
# Check if it looks like a sound theme (contains sound files)
|
||||
if os.path.isdir(
|
||||
fullPath) and item != 'default' and item not in themes:
|
||||
# Check if it looks like a sound theme (contains
|
||||
# sound files)
|
||||
if self.isValidSoundTheme(fullPath):
|
||||
themes.append(item)
|
||||
except Exception:
|
||||
continue
|
||||
|
||||
|
||||
return themes
|
||||
|
||||
|
||||
def isValidSoundTheme(self, themePath):
|
||||
"""Check if a directory contains sound files"""
|
||||
soundExtensions = ['.wav', '.ogg', '.mp3', '.flac']
|
||||
@ -81,4 +86,4 @@ class command(ConfigCommand):
|
||||
return True
|
||||
except Exception:
|
||||
pass
|
||||
return False
|
||||
return False
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
|
||||
@ -10,17 +12,18 @@ _module = importlib.util.module_from_spec(_spec)
|
||||
_spec.loader.exec_module(_module)
|
||||
ConfigCommand = _module.ConfigCommand
|
||||
|
||||
|
||||
class command(ConfigCommand):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
|
||||
def getDescription(self):
|
||||
return "Toggle sound output on or off"
|
||||
|
||||
|
||||
def run(self):
|
||||
currentState = self.getBooleanSetting('sound', 'enabled', True)
|
||||
newState = self.toggleBooleanSetting('sound', 'enabled')
|
||||
|
||||
|
||||
if newState != currentState:
|
||||
stateText = "enabled" if newState else "disabled"
|
||||
self.presentText(f"Sound {stateText}")
|
||||
@ -28,4 +31,4 @@ class command(ConfigCommand):
|
||||
if newState:
|
||||
self.playSound('Accept')
|
||||
else:
|
||||
self.presentText("Failed to change sound setting")
|
||||
self.presentText("Failed to change sound setting")
|
||||
|
@ -1,40 +1,48 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
|
||||
def getDescription(self):
|
||||
return "Adjust speech pitch (voice height)"
|
||||
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
# Get current pitch
|
||||
currentPitch = float(self.env['runtime']['settingsManager'].getSetting('speech', 'pitch'))
|
||||
currentPitch = float(
|
||||
self.env['runtime']['settingsManager'].getSetting(
|
||||
'speech', 'pitch'))
|
||||
except Exception as e:
|
||||
currentPitch = 0.5
|
||||
|
||||
|
||||
# Present current pitch
|
||||
pitchPercent = int(currentPitch * 100)
|
||||
self.env['runtime']['outputManager'].presentText(f"Current speech pitch: {pitchPercent} percent", interrupt=True)
|
||||
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
f"Current speech pitch: {pitchPercent} percent", interrupt=True)
|
||||
|
||||
# Increase by 10%, wrap around if at max
|
||||
newPitch = currentPitch + 0.1
|
||||
if newPitch > 1.0:
|
||||
newPitch = 0.1 # Wrap to minimum
|
||||
|
||||
|
||||
# Apply the new pitch
|
||||
self.env['runtime']['settingsManager'].setSetting('speech', 'pitch', str(newPitch))
|
||||
|
||||
self.env['runtime']['settingsManager'].setSetting(
|
||||
'speech', 'pitch', str(newPitch))
|
||||
|
||||
newPercent = int(newPitch * 100)
|
||||
self.env['runtime']['outputManager'].presentText(f"Speech pitch set to {newPercent} percent", interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
f"Speech pitch set to {newPercent} percent", interrupt=True)
|
||||
self.env['runtime']['outputManager'].playSound('Accept')
|
||||
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
pass
|
||||
|
@ -1,39 +1,47 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
|
||||
def getDescription(self):
|
||||
return "Adjust speech rate (speed)"
|
||||
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
# Get current rate
|
||||
currentRate = float(self.env['runtime']['settingsManager'].getSetting('speech', 'rate'))
|
||||
currentRate = float(
|
||||
self.env['runtime']['settingsManager'].getSetting(
|
||||
'speech', 'rate'))
|
||||
except Exception as e:
|
||||
currentRate = 0.5
|
||||
|
||||
|
||||
# Present current rate
|
||||
ratePercent = int(currentRate * 100)
|
||||
self.env['runtime']['outputManager'].presentText(f"Current speech rate: {ratePercent} percent", interrupt=True)
|
||||
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
f"Current speech rate: {ratePercent} percent", interrupt=True)
|
||||
|
||||
# Increase by 10%, wrap around if at max
|
||||
newRate = currentRate + 0.1
|
||||
if newRate > 1.0:
|
||||
newRate = 0.1 # Wrap to minimum
|
||||
|
||||
|
||||
# Apply the new rate
|
||||
self.env['runtime']['settingsManager'].setSetting('speech', 'rate', str(newRate))
|
||||
|
||||
self.env['runtime']['settingsManager'].setSetting(
|
||||
'speech', 'rate', str(newRate))
|
||||
|
||||
newPercent = int(newRate * 100)
|
||||
self.env['runtime']['outputManager'].presentText(f"Speech rate set to {newPercent} percent", interrupt=False, flush=False)
|
||||
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
f"Speech rate set to {newPercent} percent", interrupt=False, flush=False)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
pass
|
||||
|
@ -1,18 +1,21 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
|
||||
def getDescription(self):
|
||||
return "Adjust speech rate (temporary - use save to make permanent)"
|
||||
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
# Get current rate from runtime settings (may be temporary)
|
||||
@ -20,30 +23,37 @@ class command():
|
||||
currentRate = float(settingsManager.getSetting('speech', 'rate'))
|
||||
except Exception as e:
|
||||
currentRate = 0.5
|
||||
|
||||
|
||||
# Present current rate
|
||||
ratePercent = int(currentRate * 100)
|
||||
self.env['runtime']['outputManager'].presentText(f"Current speech rate: {ratePercent} percent", interrupt=True)
|
||||
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
f"Current speech rate: {ratePercent} percent", interrupt=True)
|
||||
|
||||
# Increase by 10%, wrap around if at max
|
||||
newRate = currentRate + 0.1
|
||||
if newRate > 1.0:
|
||||
newRate = 0.1 # Wrap to minimum
|
||||
|
||||
|
||||
# Apply ONLY to runtime - this is temporary until saved
|
||||
settingsManager = self.env['runtime']['settingsManager']
|
||||
settingsManager.settings['speech']['rate'] = str(newRate)
|
||||
|
||||
|
||||
# Apply to speech system immediately for this session
|
||||
if 'speechDriver' in self.env['runtime']:
|
||||
try:
|
||||
self.env['runtime']['speechDriver'].setRate(newRate)
|
||||
except Exception as e:
|
||||
print(f'adjust_speech_rate setRate: Error setting speech rate: {str(e)}')
|
||||
|
||||
print(
|
||||
f'adjust_speech_rate setRate: Error setting speech rate: {
|
||||
str(e)}')
|
||||
|
||||
newPercent = int(newRate * 100)
|
||||
self.env['runtime']['outputManager'].presentText(f"Speech rate temporarily set to {newPercent} percent", interrupt=False, flush=False)
|
||||
self.env['runtime']['outputManager'].presentText("Use save command to make permanent", interrupt=False, flush=False)
|
||||
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
f"Speech rate temporarily set to {newPercent} percent",
|
||||
interrupt=False,
|
||||
flush=False)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
"Use save command to make permanent", interrupt=False, flush=False)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
pass
|
||||
|
@ -1,40 +1,48 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
|
||||
def getDescription(self):
|
||||
return "Adjust speech volume (loudness)"
|
||||
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
# Get current volume
|
||||
currentVolume = float(self.env['runtime']['settingsManager'].getSetting('speech', 'volume'))
|
||||
currentVolume = float(
|
||||
self.env['runtime']['settingsManager'].getSetting(
|
||||
'speech', 'volume'))
|
||||
except Exception as e:
|
||||
currentVolume = 1.0
|
||||
|
||||
|
||||
# Present current volume
|
||||
volumePercent = int(currentVolume * 100)
|
||||
self.env['runtime']['outputManager'].presentText(f"Current speech volume: {volumePercent} percent", interrupt=True)
|
||||
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
f"Current speech volume: {volumePercent} percent", interrupt=True)
|
||||
|
||||
# Increase by 10%, wrap around if at max
|
||||
newVolume = currentVolume + 0.1
|
||||
if newVolume > 1.0:
|
||||
newVolume = 0.1 # Wrap to minimum
|
||||
|
||||
|
||||
# Apply the new volume
|
||||
self.env['runtime']['settingsManager'].setSetting('speech', 'volume', str(newVolume))
|
||||
|
||||
self.env['runtime']['settingsManager'].setSetting(
|
||||
'speech', 'volume', str(newVolume))
|
||||
|
||||
newPercent = int(newVolume * 100)
|
||||
self.env['runtime']['outputManager'].presentText(f"Speech volume set to {newPercent} percent", interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
f"Speech volume set to {newPercent} percent", interrupt=True)
|
||||
self.env['runtime']['outputManager'].playSound('Accept')
|
||||
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
pass
|
||||
|
@ -1,59 +1,80 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
|
||||
def getDescription(self):
|
||||
return "Show current speech settings"
|
||||
|
||||
|
||||
def run(self):
|
||||
# Get current speech settings
|
||||
driver = self.env['runtime']['settingsManager'].getSetting('speech', 'driver')
|
||||
module = self.env['runtime']['settingsManager'].getSetting('speech', 'module')
|
||||
voice = self.env['runtime']['settingsManager'].getSetting('speech', 'voice')
|
||||
rate = self.env['runtime']['settingsManager'].getSetting('speech', 'rate')
|
||||
pitch = self.env['runtime']['settingsManager'].getSetting('speech', 'pitch')
|
||||
volume = self.env['runtime']['settingsManager'].getSetting('speech', 'volume')
|
||||
enabled = self.env['runtime']['settingsManager'].getSetting('speech', 'enabled')
|
||||
|
||||
self.env['runtime']['outputManager'].presentText("Current speech settings:", interrupt=True)
|
||||
|
||||
driver = self.env['runtime']['settingsManager'].getSetting(
|
||||
'speech', 'driver')
|
||||
module = self.env['runtime']['settingsManager'].getSetting(
|
||||
'speech', 'module')
|
||||
voice = self.env['runtime']['settingsManager'].getSetting(
|
||||
'speech', 'voice')
|
||||
rate = self.env['runtime']['settingsManager'].getSetting(
|
||||
'speech', 'rate')
|
||||
pitch = self.env['runtime']['settingsManager'].getSetting(
|
||||
'speech', 'pitch')
|
||||
volume = self.env['runtime']['settingsManager'].getSetting(
|
||||
'speech', 'volume')
|
||||
enabled = self.env['runtime']['settingsManager'].getSetting(
|
||||
'speech', 'enabled')
|
||||
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
"Current speech settings:", interrupt=True)
|
||||
|
||||
# Present all settings
|
||||
self.env['runtime']['outputManager'].presentText(f"Speech enabled: {enabled}", interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(f"Driver: {driver}", interrupt=True)
|
||||
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
f"Speech enabled: {enabled}", interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
f"Driver: {driver}", interrupt=True)
|
||||
|
||||
if module:
|
||||
self.env['runtime']['outputManager'].presentText(f"Module: {module}", interrupt=True)
|
||||
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
f"Module: {module}", interrupt=True)
|
||||
|
||||
if voice:
|
||||
self.env['runtime']['outputManager'].presentText(f"Voice: {voice}", interrupt=True)
|
||||
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
f"Voice: {voice}", interrupt=True)
|
||||
|
||||
try:
|
||||
ratePercent = int(float(rate) * 100)
|
||||
self.env['runtime']['outputManager'].presentText(f"Rate: {ratePercent} percent", interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
f"Rate: {ratePercent} percent", interrupt=True)
|
||||
except Exception as e:
|
||||
self.env['runtime']['outputManager'].presentText(f"Rate: {rate}", interrupt=True)
|
||||
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
f"Rate: {rate}", interrupt=True)
|
||||
|
||||
try:
|
||||
pitchPercent = int(float(pitch) * 100)
|
||||
self.env['runtime']['outputManager'].presentText(f"Pitch: {pitchPercent} percent", interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
f"Pitch: {pitchPercent} percent", interrupt=True)
|
||||
except Exception as e:
|
||||
self.env['runtime']['outputManager'].presentText(f"Pitch: {pitch}", interrupt=True)
|
||||
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
f"Pitch: {pitch}", interrupt=True)
|
||||
|
||||
try:
|
||||
volumePercent = int(float(volume) * 100)
|
||||
self.env['runtime']['outputManager'].presentText(f"Volume: {volumePercent} percent", interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
f"Volume: {volumePercent} percent", interrupt=True)
|
||||
except Exception as e:
|
||||
self.env['runtime']['outputManager'].presentText(f"Volume: {volume}", interrupt=True)
|
||||
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
f"Volume: {volume}", interrupt=True)
|
||||
|
||||
self.env['runtime']['outputManager'].playSound('Accept')
|
||||
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
pass
|
||||
|
@ -5,16 +5,25 @@
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return 'No description found'
|
||||
return 'No description found'
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['outputManager'].presentText('ok i run open macro' , interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
'ok i run open macro', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -5,16 +5,25 @@
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return 'No description found'
|
||||
return 'No description found'
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['outputManager'].presentText('ok i run open save' , interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
'ok i run open save', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -5,16 +5,25 @@
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return 'No description found'
|
||||
return 'No description found'
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['outputManager'].presentText('ok i run replace macro' , interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
'ok i run replace macro', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -5,16 +5,25 @@
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return 'No description found'
|
||||
return 'No description found'
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['outputManager'].presentText('ok i run search macro' , interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
'ok i run search macro', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -4,26 +4,36 @@
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import datetime
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return _('presents the date')
|
||||
|
||||
return _('presents the date')
|
||||
|
||||
def run(self):
|
||||
dateFormat = self.env['runtime']['settingsManager'].getSetting('general', 'dateFormat')
|
||||
dateFormat = self.env['runtime']['settingsManager'].getSetting(
|
||||
'general', 'dateFormat')
|
||||
|
||||
# get the time formatted
|
||||
dateString = datetime.datetime.strftime(datetime.datetime.now(), dateFormat)
|
||||
dateString = datetime.datetime.strftime(
|
||||
datetime.datetime.now(), dateFormat)
|
||||
|
||||
# present the time via speak and braile, there is no soundicon, interrupt the current speech
|
||||
self.env['runtime']['outputManager'].presentText(dateString , soundIcon='', interrupt=True)
|
||||
# present the time via speak and braile, there is no soundicon,
|
||||
# interrupt the current speech
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
dateString, soundIcon='', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -5,20 +5,26 @@
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.keyMakro = [[1, 'KEY_LEFTCTRL'], [1, 'KEY_G'], [0.05,'sleep'] ,[0, 'KEY_G'], [0, 'KEY_LEFTCTRL']]
|
||||
self.keyMakro = [[1, 'KEY_LEFTCTRL'], [1, 'KEY_G'], [
|
||||
0.05, 'sleep'], [0, 'KEY_G'], [0, 'KEY_LEFTCTRL']]
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return 'No description found'
|
||||
return 'No description found'
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['inputManager'].sendKeys(self.keyMakro)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
@ -5,17 +5,33 @@
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.macro = [[1,'KEY_LEFTSHIFT'],[1,'KEY_LEFTCTRL'],[1,'KEY_N'],[0.05,'SLEEP'],[0,'KEY_N'],[0,'KEY_LEFTCTRL'],[0,'KEY_LEFTSHIFT']]
|
||||
self.macro = [
|
||||
[
|
||||
1, 'KEY_LEFTSHIFT'], [
|
||||
1, 'KEY_LEFTCTRL'], [
|
||||
1, 'KEY_N'], [
|
||||
0.05, 'SLEEP'], [
|
||||
0, 'KEY_N'], [
|
||||
0, 'KEY_LEFTCTRL'], [
|
||||
0, 'KEY_LEFTSHIFT']]
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return 'No description found'
|
||||
return 'No description found'
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['inputManager'].sendKeys(self.macro)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -5,16 +5,25 @@
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return 'No description found'
|
||||
return 'No description found'
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['outputManager'].presentText('ok i run open save' , interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
'ok i run open save', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -5,16 +5,25 @@
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return 'No description found'
|
||||
return 'No description found'
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['outputManager'].presentText('ok i run replace macro' , interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
'ok i run replace macro', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -5,16 +5,25 @@
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return 'No description found'
|
||||
return 'No description found'
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['outputManager'].presentText('ok i run search macro' , interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
'ok i run search macro', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -4,26 +4,36 @@
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import datetime
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return _('presents the date')
|
||||
|
||||
return _('presents the date')
|
||||
|
||||
def run(self):
|
||||
dateFormat = self.env['runtime']['settingsManager'].getSetting('general', 'dateFormat')
|
||||
dateFormat = self.env['runtime']['settingsManager'].getSetting(
|
||||
'general', 'dateFormat')
|
||||
|
||||
# get the time formatted
|
||||
dateString = datetime.datetime.strftime(datetime.datetime.now(), dateFormat)
|
||||
dateString = datetime.datetime.strftime(
|
||||
datetime.datetime.now(), dateFormat)
|
||||
|
||||
# present the time via speak and braile, there is no soundicon, interrupt the current speech
|
||||
self.env['runtime']['outputManager'].presentText(dateString , soundIcon='', interrupt=True)
|
||||
# present the time via speak and braile, there is no soundicon,
|
||||
# interrupt the current speech
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
dateString, soundIcon='', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -2,6 +2,9 @@
|
||||
# -*- encoding: utf-8
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
@ -5,16 +5,25 @@
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return 'No description found'
|
||||
return 'No description found'
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['outputManager'].presentText('ok i run open macro' , interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
'ok i run open macro', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -2,6 +2,9 @@
|
||||
# -*- encoding: utf-8
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
@ -5,16 +5,25 @@
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return 'No description found'
|
||||
return 'No description found'
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['outputManager'].presentText('ok i run replace macro' , interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
'ok i run replace macro', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -5,16 +5,25 @@
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return 'No description found'
|
||||
return 'No description found'
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['outputManager'].presentText('ok i run search macro' , interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
'ok i run search macro', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -4,26 +4,36 @@
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import datetime
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return _('presents the date')
|
||||
|
||||
return _('presents the date')
|
||||
|
||||
def run(self):
|
||||
dateFormat = self.env['runtime']['settingsManager'].getSetting('general', 'dateFormat')
|
||||
dateFormat = self.env['runtime']['settingsManager'].getSetting(
|
||||
'general', 'dateFormat')
|
||||
|
||||
# get the time formatted
|
||||
dateString = datetime.datetime.strftime(datetime.datetime.now(), dateFormat)
|
||||
dateString = datetime.datetime.strftime(
|
||||
datetime.datetime.now(), dateFormat)
|
||||
|
||||
# present the time via speak and braile, there is no soundicon, interrupt the current speech
|
||||
self.env['runtime']['outputManager'].presentText(dateString , soundIcon='', interrupt=True)
|
||||
# present the time via speak and braile, there is no soundicon,
|
||||
# interrupt the current speech
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
dateString, soundIcon='', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -5,16 +5,25 @@
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return 'No description found'
|
||||
return 'No description found'
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['outputManager'].presentText('ok i run open macro' , interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
'ok i run open macro', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -5,16 +5,25 @@
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return 'No description found'
|
||||
return 'No description found'
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['outputManager'].presentText('ok i run open save' , interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
'ok i run open save', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -5,16 +5,25 @@
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return 'No description found'
|
||||
return 'No description found'
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['outputManager'].presentText('ok i run replace macro' , interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
'ok i run replace macro', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -5,16 +5,25 @@
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return 'No description found'
|
||||
return 'No description found'
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['outputManager'].presentText('ok i run search macro' , interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
'ok i run search macro', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -4,26 +4,36 @@
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import datetime
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return _('presents the date')
|
||||
|
||||
return _('presents the date')
|
||||
|
||||
def run(self):
|
||||
dateFormat = self.env['runtime']['settingsManager'].getSetting('general', 'dateFormat')
|
||||
dateFormat = self.env['runtime']['settingsManager'].getSetting(
|
||||
'general', 'dateFormat')
|
||||
|
||||
# get the time formatted
|
||||
dateString = datetime.datetime.strftime(datetime.datetime.now(), dateFormat)
|
||||
dateString = datetime.datetime.strftime(
|
||||
datetime.datetime.now(), dateFormat)
|
||||
|
||||
# present the time via speak and braile, there is no soundicon, interrupt the current speech
|
||||
self.env['runtime']['outputManager'].presentText(dateString , soundIcon='', interrupt=True)
|
||||
# present the time via speak and braile, there is no soundicon,
|
||||
# interrupt the current speech
|
||||
self.env['runtime']['outputManager'].presentText(
|
||||
dateString, soundIcon='', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -5,9 +5,13 @@
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
# examples:
|
||||
@ -15,14 +19,18 @@ class command():
|
||||
# self.keyMakro = [[1,'KEY_LEFTSHIFT'],[1,'KEY_LEFTCTRL'],[1,'KEY_N'],[0.05,'SLEEP'],[0,'KEY_N'],[0,'KEY_LEFTCTRL'],[0,'KEY_LEFTSHIFT']]
|
||||
self.keyMakro = []
|
||||
self.byteMakro = []
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return 'No description found'
|
||||
return 'No description found'
|
||||
|
||||
def run(self):
|
||||
if self.env['runtime']['inputManager'].getShortcutType() in ['KEY']:
|
||||
self.env['runtime']['inputManager'].sendKeys(self.keyMakro)
|
||||
elif self.env['runtime']['inputManager'].getShortcutType() in ['BYTE']:
|
||||
self.env['runtime']['byteManager'].sendBytes(self.byteMakro)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
Reference in New Issue
Block a user