Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 0 additions & 55 deletions .github/Install-VCForPython27.ps1

This file was deleted.

30 changes: 0 additions & 30 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,6 @@ name: Caster Lint/Unit Tests
on: [push, pull_request]

jobs:
python-windows-2-7:
name: python 2 windows
runs-on: windows-latest
strategy:
matrix:
python-version: [2.7.x]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: 'x86'
- name: Install C++ Compiler for Python 2.7
run: .\.github\Install-VCForPython27.ps1
shell: powershell
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools
pip install wheel
pip install -U -r requirements-dev.txt
- name: Lint with pylint
run: |
pylint -E _caster.py
pylint -E castervoice
- name: Unit Tests Via Testrunner
run: |
python tests/testrunner.py

python-windows-3-8-x:
name: python 3 windows
runs-on: windows-latest
Expand Down
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ generated-members=pythoncom.*,wx.*
ignored-modules=natlink,natlinkstatus

[MASTER]
extension-pkg-whitelist=pythoncom,wx,pydevd,win32gui
extension-pkg-whitelist=pythoncom,wx,pydevd,win32gui,PySide2

[MESSAGES CONTROL]
disable=all
Expand Down
24 changes: 21 additions & 3 deletions Install_Caster_DNS-WSR.bat
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@

@echo off

SetLocal EnableDelayedExpansion
set python_version=3.8-32
set currentpath=%~dp0
echo Installation path: %currentpath%

@REM execute python launcher for python directory
FOR /F "tokens=1 USEBACKQ delims=" %%i IN (`py -%python_version% -c "import sys; print(sys.exec_prefix)"`) DO ( set python_path=%%i )

@REM whack a funny trailing character (newline?) from end
set python_path=!python_path:~0,-1!

set PATH=%python_path%;%python_path%/Scripts;%PATH%
echo %PATH%

echo Next line should clearly state python version:
python --version

echo Using this python/pip:
python -m pip -V

py -%python_version% -m pip install --upgrade pip

echo Installing Caster Dependencies for DNS/WSR
python -m pip install -r "%currentpath%requirements.txt"
py -%python_version% -m pip install -r "%currentpath%requirements.txt"

pause 1
pause 1
46 changes: 24 additions & 22 deletions _caster.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,27 @@
#! python2.7
'''
main Caster module
Created on Jun 29, 2014
'''
import six

if six.PY2:
import logging
logging.basicConfig()

import logging
import importlib
from castervoice.lib.ctrl.dependencies import DependencyMan # requires nothing
DependencyMan().initialize()

from castervoice.lib import settings # requires DependencyMan to be initialized
settings.initialize()
from dragonfly import get_engine, get_current_engine
from castervoice.lib import control
from castervoice.lib import settings
from castervoice.lib import printer
from castervoice.lib.ctrl.configure_engine import EngineConfigEarly, EngineConfigLate
from castervoice.lib.ctrl.dependencies import DependencyMan
from castervoice.lib.ctrl.updatecheck import UpdateChecker
from castervoice.asynch import hud_support

from castervoice.lib.ctrl.updatecheck import UpdateChecker # requires settings/dependencies
UpdateChecker().initialize()
printer.out("@ - Starting {} with `{}` Engine -\n".format(settings.SOFTWARE_NAME, get_engine().name))

from castervoice.lib.ctrl.configure_engine import EngineConfigEarly, EngineConfigLate
DependencyMan().initialize() # requires nothing
settings.initialize()
UpdateChecker().initialize() # requires settings/dependencies
EngineConfigEarly() # requires settings/dependencies

_NEXUS = None

from castervoice.lib import printer
from castervoice.lib import control

if control.nexus() is None: # Initialize Caster State
if control.nexus() is None:
from castervoice.lib.ctrl.mgr.loading.load.content_loader import ContentLoader
from castervoice.lib.ctrl.mgr.loading.load.content_request_generator import ContentRequestGenerator
from castervoice.lib.ctrl.mgr.loading.load.reload_fn_provider import ReloadFunctionProvider
Expand All @@ -38,9 +32,17 @@
_content_loader = ContentLoader(_crg, importlib.import_module, _rp.get_reload_fn(), _sma)
control.init_nexus(_content_loader)
EngineConfigLate() # Requires grammars to be loaded and nexus

if settings.SETTINGS["sikuli"]["enabled"]:
from castervoice.asynch.sikuli import sikuli_controller
sikuli_controller.get_instance().bootstrap_start_server_proxy()

printer.out("\n*- Starting " + settings.SOFTWARE_NAME + " -*")
try:
if get_current_engine().name != "text":
hud_support.start_hud()
except ImportError:
pass # HUD is not available

dh = printer.get_delegating_handler()
dh.register_handler(hud_support.HudPrintMessageHandler()) # After hud starts
printer.out("\n") # Force update to display text
54 changes: 24 additions & 30 deletions castervoice/asynch/hmc/h_launch.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,26 @@
from subprocess import Popen
import sys, os
import os
import subprocess
import sys

from xmlrpc.server import SimpleXMLRPCServer

try: # Style C -- may be imported into Caster, or externally
BASE_PATH = os.path.realpath(__file__).rsplit(os.path.sep + "castervoice", 1)[0]
if BASE_PATH not in sys.path:
sys.path.append(BASE_PATH)
finally:
from castervoice.asynch.hmc.hmc_ask_directory import HomunculusDirectory
from castervoice.asynch.hmc.hmc_recording import HomunculusRecording
from castervoice.asynch.hmc.hmc_confirm import HomunculusConfirm
from castervoice.asynch.hmc.homunculus import Homunculus
from castervoice.lib import settings
'''
To add a new homunculus (pop-up ui window) type:
(1) create the module
(2) and its type and title constants to settings.py
(3) add it to _get_title(), and "if __name__ == '__main__':" in this module
(4) call launch() from this module with its type and any data it needs (data as a single string with no spaces)
'''


def launch(hmc_type, data=None):
from dragonfly import (WaitWindow, FocusWindow, Key)
instructions = _get_instructions(hmc_type)
if data is not None: # and callback!=None:
if data is not None:
instructions.append(data)
Popen(instructions)

subprocess.Popen(instructions)
hmc_title = _get_title(hmc_type)
WaitWindow(title=hmc_title, timeout=5).execute()
FocusWindow(title=hmc_title).execute()
Key("tab").execute()


def _get_instructions(hmc_type):
Expand Down Expand Up @@ -61,17 +51,21 @@ def _get_title(hmc_type):
return default


def main():
import PySide2.QtWidgets
from castervoice.asynch.hmc.homunculus import Homunculus
from castervoice.lib.merge.communication import Communicator
server_address = (Communicator.LOCALHOST, Communicator().com_registry["hmc"])
# Enabled by default logging causes RPC to malfunction when the GUI runs on
# pythonw. Explicitly disable logging for the XML server.
server = SimpleXMLRPCServer(server_address, logRequests=False, allow_none=True)
app = PySide2.QtWidgets.QApplication(sys.argv)
window = Homunculus(server, sys.argv)
window.show()
exit_code = app.exec_()
server.shutdown()
sys.exit(exit_code)


if __name__ == '__main__':
found_word = None
if len(sys.argv) > 2:
found_word = sys.argv[2]
if sys.argv[1] == settings.QTYPE_DEFAULT:
app = Homunculus(sys.argv[1])
elif sys.argv[1] == settings.QTYPE_RECORDING:
app = HomunculusRecording([settings.QTYPE_RECORDING, found_word])
elif sys.argv[1] == settings.QTYPE_INSTRUCTIONS:
app = Homunculus(sys.argv[1], sys.argv[2])
elif sys.argv[1] == settings.QTYPE_DIRECTORY:
app = HomunculusDirectory(sys.argv[1])
elif sys.argv[1] == settings.QTYPE_CONFIRM:
app = HomunculusConfirm([sys.argv[1], sys.argv[2]])
main()
12 changes: 4 additions & 8 deletions castervoice/asynch/hmc/hmc_ask_directory.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
import six
if six.PY2:
from Tkinter import Label, Entry, StringVar # pylint: disable=import-error
import tkFileDialog # pylint: disable=import-error
else:
from tkinter import Label, Entry, StringVar, filedialog as tkFileDialog
import os
import sys
from threading import Timer
from tkinter import Entry, Label, StringVar
from tkinter import filedialog as tkFileDialog

try: # Style C -- may be imported into Caster, or externally
BASE_PATH = os.path.realpath(__file__).rsplit(os.path.sep + "castervoice", 1)[0]
if BASE_PATH not in sys.path:
sys.path.append(BASE_PATH)
finally:
from castervoice.lib import settings
from castervoice.asynch.hmc.homunculus import Homunculus
from castervoice.lib import settings


class HomunculusDirectory(Homunculus):
def __init__(self, params):
Homunculus.__init__(self, params[0])
Homunculus.__init__(self, params[0], args=None)
self.title(settings.HOMUNCULUS_VERSION + settings.HMC_TITLE_DIRECTORY)

self.geometry("640x50+" + str(int(self.winfo_screenwidth()/2 - 320)) + "+" +
Expand Down
8 changes: 2 additions & 6 deletions castervoice/asynch/hmc/hmc_confirm.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import six
if six.PY2:
from Tkinter import Label # pylint: disable=import-error
else:
from tkinter import Label
from tkinter import Label
import os
import sys
from threading import Timer
Expand All @@ -18,7 +14,7 @@

class HomunculusConfirm(Homunculus):
def __init__(self, params):
Homunculus.__init__(self, params[0])
Homunculus.__init__(self, params[0], args=None)
self.title(settings.HOMUNCULUS_VERSION + settings.HMC_TITLE_CONFIRM)

self.geometry("320x50+" + str(int(self.winfo_screenwidth()/2 - 160)) + "+" +
Expand Down
11 changes: 3 additions & 8 deletions castervoice/asynch/hmc/hmc_recording.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import sys, os
from threading import Timer

import six
if six.PY2:
from Tkinter import Label, Entry, Checkbutton # pylint: disable=import-error
import Tkinter as tk # pylint: disable=import-error
else:
from tkinter import Label, Entry, Checkbutton
import tkinter as tk
from tkinter import Label, Entry, Checkbutton
import tkinter as tk

try: # Style C -- may be imported into Caster, or externally
BASE_PATH = os.path.realpath(__file__).rsplit(os.path.sep + "castervoice", 1)[0]
Expand All @@ -26,7 +21,7 @@ def get_row(self, cut_off=0):

def __init__(self, params):
self.grid_row = 0
Homunculus.__init__(self, params[0])
Homunculus.__init__(self, params[0], args=None)
self.title(settings.HOMUNCULUS_VERSION + settings.HMC_TITLE_RECORDING)

self.geometry("640x480+" + str(int(self.winfo_screenwidth()/2 - 320)) + "+" +
Expand Down
Loading