Erster Commit: nativer Linux-Port aus macOS-Bytecode
Läuft die Voice Acoustic VA-Remotecontrol (AllDSP AllControl) nativ unter Linux auf echtem wxGTK 3.0 — ohne Wine und ohne dekompilierten App-Code. Ausgeführt wird das unveränderte Python-2.7-Bytecode aus dem macOS-.app; C-Extensions (wxGTK/numpy/ scipy/PortAudio) kommen nativ aus Debian stretch. Enthält: va/ (Original-.pyc + pure-Python-Libs + Assets + launch.py mit den drei Linux-Fixes), Dockerfile/run.sh/entrypoint.sh, reference/ (dekompilierter Quellcode zum Debuggen) und README/STATUS. img.cache (378 MB, regenerierbar) ist per .gitignore ausgeschlossen. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@@ -0,0 +1,15 @@
|
||||
# Generierte Skin-Bitmap-Caches (werden aus den SVGs neu erzeugt, ~378 MB)
|
||||
**/img.cache
|
||||
**/img.cache.zip
|
||||
|
||||
# GIMP-Editing-Quellen (nicht Laufzeit)
|
||||
**/*.xcf
|
||||
|
||||
# Python
|
||||
**/*.pyo
|
||||
__pycache__/
|
||||
|
||||
# App-Laufzeitdaten / Logs
|
||||
Voice_Acoustic/
|
||||
*.dfl
|
||||
*.log
|
||||
@@ -0,0 +1,46 @@
|
||||
# VA-Remotecontrol NATIV auf Linux (kein Wine) — aus ORIGINAL-macOS-Bytecode.
|
||||
#
|
||||
# Kernidee: die App-Module (one_unit, child_unit, ...) liegen im macOS-.app als
|
||||
# UNVERAENDERTES Python-2.7-Bytecode vor. CPython-Bytecode ist OS-unabhaengig,
|
||||
# laeuft also direkt auf einem Linux-CPython-2.7 — KEINE Dekompilierung noetig.
|
||||
# Nur die C-Extensions kommen nativ aus dem Distro (wxGTK3, numpy, scipy, ...).
|
||||
#
|
||||
# macOS-Build nutzt wxPython 3.0.3 (Classic) -> Linux-Pendant: python-wxgtk3.0
|
||||
# (wxPython 3.0.2) aus Debian stretch. Stretch ist EOL -> archive.debian.org.
|
||||
# Muss auf einer Maschine gebaut werden, die archive.debian.org erreicht.
|
||||
FROM debian:stretch
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# stretch ist EOL -> Paketquellen auf archive.debian.org umbiegen.
|
||||
# [trusted=yes] = Signaturpruefung aus (Release-Key ist abgelaufen/fehlt im
|
||||
# Base-Keyring -> sonst exit 100). Check-Valid-Until aus = abgelaufenes Release ok.
|
||||
# WICHTIG: debian-security MUSS mit rein - das Base-Image hat security-gepatchte
|
||||
# Libs (z.B. libnettle6 ...deb9u1); ohne stretch/updates findet apt die passenden
|
||||
# libhogweed4/libgnutls30/libcups2 (deb9u1) nicht -> "held broken packages".
|
||||
RUN { echo 'deb [trusted=yes] http://archive.debian.org/debian stretch main contrib'; \
|
||||
echo 'deb [trusted=yes] http://archive.debian.org/debian-security stretch/updates main'; \
|
||||
} > /etc/apt/sources.list && \
|
||||
echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99no-check-valid && \
|
||||
apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
python-wxgtk3.0 \
|
||||
python-numpy \
|
||||
python-scipy \
|
||||
python-serial \
|
||||
python-pyaudio \
|
||||
python-imaging \
|
||||
xauth \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# App-Baum: ORIGINAL Mac-.pyc (App + pure-Python-Libs) + Assets + Linux-win32-Stubs
|
||||
COPY va /opt/va
|
||||
|
||||
# Nicht als root laufen
|
||||
RUN useradd -m app && chown -R app /opt/va
|
||||
USER app
|
||||
ENV HOME=/home/app
|
||||
|
||||
WORKDIR /opt/va
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
|
||||
@@ -0,0 +1,104 @@
|
||||
# VA-Control for Linux
|
||||
|
||||
Nativer Linux-Port der **Voice Acoustic VA-Remotecontrol** (technisch = *AllDSP „AllControl"
|
||||
DSP-Software*) zur Fernsteuerung/Konfiguration der DSP-Verstärker (HDSP-Serie, Paveosub-…sp,
|
||||
Venia-…sp, PAV115sp …).
|
||||
|
||||
**Kein Wine. Kein dekompilierter App-Code.** Es läuft das **unveränderte, originale
|
||||
Python-2.7-Bytecode aus dem macOS-`.app`** direkt auf einem Linux-CPython-2.7 mit nativem
|
||||
wxGTK/numpy/scipy.
|
||||
|
||||

|
||||
|
||||
## Warum dieser Weg
|
||||
|
||||
CPython-**Bytecode ist plattformunabhängig** — er hängt nur an der Python-*Version* (2.7), nicht
|
||||
am Betriebssystem. Das macOS-Bundle liefert die App-Module (`one_unit`, `child_unit`, …) als
|
||||
originale `.pyc`. Die laufen unter Linux direkt weiter; nur die C-Extensions (wxWidgets, numpy,
|
||||
scipy, PortAudio) kommen nativ aus dem Distro.
|
||||
|
||||
Das umgeht beide Sackgassen der bisherigen Versuche:
|
||||
- **Wine** rendert die App nur als schwarzes Fenster (wxWidgets/`CreateActCtx`-Probleme).
|
||||
- Ein **dekompilierter** Port scheiterte, weil `one_unit`/`child_unit` (Py2.6-Bytecode) sich nicht
|
||||
sauber dekompilieren lassen — und geratener Code, der echte Limiter/Verstärker steuert, ist ein
|
||||
No-Go. Hier läuft **korrektes Original-Bytecode**, kein Rateanteil.
|
||||
|
||||
## Voraussetzungen
|
||||
|
||||
- Docker (oder Podman)
|
||||
- Ein X11-/Wayland-Desktop (für die GUI)
|
||||
- Zugang zu `archive.debian.org` beim Build (Debian stretch ist EOL)
|
||||
|
||||
## Build
|
||||
|
||||
```bash
|
||||
docker build -t va-remotecontrol:native-mac .
|
||||
```
|
||||
|
||||
Das Image basiert auf **Debian stretch** (letzte Distribution mit `python-wxgtk3.0` für Python 2)
|
||||
und installiert wxGTK 3.0, numpy, scipy, pyserial, pyaudio, PIL aus dem Archiv.
|
||||
|
||||
## Start
|
||||
|
||||
```bash
|
||||
./run.sh # GUI + Ethernet-Amps (Host-Netz)
|
||||
SERIAL_DEV=/dev/ttyUSB0 ./run.sh # zusätzlich seriell/COM
|
||||
NET=bridge ./run.sh # ohne Host-Netz (keine LAN-Amps)
|
||||
```
|
||||
|
||||
`run.sh` gibt das Host-X11 frei, setzt `--ipc=host` (gegen X-SHM-Fehler unter XWayland) und reicht
|
||||
optional den seriellen Port durch.
|
||||
|
||||
## Verbindung zu den Verstärkern
|
||||
|
||||
Die App spricht die DSPs über **Ethernet** oder **seriellen COM-Port** an:
|
||||
|
||||
- **Ethernet (empfohlen):** `run.sh` nutzt `--network host`, d. h. das Container erreicht dein LAN
|
||||
direkt (auch UDP-Discovery/Broadcast). In der App die Netzwerk-/Ethernet-Verbindung wählen.
|
||||
- **USB/seriell:** Die USB-Auto-Erkennung nutzt Windows-WMI (auf Linux gestubbt → leer). Gerät als
|
||||
COM-Port durchreichen (`SERIAL_DEV=/dev/ttyUSB0`) und in der App den Port **manuell** wählen.
|
||||
|
||||
## Die Linux-Fixes (in `va/launch.py`, non-invasiv — kein Bytecode-Patch)
|
||||
|
||||
Der Start läuft über `va/launch.py` statt über den macOS-py2app-Bootstrap. Dort sitzen drei kleine
|
||||
Kompatibilitäts-Fixes, weil die App Linux (`os.name='posix'`) wie einen **Mac** behandelt
|
||||
(`mac_names='posix'`):
|
||||
|
||||
1. **`platform.version()`** beginnt unter Linux mit `#…` → `int('#')` in einer Windows-
|
||||
Versionsprüfung crasht (und deaktiviert dabei RTA). Wird auf einen Windows-artigen String
|
||||
gemappt.
|
||||
2. **wx-Assertions → `SUPPRESS`**: diese wxGTK-Build wirft C++-Assertions als Python-Exceptions;
|
||||
sonst crasht wxPythons eigenes `flatmenu`. Auf Release-/Mac-wx sind sie unterdrückt.
|
||||
3. **`my_MenuBar.left_down`**: wird nur im Nicht-Mac-Zweig gesetzt → Klassen-Default ergänzt.
|
||||
|
||||
## Bekannte Punkte
|
||||
|
||||
- **Fader lassen sich nicht ziehen?** Die SVG-Regler haben einen Mac- und einen Windows-
|
||||
Koordinatenpfad; Linux nimmt fälschlich den Mac-Pfad (Y gespiegelt/versetzt). **Experimentell:**
|
||||
mit `VA_SVG_WINPATH=1 ./run.sh` erzwingt man den Windows-Pfad. Siehe `STATUS.md`.
|
||||
- **RTA-Messung (Mikrofon)** braucht Audio-Durchreichung (ALSA/Pulse) in den Container.
|
||||
- **`img.cache`** (vor-gerenderte Skin-Bitmaps) ist **nicht** im Repo — die App rendert aus den
|
||||
vorhandenen SVGs und baut den Cache bei Bedarf neu (siehe `.gitignore`).
|
||||
|
||||
## Aufbau
|
||||
|
||||
```
|
||||
va/ Lauffähiger App-Baum: Original-macOS-.pyc + pure-Python-Libs + Assets
|
||||
launch.py Start-Wrapper mit den Linux-Fixes
|
||||
one_unit.pyc … App-Module (Original-Bytecode, Python 2.7)
|
||||
win32*.py … Linux-Stubs für die wenigen Windows-APIs
|
||||
skins/ dfi/ … SVG-Bedienpanels, Geräte-Layouts, Factory-Presets, Sprachen
|
||||
Dockerfile Debian stretch + wxGTK3.0/numpy/scipy/… via archive.debian.org
|
||||
run.sh Start mit X11 + Netz + optional seriell
|
||||
entrypoint.sh Container-Entrypoint
|
||||
reference/ Dekompilierter Quellcode (nur zum Lesen/Debuggen) + ARCHITEKTUR.md
|
||||
```
|
||||
|
||||
## Herkunft
|
||||
|
||||
Der `va/`-Baum stammt aus `Voice Acoustic VA-Remotecontrol.app` (macOS, Version 4.0.1, py2app,
|
||||
Python 2.7.10, wxPython 3.0.3). Nur die reinen `.pyc` (App + pure-Python-Libs) wurden übernommen;
|
||||
die macOS-`.so`/`.dylib` wurden weggelassen und durch native Linux-Builds ersetzt.
|
||||
|
||||
`reference/decompiled/` enthält den aus dem **Windows**-Build (Py2.6) dekompilierten Quellcode —
|
||||
funktional dieselbe App, unverzichtbar zum Debuggen der `.pyc` (z. B. der Fader-Analyse oben).
|
||||
@@ -0,0 +1,30 @@
|
||||
# Nativer Linux-Port aus macOS-Bytecode — Stand: ✅ LÄUFT
|
||||
|
||||
## Verifiziert (headless auf echtem Xorg)
|
||||
- **Image baut sauber** (Debian stretch via archive.debian.org + debian-security).
|
||||
- **App startet nativ** aus Original-macOS-Bytecode, **ohne Wine**: wx 3.0.2 (gtk2 classic),
|
||||
numpy 1.12.1, scipy 0.18.1 laden, one_unit/child_unit laufen als Original-`.pyc`.
|
||||
- **GUI rendert korrekt** (Menü File/Tools/Help, Status-Icons, „All Units (0 units online)",
|
||||
Voice-Acoustic-Logo) — siehe `screenshot-native.png`. **Kein schwarzer Wine-Screen.**
|
||||
- **Log ist sauber** — keine Tracebacks (nur eine harmlose wxPyDeprecationWarning).
|
||||
|
||||
Getestet mit Xorg **dummy**-Treiber (liefert VidMode/RandR) im Container; **Xvfb geht NICHT**,
|
||||
weil es die XFree86-VidMode-Extension nicht hat und wx 3.0 dann bei `wxDisplay.GetCurrentMode()`
|
||||
crasht — reines Test-Artefakt, auf echtem Display irrelevant.
|
||||
|
||||
## Drei Linux-Fixes in `va/launch.py` (non-invasiv, KEIN Bytecode-Patch)
|
||||
1. **`platform.version()`** unter Linux beginnt mit `#…` → `int('#')` in einer Windows-
|
||||
Versionsprüfung (`one_unit.start()`) crasht und deaktiviert dabei RTA. Fix: Windows-artigen
|
||||
String liefern → Prüfung läuft durch, RTA bleibt aktiv.
|
||||
2. **wx-Assertions → SUPPRESS**: diese wxGTK-Build wirft C++-Assertions als Python-Exceptions
|
||||
(Default). `one_unit.app.SetAssertMode(wx.PYAPP_ASSERT_SUPPRESS)` = Release-/Mac-Verhalten;
|
||||
sonst crasht `flatmenu.DrawMenuBar` an einer transienten negativen Bitmapgröße.
|
||||
3. **`my_MenuBar.left_down`**: wird nur im Nicht-Mac-Zweig von `__init__` gesetzt (Linux läuft
|
||||
als „mac", `mac_names='posix'`), `OnPaint` braucht es aber → Klassen-Default `= False`.
|
||||
|
||||
## Noch offen (braucht deine Maschine)
|
||||
- **Realer Lauf auf dem Desktop** via `./run.sh` (X11/XWayland) — sollte laut Headless-Test
|
||||
direkt gehen; GDK_BACKEND=x11 + `--ipc=host` sind gesetzt.
|
||||
- **Geräteanbindung** ungetestet mangels Amp: Ethernet (Host-Netz) oder seriell/COM
|
||||
(`SERIAL_DEV=/dev/ttyUSB0`). Discovery/Protokoll laufen als Original-Bytecode.
|
||||
- **RTA-Mikrofon**: braucht Audio-Durchreichung (ALSA/Pulse) in den Container.
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
# Startet die native VA-Remotecontrol aus Original-macOS-Bytecode (Python 2.7 + wxGTK 3.0).
|
||||
cd /opt/va
|
||||
|
||||
# Seriellen Port (falls durchgereicht) - die App nutzt pyserial direkt auf /dev/tty*
|
||||
SERIAL_DEV="${SERIAL_DEV:-/dev/ttyUSB0}"
|
||||
[ -e "$SERIAL_DEV" ] && echo "[entrypoint] serielles Geraet: $SERIAL_DEV" || \
|
||||
echo "[entrypoint] kein $SERIAL_DEV (Ethernet geht trotzdem)"
|
||||
|
||||
# wxGTK3 im Container ohne SHM-Aerger (XWayland/getrennter IPC-Namespace)
|
||||
export GDK_BACKEND=x11
|
||||
|
||||
echo "[entrypoint] starte: python launch.py"
|
||||
exec python launch.py "$@"
|
||||
@@ -0,0 +1,69 @@
|
||||
# VA-Remotecontrol — Reverse-Engineering-Notizen
|
||||
|
||||
Analyse der `Voice_Acoustic_VA-Remotecontrol_64_bit_v_4_0_1` (Stand 08/2026).
|
||||
|
||||
## Was ist das?
|
||||
Ein Rebrand der **AllDSP „AllControl" DSP-Software** zur Fernsteuerung/Konfiguration
|
||||
der DSP-Verstärker (HDSP-Serie, Paveosub-…sp, Venia-…sp, PAV115sp usw.).
|
||||
|
||||
| Merkmal | Wert |
|
||||
|---|---|
|
||||
| Sprache | **Python 2.6** (py2exe-Bundle, 32-bit) |
|
||||
| GUI | **wxPython / wxWidgets 2.8** (`wx._core_.pyd`, `wxmsw28uh_*_vc.dll`) |
|
||||
| Numerik | **numpy + scipy** (FIR-Design, RTA-Messungen, PDF-Report) |
|
||||
| Bootstrap-EXE | `VA-Remotecontrol.exe` (enthält angehängtes ZIP mit 904 `.pyc`) |
|
||||
| MSVC-Runtime | **VC++2008 / msvcr90** (nicht gebundlet → unter Wine `vcrun2008`) |
|
||||
| Lizenz-Dongle | **keiner** (`keyfile.py` = statischer Preset-Encryption-Key) |
|
||||
|
||||
## Ordner im Installat
|
||||
- `src/` — **dekompilierter App-Quellcode** (47 Module, s.u.) ← zum Analysieren
|
||||
- `pycode/` — die 904 rohen `.pyc` (App + komplette Py2.6-Standardbibliothek)
|
||||
- `*.pyd`,`*.dll`— native Extension-Module (numpy/scipy/wx/pywin32) + Python-Runtime
|
||||
- `factory/` — Werks-Presets/Firmware `.ffi` je Produkt (HDSP-3/-6, Paveosub-112/115/118/218sp, Venia-8sp, PAV115sp-8K4 …)
|
||||
- `configurations/` — DSP-Struktur-Definitionen `.cfg` + `.csv` (DPD2, DPCP88, DPD3 …)
|
||||
- `dfi/` — Geräte-/Frontplatten-Layouts `.dfi/.dfu/.dfe`
|
||||
- `skins/` — SVG-Bedienpanels (das UI wird aus SVGs aufgebaut, s. `svg_panel.py`)
|
||||
- `local/` — Sprachdateien (deutsch, english, mandarin, nederlands, polish, portuguese, spanish, …)
|
||||
- `drivers/` — Windows-USB-Treiber `adspusb.inf/.cat`
|
||||
|
||||
## Modul-Landkarte (`src/`)
|
||||
**Einstieg**
|
||||
- `main.py` → ruft `one_unit.main_application(argv).start()`
|
||||
- `one_unit.py` (3.7k Z.) — Haupt-App/Fenster; `child_unit.py`, `select_unit*` — Geräteauswahl/-instanzen
|
||||
- `countDSPs.py` — zählt/erkennt angeschlossene DSPs
|
||||
|
||||
**Kommunikation zu den Verstärkern** (der interessante Teil)
|
||||
- `d_protocol.py` — Wire-Protokoll (nutzt `struct`, `socket`, `myserial`, `zipfile`)
|
||||
- `d_usb.py` — findet USB-Geräte per **WMI**, Filter auf **`VID_0684` (= AllDSP GmbH)**, mappt auf COM-Port
|
||||
- `d_ethernet.py` — TCP/IP-Transport (`socket`)
|
||||
- `d_keepalive.py`, `d_bootloader.py` — Verbindung halten / Firmware-Flash
|
||||
- `protocol.py`, `server.py` — höhere Protokoll-/Serverschicht
|
||||
- `network_settings.py`, `network_graphical.py`, `network_customized.py` — Multi-Device-Netz
|
||||
|
||||
> **Transport = USB-Seriell (virtueller COM-Port) ODER Ethernet.** Kein FTDI-D2XX,
|
||||
> sondern klassisch über COM (`myserial` = pyserial-Wrapper).
|
||||
|
||||
**GUI / DSP-Bedienung**
|
||||
- `svg_panel.py` — rendert Bedienoberflächen aus SVG
|
||||
- `control_panel.py`, `diagram.py` (EQ/Filterkurven), `my_menu.py`, `dialog.py`, `fir_dialog.py`, `MyOGLlike.py` (OpenGL-Canvas)
|
||||
- `user_config_*.py` — die einzelnen DSP-Blöcke: `audio, dc, display, keys, leds, model, network, tcs, timer, various, vu`
|
||||
- `rta_measurements.py` (Echtzeit-Analyzer, nutzt PortAudio/`pyaudio`), `record.py`, `makePDF.py`
|
||||
|
||||
**Daten**
|
||||
- `data_model.py`, `definitions.py` — Datenmodell / Konstanten (STRUCT_ID_GAIN/DELAY/LPF/HPF/PEQ/LIMITER/…)
|
||||
- `keyfile.py` — **nur** `preset_encryption_key` (Presets sind verschlüsselt; keine Lizenzprüfung)
|
||||
|
||||
## Für Linux/Docker relevante Stolpersteine
|
||||
1. **Crypto:** Py2.6 `random.seed()` → `os.urandom` → Windows-CryptoAPI. Im Wine-Prefix
|
||||
muss `rsaenh.dll` registriert sein (`regsvr32 rsaenh.dll`), sonst Crash `0x80090017`.
|
||||
→ ist im Docker-Image gefixt.
|
||||
2. **USB-Erkennung via WMI** (`d_usb.ListUSBDevices`, `Win32_USBControllerDevice`): funktioniert
|
||||
unter Wine praktisch nicht. → Gerät stattdessen als **COM-Port** durchreichen
|
||||
(`/dev/ttyUSB0` → `dosdevices/com1`) und in der App den COM-Port **manuell** wählen,
|
||||
oder die **Ethernet-Anbindung** nutzen (umgeht das USB/WMI-Problem komplett).
|
||||
3. **RTA-Messung** braucht Audio-I/O (PortAudio) — im Container nur mit ALSA/Pulse-Durchreichung.
|
||||
|
||||
## Wie der Quellcode entstand
|
||||
- `.pyc` aus dem an `VA-Remotecontrol.exe` angehängten ZIP extrahiert.
|
||||
- Dekompiliert mit **uncompyle6** (42 Module); die 5 komplexeren mit **pycdc/Decompyle++**
|
||||
(Kopf-Kommentar „NOTE: mit pycdc…" → dort ggf. kleinere Ungenauigkeiten prüfen).
|
||||
@@ -0,0 +1,806 @@
|
||||
# Source Generated with Decompyle++
|
||||
# File: child_unit.pyc (Python 2.6)
|
||||
|
||||
if __name__ == '__main__':
|
||||
import main
|
||||
main.run()
|
||||
|
||||
import mytime
|
||||
import ConfigParser
|
||||
import os.path as os
|
||||
import sys
|
||||
import marshal
|
||||
import cPickle
|
||||
import wx
|
||||
import datetime
|
||||
import control_panel
|
||||
import svg_panel
|
||||
import data_model
|
||||
import countDSPs
|
||||
import threading
|
||||
import svg
|
||||
import svg.document as svg
|
||||
import traceback
|
||||
import future
|
||||
import protocol
|
||||
import main
|
||||
import dialog
|
||||
import base64
|
||||
import StringIO
|
||||
import tempfile
|
||||
import math
|
||||
import socket
|
||||
import server
|
||||
import shutil
|
||||
import d_protocol
|
||||
from tetris.TetrisGame import TetrisGame
|
||||
import zipfile
|
||||
import one_unit
|
||||
import string
|
||||
import my_menu
|
||||
import inspect
|
||||
from definitions import *
|
||||
default_encryption_key = 'nvbhfwieahscoiuafnrakjdfhaskjdhvlskdjncailsuydkdfjnalsuvhesrioiclioswoqweymdpwkxmnakcnxenwoawkomoqxsojdinoskdcmskjdfmaxkjnsdcjkndlkscntnvlakjsbxnlkjdbhvkjdgnlfcusxnl'
|
||||
dspArchitectures = {
|
||||
'1.9.16': 'MK2.1',
|
||||
'1.9.31': 'MK2.2',
|
||||
'1.10.16': 'MK2.2',
|
||||
'1.10.18': 'MK2.1',
|
||||
'1.10.30': 'MK2.2',
|
||||
'1.10.31': 'MK2.3',
|
||||
'1.10.37': 'MK2.1',
|
||||
'1.10.51': 'MK2.1',
|
||||
'1.10.65': 'MK3.1',
|
||||
'1.10.66': 'MK3.1',
|
||||
'1.10.67': 'MK3.1',
|
||||
'1.11.16': 'MK2.3',
|
||||
'1.11.30': 'MK2.2',
|
||||
'1.11.31': 'MK2.5',
|
||||
'1.11.37': 'MK2.1',
|
||||
'18.20.71': 'MK2.1',
|
||||
'54.1.1': 'MK2.2',
|
||||
'54.10.51': 'MK2.1' }
|
||||
|
||||
def Key(*args):
|
||||
return data_model.Key(*args)
|
||||
|
||||
|
||||
def getString(str):
|
||||
return one_unit.getString(str)
|
||||
|
||||
if os.name in mac_names:
|
||||
newline = '\n'
|
||||
else:
|
||||
newline = '\r\n'
|
||||
|
||||
class logPanel(wx.Frame):
|
||||
|
||||
def __init__(self, parent):
|
||||
|
||||
try:
|
||||
title = 'Hardware Log for ' + parent.active_unit.name.strip()
|
||||
except:
|
||||
title = 'Hardware Log'
|
||||
|
||||
wx.Frame.__init__(self, None, -1, title = title, size = (800, 430))
|
||||
self.title = title
|
||||
self.parent = parent
|
||||
self.pdfDataSet = { }
|
||||
self.isTCS = self.parent.isTCS
|
||||
self.isZwembad = False
|
||||
if self.parent.active_unit.name.lower().find('zwembad') >= 0:
|
||||
self.isZwembad = True
|
||||
|
||||
tempP = wx.Panel(self)
|
||||
if os.name in mac_names:
|
||||
ph = 30
|
||||
else:
|
||||
ph = 10
|
||||
wx.StaticText(tempP, -1, 'Fetching Data...', pos = (10, 10))
|
||||
alkey = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_ACTIVITY_LOG, 0, 0)
|
||||
parent.remote_link.set_get_key(alkey)
|
||||
|
||||
try:
|
||||
self.SetPosition(parent.lastLogPosition)
|
||||
except:
|
||||
pass
|
||||
|
||||
self.Show(True)
|
||||
one_unit.tryYield()
|
||||
parent.waitForSync('cu.lP', key = alkey)
|
||||
if parent.active_unit.MAC not in one_unit.app.unitLogs:
|
||||
wx.StaticText(tempP, -1, 'No available data.', pos = (10, 10))
|
||||
return None
|
||||
tempP.Destroy()
|
||||
self.p = wx.Panel(self, size = (800, 400 + ph))
|
||||
self.nb = wx.Notebook(self.p, size = (800, 370 + ph))
|
||||
self.signalLevelPanel = wx.Panel(self.nb)
|
||||
self.signalLevelPanel.Bind(wx.EVT_PAINT, self.OnPaintSignalLevel)
|
||||
if self.isTCS:
|
||||
if self.isZwembad:
|
||||
self.nb.AddPage(self.signalLevelPanel, 'Zwembad')
|
||||
else:
|
||||
self.nb.AddPage(self.signalLevelPanel, 'CO2 Level')
|
||||
else:
|
||||
self.nb.AddPage(self.signalLevelPanel, 'Input Signal Level')
|
||||
self.gainReductionPanel = wx.Panel(self.nb)
|
||||
self.gainReductionPanel.Bind(wx.EVT_PAINT, self.OnPaintGainReduction)
|
||||
if self.isTCS:
|
||||
if self.isZwembad:
|
||||
self.nb.AddPage(self.gainReductionPanel, 'Lucht')
|
||||
else:
|
||||
self.nb.AddPage(self.gainReductionPanel, 'Pressure Change')
|
||||
else:
|
||||
self.nb.AddPage(self.gainReductionPanel, 'Output Gain Reduction')
|
||||
self.temperaturePanel = wx.Panel(self.nb)
|
||||
self.temperaturePanel.Bind(wx.EVT_PAINT, self.OnPaintTemperature)
|
||||
if self.isZwembad:
|
||||
self.nb.AddPage(self.temperaturePanel, 'Verwarming')
|
||||
else:
|
||||
self.nb.AddPage(self.temperaturePanel, 'Temperature')
|
||||
self.messagesPanel = wx.Panel(self.nb)
|
||||
self.nb.AddPage(self.messagesPanel, 'Messages')
|
||||
(self.w, self.h) = self.GetSize()
|
||||
self.bw = 10
|
||||
self.msgLabels = { }
|
||||
self.writeMessages()
|
||||
if one_unit.app.mijnpc == True:
|
||||
self.resetLogButton = wx.Button(self.p, -1, 'Clear', pos = (5, 373 + ph))
|
||||
self.Bind(wx.EVT_BUTTON, self.onClear, self.resetLogButton)
|
||||
|
||||
self.refreshLogButton = wx.Button(self.p, -1, 'Refresh', pos = (705, 373 + ph))
|
||||
self.Bind(wx.EVT_BUTTON, self.onRefresh, self.refreshLogButton)
|
||||
self.exportLogButton = wx.Button(self.p, -1, 'Export', pos = (620, 373 + ph))
|
||||
self.Bind(wx.EVT_BUTTON, self.onExport, self.exportLogButton)
|
||||
self.SetSize((800, 450))
|
||||
self.parent.lastLogPosition = self.GetPosition()
|
||||
|
||||
try:
|
||||
self.nb.SetSelection(self.parent.lastLogPage)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
def onExport(self, e):
|
||||
print mytime.displayTime(), 'export'
|
||||
dlg = wx.FileDialog(self, message = 'Save as....', defaultDir = one_unit.app.library_path, defaultFile = self.title + '.pdf', style = wx.SAVE | wx.CHANGE_DIR)
|
||||
if dlg.ShowModal() == wx.ID_OK:
|
||||
filename = dlg.GetPath()
|
||||
if filename[-4:] not in ('.pdf',):
|
||||
filename += '.txt'
|
||||
|
||||
one_unit.app.library_path = os.path.split(filename)[0]
|
||||
dlg.Destroy()
|
||||
else:
|
||||
dlg.Destroy()
|
||||
return None
|
||||
print (dlg.ShowModal() == wx.ID_OK).displayTime(), 'cu.Saving Log to', filename
|
||||
localtime = localtime
|
||||
strftime = strftime
|
||||
import time
|
||||
timeString = strftime('%a, %d %b %Y %H:%M:%S', localtime())
|
||||
import makePDF
|
||||
res = makePDF.MyPDF(headerText = self.title + ' (MAC: ' + self.parent.active_unit.MAC + ') ' + timeString)
|
||||
res.reset()
|
||||
res.add_page()
|
||||
res.set_font('Arial', size = 9)
|
||||
for category in sorted(self.pdfDataSet.keys()):
|
||||
if category == 'Messages':
|
||||
continue
|
||||
|
||||
dataSet = self.pdfDataSet[category]
|
||||
for line in dataSet:
|
||||
res.multi_cell(400, 4, txt = line, align = 'L')
|
||||
|
||||
|
||||
dataSet = self.pdfDataSet['Messages']
|
||||
for line in dataSet:
|
||||
res.multi_cell(400, 4, txt = line, align = 'L')
|
||||
|
||||
res.output(filename)
|
||||
res.close()
|
||||
|
||||
|
||||
def onRefresh(self, e):
|
||||
self.parent.lastLogPosition = self.GetPosition()
|
||||
self.parent.lastLogPage = self.nb.GetSelection()
|
||||
wx.CallAfter(self.parent.showHardwareLog)
|
||||
self.Destroy()
|
||||
|
||||
|
||||
def onClear(self, e):
|
||||
dlgMessage = getString('dlm')
|
||||
dlgTitle = getString('hl')
|
||||
res = wx.MessageBox(dlgMessage, dlgTitle, wx.OK | wx.CANCEL)
|
||||
if res != wx.OK:
|
||||
return None
|
||||
key = data_model.Key(protocol.STRUCT_ID_COMMAND, protocol.MEMBER_ID_COMMAND, 0, protocol.cmdResetLog)
|
||||
self.parent.set_value(key, 1)
|
||||
mytime.sleep(1)
|
||||
self.parent.set_value(key, 0)
|
||||
|
||||
|
||||
def writeMessages(self):
|
||||
self.pdfDataSet['Messages'] = []
|
||||
self.pdfDataSet['Messages'].append('')
|
||||
self.pdfDataSet['Messages'].append('Status Messages:')
|
||||
|
||||
try:
|
||||
log = one_unit.app.unitLogs[self.parent.active_unit.MAC]
|
||||
data = { }
|
||||
minutes = None
|
||||
hour = None
|
||||
hours = None
|
||||
days = None
|
||||
i = 0
|
||||
for logEntry in log['6 minute']:
|
||||
data[i] = logEntry
|
||||
i += 1
|
||||
|
||||
minutes = i
|
||||
for logEntry in log['1 hour']:
|
||||
data[i] = logEntry
|
||||
i += 1
|
||||
|
||||
hour = i
|
||||
for logEntry in log['16 hour']:
|
||||
data[i] = logEntry
|
||||
i += 1
|
||||
|
||||
hours = i
|
||||
for logEntry in log['10 day']:
|
||||
data[i] = logEntry
|
||||
i += 1
|
||||
|
||||
days = i
|
||||
except:
|
||||
print mytime.displayTime(), 'ou.lp.opsl No data'
|
||||
traceback.print_exc(file = sys.stdout)
|
||||
return None
|
||||
|
||||
line = 0
|
||||
lastMessage = ''
|
||||
for t in data:
|
||||
res = data[t]
|
||||
timeString = str((1 + t) * 6) + ' minutes ago'
|
||||
if t >= minutes and t < hour:
|
||||
timeString = str(1 + t - minutes) + ' hours ago'
|
||||
|
||||
if t >= hour and t < hours:
|
||||
timeString = str(int((1 + t - hour) * 16 / 24)) + ' days ago'
|
||||
|
||||
if t >= hours:
|
||||
timeString = str((1 + t - hours) * 10) + ' days ago'
|
||||
|
||||
lastMessage = text
|
||||
if os.name in mac_names:
|
||||
splitLimit = 120
|
||||
else:
|
||||
splitLimit = 150
|
||||
if len(text) > splitLimit:
|
||||
while len(text) > splitLimit:
|
||||
pos = text.find(',', splitLimit - 30)
|
||||
text1 = text[:pos + 1]
|
||||
text = ' ' + text[pos + 2:]
|
||||
self.msgLabels[line] = wx.StaticText(self.messagesPanel, -1, text1, pos = (10, 10 + line * 20))
|
||||
self.pdfDataSet['Messages'].append(text1)
|
||||
line += 1
|
||||
self.msgLabels[line] = wx.StaticText(self.messagesPanel, -1, text, pos = (10, 10 + line * 20))
|
||||
self.pdfDataSet['Messages'].append(text)
|
||||
line += 1
|
||||
continue
|
||||
self.msgLabels[line] = wx.StaticText(self.messagesPanel, -1, text, pos = (10, 10 + line * 20))
|
||||
self.pdfDataSet['Messages'].append(text)
|
||||
line += 1
|
||||
|
||||
if line == 0:
|
||||
print mytime.displayTime(), 'No messages'
|
||||
self.msgLabels['None'] = wx.StaticText(self.messagesPanel, -1, 'No messages.', pos = (10, 10))
|
||||
self.pdfDataSet['Messages'].append('No Messages')
|
||||
|
||||
|
||||
|
||||
def drawScale(self, dc, low, high, unit, vlines):
|
||||
dc.SetPen(wx.Pen(wx.BLACK, 2))
|
||||
offset = 41
|
||||
dc.DrawLine(offset - 1, self.h - 100, self.w - 30, self.h - 100)
|
||||
dc.DrawLine(offset - 1, 20, offset - 1, self.h - 100)
|
||||
dc.SetTextForeground(wx.BLACK)
|
||||
if os.name in mac_names:
|
||||
dc.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.NORMAL))
|
||||
else:
|
||||
dc.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL))
|
||||
if self.isTCS:
|
||||
dc.DrawText('hours', 30, self.h - 93)
|
||||
else:
|
||||
dc.DrawText('minutes', 30, self.h - 93)
|
||||
(w, h) = dc.GetTextExtent(unit)
|
||||
dc.DrawText(unit, offset - 1 - w, 0)
|
||||
dc.SetPen(wx.Pen(wx.BLACK, 1))
|
||||
scale = (self.h - 120) / vlines
|
||||
notch = (high - low) / vlines
|
||||
for i in range(vlines + 1):
|
||||
labelString = str(low + i * notch)
|
||||
(w, h) = dc.GetTextExtent(labelString)
|
||||
dc.DrawLine(offset - 1, self.h - 100 - i * scale, offset - 8, self.h - 100 - i * scale)
|
||||
dc.DrawText(labelString, offset - 11 - w, self.h - 100 - h / 2 - i * scale)
|
||||
|
||||
|
||||
|
||||
def drawDataSet(self, dc, data1, data2, low, high, yellow, red, unit, noPeak = False, title = ''):
|
||||
self.pdfDataSet[title] = []
|
||||
self.pdfDataSet[title].append('')
|
||||
self.pdfDataSet[title].append(title)
|
||||
|
||||
try:
|
||||
if os.name in mac_names:
|
||||
dc.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.NORMAL))
|
||||
else:
|
||||
dc.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL))
|
||||
log = one_unit.app.unitLogs[self.parent.active_unit.MAC]
|
||||
data = { }
|
||||
minutes = None
|
||||
hour = None
|
||||
hours = None
|
||||
days = None
|
||||
maxVal = -100
|
||||
maxI = 0
|
||||
i = 0
|
||||
for logEntry in log['6 minute']:
|
||||
data[i] = (logEntry[data1], logEntry[data2])
|
||||
if data[i][1] >= maxVal:
|
||||
maxVal = data[i][1]
|
||||
maxI = i
|
||||
|
||||
i += 1
|
||||
|
||||
minutes = i
|
||||
for logEntry in log['1 hour']:
|
||||
data[i] = (logEntry[data1], logEntry[data2])
|
||||
if data[i][1] >= maxVal:
|
||||
maxVal = data[i][1]
|
||||
maxI = i
|
||||
|
||||
i += 1
|
||||
|
||||
hour = i
|
||||
for logEntry in log['16 hour']:
|
||||
data[i] = (logEntry[data1], logEntry[data2])
|
||||
if data[i][1] >= maxVal:
|
||||
maxVal = data[i][1]
|
||||
maxI = i
|
||||
|
||||
i += 1
|
||||
|
||||
hours = i
|
||||
for logEntry in log['10 day']:
|
||||
data[i] = (logEntry[data1], logEntry[data2])
|
||||
if data[i][1] >= maxVal:
|
||||
maxVal = data[i][1]
|
||||
maxI = i
|
||||
|
||||
i += 1
|
||||
|
||||
days = i
|
||||
except:
|
||||
print mytime.displayTime(), 'ou.lp.opsl No data'
|
||||
traceback.print_exc(file = sys.stdout)
|
||||
return None
|
||||
|
||||
scale = (self.h - 120) / (high - low)
|
||||
offset = 41
|
||||
maxX = None
|
||||
textMinutes = 0
|
||||
textHours = 0
|
||||
textDays = 0
|
||||
for t in data:
|
||||
if t < minutes:
|
||||
if self.isTCS:
|
||||
text = str(t + 1) + ' hours ago: '
|
||||
else:
|
||||
text = str((t + 1) * 6) + ' minutes ago: '
|
||||
elif t < hour:
|
||||
if self.isTCS:
|
||||
text = str(t + 1 - minutes) + ' days ago: '
|
||||
else:
|
||||
text = str(t + 1 - minutes) + ' hours ago: '
|
||||
elif t < hours:
|
||||
if self.isTCS:
|
||||
text = str((t + 1 - hour) / 2) + ' weeks ago: '
|
||||
else:
|
||||
text = str((t + 1 - hour) / 2) + ' days ago: '
|
||||
elif t < days:
|
||||
if self.isTCS:
|
||||
text = str((t + 1 - hours) * 10) + ' weeks ago: '
|
||||
else:
|
||||
text = str((t + 1 - hours) * 10) + ' days ago: '
|
||||
|
||||
if t in (minutes, hour, hours):
|
||||
dc.SetPen(wx.Pen(wx.BLACK, 2))
|
||||
dc.DrawLine(offset + t * self.bw + 1, self.h - 85, offset + t * self.bw + 1, self.h - 100)
|
||||
|
||||
if t == minutes:
|
||||
if self.isTCS:
|
||||
dc.DrawText('days', offset + t * self.bw + 4, self.h - 93)
|
||||
else:
|
||||
dc.DrawText('hours', offset + t * self.bw + 4, self.h - 93)
|
||||
|
||||
if t == hour:
|
||||
if self.isTCS:
|
||||
dc.DrawText('weeks', offset + t * self.bw + 4, self.h - 93)
|
||||
else:
|
||||
dc.DrawText('days', offset + t * self.bw + 4, self.h - 93)
|
||||
|
||||
v = data[t][0]
|
||||
text += 'Average: ' + str(v)
|
||||
if v < low:
|
||||
v = low
|
||||
|
||||
if v > high:
|
||||
v = high
|
||||
|
||||
if v < yellow:
|
||||
dc.SetPen(wx.Pen(wx.Colour(0, 220, 0), 1))
|
||||
dc.SetBrush(wx.Brush(wx.Colour(0, 220, 0)))
|
||||
elif v < red:
|
||||
dc.SetPen(wx.Pen(wx.Colour(255, 142, 0), 1))
|
||||
dc.SetBrush(wx.Brush(wx.Colour(255, 142, 0)))
|
||||
else:
|
||||
dc.SetPen(wx.Pen(wx.RED, 1))
|
||||
dc.SetBrush(wx.Brush(wx.RED))
|
||||
v = round((v - low) * scale, 0)
|
||||
dc.DrawRectangle(offset + t * self.bw + 2, self.h - 101 - v, self.bw - 2, v)
|
||||
v = data[t][1]
|
||||
text += ', Peak: ' + str(v)
|
||||
self.pdfDataSet[title].append(text)
|
||||
if v < low:
|
||||
v = low
|
||||
|
||||
if v > high:
|
||||
v = high
|
||||
|
||||
dc.SetPen(wx.Pen(wx.BLACK, 1))
|
||||
v = (v - low) * scale
|
||||
if t == 0:
|
||||
x = offset + 1 + t * self.bw
|
||||
y = self.h - 103 - v
|
||||
|
||||
if noPeak == False:
|
||||
dc.DrawLine(offset + t * self.bw + 2, self.h - 103 - v, offset + t * self.bw + self.bw, self.h - 103 - v)
|
||||
|
||||
x = offset + 1 + t * self.bw
|
||||
y = self.h - 103 - v
|
||||
if t == maxI:
|
||||
maxX = x
|
||||
maxY = y
|
||||
|
||||
dc.SetPen(wx.Pen(wx.BLACK, 1))
|
||||
dc.DrawLine(offset + t * self.bw + 1, self.h - 95, offset + t * self.bw + 1, self.h - 100)
|
||||
textPos = offset + t * self.bw - 6
|
||||
if self.isTCS:
|
||||
if t == 6 and t < minutes:
|
||||
dc.DrawText('6', textPos, self.h - 93)
|
||||
|
||||
if t == 12 and t < minutes:
|
||||
dc.DrawText('12', textPos, self.h - 93)
|
||||
|
||||
if t == 18 and t < minutes:
|
||||
dc.DrawText('18', textPos, self.h - 93)
|
||||
|
||||
if t == 24 and t < minutes:
|
||||
dc.DrawText('24', textPos, self.h - 93)
|
||||
|
||||
if t == 30 and t < minutes:
|
||||
dc.DrawText('30', textPos, self.h - 93)
|
||||
|
||||
if t - minutes == 6 and t > minutes and t < hour:
|
||||
dc.DrawText('3', textPos, self.h - 93)
|
||||
|
||||
if t - minutes == 14 and t > minutes and t < hour:
|
||||
dc.DrawText('7', textPos, self.h - 93)
|
||||
|
||||
if t - hour == 4 and t > hour and t < hours:
|
||||
dc.DrawText('4', textPos, self.h - 93)
|
||||
|
||||
if t - hour == 8 and t > hour and t < hours:
|
||||
dc.DrawText('8', textPos, self.h - 93)
|
||||
|
||||
if t - hour == 12 and t > hour and t < hours:
|
||||
dc.DrawText('12', textPos, self.h - 93)
|
||||
|
||||
if t - hours == 1:
|
||||
dc.DrawText('15', textPos, self.h - 93)
|
||||
|
||||
if t - hours == 3:
|
||||
dc.DrawText('45', textPos, self.h - 93)
|
||||
|
||||
t - hours == 3
|
||||
if t == 9 and t < minutes:
|
||||
dc.DrawText('60', textPos, self.h - 93)
|
||||
|
||||
if t == 19 and t < minutes:
|
||||
dc.DrawText('120', textPos, self.h - 93)
|
||||
|
||||
if t == 29 and t < minutes:
|
||||
dc.DrawText('180', textPos, self.h - 93)
|
||||
|
||||
if t - minutes == 6 and t > minutes and t < hour:
|
||||
dc.DrawText('6', textPos + 3, self.h - 93)
|
||||
|
||||
if t - minutes == 12 and t > minutes and t < hour:
|
||||
dc.DrawText('12', textPos, self.h - 93)
|
||||
|
||||
if t - hour == 6 and t > hour and t < hours:
|
||||
dc.DrawText('4', textPos, self.h - 93)
|
||||
|
||||
if t - hour == 12 and t > hour and t < hours:
|
||||
dc.DrawText('8', textPos, self.h - 93)
|
||||
|
||||
if t - hours in (1, 3):
|
||||
dc.DrawText(str((t - hours) * 10), textPos, self.h - 93)
|
||||
continue
|
||||
|
||||
if maxX != None:
|
||||
if os.name in mac_names:
|
||||
offset = 5
|
||||
else:
|
||||
offset = 7
|
||||
dc.DrawText('X', maxX + self.bw / 2 - 4, maxY - offset)
|
||||
dc.DrawText(str(maxVal) + unit, maxX + self.bw / 2 + 3, maxY - 13 - offset)
|
||||
|
||||
|
||||
|
||||
def OnPaintSignalLevel(self, event = None):
|
||||
dc = wx.PaintDC(self.signalLevelPanel)
|
||||
dc.Clear()
|
||||
if self.isTCS:
|
||||
if self.isZwembad:
|
||||
self.drawScale(dc, 10, 40, u'°C', 30)
|
||||
self.drawDataSet(dc, 3, 4, 10, 40, 100, 100, u'°C', noPeak = True, title = 'Zwembad:')
|
||||
else:
|
||||
self.drawScale(dc, 400, 1400, 'ppm', 20)
|
||||
self.drawDataSet(dc, 3, 4, 400, 1400, 900, 1300, 'ppm', noPeak = True, title = 'CO2 reading (ppm):')
|
||||
else:
|
||||
self.drawScale(dc, -48, 24, 'dBu', 12)
|
||||
self.drawDataSet(dc, 3, 4, -48, 24, 8, 14, 'dBu', title = 'Input Signal Level (dBu):')
|
||||
|
||||
|
||||
def OnPaintGainReduction(self, event = None):
|
||||
dc = wx.PaintDC(self.gainReductionPanel)
|
||||
dc.Clear()
|
||||
if self.isTCS:
|
||||
if self.isZwembad:
|
||||
self.drawScale(dc, -10, 40, u'°C', 50)
|
||||
self.drawDataSet(dc, 1, 2, -10, 40, 100, 100, u'°C', noPeak = True, title = 'Lucht:')
|
||||
else:
|
||||
self.drawScale(dc, -1250, 1250, 'Pa', 25)
|
||||
self.drawDataSet(dc, 5, 6, -1250, 1250, 400, 500, 'Pa', noPeak = True, title = 'Pressure Deviation (Pa):')
|
||||
else:
|
||||
self.drawScale(dc, 0, 15, 'dB', 15)
|
||||
self.drawDataSet(dc, 5, 6, 0, 15, 0, 6, 'dB', title = 'Gain Reduction (dB):')
|
||||
|
||||
|
||||
def OnPaintTemperature(self, event = None):
|
||||
dc = wx.PaintDC(self.temperaturePanel)
|
||||
dc.Clear()
|
||||
if self.isTCS:
|
||||
if self.isZwembad:
|
||||
self.drawScale(dc, 0, 60, u'°C', 60)
|
||||
self.drawDataSet(dc, 5, 6, 0, 60, 100, 100, u'°C', noPeak = True, title = 'Verwarming:')
|
||||
else:
|
||||
self.drawScale(dc, 0, 100, u'°C', 10)
|
||||
self.drawDataSet(dc, 1, 2, 0, 100, 66, 71, u'°C', noPeak = True, title = u'Temperature (°C):')
|
||||
else:
|
||||
self.drawScale(dc, 0, 100, u'°C', 10)
|
||||
self.drawDataSet(dc, 1, 2, 0, 100, 66, 71, u'°C', title = u'Temperature (°C):')
|
||||
|
||||
|
||||
|
||||
class Child_frame(wx.Frame):
|
||||
|
||||
def __init__(self, parent, *args, **kwds):
|
||||
mystyle = wx.MINIMIZE_BOX | wx.CAPTION | wx.CLOSE_BOX | wx.CLIP_CHILDREN | wx.SYSTEM_MENU | wx.MAXIMIZE_BOX
|
||||
self.main_config = parent.main_config
|
||||
self.my_start_time = mytime.clock()
|
||||
self.last_sorry_time = 0
|
||||
self.history = { }
|
||||
self.lastRestoredId = None
|
||||
self.updating_from_nww = False
|
||||
self.startTime = mytime.clock()
|
||||
self.printedSyncTime = False
|
||||
self.__name__ = 'Child Frame'
|
||||
self.windowReference = None
|
||||
self.modelNameFromUi = [
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'']
|
||||
self.executeTask = None
|
||||
self.isClosed = False
|
||||
self.fastTimerRunning = False
|
||||
self.flashSizePrinted = False
|
||||
self.lastSelectedChannel = None
|
||||
self.lastSnapshotTime = datetime.datetime.now()
|
||||
self.blockSwitchViewWhenNotSynced = False
|
||||
self.shouldBeVisible = True
|
||||
self.clickTime = mytime.clock() + 1
|
||||
self.isVisible = False
|
||||
self.userBits = { }
|
||||
self.MAC = 'Uninitialized'
|
||||
|
||||
try:
|
||||
import keyfile
|
||||
except:
|
||||
print mytime.displayTime() + ' Failed to import keyfile'
|
||||
traceback.print_exc(file = sys.stdout)
|
||||
|
||||
|
||||
try:
|
||||
self.preset_encryption_key = keyfile.preset_encryption_key
|
||||
except:
|
||||
self.preset_encryption_key = None
|
||||
|
||||
|
||||
try:
|
||||
self.backup_encryption_key = keyfile.backup_encryption_key
|
||||
except:
|
||||
self.backup_encryption_key = None
|
||||
|
||||
|
||||
try:
|
||||
self.no_border = self.main_config.get('ROOT', no_border)
|
||||
if self.no_border == 'yes':
|
||||
self.no_border = True
|
||||
except:
|
||||
if os.name in mac_names:
|
||||
self.no_border = False
|
||||
else:
|
||||
self.no_border = True
|
||||
|
||||
if args[3] == True:
|
||||
self.mv_panel = True
|
||||
else:
|
||||
self.mv_panel = False
|
||||
args = args[:3]
|
||||
|
||||
try:
|
||||
self.bgcolour = eval(self.main_config.get('ROOT', 'bgcolour'))
|
||||
except:
|
||||
self.bgcolour = (0, 0, 0)
|
||||
|
||||
|
||||
try:
|
||||
self.preset_extension = self.main_config.get('ROOT', 'preset_extension')
|
||||
except:
|
||||
self.preset_extension = 'preset'
|
||||
|
||||
|
||||
try:
|
||||
self.spk_lib_id = self.main_config.get('ROOT', 'speaker_lib_id')
|
||||
except:
|
||||
self.spk_lib_id = '#'
|
||||
|
||||
self.svg_scale_x = 1
|
||||
self.svg_scale_y = 1
|
||||
self.svg_file_scale_x = 1
|
||||
self.svg_file_scale_y = 1
|
||||
if self.no_border:
|
||||
mystyle = wx.BORDER_NONE
|
||||
|
||||
mystyle &= ~(wx.RESIZE_BORDER | wx.RESIZE_BOX | wx.MAXIMIZE_BOX)
|
||||
wx.Frame.__init__(self, style = mystyle, *args)
|
||||
if os.name in mac_names:
|
||||
self.bgpanel = wx.Panel(self, wx.ID_ANY, size = (2000, 2000))
|
||||
self.bgpanel.SetBackgroundColour(self.bgcolour)
|
||||
|
||||
self.Show(False)
|
||||
self.init_done = False
|
||||
self.parent = parent
|
||||
self.updatingFirmware = False
|
||||
self.restartingAfterFirmwareUpdate = False
|
||||
self.restartingAfterFirmwareUpdateDelay = None
|
||||
self.SetBackgroundColour(self.bgcolour)
|
||||
self.server = parent.server
|
||||
self.last_index = 0
|
||||
self.index_button_name = ''
|
||||
self.progress = None
|
||||
self.alwaysGrantAccessToOutPanel = False
|
||||
self.views = None
|
||||
self.preset_accessrights = 0
|
||||
self.CanMaximize = False
|
||||
self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
|
||||
self.Bind(wx.EVT_SIZE, self.OnSize)
|
||||
self.storeWithKey = None
|
||||
|
||||
|
||||
def OnSize(self, e):
|
||||
if self.init_done == False:
|
||||
return None
|
||||
if self.no_border == True:
|
||||
self.frame_height = 0
|
||||
else:
|
||||
self.frame_height = 22
|
||||
self.AutoCenter(self.current_view, self.GetSize())
|
||||
|
||||
|
||||
def AutoCenter(self, view, size):
|
||||
|
||||
try:
|
||||
client_area = wx.Display().GetClientArea()
|
||||
x = client_area[2]
|
||||
width = view.GetSize()[0]
|
||||
height = view.GetSize()[1] + self.frame_height
|
||||
x_pos = (size[0] - width) / 2
|
||||
if self.menubar != None:
|
||||
view.SetPosition((x_pos, self.menubar.GetSize()[1]))
|
||||
self.menubar.SetSize((size[0], self.menubar.GetSize()[1]))
|
||||
else:
|
||||
view.SetPosition((x_pos, 0))
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
def OnLeftUp(self, e):
|
||||
pass
|
||||
|
||||
|
||||
def OnLeftDown(self, e):
|
||||
pass
|
||||
|
||||
|
||||
def refreshAccess(self):
|
||||
accesskey = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_ACCESS_RIGHTS, 0, 0)
|
||||
self.remote_link.set_get_key(accesskey)
|
||||
userkey = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CURRENT_USER, 0, 0)
|
||||
self.remote_link.set_get_key(userkey)
|
||||
self.waitForSync('cu.rA', key = userkey)
|
||||
self.waitForSync('cu.rA', key = accesskey)
|
||||
current_user = self.model.get(data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CURRENT_USER, 0, 0), self.MAC)
|
||||
accesskey = data_model.Key(protocol.STRUCT_ID_PRESET_GLOBAL, protocol.MEMBER_ID_USER_ACCESS_RIGHTS, 0, current_user)
|
||||
self.remote_link.set_get_key(accesskey)
|
||||
self.waitForSync('cu.rA', key = accesskey)
|
||||
|
||||
|
||||
def get_access(self):
|
||||
|
||||
try:
|
||||
if mytime.clock() - self.my_start_time > 10:
|
||||
skip_retry = True
|
||||
else:
|
||||
skip_retry = False
|
||||
except:
|
||||
skip_retry = False
|
||||
|
||||
accessrights = 0
|
||||
current_user = 0
|
||||
|
||||
try:
|
||||
if self.MAC[:4] in ('DEMO', 'GRPdeactivated', 'VN::'):
|
||||
self.full_access = True
|
||||
user_levels = {
|
||||
one_unit.app.demo_locked_password: protocol.uLocked,
|
||||
one_unit.app.demo_user_password: protocol.uUser,
|
||||
one_unit.app.demo_admin_password: protocol.uAdmin,
|
||||
one_unit.app.demo_developer_password: protocol.uDeveloper }
|
||||
accessrights = 0xFFFFFFFFL
|
||||
|
||||
try:
|
||||
current_user = user_levels[one_unit.app.check_password]
|
||||
except:
|
||||
current_user = protocol.uUser
|
||||
|
||||
self.accessrights = accessrights
|
||||
preset_accessrights = 0xFFFFFFFFL
|
||||
self.preset_accessrights = preset_accessrights
|
||||
if self.active_unit.link_type == 'USB' and self.MK2 == True:
|
||||
if current_user < protocol.uAdmin:
|
||||
current_user = protocol.uAdmin
|
||||
|
||||
|
||||
if one_unit.app.always_show_full_graphics == True:
|
||||
accessrights |= protocol.arShowFullSkin
|
||||
|
||||
self.current_user = current_user
|
||||
self.a
|
||||
@@ -0,0 +1,180 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: cleanImage.pyc
|
||||
# Compiled at: 2022-10-28 07:19:25
|
||||
import mytime, struct
|
||||
|
||||
def findDataSize(data):
|
||||
i = len(data) - 1
|
||||
while i > 0:
|
||||
if ord(data[i]) != 255:
|
||||
return i + 1
|
||||
i -= 1
|
||||
|
||||
return
|
||||
|
||||
|
||||
def verifyChecksum(data):
|
||||
if ord(data[0]) == 251:
|
||||
return True
|
||||
else:
|
||||
dataSize = findDataSize(data)
|
||||
Checksum = 1454917101
|
||||
i = 0
|
||||
while i < (dataSize - 4) / 4:
|
||||
Checksum = Checksum ^ ord(data[i])
|
||||
i += 1
|
||||
|
||||
while i < (dataSize - 4) / 2:
|
||||
Checksum = Checksum ^ ord(data[i]) << 8 & 65280
|
||||
i += 1
|
||||
|
||||
while i < dataSize - 4:
|
||||
Checksum = Checksum ^ ord(data[i]) << 16 & 16711680
|
||||
i += 1
|
||||
|
||||
try:
|
||||
storedChecksum = struct.unpack('<L', data[dataSize - 4:dataSize])[0]
|
||||
except:
|
||||
return False
|
||||
|
||||
if storedChecksum == Checksum:
|
||||
return True
|
||||
print 'Checksum FAILED, calculated', hex(Checksum), ' but file says', hex(storedChecksum), 'preset corrupt?'
|
||||
return False
|
||||
return
|
||||
|
||||
|
||||
updateImageStartAddress = 0
|
||||
|
||||
def verifySectorsperSlot(srcPath, sectorsPerSlot, flashDiskStart, sectorSize):
|
||||
f = open(srcPath, 'rb')
|
||||
data = f.read()
|
||||
f.close()
|
||||
mytime.sleep(0.1)
|
||||
slots = {}
|
||||
txt = 'Verifying slot size for ' + srcPath + ' with slot size ' + str(sectorsPerSlot) + ', data length ' + str(len(data)) + ' bytes, sector size ' + str(sectorSize) + ' bytes'
|
||||
slotSize = sectorsPerSlot * sectorSize
|
||||
data = data[flashDiskStart - updateImageStartAddress:]
|
||||
address = flashDiskStart
|
||||
verified = True
|
||||
foundGlobal = False
|
||||
foundLastPreset = False
|
||||
while len(data) >= sectorSize:
|
||||
slot = data[:slotSize]
|
||||
if ord(slot[0]) == 251:
|
||||
foundGlobal = True
|
||||
if ord(slot[0]) == 252:
|
||||
foundLastPreset = True
|
||||
if ord(slot[0]) != 0 and ord(slot[0]) != 251 and ord(slot[0]) != 255:
|
||||
checksum = verifyChecksum(slot)
|
||||
print 'verified slot', ord(slot[0]), 'naam:', slot[65:81], 'resultaat:', checksum, 'for', sectorsPerSlot, 'sectors per slot'
|
||||
if checksum == False:
|
||||
verified = False
|
||||
break
|
||||
data = data[slotSize:]
|
||||
address += slotSize
|
||||
|
||||
if foundGlobal == False or foundLastPreset == False:
|
||||
verified = False
|
||||
if verified == True:
|
||||
txt += ': PASS'
|
||||
try:
|
||||
print txt
|
||||
except:
|
||||
pass
|
||||
|
||||
else:
|
||||
try:
|
||||
txt += ': FAIL'
|
||||
print txt
|
||||
except:
|
||||
pass
|
||||
|
||||
return verified
|
||||
|
||||
|
||||
def getSectorsPerSlot(srcPath, sectorsPerSlot, flashDiskStart, sectorSize, limit):
|
||||
res = 0
|
||||
aantalGevonden = 0
|
||||
while True:
|
||||
if verifySectorsperSlot(srcPath, sectorsPerSlot, flashDiskStart, sectorSize):
|
||||
res = sectorsPerSlot
|
||||
return res
|
||||
aantalGevonden += 1
|
||||
sectorsPerSlot += 1
|
||||
if sectorsPerSlot > limit:
|
||||
break
|
||||
|
||||
if aantalGevonden != 1:
|
||||
print 'ERROR -> niet 1 flash disk size gevonden', res, aantalGevonden
|
||||
return None
|
||||
else:
|
||||
return res
|
||||
|
||||
|
||||
def cleanImage(srcPath, targetPath, sectorsPerSlot, flashDiskStart, sectorSize, limit):
|
||||
sectorsPerSlot = getSectorsPerSlot(srcPath, sectorsPerSlot, flashDiskStart, sectorSize, limit)
|
||||
print 'FFI slot size:', sectorsPerSlot
|
||||
if sectorsPerSlot == None:
|
||||
print 'Failed to verify slot size! Image unchanged'
|
||||
f = open(srcPath, 'rb')
|
||||
data = f.read()
|
||||
f.close()
|
||||
mytime.sleep(0.5)
|
||||
f = open(targetPath, 'wb')
|
||||
f.write(data)
|
||||
f.close()
|
||||
return
|
||||
else:
|
||||
f = open(srcPath, 'rb')
|
||||
data = f.read()
|
||||
f.close()
|
||||
mytime.sleep(0.1)
|
||||
slots = {}
|
||||
try:
|
||||
txt = mytime.displayTime() + ' Cleaning ' + srcPath
|
||||
print txt
|
||||
except:
|
||||
pass
|
||||
|
||||
slotSize = sectorsPerSlot * sectorSize
|
||||
outData = data[:flashDiskStart]
|
||||
data = data[flashDiskStart:]
|
||||
address = flashDiskStart
|
||||
print 'd_p.Flash info: Slot size:', slotSize, 'sector size:', sectorSize, 'data length:', len(data), 'flash disk start address:', flashDiskStart
|
||||
while len(data) >= sectorSize:
|
||||
slot = data[:slotSize]
|
||||
if ord(slot[0]) != 0 and ord(slot[0]) != 255:
|
||||
checksum = verifyChecksum(slot)
|
||||
slots[ord(slot[0])] = slot
|
||||
data = data[slotSize:]
|
||||
address += slotSize
|
||||
|
||||
for slotNumber in sorted(slots.keys()):
|
||||
slotData = slots[slotNumber]
|
||||
if slotNumber == 251:
|
||||
slotName = 'Global: ' + slotData[1:17]
|
||||
elif slotNumber == 252:
|
||||
slotName = 'Last Setting: ' + slotData[67:83]
|
||||
elif slotNumber < 10:
|
||||
slotName = 'Preset: ' + slotData[67:83]
|
||||
else:
|
||||
slotName = 'Preset: ' + slotData[67:83]
|
||||
txt = mytime.displayTime() + ' Appending slot ' + str(slotNumber) + ': ' + slotName
|
||||
print txt
|
||||
outData += slotData
|
||||
|
||||
f = open(targetPath, 'wb')
|
||||
f.write(outData)
|
||||
f.close()
|
||||
mytime.sleep(0.1)
|
||||
return
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
cleanImage('presets/NAW/99_mac.ffi', 'presets/NAW/99_mac.ffi_compacted', 4, 196608, 4096, 16)
|
||||
|
||||
# okay decompiling pycode/cleanImage.pyc
|
||||
@@ -0,0 +1,490 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: configure_group.pyc
|
||||
# Compiled at: 2023-01-20 14:42:29
|
||||
import wx, os, data_model, traceback, one_unit, ConfigParser, wx.lib.buttons, protocol, sys, select_keys, select_units, d_protocol, mytime, dialog
|
||||
mac_names = 'posix'
|
||||
|
||||
class Dialog(wx.Dialog):
|
||||
|
||||
def __init__(self, parent, id, title, infotext='', group='', bg=None, size=(460, 315), bgcolour=(220, 220, 220), fgcolour=(70, 70, 70)):
|
||||
wx.Dialog.__init__(self, None, wx.ID_ANY, title, size=size, style=wx.STAY_ON_TOP | wx.DEFAULT_DIALOG_STYLE)
|
||||
self.parent = parent
|
||||
if bg != None:
|
||||
self.bg = bg
|
||||
self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
|
||||
self.frame_height = 2 * wx.SystemSettings.GetMetric(wx.SYS_CAPTION_Y) + wx.SystemSettings.GetMetric(wx.SYS_BORDER_Y)
|
||||
if os.name in mac_names:
|
||||
self.frame_height = 24
|
||||
self.infotext = None
|
||||
self.group = group
|
||||
if infotext != '':
|
||||
textstring = wx.StaticText(self, -1, infotext, style=wx.ALIGN_LEFT, pos=(25,
|
||||
10))
|
||||
self.infotext = textstring
|
||||
self.infostring = infotext
|
||||
textstring.Wrap(350)
|
||||
try:
|
||||
self.support_virtual_units = eval(one_unit.app.main_config.get('ROOT', 'support_virtual_units'))
|
||||
except:
|
||||
self.support_virtual_units = True
|
||||
|
||||
self.group_types = one_unit.app.group_types.keys()
|
||||
one_unit.app.groupconfig = ConfigParser.ConfigParser()
|
||||
if os.path.exists(os.path.join(one_unit.app.asys_config_path, 'grouping.cfg')):
|
||||
one_unit.app.groupconfig.read(os.path.join(one_unit.app.asys_config_path, 'grouping.cfg'))
|
||||
self.enabled = one_unit.app.groupconfig.get(group, 'enabled')
|
||||
if self.enabled == 'yes':
|
||||
self.enabled = True
|
||||
else:
|
||||
self.enabled = False
|
||||
try:
|
||||
self.members = eval(one_unit.app.groupconfig.get(group, 'members'))
|
||||
except:
|
||||
self.members = {}
|
||||
|
||||
for MAC in self.members:
|
||||
member = self.members[MAC]
|
||||
if MAC in self.parent.parent.parent.parent.peers.units.keys():
|
||||
if member[0] != self.parent.parent.parent.parent.peers.units[MAC].name:
|
||||
member = (
|
||||
self.parent.parent.parent.parent.peers.units[MAC].name, member[1], member[2])
|
||||
self.members[MAC] = member
|
||||
|
||||
try:
|
||||
links = eval(one_unit.app.groupconfig.get(group, 'links'))
|
||||
except:
|
||||
links = []
|
||||
|
||||
self.links = []
|
||||
for tup in links:
|
||||
key = data_model.Key(tup[0], tup[1], tup[2], tup[3])
|
||||
self.links.append(key)
|
||||
|
||||
try:
|
||||
exceptions = eval(one_unit.app.groupconfig.get(group, 'exceptions'))
|
||||
except:
|
||||
exceptions = []
|
||||
|
||||
self.exceptions = []
|
||||
for tup in exceptions:
|
||||
key = data_model.Key(tup[0], tup[1], tup[2], tup[3])
|
||||
self.exceptions.append(key)
|
||||
|
||||
self.name = one_unit.app.groupconfig.get(group, 'name')
|
||||
self.group_type = one_unit.app.groupconfig.get(group, 'type')
|
||||
descriptionText = one_unit.app.groupconfig.get(group, 'description')
|
||||
print 'desc txt:', descriptionText
|
||||
print mytime.displayTime() + ' wxPython version: ' + str(wx.VERSION_STRING)
|
||||
descriptionText = descriptionText.decode('utf-8')
|
||||
self.name = self.name.decode('utf-8')
|
||||
statuslabel = wx.StaticText(self, -1, 'Status:', style=wx.ALIGN_LEFT, pos=(25,
|
||||
10))
|
||||
if self.enabled == True:
|
||||
self.statusindication = wx.StaticText(self, -1, 'Enabled', style=wx.ALIGN_LEFT, pos=(180,
|
||||
10))
|
||||
self.status_button = wx.lib.buttons.GenButton(self, 3, 'Disable', pos=(350,
|
||||
10), size=(100,
|
||||
20))
|
||||
else:
|
||||
self.statusindication = wx.StaticText(self, -1, 'Disabled', style=wx.ALIGN_LEFT, pos=(180,
|
||||
10))
|
||||
self.status_button = wx.lib.buttons.GenButton(self, 3, 'Enable', pos=(350,
|
||||
10), size=(100,
|
||||
20))
|
||||
self.delete_button = wx.lib.buttons.GenButton(self, 333, 'Delete Group', pos=(10,
|
||||
260), size=(140,
|
||||
20))
|
||||
namelabel = wx.StaticText(self, -1, 'Name (max 20 characters):', style=wx.ALIGN_LEFT, pos=(25,
|
||||
35))
|
||||
style = wx.TE_PROCESS_ENTER
|
||||
self.namefield = wx.TextCtrl(self, 3, self.name, style=style, pos=(180, 32), size=(140,
|
||||
20))
|
||||
self.namefield.SetMaxLength(20)
|
||||
typelabel = wx.StaticText(self, -1, 'Type:', style=wx.ALIGN_LEFT, pos=(25,
|
||||
63))
|
||||
self.select_type = wx.Choice(self, 30, choices=self.group_types, style=wx.BORDER_NONE, pos=(179,
|
||||
60), size=(158,
|
||||
26))
|
||||
try:
|
||||
self.select_type.SetStringSelection(self.group_type)
|
||||
except:
|
||||
print mytime.displayTime() + ' Unsupported Group Type'
|
||||
|
||||
self.exceptions_button = wx.lib.buttons.GenButton(self, 4, '-> Exceptions ', pos=(180,
|
||||
222), size=(100,
|
||||
20))
|
||||
self.linkslabel = wx.StaticText(self, -1, 'Links:', style=wx.ALIGN_LEFT, pos=(25,
|
||||
222))
|
||||
self.links_button = wx.lib.buttons.GenButton(self, 5, '-> Setup Links', pos=(180,
|
||||
222), size=(100,
|
||||
20))
|
||||
self.links_button.Disable()
|
||||
self.links_button.Show(False)
|
||||
self.exceptions_button.Disable()
|
||||
self.exceptions_button.Show(False)
|
||||
self.linkslabel.Show(False)
|
||||
if self.group_type in ('Advanced', 'Relative'):
|
||||
self.linkslabel.Show(True)
|
||||
self.links_button.Enable()
|
||||
self.links_button.Show(True)
|
||||
if self.group_type == 'Carbon Copy':
|
||||
self.linkslabel.Show(True)
|
||||
self.exceptions_button.Enable()
|
||||
self.exceptions_button.Show(True)
|
||||
if self.group_type == 'Mute':
|
||||
self.linkslabel.Show(False)
|
||||
self.exceptions_button.Show(False)
|
||||
self.links_button.Show(False)
|
||||
descriptionlabel = wx.StaticText(self, -1, 'Description:', style=wx.ALIGN_LEFT, pos=(25,
|
||||
86))
|
||||
self.description = wx.TextCtrl(self, 4, descriptionText, style=style | wx.TE_MULTILINE, pos=(180,
|
||||
88), size=(270,
|
||||
100))
|
||||
memberslabel = wx.StaticText(self, -1, 'Members:', style=wx.ALIGN_LEFT, pos=(25,
|
||||
196))
|
||||
self.members_button = wx.lib.buttons.GenButton(self, 6, 'Select...', pos=(180,
|
||||
193), size=(100,
|
||||
20))
|
||||
if self.support_virtual_units == True:
|
||||
self.members_button = wx.lib.buttons.GenButton(self, 7, 'Allocate...', pos=(300,
|
||||
193), size=(110,
|
||||
20))
|
||||
if os.name in mac_names:
|
||||
font = wx.Font(11, wx.SWISS, wx.NORMAL, wx.NORMAL)
|
||||
textstring.SetFont(font)
|
||||
namelabel.SetFont(font)
|
||||
self.namefield.SetFont(font)
|
||||
typelabel.SetFont(font)
|
||||
self.exceptions_button.SetFont(font)
|
||||
self.links_button.SetFont(font)
|
||||
self.linkslabel.SetFont(font)
|
||||
descriptionlabel.SetFont(font)
|
||||
self.description.SetFont(font)
|
||||
memberslabel.SetFont(font)
|
||||
self.members_button.SetFont(font)
|
||||
statuslabel.SetFont(font)
|
||||
self.statusindication.SetFont(font)
|
||||
self.status_button.SetFont(font)
|
||||
ok_button = wx.lib.buttons.GenButton(self, 1, 'Ok', pos=(295, 260), size=(70,
|
||||
20))
|
||||
cancel_button = wx.lib.buttons.GenButton(self, 2, 'Cancel', pos=(375, 260), size=(70,
|
||||
20))
|
||||
self.Centre()
|
||||
self.save_group_button = wx.lib.buttons.GenButton(self, 206, 'Save Group', pos=(350,
|
||||
61), size=(100,
|
||||
20))
|
||||
self.SetBackgroundColour(bgcolour)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnOK, id=1)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnSaveGroup, id=206)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnCancel, id=2)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnEnable, id=3)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnDelete, id=333)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnExceptions, id=4)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnLinks, id=5)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnMembers, id=6)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnAllocate, id=7)
|
||||
self.Bind(wx.EVT_CHOICE, self.OnChangeType, id=30)
|
||||
self.CenterOnScreen()
|
||||
self.response = None
|
||||
self.last_struct_id = -1
|
||||
self.refresh_timer = wx.Timer(self)
|
||||
self.Bind(wx.EVT_TIMER, self.on_timer, self.refresh_timer)
|
||||
self.refresh_timer.Start(100)
|
||||
return
|
||||
|
||||
def OnDelete(self, e):
|
||||
self.parent.mark_for_delete = True
|
||||
self.Cancel()
|
||||
return
|
||||
|
||||
def OnChangeType(self, e):
|
||||
self.group_type = self.select_type.GetStringSelection()
|
||||
self.links_button.Disable()
|
||||
self.links_button.Show(False)
|
||||
self.exceptions_button.Disable()
|
||||
self.exceptions_button.Show(False)
|
||||
self.linkslabel.Show(False)
|
||||
if self.group_type in ('Advanced', 'Relative'):
|
||||
self.linkslabel.Show(True)
|
||||
self.links_button.Enable()
|
||||
self.links_button.Show(True)
|
||||
if self.group_type == 'Carbon Copy':
|
||||
self.linkslabel.Show(True)
|
||||
self.exceptions_button.Enable()
|
||||
self.exceptions_button.Show(True)
|
||||
if self.group_type == 'Mute':
|
||||
self.linkslabel.Show(False)
|
||||
self.exceptions_button.Show(False)
|
||||
self.links_button.Show(False)
|
||||
return
|
||||
|
||||
def on_timer(self, e):
|
||||
self.refresh_timer.Stop()
|
||||
return
|
||||
|
||||
def OnEnable(self, e):
|
||||
if self.enabled == True:
|
||||
self.enabled = False
|
||||
self.statusindication.SetLabel('Disabled')
|
||||
self.status_button.SetLabel('Enable')
|
||||
else:
|
||||
self.enabled = True
|
||||
self.select_type.Enable()
|
||||
self.statusindication.SetLabel('Enabled')
|
||||
self.status_button.SetLabel('Disable')
|
||||
if os.name in mac_names:
|
||||
self.namefield.Show(True)
|
||||
self.description.Show(True)
|
||||
else:
|
||||
self.namefield.Enable(True)
|
||||
self.description.Enable(True)
|
||||
self.members_button.Enable(True)
|
||||
self.group_type = self.select_type.GetStringSelection()
|
||||
if self.group_type in ('Advanced', 'Relative'):
|
||||
self.linkslabel.Show(True)
|
||||
self.links_button.Enable()
|
||||
self.links_button.Show(True)
|
||||
if self.group_type == 'Carbon Copy':
|
||||
self.linkslabel.Show(True)
|
||||
self.exceptions_button.Enable()
|
||||
self.exceptions_button.Show(True)
|
||||
if self.group_type == 'Mute':
|
||||
self.linkslabel.Show(False)
|
||||
self.exceptions_button.Show(False)
|
||||
self.links_button.Show(False)
|
||||
return
|
||||
|
||||
def OnExceptions(self, e):
|
||||
try:
|
||||
lead_member = self.members.keys()[0]
|
||||
member_type = self.members[lead_member][1]
|
||||
except:
|
||||
return
|
||||
else:
|
||||
dial = select_keys.Dialog(self, -1, 'Select Exceptions for ' + self.namefield.GetValue()[:20], ' ', member_type, self.exceptions, group_type=self.group_type)
|
||||
dial.ShowModal()
|
||||
if dial.response == 'OK':
|
||||
self.exceptions = dial.result
|
||||
|
||||
dial.Destroy()
|
||||
return
|
||||
|
||||
def OnLinks(self, e):
|
||||
try:
|
||||
lead_member = self.members.keys()[0]
|
||||
member_type = self.members[lead_member][1]
|
||||
except:
|
||||
return
|
||||
else:
|
||||
if self.group_type == 'Relative':
|
||||
only_numbers = True
|
||||
else:
|
||||
only_numbers = False
|
||||
dial = select_keys.Dialog(self, -1, 'Select Linked items for ' + self.namefield.GetValue()[:20], ' ', member_type, self.links, only_numbers=only_numbers, group_type=self.group_type)
|
||||
dial.ShowModal()
|
||||
if dial.response == 'OK':
|
||||
self.links = dial.result
|
||||
|
||||
dial.Destroy()
|
||||
return
|
||||
|
||||
def OnAllocate(self, e):
|
||||
dial = select_units.Dialog(self, -1, 'Allocate Virtual Units for ' + self.namefield.GetValue()[:20], ' ', '', self.members, allocate=True, groupID=self.group, group_type=self.group_type)
|
||||
dial.ShowModal()
|
||||
if dial.response == 'OK':
|
||||
self.members = dial.result
|
||||
dial.Destroy()
|
||||
return
|
||||
|
||||
def OnMembers(self, e):
|
||||
if self.support_virtual_units == True:
|
||||
dial = select_units.Dialog(self, -1, 'Select Group Members for ' + self.namefield.GetValue()[:20], ' ', '', self.members, add_virtual=True, groupID=self.group, group_type=self.group_type)
|
||||
else:
|
||||
dial = select_units.Dialog(self, -1, 'Select Group Members for ' + self.namefield.GetValue()[:20], ' ', '', self.members, groupID=self.group, group_type=self.group_type)
|
||||
dial.ShowModal()
|
||||
if dial.response == 'OK':
|
||||
self.members = dial.result
|
||||
dial.Destroy()
|
||||
return
|
||||
|
||||
def OnEraseBackground(self, evt):
|
||||
"""
|
||||
Add a picture to the background
|
||||
"""
|
||||
dc = evt.GetDC()
|
||||
if not dc:
|
||||
dc = wx.ClientDC(self)
|
||||
rect = self.GetUpdateRegion().GetBox()
|
||||
dc.SetClippingRect(rect)
|
||||
dc.Clear()
|
||||
bmp = wx.Bitmap(self.bg)
|
||||
dc.DrawBitmap(bmp, 0, 0)
|
||||
return
|
||||
|
||||
def OnOK(self, evt):
|
||||
self.response = 'OK'
|
||||
try:
|
||||
if self.parent.mark_for_delete == False:
|
||||
if not self.saveGroup():
|
||||
return
|
||||
except:
|
||||
pass
|
||||
|
||||
if self.IsModal() == False:
|
||||
self.Destroy()
|
||||
else:
|
||||
self.Close()
|
||||
return
|
||||
|
||||
def saveGroup(self, file=None):
|
||||
if file == None:
|
||||
config = one_unit.app.groupconfig
|
||||
else:
|
||||
config = ConfigParser.ConfigParser()
|
||||
config.add_section(self.group)
|
||||
name = self.namefield.GetValue()[:20].strip()
|
||||
if len(name) < 1:
|
||||
name = str(self.group)
|
||||
try:
|
||||
name = name.encode('utf-8')
|
||||
except:
|
||||
name = ('').join(c for c in name if c in data_model.validFilenameChars)
|
||||
|
||||
found = True
|
||||
while found == True:
|
||||
found = False
|
||||
for testgroup in one_unit.app.group_names:
|
||||
if one_unit.app.group_names[testgroup] == name and testgroup != self.group:
|
||||
dial = dialog.Dialog(self, -1, 'Rename Group', 'This name is already in use. Please choose another name.', textkey='', default_text='', Set=False)
|
||||
dial.ShowModal()
|
||||
name = dial.textfield.GetValue()
|
||||
response = dial.response
|
||||
dial.Destroy()
|
||||
if response != 'OK':
|
||||
return False
|
||||
found = True
|
||||
|
||||
group_type = self.select_type.GetStringSelection()
|
||||
description = self.description.GetValue()
|
||||
try:
|
||||
description = description.encode('utf-8')
|
||||
except:
|
||||
description = ('').join(c for c in description if c in data_model.validFilenameChars)
|
||||
|
||||
links = []
|
||||
for key in self.links:
|
||||
links.append((key.struct_id, key.member_id, key.channel, key.num))
|
||||
|
||||
if group_type in one_unit.app.fixed_group_links:
|
||||
links = one_unit.app.fixed_group_links[group_type]
|
||||
exceptions = []
|
||||
for key in self.exceptions:
|
||||
exceptions.append((key.struct_id, key.member_id, key.channel, key.num))
|
||||
|
||||
functions = []
|
||||
if file == None:
|
||||
one_unit.app.groups[self.group] = self.members
|
||||
for member in self.members.keys():
|
||||
if member not in one_unit.app.server.peers.units.keys():
|
||||
print mytime.displayTime() + ' Adding', member, self.members[member]
|
||||
unit = one_unit.RemoteUnit()
|
||||
unit.name = self.members[member][0]
|
||||
unit.type = self.members[member][1]
|
||||
unit.MAC = member
|
||||
unit.IP = 'No IP'
|
||||
unit.link_status = 'Virtual'
|
||||
one_unit.app.main_frame.peers.add(unit)
|
||||
d_unit = d_protocol.RemoteUnit()
|
||||
d_unit.MAC = unit.MAC
|
||||
if unit.type.count('_') > 2:
|
||||
d_unit.type = unit.type[:unit.type.rfind('_')]
|
||||
else:
|
||||
d_unit.type = unit.type
|
||||
d_unit.link_type = 'virtual'
|
||||
d_unit.link_status = 'virtual'
|
||||
d_unit.Serial = 'virtual'
|
||||
d_unit.IP = 'virtual'
|
||||
d_unit.HWVersion = 'virtual'
|
||||
d_unit.FWVersion = 'virtual'
|
||||
d_unit.PICVersion = 'virtual'
|
||||
d_unit.ProductionDate = 'virtual'
|
||||
d_unit.originalSwID = d_unit.type
|
||||
d_unit.Muted = 'False'
|
||||
d_unit.BuildNumber = '99999999'
|
||||
d_unit.name = unit.name
|
||||
one_unit.app.server.peers.add(d_unit)
|
||||
try:
|
||||
one_unit.app.server.peers.units[unit.MAC].numericalFWVersion = 10000000000.0
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
one_unit.app.main_frame.model.set_unit_name(unit.name, unit.MAC)
|
||||
|
||||
one_unit.app.group_names[self.group] = name
|
||||
one_unit.app.group_enabled[self.group] = self.enabled
|
||||
one_unit.app.group_links[self.group] = links
|
||||
one_unit.app.group_functions[self.group] = functions
|
||||
one_unit.app.group_exceptions[self.group] = exceptions
|
||||
one_unit.app.group_type[self.group] = group_type
|
||||
group_id = self.group
|
||||
config.set(group_id, 'members', self.members)
|
||||
config.set(group_id, 'type', group_type)
|
||||
config.set(group_id, 'name', name)
|
||||
config.set(group_id, 'links', links)
|
||||
config.set(group_id, 'functions', functions)
|
||||
config.set(group_id, 'exceptions', exceptions)
|
||||
config.set(group_id, 'description', description)
|
||||
if self.enabled == True:
|
||||
self.enabled = 'yes'
|
||||
else:
|
||||
self.enabled = 'no'
|
||||
config.set(group_id, 'enabled', self.enabled)
|
||||
if file == None:
|
||||
file = os.path.join(one_unit.app.asys_config_path, 'grouping.cfg')
|
||||
try:
|
||||
groupconfigfile = open(file, 'wb')
|
||||
config.write(groupconfigfile)
|
||||
groupconfigfile.close()
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
dial = dialog.Dialog(None, -1, 'Folder Rights', 'You do not have sufficient access rights to run this program. Please run this program as administrator.', OK_Only=True)
|
||||
dial.ShowModal()
|
||||
dial.Destroy()
|
||||
return False
|
||||
|
||||
print 'cg.sg.Saved Group', file
|
||||
return True
|
||||
|
||||
def OnSaveGroup(self, e):
|
||||
print mytime.displayTime() + ' dg.Save Group'
|
||||
wildcard = 'Group (*.group)|*.group'
|
||||
dlg = wx.FileDialog(self, message='Choose a file', defaultDir=one_unit.app.library_path, defaultFile=self.namefield.GetValue(), wildcard=wildcard, style=wx.SAVE | wx.CHANGE_DIR)
|
||||
if dlg.ShowModal() == wx.ID_OK:
|
||||
path = dlg.GetPath()
|
||||
dlg.Destroy()
|
||||
if path.endswith('.group') == False:
|
||||
path += '.group'
|
||||
self.saveGroup(file=path)
|
||||
else:
|
||||
dlg.Destroy()
|
||||
print mytime.displayTime() + ' dg.Save Group Exit'
|
||||
return
|
||||
|
||||
def OnCancel(self, evt):
|
||||
self.Cancel()
|
||||
return
|
||||
|
||||
def Cancel(self):
|
||||
self.response = 'Cancel'
|
||||
if self.IsModal == False:
|
||||
self.Destroy()
|
||||
else:
|
||||
self.Close()
|
||||
return
|
||||
|
||||
|
||||
|
||||
# okay decompiling pycode/configure_group.pyc
|
||||
@@ -0,0 +1,139 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: countDSPs.pyc
|
||||
# Compiled at: 2025-01-21 13:03:48
|
||||
import shutil, zipfile, os, datetime, time, struct, sys
|
||||
row = 200
|
||||
column = 300
|
||||
sys.stdout.write(('\x1b[8;{rows};{cols}t').format(rows=row, cols=column))
|
||||
print '\x1b[3;0;0t'
|
||||
time.sleep(0.1)
|
||||
flashDiskStartAddress = 262144
|
||||
imageStartAddress = 65536
|
||||
removeLock = True
|
||||
|
||||
def unzipAndExtractFFI(path):
|
||||
if zipfile.is_zipfile(path):
|
||||
zfile = zipfile.ZipFile(path, 'r')
|
||||
lockData = ''
|
||||
for info in zfile.infolist():
|
||||
fname = info.filename
|
||||
if len(fname) < 8:
|
||||
continue
|
||||
if fname.endswith('info.lst'):
|
||||
lockData = zfile.read(fname)
|
||||
continue
|
||||
else:
|
||||
data = zfile.read(fname)
|
||||
|
||||
try:
|
||||
return (
|
||||
data, lockData)
|
||||
except:
|
||||
return ([], [])
|
||||
|
||||
else:
|
||||
f = open(path, 'rb')
|
||||
data = f.read()
|
||||
f.close()
|
||||
return (data, '')
|
||||
return
|
||||
|
||||
|
||||
def createDir(file):
|
||||
myPath = os.path.split(file)[0].split('/')
|
||||
for i in range(5, len(myPath) + 1):
|
||||
path = ''
|
||||
for j in range(i):
|
||||
path += '/' + myPath[j]
|
||||
|
||||
if not os.path.exists(path):
|
||||
os.mkdir(path)
|
||||
|
||||
return
|
||||
|
||||
|
||||
def Walk(root, recurse=1, pattern='*', return_folders=0, return_files=1):
|
||||
import fnmatch, os, string
|
||||
result = []
|
||||
try:
|
||||
names = os.listdir(root)
|
||||
except os.error:
|
||||
return result
|
||||
else:
|
||||
pattern = pattern or '*'
|
||||
pat_list = string.splitfields(pattern, ';')
|
||||
for name in names:
|
||||
fullname = os.path.normpath(os.path.join(root, name))
|
||||
for pat in pat_list:
|
||||
if fnmatch.fnmatch(name, pat):
|
||||
if return_files == 1 and os.path.isfile(fullname) or return_folders == 1 and os.path.isdir(fullname):
|
||||
if fullname.find('.') >= 0 and return_files != 1:
|
||||
continue
|
||||
result.append(fullname)
|
||||
continue
|
||||
|
||||
if recurse:
|
||||
if os.path.isdir(fullname) and not os.path.islink(fullname):
|
||||
result = result + Walk(fullname, recurse, pattern, return_folders)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
loaderStartPositions = {944: 'MK2.1',
|
||||
3488: 'MK2.2',
|
||||
3760: 'MK2.3',
|
||||
4320: 'MK2.5',
|
||||
52: 'MK1',
|
||||
0: 'MK3.1'}
|
||||
|
||||
def countDSPs(srcData):
|
||||
aantalNullen = 0
|
||||
aantalEnen = 0
|
||||
lastV = -1
|
||||
pos = 0
|
||||
loaderStartPos = 0
|
||||
dataStartPos = 0
|
||||
for vChar in srcData:
|
||||
v = ord(vChar)
|
||||
if v == 0 and lastV == 0:
|
||||
aantalNullen += 1
|
||||
if v == 255 and lastV == 255:
|
||||
aantalEnen += 1
|
||||
if aantalNullen > 32 and loaderStartPos == 0:
|
||||
if v != 0:
|
||||
loaderStartPos = pos
|
||||
if aantalEnen > 32 and dataStartPos == 0:
|
||||
if v != 255:
|
||||
dataStartPos = pos
|
||||
break
|
||||
if v != 0:
|
||||
aantalNullen = 0
|
||||
lastV = v
|
||||
pos += 1
|
||||
if pos > 5000:
|
||||
break
|
||||
|
||||
try:
|
||||
return loaderStartPositions[loaderStartPos]
|
||||
except:
|
||||
print 'Error: onbekende loader start pos', loaderStartPos
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
ffiFiles = Walk(os.getcwd())
|
||||
print ' '
|
||||
for ffiFile in ffiFiles:
|
||||
if ffiFile.endswith('.ffi') == False:
|
||||
continue
|
||||
(srcData, lockData) = unzipAndExtractFFI(ffiFile)
|
||||
aantalDSPs = countDSPs(srcData)
|
||||
print ffiFile, 'Aantal DSPs:', aantalDSPs
|
||||
|
||||
|
||||
# okay decompiling pycode/countDSPs.pyc
|
||||
@@ -0,0 +1,274 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: d_bootloader.pyc
|
||||
# Compiled at: 2023-05-16 13:01:50
|
||||
import socket, collections, mytime, threading, sys, copy, struct, types, d_protocol, os.path, traceback, main, one_unit, wx
|
||||
from definitions import *
|
||||
|
||||
def getString(str):
|
||||
return one_unit.getString(str)
|
||||
|
||||
|
||||
mac_names = 'posix'
|
||||
|
||||
def check_interfaces():
|
||||
if os.name in mac_names:
|
||||
return
|
||||
import subprocess
|
||||
startupinfo = subprocess.STARTUPINFO()
|
||||
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
||||
args = [
|
||||
'ipconfig']
|
||||
run = subprocess.Popen(args, stdout=subprocess.PIPE, startupinfo=startupinfo)
|
||||
pfile = run.stdout
|
||||
res = pfile.read()
|
||||
pfile.close()
|
||||
if res.count('IP Address') > 1:
|
||||
wx.MessageBox('Warning: You have multiple network interfaces connected. This may lead to problems during upload. It is strongly recommended to disconnect all but one interface.')
|
||||
return
|
||||
|
||||
|
||||
class Bootloader:
|
||||
|
||||
def __init__(self, parent):
|
||||
self.thread = threading.Thread(name='AllDSP Server Bootloader Detection', target=self.process)
|
||||
self.thread.daemon = True
|
||||
self.parent = parent
|
||||
self.channel = None
|
||||
self.erasecounter = 0
|
||||
self.MAC = 'Bootloader'
|
||||
self.lastPrintTime = 0
|
||||
return
|
||||
|
||||
def process(self):
|
||||
one_unit.lowPriority()
|
||||
PORT = 30684
|
||||
reported_error = False
|
||||
while one_unit.app.application_stopping == False:
|
||||
try:
|
||||
s.close()
|
||||
del s
|
||||
mytime.sleep(1)
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
s.bind(('', PORT))
|
||||
s.settimeout(0.01)
|
||||
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
|
||||
one_unit.app.bootloader_ok = True
|
||||
except:
|
||||
if reported_error == False:
|
||||
print mytime.displayTime() + ' Bootloader Server Failed'
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
reported_error = True
|
||||
mytime.sleep(1)
|
||||
continue
|
||||
|
||||
self.clients = {}
|
||||
self.erasecounter = 0
|
||||
while one_unit.app.application_stopping == False:
|
||||
mytime.sleep(0.01)
|
||||
try:
|
||||
(new_pkt, addr) = s.recvfrom(4096)
|
||||
one_unit.app.bootloader_last_rx = mytime.clock()
|
||||
self.addr = addr
|
||||
self.stopping = False
|
||||
self.action = 'start_main_update'
|
||||
self.completion = 'erasing'
|
||||
if ord(new_pkt[0]) == 0 and ord(new_pkt[1]) == 1 and ord(new_pkt[2]) == 66 and ord(new_pkt[3]) == 76:
|
||||
skin_high = unicode(ord(new_pkt[4]))
|
||||
skin_mid = unicode(ord(new_pkt[5]))
|
||||
skin_low = unicode(ord(new_pkt[6]))
|
||||
self.broadcasted_skin = skin_high + '_' + skin_mid + '_' + skin_low
|
||||
else:
|
||||
break
|
||||
skinBeforeReplacement = ':' + skin_high + '.' + skin_mid + '.' + skin_low
|
||||
try:
|
||||
self.broadcasted_skin = one_unit.app.type_replacements[self.broadcasted_skin]
|
||||
except:
|
||||
pass
|
||||
|
||||
unit = d_protocol.RemoteUnit()
|
||||
unit.MAC = 'Startup...'
|
||||
unit.IP = 'Startup...'
|
||||
unit.type = self.broadcasted_skin
|
||||
unit.name = 'Startup...'
|
||||
unit.pkt = None
|
||||
unit.link_type = 'Ethernet'
|
||||
unit.link_status = 'Bootloader'
|
||||
unit.HWVersion = 'Unknown'
|
||||
unit.PICVersion = 'Unknown'
|
||||
unit.Serial = 'Unknown'
|
||||
unit.DSPState = 0
|
||||
unit.ProductionDate = 'Unknown'
|
||||
unit.originalSwID = skin_high + '.' + skin_mid + '.' + skin_low + skinBeforeReplacement
|
||||
self.parent.peers.add(unit)
|
||||
if one_unit.app.enable_bootloader == False:
|
||||
continue
|
||||
print mytime.displayTime() + ' d_b.Entering bootloader'
|
||||
check_interfaces()
|
||||
one_unit.updateBootloaderDial('Bootloader', getString('eif'), statusInfo=infoStatusInterfaceUpdate | infoStatusResetOK | infoStatusRunning)
|
||||
(ip, port) = addr
|
||||
self.ip = ip
|
||||
ip = '<broadcast>'
|
||||
addr = (ip, port)
|
||||
while one_unit.app.application_stopping == False:
|
||||
if self.action != None:
|
||||
self.upload_ethernet_firmware(s, addr)
|
||||
mytime.sleep(0.01)
|
||||
continue
|
||||
else:
|
||||
break
|
||||
|
||||
break
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
s.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
if one_unit.app.application_stopping == False:
|
||||
mytime.sleep(5)
|
||||
|
||||
return
|
||||
|
||||
def start(self):
|
||||
"""Start the updating thread"""
|
||||
self.stopping = False
|
||||
self.thread.start()
|
||||
return
|
||||
|
||||
def upload_ethernet_firmware(self, s, addr):
|
||||
if self.action == 'start_main_update':
|
||||
if self.completion == 'erasing':
|
||||
counter = 1000
|
||||
while counter > 0:
|
||||
counter -= 1
|
||||
try:
|
||||
new_pkt = s.recv(4096)
|
||||
except:
|
||||
break
|
||||
|
||||
cmd = chr(0) + chr(2) + 'dddd.dfi' + chr(0) + 'netascii' + chr(0)
|
||||
try:
|
||||
s.sendto(cmd, addr)
|
||||
except:
|
||||
print mytime.displayTime() + ' Bootloader Send Failed:', addr
|
||||
return
|
||||
else:
|
||||
self.update_start_time = mytime.clock()
|
||||
if mytime.clock() - self.lastPrintTime > 1:
|
||||
self.lastPrintTime = mytime.clock()
|
||||
print mytime.displayTime() + ' Erasing Interface....'
|
||||
start_time = mytime.clock()
|
||||
while True:
|
||||
try:
|
||||
new_pkt = s.recv(4096)
|
||||
except:
|
||||
mytime.sleep(0.1)
|
||||
print mytime.displayTime() + ' No packet received'
|
||||
new_pkt = None
|
||||
|
||||
if new_pkt != None:
|
||||
break
|
||||
if mytime.clock() - start_time > 10:
|
||||
print mytime.clock(), start_time
|
||||
break
|
||||
|
||||
if new_pkt != None and ord(new_pkt[0]) == 0 and ord(new_pkt[1]) == 4:
|
||||
print mytime.displayTime() + ' Erase OK,Starting Upload'
|
||||
self.completion = 1
|
||||
try:
|
||||
datafile = open(os.path.normpath(one_unit.app.cwd + '/dfi/' + self.broadcasted_skin + '.dfe'), 'rb')
|
||||
self.data = datafile.read()
|
||||
datafile.close()
|
||||
print mytime.displayTime() + ' Uploading custom interface firmware:', self.broadcasted_skin + '.dfe'
|
||||
except:
|
||||
try:
|
||||
datafile = open(os.path.normpath(one_unit.app.cwd + '/dfi/0_0_0.dfe'), 'rb')
|
||||
self.data = datafile.read()
|
||||
datafile.close()
|
||||
except:
|
||||
self.data = ''
|
||||
print mytime.displayTime() + ' Unsupported interface type:', self.broadcasted_skin
|
||||
self.action = None
|
||||
one_unit.updateBootloaderDial('Bootloader', getString('uif'), statusInfo=infoStatusInterfaceUpdate | infoStatusUnsupported | infoStatusFinished | enableClose)
|
||||
return
|
||||
|
||||
else:
|
||||
self.length = int(len(self.data) / 512)
|
||||
elif new_pkt.find('Access violation') < 0:
|
||||
print mytime.displayTime() + ' d_b.Invalid Packet!', new_pkt
|
||||
self.erasecounter -= 0.9
|
||||
if self.erasecounter > 100:
|
||||
self.action = None
|
||||
one_unit.updateBootloaderDial('Bootloader', getString('efi'), statusInfo=infoStatusInterfaceUpdate | infoStatusEraseFailed | infoStatusFinished | enableClose)
|
||||
print mytime.displayTime() + ' Bootloader Erase Failed'
|
||||
self.erasecounter += 1
|
||||
return
|
||||
self.erasecounter = 0
|
||||
one_unit.updateBootloaderDial('Bootloader', getString('ifu') + ' (' + str(self.completion * 100 / self.length) + '%)', alwaysUpdate=False)
|
||||
if mytime.clock() - self.lastPrintTime > 1:
|
||||
self.lastPrintTime = mytime.clock()
|
||||
print mytime.displayTime() + ' (1) Uploading (' + str(self.completion * 100 / self.length) + '%)', 'Bootloader'
|
||||
block_high = int(self.completion / 256)
|
||||
block_low = self.completion - block_high * 256
|
||||
start = (self.completion - 1) * 512
|
||||
end = start + 512
|
||||
if end >= len(self.data) - 1:
|
||||
last = True
|
||||
cmd = chr(0) + chr(3) + chr(block_high) + chr(block_low) + self.data[start:]
|
||||
else:
|
||||
last = False
|
||||
cmd = chr(0) + chr(3) + chr(block_high) + chr(block_low) + self.data[start:end]
|
||||
string = ''
|
||||
for i in cmd:
|
||||
string += hex(ord(i)) + ':'
|
||||
|
||||
s.sendto(cmd, addr)
|
||||
start_time = mytime.clock()
|
||||
send_time = mytime.clock()
|
||||
while True:
|
||||
mytime.sleep(0.01)
|
||||
try:
|
||||
new_pkt = s.recv(64)
|
||||
except:
|
||||
new_pkt = None
|
||||
|
||||
if new_pkt != None and ord(new_pkt[0]) == 0 and ord(new_pkt[1]) == 4 and ord(new_pkt[2]) == block_high and ord(new_pkt[3]) == block_low:
|
||||
break
|
||||
if mytime.clock() - send_time > 0.5:
|
||||
send_time = mytime.clock()
|
||||
try:
|
||||
s.sendto(cmd, addr)
|
||||
except:
|
||||
pass
|
||||
|
||||
if mytime.clock() - start_time > 5:
|
||||
print mytime.displayTime() + ' Timeout!'
|
||||
one_unit.updateBootloaderDial('Bootloader', getString('itwf'), statusInfo=infoStatusInterfaceUpdate | infoStatusWriteFailed | infoStatusFinished | enableClose)
|
||||
break
|
||||
|
||||
if new_pkt != None and ord(new_pkt[0]) == 0 and ord(new_pkt[1]) == 4 and ord(new_pkt[2]) == block_high and ord(new_pkt[3]) == block_low:
|
||||
self.completion += 1
|
||||
if last == True:
|
||||
one_unit.updateBootloaderDial('Bootloader', 'Finished')
|
||||
print mytime.displayTime() + ' Finished in', round(mytime.clock() - self.update_start_time, 1), 'seconds'
|
||||
mytime.sleep(1)
|
||||
self.action = None
|
||||
if one_unit.app.bootloader_mode == False:
|
||||
one_unit.app.enable_bootloader = False
|
||||
return
|
||||
else:
|
||||
return
|
||||
|
||||
|
||||
|
||||
# okay decompiling pycode/d_bootloader.pyc
|
||||
@@ -0,0 +1,741 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: d_ethernet.pyc
|
||||
# Compiled at: 2025-03-06 16:07:19
|
||||
import sys
|
||||
from socket import *
|
||||
import asyncore, asynchat, collections, mytime, threading, copy, struct, types, d_protocol, os.path, traceback, main, one_unit
|
||||
from definitions import *
|
||||
import d_protocol
|
||||
|
||||
def getString(str):
|
||||
return one_unit.getString(str)
|
||||
|
||||
|
||||
mac_names = 'posix'
|
||||
if os.name in mac_names:
|
||||
newline = '\n'
|
||||
else:
|
||||
newline = '\r\n'
|
||||
usePolling = True
|
||||
|
||||
class Ethernet():
|
||||
|
||||
def __init__(self, parent):
|
||||
self.thread1 = threading.Thread(name='AllDSP Server Ethernet Detection Port 50674', target=self.process1)
|
||||
self.thread1.daemon = True
|
||||
self.thread2 = threading.Thread(name='AllDSP Server Ethernet Detection Port 50774', target=self.process2)
|
||||
self.thread2.daemon = True
|
||||
if usePolling:
|
||||
self.thread3 = threading.Thread(name='AllDSP Server Ethernet Polling', target=self.process3)
|
||||
self.thread3.daemon = True
|
||||
self.parent = parent
|
||||
self.channel = None
|
||||
self.conn = UDP_announce_listener(self)
|
||||
self.polling_ip = 0
|
||||
self.ip_index = 0
|
||||
self.printedError = False
|
||||
self.myip = None
|
||||
self.found = []
|
||||
self.foundtime = {}
|
||||
one_unit.app.subnet_mask_list = {}
|
||||
self.poll_skip_list = {}
|
||||
self.pollingTimeout = 0.05
|
||||
self.lastIPListCheckTime = 0
|
||||
return
|
||||
|
||||
def add_unit(self, myip, pkt):
|
||||
unit = d_protocol.RemoteUnit()
|
||||
unit.MAC = pkt.MAC
|
||||
unit.IP = myip
|
||||
unit.type = pkt.broadcasted_skin
|
||||
unit.name = 'No Name'
|
||||
unit.pkt = pkt
|
||||
unit.link_type = 'Ethernet'
|
||||
unit.link_status = 'ready'
|
||||
unit.HWVersion = pkt.HWVersion
|
||||
unit.PICVersion = pkt.PICVersion
|
||||
unit.Serial = pkt.Serial
|
||||
unit.DSPState = pkt.DSPState
|
||||
unit.ProductionDate = pkt.ProductionDate
|
||||
unit.originalSwID = pkt.originalSwID
|
||||
self.parent.peers.add(unit)
|
||||
return
|
||||
|
||||
def sendResetLoader(self, s, ip):
|
||||
try:
|
||||
s.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
mytime.sleep(0.1)
|
||||
s = socket(AF_INET, SOCK_STREAM)
|
||||
s.settimeout(1)
|
||||
s.connect((ip, 50675))
|
||||
cmd = chr(0) + chr(7) + chr(0) + chr(0)
|
||||
nul = '0' * 512
|
||||
cmd += nul
|
||||
try:
|
||||
s.send(cmd)
|
||||
print mytime.displayTime() + ' d_e.srl.Loader Reset 1 Sent to', ip
|
||||
try:
|
||||
pkt = s.recv(1024)
|
||||
print mytime.displayTime() + ' d_e.srl.Got reply from', ip, pkt
|
||||
except:
|
||||
print mytime.displayTime() + ' d_e.srl.No reply from', ip
|
||||
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
|
||||
s.close()
|
||||
mytime.sleep(0.1)
|
||||
s = socket(AF_INET, SOCK_STREAM)
|
||||
s.settimeout(1)
|
||||
s.connect((ip, 50675))
|
||||
cmd = chr(0) + 'Q'
|
||||
nul = '0' * 512
|
||||
cmd += nul
|
||||
try:
|
||||
s.send(cmd)
|
||||
print mytime.displayTime() + ' d_e.srl.Loader Reset 2 Sent to', ip
|
||||
try:
|
||||
pkt = s.recv(1024)
|
||||
print mytime.displayTime() + ' d_e.srl.Got reply from', ip, pkt
|
||||
except:
|
||||
print mytime.displayTime() + ' d_e.srl.No reply from', ip
|
||||
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
|
||||
s.close()
|
||||
mytime.sleep(0.1)
|
||||
s = socket(AF_INET, SOCK_STREAM)
|
||||
s.settimeout(1)
|
||||
s.connect((ip, 50675))
|
||||
cmd = 'DDReset_Interface'
|
||||
try:
|
||||
s.send(cmd)
|
||||
print mytime.displayTime() + ' d_e.srl.Loader Reset 3 Sent to', ip
|
||||
try:
|
||||
pkt = s.recv(1024)
|
||||
print mytime.displayTime() + ' d_e.srl.Got reply from', ip, pkt
|
||||
except:
|
||||
print mytime.displayTime() + ' d_e.srl.No reply from', ip
|
||||
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
|
||||
s.close()
|
||||
mytime.sleep(0.1)
|
||||
s = socket(AF_INET, SOCK_STREAM)
|
||||
s.settimeout(1)
|
||||
s.connect((ip, 50675))
|
||||
cmd = 'DDUPLOADFIRMWARE'
|
||||
try:
|
||||
s.send(cmd)
|
||||
print mytime.displayTime() + ' d_e.srl.Loader Reset 4 Sent to', ip
|
||||
try:
|
||||
pkt = s.recv(1024)
|
||||
print mytime.displayTime() + ' d_e.srl.Got reply from', ip, pkt
|
||||
except:
|
||||
print mytime.displayTime() + ' d_e.srl.No reply from', ip
|
||||
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
|
||||
s.close()
|
||||
mytime.sleep(0.1)
|
||||
s = socket(AF_INET, SOCK_STREAM)
|
||||
s.settimeout(1)
|
||||
s.connect((ip, 50675))
|
||||
cmd = 'DCRESARTFIRMWARE'
|
||||
try:
|
||||
s.send(cmd)
|
||||
print mytime.displayTime() + ' d_e.srl.Loader Reset 5 Sent to', ip
|
||||
try:
|
||||
pkt = s.recv(1024)
|
||||
print mytime.displayTime() + ' d_e.srl.Got reply from', ip, pkt
|
||||
except:
|
||||
print mytime.displayTime() + ' d_e.srl.No reply from', ip
|
||||
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
|
||||
s.close()
|
||||
return
|
||||
|
||||
def pollIP(self, ip_to_poll):
|
||||
try:
|
||||
s = socket(AF_INET, SOCK_STREAM)
|
||||
s.settimeout(self.pollingTimeout)
|
||||
s.connect((ip_to_poll, 50675))
|
||||
s.settimeout(self.pollingTimeout)
|
||||
try:
|
||||
s.settimeout(1)
|
||||
cmd = '4DPP' + chr(253) + chr(0) + chr(255) + chr(0)
|
||||
cs = d_protocol.Checksum()
|
||||
cs.add(cmd)
|
||||
cmd += cs.get()
|
||||
s.send(cmd)
|
||||
try:
|
||||
pkt = s.recv(1024)
|
||||
except:
|
||||
pkt = None
|
||||
try:
|
||||
self.sendResetLoader(s, ip_to_poll)
|
||||
except:
|
||||
pass
|
||||
|
||||
s.close()
|
||||
return
|
||||
else:
|
||||
if pkt != None and len(pkt) > 3:
|
||||
if pkt[:3] != 'DDB':
|
||||
try:
|
||||
pkt = s.recv(1024)
|
||||
print mytime.displayTime(), 'd_e.pi.Got another packet'
|
||||
mytime.sleep(0.01)
|
||||
except:
|
||||
pkt = None
|
||||
|
||||
s.close()
|
||||
if pkt != None:
|
||||
string = ''
|
||||
for c in pkt:
|
||||
string += ':' + hex(ord(c))
|
||||
|
||||
parsedPkt = parse_announce(pkt)
|
||||
if isinstance(parsedPkt, Announcement):
|
||||
if one_unit.app.runConnectionTest == True:
|
||||
one_unit.app.connectionTestLog.write(mytime.displayTime() + ' Received solicited announcement, MAC: ' + parsedPkt.MAC + ', IP: ' + ip_to_poll + newline)
|
||||
if parsedPkt.MAC not in one_unit.app.server.peers.ignore_list:
|
||||
self.add_unit(ip_to_poll, parsedPkt)
|
||||
self.found.append(ip_to_poll)
|
||||
return True
|
||||
self.foundtime[ip_to_poll] = mytime.clock()
|
||||
else:
|
||||
self.poll_skip_list[ip_to_poll] = mytime.clock()
|
||||
s = socket(AF_INET, SOCK_STREAM)
|
||||
s.settimeout(1)
|
||||
s.connect((ip_to_poll, 50675))
|
||||
s.settimeout(1)
|
||||
tmpcounter = 20
|
||||
while tmpcounter > 0:
|
||||
tmpcounter -= 1
|
||||
try:
|
||||
cmd = 'DDCOPY__FIRMWARE'
|
||||
s.send(cmd)
|
||||
mytime.sleep(0.1)
|
||||
cmd = 'DQ'
|
||||
s.send(cmd)
|
||||
mytime.sleep(0.1)
|
||||
except:
|
||||
break
|
||||
|
||||
s.close()
|
||||
else:
|
||||
s.close()
|
||||
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
|
||||
except:
|
||||
s.close()
|
||||
|
||||
return False
|
||||
|
||||
def getMyIPList(self):
|
||||
self.lastIPListCheckTime = mytime.clock()
|
||||
hostName = 'Start'
|
||||
hostByName = 'Start'
|
||||
try:
|
||||
snm_list = {}
|
||||
hostName = gethostname()
|
||||
hostByName = gethostbyname_ex(hostName)
|
||||
ip_list = [_[1] for ip in hostByName][2]
|
||||
try:
|
||||
one_unit.check_interfaces()
|
||||
for adapter in one_unit.app.LAN_adapters.values():
|
||||
if adapter.IPv4 is not None and adapter.IPv4 not in ip_list:
|
||||
ip_list.append(adapter.IPv4)
|
||||
if adapter.subnet_mask is not None:
|
||||
snm_list[adapter.IPv4] = adapter.subnet_mask
|
||||
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
|
||||
if len(ip_list) == 0:
|
||||
return []
|
||||
if one_unit.app.my_ip_list != ip_list:
|
||||
print mytime.displayTime() + ' My IP list changed from', one_unit.app.my_ip_list, 'to', ip_list
|
||||
self.pollingTimeout = 0.01
|
||||
one_unit.app.my_ip_list = ip_list
|
||||
one_unit.app.subnet_mask_list = snm_list
|
||||
one_unit.app.my_ip_list = ip_list
|
||||
return
|
||||
except:
|
||||
if self.printedError == False:
|
||||
print mytime.displayTime(), 'hostName:', hostName
|
||||
print mytime.displayTime(), 'de.Could not make IP list, hostName:', hostName, 'error:'
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
self.printedError = True
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
def ipToInt(self, ip):
|
||||
try:
|
||||
if ip.startswith('0x'):
|
||||
return int(ip.replace('0x', ''), 16)
|
||||
ip = ip.split('.')
|
||||
res = int(ip[0]) << 24
|
||||
res += int(ip[1]) << 16
|
||||
res += int(ip[2]) << 8
|
||||
if ip[3].find('(') > 0:
|
||||
res += int(ip[3][:ip[3].find('(')]) << 0
|
||||
else:
|
||||
res += int(ip[3]) << 0
|
||||
except:
|
||||
print 'de.could not convert', ip[3], 'to int'
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
res = 0
|
||||
|
||||
return res
|
||||
|
||||
def poll(self):
|
||||
if self.myip == None:
|
||||
self.getMyIPList()
|
||||
if self.ip_index >= len(one_unit.app.my_ip_list):
|
||||
self.ip_index = 0
|
||||
if len(one_unit.app.my_ip_list) == 0:
|
||||
mytime.sleep(0.1)
|
||||
self.myip = None
|
||||
else:
|
||||
self.myip = one_unit.app.my_ip_list[self.ip_index].split('.')
|
||||
return
|
||||
else:
|
||||
found = True
|
||||
while found == True and one_unit.app.application_stopping == False:
|
||||
found = False
|
||||
if self.polling_ip > 255:
|
||||
self.ip_index += 1
|
||||
try:
|
||||
if one_unit.app.my_ip_list[self.ip_index].find('169.254') >= 0 and len(one_unit.app.my_ip_list) > 1:
|
||||
self.ip_index += 1
|
||||
except:
|
||||
pass
|
||||
|
||||
self.polling_ip = 0
|
||||
self.getMyIPList()
|
||||
if self.ip_index >= len(one_unit.app.my_ip_list):
|
||||
self.ip_index = 0
|
||||
if self.pollingTimeout >= 0.4 and len(one_unit.app.my_ip_list) > 0:
|
||||
self.pollingTimeout = 0.05
|
||||
if self.pollingTimeout < 0.5 and len(one_unit.app.my_ip_list) > 0:
|
||||
self.pollingTimeout *= 2
|
||||
if self.pollingTimeout > 0.4:
|
||||
self.pollingTimeout = 0.4
|
||||
if len(one_unit.app.my_ip_list) == 0:
|
||||
mytime.sleep(0.1)
|
||||
self.myip = None
|
||||
else:
|
||||
self.myip = one_unit.app.my_ip_list[self.ip_index].split('.')
|
||||
if mytime.clock() - self.lastIPListCheckTime > 10:
|
||||
self.getMyIPList()
|
||||
if self.ip_index >= len(one_unit.app.my_ip_list):
|
||||
self.ip_index = 0
|
||||
if len(one_unit.app.my_ip_list) == 0:
|
||||
mytime.sleep(0.1)
|
||||
self.myip = None
|
||||
else:
|
||||
self.myip = one_unit.app.my_ip_list[self.ip_index].split('.')
|
||||
if self.myip == None:
|
||||
return
|
||||
ip_to_poll = self.myip[0] + '.' + self.myip[1] + '.' + self.myip[2] + '.' + str(self.polling_ip)
|
||||
self.polling_ip += 1
|
||||
if ip_to_poll in self.poll_skip_list.keys():
|
||||
if self.poll_skip_list[ip_to_poll] - mytime.clock() > 60:
|
||||
found = True
|
||||
continue
|
||||
if ip_to_poll in self.foundtime.keys():
|
||||
if mytime.clock() - self.foundtime[ip_to_poll] < 120:
|
||||
found = True
|
||||
continue
|
||||
for testunit in self.parent.peers.units.values():
|
||||
if testunit.IP == ip_to_poll and testunit.link_status != 'disconnected':
|
||||
found = True
|
||||
break
|
||||
|
||||
self.pollIP(ip_to_poll)
|
||||
return
|
||||
|
||||
def process1(self):
|
||||
try:
|
||||
s_50674 = socket(AF_INET, SOCK_DGRAM)
|
||||
s_50674.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
|
||||
s_50674.bind(('0.0.0.0', 50674))
|
||||
s_50674.settimeout(0.1)
|
||||
self.Connected = False
|
||||
self.socket_ok = True
|
||||
except:
|
||||
print mytime.displayTime() + ' de.Ethernet Server Failed'
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
self.socket_ok = False
|
||||
|
||||
mytime.sleep(1)
|
||||
if self.socket_ok == True:
|
||||
print mytime.displayTime(), 'de.Ethernet Server Listening for incoming connections on port 50674'
|
||||
while one_unit.app.application_stopping == False:
|
||||
pkt = None
|
||||
try:
|
||||
(pkt, addr) = s_50674.recvfrom(1024)
|
||||
if one_unit.app.runConnectionTest == True:
|
||||
print mytime.displayTime(), 'Ethernet Server: got packet from 50674', addr, len(pkt)
|
||||
except timeout:
|
||||
pass
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
|
||||
if pkt == None:
|
||||
continue
|
||||
subnetMatch = False
|
||||
for ip in one_unit.app.my_ip_list:
|
||||
if ip in one_unit.app.subnet_mask_list:
|
||||
if self.ipToInt(ip) & self.ipToInt(one_unit.app.subnet_mask_list[ip]) == self.ipToInt(addr[0]) & self.ipToInt(one_unit.app.subnet_mask_list[ip]):
|
||||
subnetMatch = True
|
||||
elif addr[0][:addr[0].find('.')] == ip[:ip.find('.')]:
|
||||
subnetMatch = True
|
||||
|
||||
if subnetMatch == False:
|
||||
self.getMyIPList()
|
||||
self.conn.handle_read(pkt, addr)
|
||||
|
||||
s_50674.close()
|
||||
mytime.sleep(0.1)
|
||||
print mytime.displayTime() + ' UDP Announce socket closed'
|
||||
else:
|
||||
print mytime.displayTime() + ' Ethernet Server Failed (Socket OK = False)'
|
||||
return
|
||||
|
||||
def process2(self):
|
||||
try:
|
||||
s_50774 = socket(AF_INET, SOCK_DGRAM)
|
||||
s_50774.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
|
||||
s_50774.bind(('0.0.0.0', 50774))
|
||||
s_50774.settimeout(0.1)
|
||||
self.Connected = False
|
||||
self.socket_ok = True
|
||||
except:
|
||||
print mytime.displayTime() + ' de.Ethernet Server Failed'
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
self.socket_ok = False
|
||||
|
||||
mytime.sleep(1)
|
||||
if self.socket_ok == True:
|
||||
print mytime.displayTime(), 'de.Ethernet Server Listening for incoming connections on port 50774'
|
||||
while one_unit.app.application_stopping == False:
|
||||
pkt = None
|
||||
try:
|
||||
(pkt, addr) = s_50774.recvfrom(1024)
|
||||
if one_unit.app.runConnectionTest == True:
|
||||
print mytime.displayTime(), 'Ethernet Server: got packet from 50774 #######################################', addr, len(pkt)
|
||||
except timeout:
|
||||
pass
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
|
||||
if pkt == None:
|
||||
continue
|
||||
subnetMatch = False
|
||||
for ip in one_unit.app.my_ip_list:
|
||||
if ip in one_unit.app.subnet_mask_list:
|
||||
if self.ipToInt(ip) & self.ipToInt(one_unit.app.subnet_mask_list[ip]) == self.ipToInt(addr[0]) & self.ipToInt(one_unit.app.subnet_mask_list[ip]):
|
||||
subnetMatch = True
|
||||
elif addr[0][:addr[0].find('.')] == ip[:ip.find('.')]:
|
||||
subnetMatch = True
|
||||
|
||||
if subnetMatch == False:
|
||||
self.getMyIPList()
|
||||
self.conn.handle_read(pkt, addr)
|
||||
|
||||
s_50774.close()
|
||||
mytime.sleep(0.1)
|
||||
print mytime.displayTime() + ' UDP Announce socket closed'
|
||||
else:
|
||||
print mytime.displayTime() + ' Ethernet Server Failed (Socket OK = False)'
|
||||
return
|
||||
|
||||
def process3(self):
|
||||
one_unit.lowPriority()
|
||||
self.pollingTimeout = 0.5
|
||||
loop = 30
|
||||
while loop > 0 and one_unit.app.application_stopping == False:
|
||||
try:
|
||||
for mac in one_unit.app.knownIP:
|
||||
if one_unit.app.application_stopping == True:
|
||||
break
|
||||
ip = one_unit.app.knownIP[mac]['IP']
|
||||
if ip.lower().find('offline') >= 0:
|
||||
continue
|
||||
self.pollIP(ip)
|
||||
|
||||
break
|
||||
except:
|
||||
if loop < 5:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
|
||||
mytime.sleep(0.1)
|
||||
loop -= 1
|
||||
|
||||
self.pollingTimeout = 0.05
|
||||
while one_unit.app.application_stopping == False:
|
||||
try:
|
||||
self.poll()
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
|
||||
print mytime.displayTime() + ' TCP Polling Server closed'
|
||||
return
|
||||
|
||||
def start(self):
|
||||
"""Start the updating thread"""
|
||||
self.stopping = False
|
||||
self.thread1.start()
|
||||
self.thread2.start()
|
||||
if usePolling:
|
||||
self.thread3.start()
|
||||
return
|
||||
|
||||
|
||||
class UDP_announce_listener():
|
||||
"""Handle announcements from hardware units that they broadcast
|
||||
over UDP. Can be used to discover new hardware units in the local
|
||||
network.
|
||||
"""
|
||||
|
||||
def __init__(self, parent):
|
||||
self.Connected = False
|
||||
self.ResetValues = False
|
||||
self.last_peq_key = None
|
||||
self.last_xover_key = None
|
||||
self.values = {}
|
||||
self.last_requested = -1
|
||||
self.parent = parent
|
||||
self.lock = threading.Lock()
|
||||
self.stopping = False
|
||||
self.broadcasted_skin = ''
|
||||
self.last_hw_packet_id = 0
|
||||
self.invalid_packet_counter = 0
|
||||
self.DisconnectTime = mytime.clock()
|
||||
self.ignoreList = []
|
||||
return
|
||||
|
||||
def verifyIP(self, IP):
|
||||
try:
|
||||
s = socket(AF_INET, SOCK_STREAM)
|
||||
s.settimeout(3)
|
||||
s.connect((IP, 50675))
|
||||
s.close()
|
||||
return True
|
||||
except:
|
||||
s.close()
|
||||
return False
|
||||
|
||||
return
|
||||
|
||||
def handle_read(self, pkt, addr):
|
||||
pkt = parse_packet(pkt)
|
||||
if isinstance(pkt, Announcement):
|
||||
if one_unit.app.runConnectionTest == True:
|
||||
txt = mytime.displayTime() + ' Received unsolicited announcement, MAC: ' + pkt.MAC + ', IP: ' + addr[0] + newline
|
||||
one_unit.app.connectionTestLog.write(txt)
|
||||
print txt
|
||||
if pkt.MAC in self.parent.parent.peers.units and self.parent.parent.peers.units[pkt.MAC].IP == addr[0] and self.parent.parent.peers.units[pkt.MAC].link_status in ('available',
|
||||
'ready'):
|
||||
if one_unit.app.runConnectionTest == True:
|
||||
print mytime.displayTime() + ' d_e.hr.Ignoring connected unit', pkt.MAC, addr[0], self.parent.parent.peers.units[pkt.MAC].link_status
|
||||
return
|
||||
if pkt.MAC in one_unit.app.server.peers.ignore_list:
|
||||
if one_unit.app.runConnectionTest == True:
|
||||
print mytime.displayTime() + ' d_e.hr.Ignoring known ignored unit', pkt.MAC, addr[0]
|
||||
return
|
||||
unit = d_protocol.RemoteUnit()
|
||||
unit.MK2 = pkt.MK2
|
||||
unit.MAC = pkt.MAC
|
||||
unit.IP = addr[0]
|
||||
unit.type = pkt.broadcasted_skin
|
||||
unit.name = 'No Name'
|
||||
unit.pkt = pkt
|
||||
unit.link_type = 'Ethernet'
|
||||
try:
|
||||
if True:
|
||||
if one_unit.app.runConnectionTest == True:
|
||||
print 'd_e.hr.2'
|
||||
unit.link_status = 'ready'
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
else:
|
||||
unit.HWVersion = pkt.HWVersion
|
||||
unit.PICVersion = pkt.PICVersion
|
||||
unit.Serial = pkt.Serial
|
||||
unit.DSPState = pkt.DSPState
|
||||
unit.ProductionDate = pkt.ProductionDate
|
||||
unit.originalSwID = pkt.originalSwID
|
||||
self.parent.parent.peers.add(unit)
|
||||
return
|
||||
|
||||
|
||||
class Announcement():
|
||||
"""The announcement broadcast by hardware units over USB"""
|
||||
|
||||
def __init__(self):
|
||||
"""Constructor"""
|
||||
self.UnitType2 = None
|
||||
self.UnitType1 = None
|
||||
self.MAC = None
|
||||
self.PC_PacketId = None
|
||||
self.HW_PacketId = None
|
||||
self.skin_high = None
|
||||
self.skin_mid = None
|
||||
self.originalSwID = ''
|
||||
self.skin_low = None
|
||||
self.broadcasted_skin = None
|
||||
self.HWVersion = None
|
||||
self.PICVersion = None
|
||||
self.Serial = None
|
||||
self.ProductionDate = None
|
||||
self.DSPState = None
|
||||
self.MK2 = False
|
||||
return
|
||||
|
||||
def __str__(self):
|
||||
return 'Announcement(%s, Type1=%s, Type2=%s)' % (self.MAC, self.UnitType1, self.UnitType2)
|
||||
|
||||
|
||||
def parse_announce(data):
|
||||
"""Parse the data sent by MakeConfigData(void) in DDEthernet.c,
|
||||
line 537. This data can be found in UDP broadcasts and in TCP
|
||||
responces to the 'J' command from the user.
|
||||
"""
|
||||
if len(data) < 42 or data[41] != 'Q':
|
||||
return None
|
||||
else:
|
||||
if data[:3] != 'DDB':
|
||||
return None
|
||||
res = Announcement()
|
||||
if data[36:42] == '67890Q':
|
||||
res.MK2 = True
|
||||
else:
|
||||
res.MK2 = False
|
||||
res.UnitType2 = ord(data[4])
|
||||
res.UnitType1 = ord(data[5])
|
||||
res.MAC = data[5:22]
|
||||
res.PC_PacketID = ord(data[39])
|
||||
res.HW_PacketID = ord(data[40])
|
||||
res.skin_high = unicode(ord(data[33]))
|
||||
res.skin_mid = unicode(ord(data[34]))
|
||||
res.skin_low = unicode(ord(data[35]))
|
||||
res.broadcasted_skin = res.skin_high + '_' + res.skin_mid + '_' + res.skin_low
|
||||
skinBeforeReplacement = ':' + res.skin_high + '.' + res.skin_mid + '.' + res.skin_low
|
||||
try:
|
||||
res.broadcasted_skin = one_unit.app.type_replacements[res.broadcasted_skin]
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
high = unicode(ord(data[22]))
|
||||
mid = unicode(ord(data[23]))
|
||||
low = unicode(ord(data[24]))
|
||||
res.HWVersion = high + '.' + mid + '.' + low
|
||||
high = unicode(ord(data[25]))
|
||||
mid = unicode(ord(data[26]))
|
||||
low = unicode(ord(data[27]))
|
||||
res.PICVersion = high + '.' + mid + '.' + low
|
||||
high = int(ord(data[28]))
|
||||
mid = int(ord(data[29]))
|
||||
low = int(ord(data[30]))
|
||||
res.Serial = high * 65536 + mid * 256 + low
|
||||
high = unicode(ord(data[36]))
|
||||
mid = unicode(ord(data[37]))
|
||||
low = unicode(ord(data[38]))
|
||||
res.originalSwID = high + '.' + mid + '.' + low + skinBeforeReplacement
|
||||
res.ProductionDate = '01-01-71'
|
||||
except:
|
||||
pass
|
||||
|
||||
res.DSPState = ord(data[37])
|
||||
return res
|
||||
|
||||
|
||||
def parse_packet(pkt):
|
||||
buf = ''
|
||||
while True:
|
||||
chunk = pkt
|
||||
if len(chunk) == 0:
|
||||
return
|
||||
buf += chunk
|
||||
pos = buf.find('DD')
|
||||
if pos < 0:
|
||||
buf = ''
|
||||
return
|
||||
buf = buf[pos:]
|
||||
if buf[41] != 'Q':
|
||||
print mytime.displayTime() + ' Q not found'
|
||||
buf = ''
|
||||
return
|
||||
while len(buf) < 42:
|
||||
chunk = ser.read(42 - len(buf))
|
||||
buf += chunk
|
||||
|
||||
pkt = None
|
||||
if buf[:3] == 'DDB':
|
||||
pkt = parse_announce(buf)
|
||||
else:
|
||||
print mytime.displayTime() + " Unknown pkt '%s'" % buf[:3]
|
||||
return
|
||||
buf = buf[42:]
|
||||
return pkt
|
||||
|
||||
return
|
||||
|
||||
|
||||
def makeMask(n):
|
||||
"""return a mask of n bits as a long integer"""
|
||||
return (2L << n - 1) - 1
|
||||
|
||||
|
||||
def dottedQuadToNum(ip):
|
||||
"""convert decimal dotted quad string to long integer"""
|
||||
try:
|
||||
inetaton = inet_aton(ip)
|
||||
return struct.unpack('<L', inetaton)[0]
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
return 0
|
||||
|
||||
return
|
||||
|
||||
|
||||
def networkMask(ip, bits):
|
||||
"""Convert a network address to a long integer"""
|
||||
return dottedQuadToNum(ip) & makeMask(bits)
|
||||
|
||||
|
||||
def addressInNetwork(ip1, ip2, net):
|
||||
if ip1.startswith('USB') or ip1.startswith('Startup'):
|
||||
return True
|
||||
try:
|
||||
net = networkMask(net, 32)
|
||||
ip1 = struct.unpack('<L', inet_aton(ip1))[0]
|
||||
ip2 = struct.unpack('<L', inet_aton(ip2))[0]
|
||||
return ip1 & net == ip2 & net
|
||||
except:
|
||||
print mytime.displayTime(), 'd_e.addressInNetwork failed', ip1, ip2, net
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
||||
# okay decompiling pycode/d_ethernet.pyc
|
||||
@@ -0,0 +1,56 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: d_keepalive.pyc
|
||||
# Compiled at: 2022-04-20 07:09:01
|
||||
import socket, collections, mytime, threading, sys, copy, struct, types, d_protocol, os.path, traceback, main, one_unit, wx
|
||||
mac_names = 'posix'
|
||||
|
||||
class Keepalive:
|
||||
|
||||
def __init__(self, parent):
|
||||
self.thread = threading.Thread(name='AllDSP Server Bootloader Detection', target=self.process)
|
||||
self.thread.daemon = True
|
||||
self.parent = parent
|
||||
return
|
||||
|
||||
def process(self):
|
||||
PORT = 57383
|
||||
while one_unit.app.application_stopping == False:
|
||||
try:
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
|
||||
except:
|
||||
print mytime.displayTime() + ' Keepalive Thread Failed'
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
reported_error = True
|
||||
return
|
||||
else:
|
||||
print mytime.displayTime() + ' Keepalive Thread Started'
|
||||
while one_unit.app.application_stopping == False:
|
||||
mytime.sleep(0.1)
|
||||
cmd = chr(0) + chr(2) + 'hgzd.dam' + chr(0) + 'netascii' + chr(0)
|
||||
ip = '<broadcast>'
|
||||
addr = (ip, PORT)
|
||||
try:
|
||||
s.sendto(cmd, addr)
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
s.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
return
|
||||
|
||||
def start(self):
|
||||
"""Start the updating thread"""
|
||||
self.stopping = False
|
||||
self.thread.start()
|
||||
return
|
||||
|
||||
|
||||
|
||||
# okay decompiling pycode/d_keepalive.pyc
|
||||
@@ -0,0 +1,419 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: d_usb.pyc
|
||||
# Compiled at: 2023-05-16 13:01:50
|
||||
import myserial, mytime, threading, copy, struct, types, d_protocol, os.path, traceback, glob, sys, main, one_unit, string
|
||||
from subprocess import Popen, PIPE
|
||||
import subprocess, os, platform
|
||||
mac_names = 'posix'
|
||||
|
||||
def ListUSBDevices(find='find'):
|
||||
import win32com.client, pythoncom
|
||||
try:
|
||||
pythoncom.CoInitialize()
|
||||
except:
|
||||
pass
|
||||
|
||||
devices = {}
|
||||
try:
|
||||
strComputer = '.'
|
||||
objWMIService = win32com.client.Dispatch('WbemScripting.SWbemLocator')
|
||||
objSWbemServices = objWMIService.ConnectServer(strComputer, 'root\\cimv2')
|
||||
colItems = objSWbemServices.ExecQuery('Select * from Win32_USBControllerDevice')
|
||||
for objItem in colItems:
|
||||
DeviceID = objItem.Dependent[objItem.Dependent.find('=') + 2:-1]
|
||||
if DeviceID.find('VID_0684') < 0:
|
||||
continue
|
||||
searchstring = "Select * from Win32_PnPEntity Where DeviceID = '" + DeviceID + "'"
|
||||
colUSBDevice = objSWbemServices.ExecQuery(searchstring)
|
||||
for objUSBDevice in colUSBDevice:
|
||||
if False:
|
||||
continue
|
||||
try:
|
||||
devices[int(objUSBDevice.Name[objUSBDevice.Name.find('COM') + 3:objUSBDevice.Name.rfind(')')])] = os.path.normpath(DeviceID)
|
||||
except:
|
||||
print mytime.displayTime() + ' Failed to connect USB device', objUSBDevice.Name, 'ID:', DeviceID
|
||||
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
|
||||
try:
|
||||
pythoncom.CoUninitialize()
|
||||
except:
|
||||
pass
|
||||
|
||||
return devices
|
||||
|
||||
|
||||
def RestartDevice(device):
|
||||
if os.name in mac_names or platform.version()[0] == '6':
|
||||
return
|
||||
print mytime.displayTime() + ' Restarting', device
|
||||
try:
|
||||
startupinfo = subprocess.STARTUPINFO()
|
||||
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
||||
args = ['srvdz_rt.exe', 'restart', '@' + device]
|
||||
Popen(args, stdout=PIPE, startupinfo=startupinfo)
|
||||
except:
|
||||
print mytime.displayTime() + ' Restart Device', device, 'Failed'
|
||||
|
||||
return
|
||||
|
||||
|
||||
class USB_updater:
|
||||
|
||||
def __init__(self, parent, ports=range(100)):
|
||||
self.ports = ports
|
||||
self.Connected = False
|
||||
self.ResetValues = False
|
||||
self.last_peq_key = None
|
||||
self.last_xover_key = None
|
||||
self.values = {}
|
||||
self.last_requested = -1
|
||||
self.parent = parent
|
||||
self.lock = threading.Lock()
|
||||
self.stopping = False
|
||||
self.broadcasted_skin = ''
|
||||
self.last_hw_packet_id = 0
|
||||
self.invalid_packet_counter = 0
|
||||
self.DisconnectTime = mytime.clock()
|
||||
self.thread = threading.Thread(name='AllDSP Server USB Detection', target=self.process)
|
||||
self.thread.daemon = True
|
||||
self.active_port = None
|
||||
self.active_usb_devices = {}
|
||||
self.all_usb_devices = {}
|
||||
self.loops = 0
|
||||
return
|
||||
|
||||
def start(self):
|
||||
"""Start the updating thread"""
|
||||
self.stopping = False
|
||||
self.thread.start()
|
||||
return
|
||||
|
||||
def stop(self):
|
||||
"""Stop the updating thread"""
|
||||
self.stopping = True
|
||||
self.thread.join()
|
||||
return
|
||||
|
||||
def process(self):
|
||||
one_unit.lowPriority()
|
||||
self.last_list_time = 0
|
||||
if os.name in mac_names:
|
||||
while not self.stopping and one_unit.app.application_stopping == False:
|
||||
ser = None
|
||||
self.active_port = None
|
||||
while mytime.clock() - self.last_list_time < 3:
|
||||
mytime.sleep(0.5)
|
||||
|
||||
self.last_list_time = mytime.clock()
|
||||
try:
|
||||
mac_ports = glob.glob('/dev/tty.usb*')
|
||||
except:
|
||||
mac_ports = []
|
||||
|
||||
for port in mac_ports:
|
||||
try:
|
||||
self.active_port = port
|
||||
s = port
|
||||
IP = 'USB port ' + ('').join([_[1] for letter in s if letter.isdigit()])
|
||||
ser = myserial.Serial(port, 115200, timeout=1)
|
||||
pkt = read_packet(ser)
|
||||
if isinstance(pkt, Announcement):
|
||||
unit = d_protocol.RemoteUnit()
|
||||
try:
|
||||
new_mac = ('0000000005A' + unicode(hex(int(pkt.broadcasted_skin.replace('_', '') + unicode(pkt.Serial)))).upper()[2:])[-12:]
|
||||
except:
|
||||
new_mac = '0000005A0000'
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
else:
|
||||
f_mac = ''
|
||||
for i in range(5):
|
||||
f_mac = f_mac + new_mac[i * 2:i * 2 + 2] + ':'
|
||||
|
||||
f_mac += new_mac[10:12]
|
||||
unit.MAC = f_mac
|
||||
unit.IP = IP
|
||||
unit.type = pkt.broadcasted_skin
|
||||
unit.name = 'No Name'
|
||||
unit.pkt = pkt
|
||||
unit.link_status = 'ready'
|
||||
unit.link_type = 'USB'
|
||||
unit.HWVersion = pkt.HWVersion
|
||||
unit.PICVersion = pkt.PICVersion
|
||||
unit.Serial = pkt.Serial
|
||||
unit.ProductionDate = pkt.ProductionDate
|
||||
unit.originalSwID = pkt.originalSwID
|
||||
unit.InstanceId = port
|
||||
self.parent.peers.add(unit)
|
||||
pkt = None
|
||||
ser.close()
|
||||
ser = None
|
||||
except:
|
||||
try:
|
||||
self.lock.release()
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
if ser and ser != None:
|
||||
try:
|
||||
ser.close()
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
try:
|
||||
ser = None
|
||||
except:
|
||||
pass
|
||||
|
||||
else:
|
||||
try:
|
||||
mytime.sleep(0.01)
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
try:
|
||||
ser.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
self.active_port = None
|
||||
try:
|
||||
mytime.sleep(1)
|
||||
except:
|
||||
pass
|
||||
|
||||
else:
|
||||
port_index = 0
|
||||
ser = None
|
||||
while not self.stopping and one_unit.app.application_stopping == False:
|
||||
while mytime.clock() - self.last_list_time < 3:
|
||||
mytime.sleep(0.5)
|
||||
|
||||
self.last_list_time = mytime.clock()
|
||||
self.active_usb_devices = ListUSBDevices()
|
||||
if self.loops == 3:
|
||||
self.all_usb_devices = ListUSBDevices('findall')
|
||||
for device in self.all_usb_devices.values():
|
||||
for unit in self.parent.peers.units.values():
|
||||
if unit.InstanceId == device and unit.link_status != 'disconnected':
|
||||
print device, 'already connected, skipping'
|
||||
continue
|
||||
else:
|
||||
try:
|
||||
RestartDevice(device)
|
||||
except:
|
||||
pass
|
||||
|
||||
self.loops += 1
|
||||
if self.active_usb_devices == None or len(self.active_usb_devices) == 0:
|
||||
try:
|
||||
mytime.sleep(1)
|
||||
continue
|
||||
except:
|
||||
return
|
||||
|
||||
for port in self.active_usb_devices.keys():
|
||||
try:
|
||||
self.active_port = int(port) - 1
|
||||
IP = ('').join(('USB port ', str(self.active_port + 1)))
|
||||
if ser is None:
|
||||
ser = myserial.Serial(self.active_port, 115200, timeout=1)
|
||||
start_time = mytime.clock()
|
||||
while mytime.clock() - start_time < 1:
|
||||
waiting = ser.inWaiting()
|
||||
if waiting >= 42:
|
||||
break
|
||||
|
||||
print mytime.displayTime() + ' opened serial port', ser.port + 1
|
||||
pkt = read_packet(ser)
|
||||
ser.close()
|
||||
self.active_port = None
|
||||
ser = None
|
||||
if isinstance(pkt, Announcement):
|
||||
print mytime.displayTime(), 'Got USB announcement from', IP
|
||||
unit = d_protocol.RemoteUnit()
|
||||
try:
|
||||
new_mac = ('0000000005A' + unicode(hex(int(pkt.broadcasted_skin.replace('_', '') + unicode(pkt.Serial)))).upper()[2:])[-12:]
|
||||
except:
|
||||
new_mac = '0000005A0000'
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
else:
|
||||
f_mac = ''
|
||||
for i in range(5):
|
||||
f_mac = f_mac + new_mac[i * 2:i * 2 + 2] + ':'
|
||||
|
||||
f_mac += new_mac[10:12]
|
||||
unit.MAC = f_mac
|
||||
unit.IP = IP
|
||||
unit.type = pkt.broadcasted_skin
|
||||
unit.name = 'No Name'
|
||||
unit.pkt = pkt
|
||||
unit.link_status = 'ready'
|
||||
unit.link_type = 'USB'
|
||||
unit.HWVersion = pkt.HWVersion
|
||||
unit.PICVersion = pkt.PICVersion
|
||||
unit.Serial = pkt.Serial
|
||||
unit.ProductionDate = pkt.ProductionDate
|
||||
unit.originalSwID = pkt.originalSwID
|
||||
unit.InstanceId = self.active_usb_devices[port]
|
||||
self.parent.peers.add(unit)
|
||||
else:
|
||||
print mytime.displayTime() + ' No announcement'
|
||||
except:
|
||||
try:
|
||||
self.lock.release()
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
if ser and ser != None:
|
||||
try:
|
||||
ser.close()
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
try:
|
||||
ser = None
|
||||
except:
|
||||
pass
|
||||
|
||||
else:
|
||||
try:
|
||||
mytime.sleep(0.01)
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
try:
|
||||
ser.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
self.active_port = None
|
||||
ser = None
|
||||
try:
|
||||
mytime.sleep(1)
|
||||
except:
|
||||
pass
|
||||
|
||||
return
|
||||
|
||||
|
||||
class Announcement:
|
||||
"""The announcement broadcast by hardware units over USB"""
|
||||
|
||||
def __init__(self):
|
||||
"""Constructor"""
|
||||
self.UnitType2 = None
|
||||
self.UnitType1 = None
|
||||
self.MAC = None
|
||||
self.PC_PacketId = None
|
||||
self.HW_PacketId = None
|
||||
self.skin_high = None
|
||||
self.skin_mid = None
|
||||
self.skin_low = None
|
||||
self.broadcasted_skin = None
|
||||
self.HWVersion = None
|
||||
self.PICVersion = None
|
||||
self.Serial = None
|
||||
self.ProductionDate = None
|
||||
self.originalSwID = ''
|
||||
self.MK2 = False
|
||||
return
|
||||
|
||||
def __str__(self):
|
||||
return 'Announcement(%s, Type1=%s, Type2=%s)' % (self.MAC,
|
||||
self.UnitType1, self.UnitType2)
|
||||
|
||||
|
||||
def parse_announce(data):
|
||||
"""Parse the data sent by MakeConfigData(void) in DDEthernet.c,
|
||||
line 537. This data can be found in UDP broadcasts and in TCP
|
||||
responces to the 'J' command from the user.
|
||||
"""
|
||||
if len(data) < 42 or data[41] != 'Q' or data[:3] != 'DDB':
|
||||
print mytime.displayTime() + " unexpected data: len=%d, last='%s'" % (len(data), data[41])
|
||||
return None
|
||||
else:
|
||||
res = Announcement()
|
||||
res.UnitType2 = ord(data[4])
|
||||
res.UnitType1 = ord(data[5])
|
||||
res.MAC = data[5:22]
|
||||
res.PC_PacketID = ord(data[39])
|
||||
res.HW_PacketID = ord(data[40])
|
||||
res.skin_high = unicode(ord(data[33]))
|
||||
res.skin_mid = unicode(ord(data[34]))
|
||||
res.skin_low = unicode(ord(data[35]))
|
||||
res.broadcasted_skin = res.skin_high + '_' + res.skin_mid + '_' + res.skin_low
|
||||
skinBeforeReplacement = ':' + res.skin_high + '.' + res.skin_mid + '.' + res.skin_low
|
||||
try:
|
||||
res.broadcasted_skin = one_unit.app.type_replacements[res.broadcasted_skin]
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
high = unicode(ord(data[22]))
|
||||
mid = unicode(ord(data[23]))
|
||||
low = unicode(ord(data[24]))
|
||||
res.HWVersion = high + '.' + mid + '.' + low
|
||||
high = unicode(ord(data[25]))
|
||||
mid = unicode(ord(data[26]))
|
||||
low = unicode(ord(data[27]))
|
||||
res.PICVersion = high + '.' + mid + '.' + low
|
||||
high = int(ord(data[28]))
|
||||
mid = int(ord(data[29]))
|
||||
low = int(ord(data[30]))
|
||||
res.Serial = high * 65536 + mid * 256 + low
|
||||
high = unicode(2000 + ord(data[31]))
|
||||
mid = unicode(ord(data[32]))
|
||||
low = unicode(ord(data[36]))
|
||||
res.ProductionDate = low + '-' + mid + '-' + high
|
||||
except:
|
||||
pass
|
||||
|
||||
res.originalSwID = res.skin_high + '.' + res.skin_mid + '.' + res.skin_low + skinBeforeReplacement
|
||||
return res
|
||||
|
||||
|
||||
def read_packet(ser):
|
||||
buf = ''
|
||||
while True:
|
||||
try:
|
||||
chunk = ser.read(42)
|
||||
except:
|
||||
return
|
||||
else:
|
||||
if len(chunk) == 0:
|
||||
return
|
||||
buf += chunk
|
||||
pos = buf.find('DD')
|
||||
if pos < 0:
|
||||
buf = ''
|
||||
return
|
||||
buf = buf[pos:]
|
||||
if len(buf) < 42:
|
||||
buf = ''
|
||||
return
|
||||
if buf[41] != 'Q':
|
||||
buf = ''
|
||||
return
|
||||
while len(buf) < 42:
|
||||
chunk = ser.read(42 - len(buf))
|
||||
buf += chunk
|
||||
|
||||
pkt = None
|
||||
if buf[:3] == 'DDB':
|
||||
pkt = parse_announce(buf)
|
||||
else:
|
||||
return
|
||||
|
||||
buf = buf[42:]
|
||||
return pkt
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
||||
# okay decompiling pycode/d_usb.pyc
|
||||
@@ -0,0 +1,588 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: data_model.pyc
|
||||
# Compiled at: 2023-11-20 12:35:49
|
||||
import collections, protocol
|
||||
Key = collections.namedtuple('Key', 'struct_id, member_id, channel, num')
|
||||
import traceback, mytime, sys, one_unit, math, string, inspect
|
||||
GET_links = {(Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CHECK_PASSWORD, 0, 0)): (Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CURRENT_USER, 0, 0), 0.5), (Key(protocol.STRUCT_ID_COMMAND, protocol.MEMBER_ID_COMMAND, 0, protocol.cmdGotoStandby)): (
|
||||
Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_HARDWARE_STATUS_FLAGS, 0, 0), 0.5),
|
||||
(Key(protocol.STRUCT_ID_COMMAND, protocol.MEMBER_ID_COMMAND, 0, protocol.cmdExitStandby)): (
|
||||
Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_HARDWARE_STATUS_FLAGS, 0, 0), 0.5)}
|
||||
GET_replace_list = {(Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_PIN, 0, 0)): (Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_ACCESS_RIGHTS, 0, 0)),
|
||||
(Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_BUILD_NUMBER, 0, 0)): (Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_SW_VERSION, 0, 0)),
|
||||
(Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_MODEL_NUMBER, 0, 0)): (Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_ACCESS_RIGHTS, 0, 0)),
|
||||
(Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_MODEL_FIRMWARE, 0, 0)): (Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_ACCESS_RIGHTS, 0, 0)),
|
||||
(Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_MODEL_NAME, 0, 0)): (Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_SW_VERSION, 0, 0))}
|
||||
validFilenameChars = unicode('#$%&*+!?-_.,^@<>={}[]|() ') + string.ascii_letters + string.digits
|
||||
forbiddenFilenameChars = unicode('\'"<>*[]?:;,|=')
|
||||
|
||||
def getValidName(string):
|
||||
res = ''
|
||||
for c in string:
|
||||
byte = ord(c)
|
||||
if byte < 128:
|
||||
res += c
|
||||
elif byte == 246:
|
||||
res += 'oe'
|
||||
continue
|
||||
if byte == 228:
|
||||
res += 'ae'
|
||||
continue
|
||||
if byte == 252:
|
||||
res += 'ue'
|
||||
continue
|
||||
if byte == 223:
|
||||
res += 'ss'
|
||||
continue
|
||||
if byte == 214:
|
||||
res += 'Oe'
|
||||
continue
|
||||
if byte == 196:
|
||||
res += 'Ae'
|
||||
continue
|
||||
if byte == 220:
|
||||
res += 'Ue'
|
||||
continue
|
||||
print mytime.displayTime(), 'unknown char:', byte
|
||||
res += '?'
|
||||
|
||||
res = ('').join(c for c in res if c in validFilenameChars)
|
||||
res = res.strip()
|
||||
if len(res) == 0:
|
||||
res = '????'
|
||||
return res
|
||||
|
||||
|
||||
def safeName(val):
|
||||
new_val = ('').join(c for c in val if c in validFilenameChars)
|
||||
return str(new_val)
|
||||
|
||||
|
||||
class DataModel:
|
||||
|
||||
def __init__(self, parent):
|
||||
self.parent = parent
|
||||
self.vars = {}
|
||||
self.get_list = []
|
||||
self.ignored = []
|
||||
self.current_channel = -1
|
||||
self.preset_names = {}
|
||||
self.changed = False
|
||||
self.unit_names = {}
|
||||
self.min_build_number = {}
|
||||
self.var_names = {}
|
||||
self.min_values = {}
|
||||
self.max_values = {}
|
||||
self.last_forced_update = mytime.clock()
|
||||
self.lock = self.parent.lock
|
||||
self.lastPrintCompletionTime = 0
|
||||
return
|
||||
|
||||
def reset_get_list(self):
|
||||
try:
|
||||
self.parent.server.peers.units[self.parent.MAC].process.conn.get_list = self.get_list[:]
|
||||
print mytime.displayTime(), 'dm.rgl.Reset get list to', len(self.parent.server.peers.units[self.parent.MAC].process.conn.get_list)
|
||||
except:
|
||||
pass
|
||||
|
||||
return
|
||||
|
||||
def fastAdd(self, key, verify=True):
|
||||
try:
|
||||
if verify == False or self.verify_add_var(key) == True:
|
||||
if key not in one_unit.app.member_scale:
|
||||
if key.struct_id == protocol.STRUCT_ID_PRESET_GLOBAL and key.member_id == protocol.MEMBER_ID_DELAY:
|
||||
one_unit.app.member_scale[key] = 1
|
||||
one_unit.app.member_offset[key] = 0.0
|
||||
else:
|
||||
one_unit.app.member_scale[key] = protocol.get_member_scale(key.member_id)
|
||||
one_unit.app.member_offset[key] = 0.0
|
||||
if key not in self.get_list:
|
||||
self.get_list.append(key)
|
||||
val = self.parent.server.peers.get(key, self.parent.MAC)
|
||||
if val == None:
|
||||
self.vars[key] = None
|
||||
self.parent.server.peers.units[self.parent.MAC].process.conn.get_list.append(key)
|
||||
self.parent.server.peers.units[self.parent.MAC].process.conn.config_vars.append(key)
|
||||
except:
|
||||
pass
|
||||
|
||||
return
|
||||
|
||||
def get(self, key, default=None, fast=False):
|
||||
if key is None or key.channel is None or key.channel < 0:
|
||||
return
|
||||
else:
|
||||
try:
|
||||
val = self.parent.server.peers.get(key, self.parent.MAC)
|
||||
if fast:
|
||||
return val
|
||||
if key not in one_unit.app.member_scale:
|
||||
one_unit.app.member_scale[key] = protocol.get_member_scale(key.member_id)
|
||||
one_unit.app.member_offset[key] = 0.0
|
||||
try:
|
||||
val = val - one_unit.app.member_offset[key]
|
||||
val = val / one_unit.app.member_scale[key]
|
||||
except:
|
||||
pass
|
||||
|
||||
if val == None:
|
||||
try:
|
||||
if self.parent.MAC.startswith('GRP_'):
|
||||
group = self.parent.MAC[4:]
|
||||
mac = one_unit.app.groups[group].keys()[0]
|
||||
val = self.parent.server.peers.get(key, mac)
|
||||
try:
|
||||
val = val - one_unit.app.member_offset[key]
|
||||
val = val / one_unit.app.member_scale[key]
|
||||
except:
|
||||
pass
|
||||
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
if val == None:
|
||||
val = self.vars.get(key, default)
|
||||
if self.verify_add_var(key) == True:
|
||||
if key not in self.get_list:
|
||||
self.get_list.append(key)
|
||||
if val == None:
|
||||
try:
|
||||
self.parent.server.peers.units[self.parent.MAC].process.conn.get_list.append(key)
|
||||
self.parent.server.peers.units[self.parent.MAC].process.conn.config_vars.append(key)
|
||||
self.vars[key] = None
|
||||
except:
|
||||
pass
|
||||
|
||||
return val
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
|
||||
return val
|
||||
|
||||
def verify_add_var(self, key):
|
||||
try:
|
||||
dummy = int(key.struct_id)
|
||||
except:
|
||||
return False
|
||||
else:
|
||||
try:
|
||||
dummy = int(key.member_id)
|
||||
except:
|
||||
return False
|
||||
else:
|
||||
try:
|
||||
dummy = int(key.channel)
|
||||
except:
|
||||
return False
|
||||
|
||||
try:
|
||||
dummy = int(key.num)
|
||||
except:
|
||||
return False
|
||||
|
||||
try:
|
||||
if self.parent.MAC.startswith('DEMO') == True:
|
||||
return False
|
||||
if self.parent.MAC.startswith('GRP') == True:
|
||||
return False
|
||||
if key in self.parent.remote_link.NO_GET_LIST:
|
||||
return False
|
||||
if key.struct_id == protocol.STRUCT_ID_COMMAND:
|
||||
return False
|
||||
if key.struct_id < 0 or key.member_id in (protocol.MEMBER_ID_VU_IN, protocol.MEMBER_ID_VU_OUT, protocol.MEMBER_ID_GR_IN, protocol.MEMBER_ID_GR_OUT):
|
||||
return False
|
||||
if key.struct_id == 255:
|
||||
return False
|
||||
if key.struct_id == protocol.STRUCT_ID_PRESET_GLOBAL:
|
||||
if key.member_id in (protocol.MEMBER_ID_USER_ACCESS_RIGHTS, protocol.MEMBER_ID_SET_PASSWORD) and self.parent.server.peers.units[self.parent.MAC].numericalFWVersion < self.parent.server.peers.units[self.parent.MAC].minPresetLockVersion:
|
||||
return False
|
||||
try:
|
||||
if key.member_id == protocol.MEMBER_ID_SHORT_NAME and key.channel > self.parent.server.peers.units[self.parent.MAC].process.conn.maxNumberOfPresets:
|
||||
return False
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
if key in self.parent.server.peers.units[self.parent.MAC].process.conn.get_list:
|
||||
return False
|
||||
except:
|
||||
return True
|
||||
|
||||
if key in self.min_build_number and (self.min_build_number[key] > int(self.parent.server.peers.units[self.parent.MAC].BuildNumber) or self.min_build_number[key] > 0 and self.parent.server.peers.units[self.parent.MAC].numericalFWVersion < self.parent.server.peers.units[self.parent.MAC].minBuildNumberVersion):
|
||||
return False
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
self.ignored.append(key)
|
||||
print mytime.displayTime() + ' dm.vav.invalid key 12:', key
|
||||
return False
|
||||
|
||||
if key.struct_id == protocol.STRUCT_ID_FIR and key.member_id == protocol.MEMBER_ID_GAIN and self.parent.server.peers.units[self.parent.MAC].numericalFWVersion < self.parent.server.peers.units[self.parent.MAC].minFIRgainVersion:
|
||||
return False
|
||||
return True
|
||||
|
||||
def get_by_name(self, name, default=None):
|
||||
if name is None:
|
||||
return
|
||||
else:
|
||||
key = None
|
||||
for key in self.var_names.keys():
|
||||
if self.var_names[key] == name:
|
||||
break
|
||||
|
||||
if key == None:
|
||||
return
|
||||
if key not in one_unit.app.member_scale:
|
||||
one_unit.app.member_scale[key] = protocol.get_member_scale(key.member_id)
|
||||
one_unit.app.member_offset[key] = 0.0
|
||||
try:
|
||||
val = self.parent.server.peers.get(key, self.parent.MAC)
|
||||
try:
|
||||
val = val - one_unit.app.member_offset[key]
|
||||
val = val / one_unit.app.member_scale[key]
|
||||
except:
|
||||
pass
|
||||
|
||||
if val == None:
|
||||
val = self.vars.get(key, default)
|
||||
return val
|
||||
except:
|
||||
pass
|
||||
|
||||
return self.vars.get(key, default)
|
||||
|
||||
def get_scale_by_name(self, name, default=1.0):
|
||||
if name is None:
|
||||
return 1.0
|
||||
else:
|
||||
key = None
|
||||
for key in self.var_names.keys():
|
||||
if self.var_names[key] == name:
|
||||
break
|
||||
|
||||
if key == None:
|
||||
return 1.0
|
||||
if key not in one_unit.app.member_scale:
|
||||
one_unit.app.member_scale[key] = protocol.get_member_scale(key.member_id)
|
||||
one_unit.app.member_offset[key] = 0.0
|
||||
return one_unit.app.member_scale[key]
|
||||
|
||||
def get_internal(self, key, default=None):
|
||||
if key is None or key.channel is None or key.channel < 0:
|
||||
return default
|
||||
else:
|
||||
return self.vars.get(key, default)
|
||||
|
||||
def get_unit_name(self, number):
|
||||
try:
|
||||
return self.unit_names[number]
|
||||
except:
|
||||
return number
|
||||
|
||||
return
|
||||
|
||||
def set_unit_name(self, name, number):
|
||||
self.unit_names[number] = name
|
||||
return
|
||||
|
||||
def set_to_unit(self, key, val):
|
||||
if key is None or key.channel is None or key.channel < 0:
|
||||
print mytime.displayTime() + ' data_model.invalid key!!', key
|
||||
return
|
||||
else:
|
||||
self.vars[key] = val
|
||||
if key.struct_id == protocol.STRUCT_ID_INTERNAL:
|
||||
return
|
||||
self.parent.remote_link.set_by_key(key, val)
|
||||
self.parent.remote_link.set_last_key(key)
|
||||
if self.parent.MAC[:4] in ('DEMO', 'GRPdeactivated'):
|
||||
self.vars[key] = val
|
||||
return
|
||||
for testkey in GET_links.keys():
|
||||
if testkey == key:
|
||||
get_key = GET_links[key][0]
|
||||
delaytime = GET_links[key][1]
|
||||
mytime.sleep(delaytime)
|
||||
self.parent.remote_link.set_get_key(get_key)
|
||||
|
||||
return
|
||||
|
||||
def update(self):
|
||||
print mytime.displayTime(), 'dm.u'
|
||||
if mytime.clock() - self.last_forced_update < 0.25:
|
||||
return
|
||||
self.last_forced_update = mytime.clock()
|
||||
try:
|
||||
self.parent.current_view.timer.Stop()
|
||||
self.parent.current_view.timer.Start(500)
|
||||
except:
|
||||
pass
|
||||
|
||||
return
|
||||
|
||||
def set_direct(self, key, val):
|
||||
if key.struct_id < 0:
|
||||
try:
|
||||
self.parent.current_view.update_gauge(key, val)
|
||||
except:
|
||||
pass
|
||||
|
||||
return
|
||||
if key not in one_unit.app.member_scale:
|
||||
one_unit.app.member_scale[key] = protocol.get_member_scale(key.member_id)
|
||||
one_unit.app.member_offset[key] = 0.0
|
||||
try:
|
||||
val = val - one_unit.app.member_offset[key]
|
||||
val = val / one_unit.app.member_scale[key]
|
||||
except:
|
||||
pass
|
||||
|
||||
self.set_from_unit(key, val)
|
||||
return
|
||||
|
||||
def set_from_unit(self, key, value):
|
||||
if key is None or key.channel is None or key.channel < 0:
|
||||
print mytime.displayTime() + ' data_model.invalid key!!', key
|
||||
return
|
||||
else:
|
||||
if key.member_id == protocol.MEMBER_ID_CURRENT_USER:
|
||||
if self.parent.current_view.select_skin_to_current_user() == True:
|
||||
return
|
||||
if key in self.vars.keys():
|
||||
self.lock.acquire()
|
||||
if value != self.vars[key]:
|
||||
self.vars[key] = value
|
||||
self.changed = True
|
||||
if key.member_id == protocol.MEMBER_ID_UI_CONTROL:
|
||||
self.parent.setUIControl(key, value)
|
||||
self.lock.release()
|
||||
return
|
||||
|
||||
def set_default(self, key, value):
|
||||
if key.struct_id == protocol.STRUCT_ID_COMMAND:
|
||||
return
|
||||
else:
|
||||
if key is None or key.channel is None or key.channel < 0:
|
||||
print mytime.displayTime() + ' data_model.sd.invalid key!!', key
|
||||
return
|
||||
if key in self.vars.keys():
|
||||
return
|
||||
self.vars[key] = value
|
||||
return
|
||||
|
||||
def key_with_prototype_channel(self, key):
|
||||
key = Key(key.struct_id, key.member_id, -1, key.num)
|
||||
return key
|
||||
|
||||
def set_var_name(self, key, name):
|
||||
self.var_names[key] = name
|
||||
return
|
||||
|
||||
def get_var_name(self, key):
|
||||
try:
|
||||
return self.var_names[key]
|
||||
except:
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
def set_min(self, key, val):
|
||||
try:
|
||||
tmp = float(val)
|
||||
self.min_values[key] = val
|
||||
except:
|
||||
pass
|
||||
|
||||
return
|
||||
|
||||
def set_max(self, key, val):
|
||||
try:
|
||||
tmp = float(val)
|
||||
self.max_values[key] = val
|
||||
except:
|
||||
pass
|
||||
|
||||
return
|
||||
|
||||
def set_min_build_number(self, key, val):
|
||||
self.min_build_number[key] = val
|
||||
return
|
||||
|
||||
def get_min(self, key):
|
||||
try:
|
||||
res = self.min_values[key]
|
||||
except:
|
||||
return
|
||||
|
||||
if key.member_id == protocol.MEMBER_ID_THRESHOLD and key.channel in self.parent.thresholdCorrection:
|
||||
res += self.parent.thresholdCorrection[key.channel]
|
||||
return res
|
||||
|
||||
def get_max(self, key):
|
||||
try:
|
||||
res = self.max_values[key]
|
||||
except:
|
||||
return
|
||||
|
||||
if key.member_id == protocol.MEMBER_ID_THRESHOLD and key.channel in self.parent.thresholdCorrection:
|
||||
res += self.parent.thresholdCorrection[key.channel]
|
||||
return res
|
||||
|
||||
def resetFIR(self):
|
||||
for testkey in self.get_list[:]:
|
||||
if testkey.member_id == protocol.MEMBER_ID_FIR:
|
||||
self.get_list.remove(testkey)
|
||||
|
||||
for testkey in self.vars.keys():
|
||||
if testkey.member_id == protocol.MEMBER_ID_FIR:
|
||||
del self.vars[testkey]
|
||||
|
||||
return
|
||||
|
||||
def reset(self):
|
||||
self.vars = {}
|
||||
try:
|
||||
self.parent.server.peers.units[self.parent.MAC].process.conn.get_list = []
|
||||
except:
|
||||
pass
|
||||
|
||||
self.get_list = []
|
||||
print mytime.displayTime() + ' dm.reset'
|
||||
self.preset_names = {}
|
||||
return
|
||||
|
||||
def access_granted(self, key):
|
||||
if self.parent.full_access == True:
|
||||
return True
|
||||
access_granted = True
|
||||
arkey = Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_ACCESS_RIGHTS, 0, 0)
|
||||
try:
|
||||
accessrights = int(self.get(arkey))
|
||||
except:
|
||||
accessrights = 0
|
||||
|
||||
if key.struct_id == protocol.STRUCT_ID_GLOBAL:
|
||||
if key.member_id == protocol.MEMBER_ID_CHECK_PASSWORD:
|
||||
return True
|
||||
if key.member_id == protocol.MEMBER_ID_SHORT_NAME:
|
||||
if accessrights & protocol.arUnitName == 0:
|
||||
access_granted = False
|
||||
elif key.member_id == protocol.MEMBER_ID_STANDBY_DELAY:
|
||||
if accessrights & protocol.arUnitConfiguration == 0:
|
||||
access_granted = False
|
||||
else:
|
||||
return True
|
||||
elif key.struct_id == protocol.STRUCT_ID_PRESET_GLOBAL:
|
||||
return True
|
||||
if key.channel < 128 and accessrights & protocol.arInChannel == 0:
|
||||
access_granted = False
|
||||
if key.channel >= 128 and accessrights & protocol.arOutChannel == 0:
|
||||
access_granted = False
|
||||
if access_granted == False:
|
||||
return False
|
||||
return True
|
||||
|
||||
def completion(self, key=None):
|
||||
if one_unit.app.application_stopping == True:
|
||||
return 100
|
||||
else:
|
||||
if key != None:
|
||||
try:
|
||||
if key in self.parent.server.peers.units[self.parent.MAC].process.conn.get_list:
|
||||
return 0
|
||||
else:
|
||||
return 100
|
||||
except:
|
||||
if self.parent.MAC[:4] not in ('DEMO', 'GRP_', 'VN::'):
|
||||
return 0
|
||||
else:
|
||||
return 100
|
||||
|
||||
if len(self.get_list) == 0:
|
||||
completion = 0
|
||||
else:
|
||||
try:
|
||||
if len(self.get_list) < len(self.parent.server.peers.units[self.parent.MAC].process.conn.get_list):
|
||||
for key in self.parent.server.peers.units[self.parent.MAC].process.conn.get_list:
|
||||
if key not in self.get_list:
|
||||
self.get_list.append(key)
|
||||
|
||||
completion = (len(self.get_list) - len(self.parent.server.peers.units[self.parent.MAC].process.conn.get_list)) * 100 / len(self.get_list)
|
||||
if completion < 0:
|
||||
completion = 0
|
||||
except:
|
||||
completion = 0
|
||||
|
||||
if one_unit.app.printCompletion != None and mytime.clock() - self.lastPrintCompletionTime > 3 and completion < 100 and (completion >= one_unit.app.printCompletion or completion < 0):
|
||||
self.lastPrintCompletionTime = mytime.clock()
|
||||
try:
|
||||
print mytime.displayTime() + ' dm.Completion for ' + self.parent.MAC + ':', completion, 'Get list:', self.parent.server.peers.units[self.parent.MAC].process.conn.get_list
|
||||
except:
|
||||
pass
|
||||
|
||||
return completion
|
||||
|
||||
def synced(self, key=None):
|
||||
if one_unit.app.application_stopping == True:
|
||||
print mytime.displayTime() + ' data_model.synced(): application stopping'
|
||||
return True
|
||||
else:
|
||||
if self.parent.MAC[:4] in ('DEMO', 'GRP_', 'VN::'):
|
||||
return True
|
||||
if self.parent.MAC[:4] == 'GRP_':
|
||||
group = self.parent.MAC[4:]
|
||||
maclist = one_unit.app.groups[group]
|
||||
for mac in maclist:
|
||||
if key == None:
|
||||
try:
|
||||
if self.parent.server.peers.units[mac].process.conn.full_synced == False or self.parent.server.peers.units[self.parent.MAC].process.conn.synced == False:
|
||||
return False
|
||||
except:
|
||||
pass
|
||||
|
||||
else:
|
||||
try:
|
||||
if self.parent.server.peers.units[mac].process.conn.values[key].write_val != None or key in self.parent.server.peers.units[mac].process.conn.get_list:
|
||||
return False
|
||||
except:
|
||||
pass
|
||||
|
||||
return True
|
||||
if key == None:
|
||||
try:
|
||||
if self.parent.server.peers.units[self.parent.MAC].process.conn.full_synced == True and self.parent.server.peers.units[self.parent.MAC].process.conn.synced == True:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
except:
|
||||
return False
|
||||
|
||||
else:
|
||||
try:
|
||||
if key in self.parent.server.peers.units[self.parent.MAC].process.conn.get_list:
|
||||
return False
|
||||
except:
|
||||
return False
|
||||
|
||||
try:
|
||||
if self.parent.server.peers.units[self.parent.MAC].process.conn.values[key].write_val != None:
|
||||
return False
|
||||
except:
|
||||
if key.struct_id in (protocol.STRUCT_ID_LPF, protocol.STRUCT_ID_HPF) and key.member_id in (protocol.MEMBER_ID_GAIN, protocol.MEMBER_ID_Q):
|
||||
if key in self.parent.server.peers.units[self.parent.MAC].process.conn.get_list:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
print mytime.displayTime() + ' dm.s.Unknown key', key
|
||||
return True
|
||||
else:
|
||||
return True
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
||||
# okay decompiling pycode/data_model.pyc
|
||||
@@ -0,0 +1,103 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: definitions.pyc
|
||||
# Compiled at: 2022-04-20 07:08:28
|
||||
import mytime, os, base64
|
||||
infoStatusByText = 0
|
||||
infoStatusVersionOK = 1
|
||||
infoStatusImageSaved = 2
|
||||
infoStatusVerifyingFirmwareVersion = 3
|
||||
infoStatusSettingToStandby = 4
|
||||
infoStatusErasing = 5
|
||||
infoStatusUploading = 6
|
||||
infoStatusEraseFailed = 7
|
||||
infoStatusWriteFailed = 8
|
||||
infoStatusUnsupported = 9
|
||||
infoStatusResetOK = 10
|
||||
closedByUser = 1048576
|
||||
enableClose = 2097152
|
||||
infoStatusUIMask = 15728640
|
||||
infoStatusInterfaceUpdate = 16777216
|
||||
infoStatusMainUpdate = 33554432
|
||||
infoStatusMakeFlashImage = 50331648
|
||||
infoStatusLoadFlashImage = 67108864
|
||||
infoStatusProcessmask = 251658240
|
||||
infoStatusStart = 268435456
|
||||
infoStatusRunning = 536870912
|
||||
infoStatusFinished = 805306368
|
||||
infoStatusProgressMask = 4026531840L
|
||||
mac_names = 'posix'
|
||||
|
||||
def isMAC():
|
||||
return os.name == 'posix'
|
||||
|
||||
|
||||
def sleep(t):
|
||||
mytime.sleep(t)
|
||||
return
|
||||
|
||||
|
||||
def displayTime():
|
||||
return mytime.displayTime()
|
||||
|
||||
|
||||
def getFloatFromTextControl(control):
|
||||
val = control.GetValue()
|
||||
res = ''
|
||||
kilo = False
|
||||
for c in val:
|
||||
if c.isdigit() or c in ('.', ',', '-'):
|
||||
res += c
|
||||
if c in ('k', 'K') and res != '':
|
||||
kilo = True
|
||||
|
||||
if res[0] in ('.', ','):
|
||||
res = '0' + res
|
||||
try:
|
||||
return float(res)
|
||||
except:
|
||||
print mytime.displayTime(), 'd.failed to convert value', val, 'to float'
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
return 0
|
||||
|
||||
return
|
||||
|
||||
|
||||
def encode(clear, key):
|
||||
enc = []
|
||||
for i in range(len(clear)):
|
||||
key_c = key[i % len(key)]
|
||||
enc_c = chr((ord(clear[i]) + ord(key_c)) % 256)
|
||||
enc.append(enc_c)
|
||||
|
||||
return base64.urlsafe_b64encode(('').join(enc))
|
||||
|
||||
|
||||
def decode(enc, key):
|
||||
dec = []
|
||||
enc = base64.urlsafe_b64decode(enc)
|
||||
for i in range(len(enc)):
|
||||
key_c = key[i % len(key)]
|
||||
dec_c = chr((256 + ord(enc[i]) - ord(key_c)) % 256)
|
||||
dec.append(dec_c)
|
||||
|
||||
return ('').join(dec)
|
||||
|
||||
|
||||
def safename(name):
|
||||
name = name.replace('>', '&r&')
|
||||
name = name.replace('<', '&l&')
|
||||
name = name.replace(':', '&d&')
|
||||
name = name.replace('|', '&p&')
|
||||
name = name.replace('"', '&q&')
|
||||
name = name.replace('/', '&s&')
|
||||
name = name.replace('\\', '&b&')
|
||||
name = name.replace('?', '&v&')
|
||||
name = name.replace('*', '&a&')
|
||||
return name
|
||||
|
||||
|
||||
|
||||
# okay decompiling pycode/definitions.pyc
|
||||
@@ -0,0 +1,348 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: dialog.pyc
|
||||
# Compiled at: 2024-11-13 12:27:50
|
||||
import mytime, wx, os, data_model, traceback, one_unit, sys, inspect, protocol
|
||||
mac_names = 'posix'
|
||||
|
||||
def getString(strID):
|
||||
return one_unit.getString(strID)
|
||||
|
||||
|
||||
class Dialog(wx.Dialog):
|
||||
|
||||
def __init__(self, parent, id, title, infotext='', optkey=None, optmask=0, opttext={}, bgcolour=(220, 220, 220), fgcolour=(70, 70, 70), OK_Only=False, textkey=None, default_text=None, IsPassword=False, Set=True, Wrap=400, size=(250, 100), bg=None, choices={}, value_mask=None, selectkey=None, default_choice=0, OK_Enable=True, OKtext='Ok', Canceltext='Cancel', OK_Show=True, max=None, default_options=0, always_use_default_choice=False):
|
||||
wx.Dialog.__init__(self, None, wx.ID_ANY, title, size=size, style=wx.STAY_ON_TOP | wx.CAPTION | wx.DEFAULT_DIALOG_STYLE)
|
||||
self.parent = parent
|
||||
self.value_mask = value_mask
|
||||
self.optkey = optkey
|
||||
self.updating = False
|
||||
self.response = 'Cancel'
|
||||
self.textkey = textkey
|
||||
self.selectkey = selectkey
|
||||
self.options = default_options
|
||||
self.choices = choices
|
||||
self.default_options = default_options
|
||||
self.max = max
|
||||
self.optmask = optmask
|
||||
self.frame_height = 2 * wx.SystemSettings.GetMetric(wx.SYS_CAPTION_Y) + wx.SystemSettings.GetMetric(wx.SYS_BORDER_Y)
|
||||
if os.name in mac_names:
|
||||
self.frame_height = 24
|
||||
self.chkboxes = {}
|
||||
self.Set = Set
|
||||
self.infotext = None
|
||||
self.textpanel = wx.Panel(self, -1)
|
||||
textvbox = wx.BoxSizer(wx.VERTICAL)
|
||||
textfieldpanel = wx.Panel(self, -1)
|
||||
textfieldvbox = wx.BoxSizer(wx.VERTICAL)
|
||||
selectfieldpanel = wx.Panel(self, -1)
|
||||
selectfieldvbox = wx.BoxSizer(wx.VERTICAL)
|
||||
optionspanel = wx.Panel(self, -1)
|
||||
optionsvbox = wx.BoxSizer(wx.VERTICAL)
|
||||
buttonspanel = wx.Panel(self, -1)
|
||||
buttonshbox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
mainvbox = wx.BoxSizer(wx.VERTICAL)
|
||||
if infotext != '':
|
||||
textstring = wx.StaticText(self.textpanel, -1, infotext, style=wx.ALIGN_LEFT)
|
||||
textstring.Wrap(Wrap)
|
||||
textstring.SetForegroundColour(fgcolour)
|
||||
textvbox.Add(textstring, 1, wx.EXPAND)
|
||||
self.textpanel.SetSizer(textvbox)
|
||||
if Wrap > 0:
|
||||
textvbox.SetMinSize((Wrap, 10))
|
||||
else:
|
||||
textvbox.SetMinSize(size)
|
||||
mainvbox.Add(self.textpanel, 0, border=10, flag=wx.ALL)
|
||||
self.infotext = textstring
|
||||
self.infostring = infotext
|
||||
self.wrap = Wrap
|
||||
if textkey != None:
|
||||
textval = ''
|
||||
if default_text == None:
|
||||
try:
|
||||
textval = self.parent.model.get(textkey)
|
||||
retries = 20
|
||||
while textval == None and retries > 0:
|
||||
print mytime.clock(), 'Retrieving text value for dialog with key', textkey
|
||||
self.parent.remote_link.set_get_key(textkey)
|
||||
retries -= 1
|
||||
mytime.sleep(0.1)
|
||||
textval = self.parent.model.get(textkey)
|
||||
|
||||
except:
|
||||
print mytime.displayTime() + ' Failed to get text for dialog'
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
|
||||
if textval == None:
|
||||
textval = ''
|
||||
if default_text != None:
|
||||
textval = default_text
|
||||
if IsPassword == True:
|
||||
style = wx.TE_PROCESS_ENTER | wx.TE_PASSWORD
|
||||
else:
|
||||
style = wx.TE_PROCESS_ENTER
|
||||
textfield = wx.TextCtrl(textfieldpanel, 3, unicode(textval), style=style)
|
||||
textfieldvbox.Add(textfield, 1, border=5, flag=wx.ALIGN_LEFT | wx.ALL)
|
||||
textfield.SetFocus()
|
||||
textfieldpanel.SetSizer(textfieldvbox)
|
||||
mainvbox.Add(textfieldpanel, 0, border=10, flag=wx.LEFT | wx.RIGHT)
|
||||
self.textfield = textfield
|
||||
if selectkey != None:
|
||||
selectval = None
|
||||
try:
|
||||
selectval = self.parent.model.get(selectkey)
|
||||
retries = 20
|
||||
while selectval == None and retries > 0:
|
||||
print mytime.clock(), 'Retrieving select value for dialog with key', selectkey
|
||||
self.parent.remote_link.set_get_key(selectkey)
|
||||
retries -= 1
|
||||
mytime.sleep(0.1)
|
||||
selectval = self.parent.model.get(selectkey)
|
||||
|
||||
if value_mask != None:
|
||||
selectval = int(int(selectval) & value_mask)
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
else:
|
||||
if selectval == None or always_use_default_choice == True:
|
||||
selectval = default_choice
|
||||
if selectval not in self.choices.keys():
|
||||
selectval = default_choice
|
||||
style = wx.BORDER_NONE | wx.CB_READONLY
|
||||
mychoices = []
|
||||
for i in sorted(choices.keys()):
|
||||
mychoices.append(choices[i])
|
||||
|
||||
selectfield = wx.ComboBox(selectfieldpanel, 30, choices=mychoices, style=style)
|
||||
selectfield.SetStringSelection(self.choices[selectval])
|
||||
selectfieldvbox.Add(selectfield, 1, border=5, flag=wx.ALIGN_LEFT | wx.ALL)
|
||||
selectfieldpanel.SetSizer(selectfieldvbox)
|
||||
mainvbox.Add(selectfieldpanel, 0, border=10, flag=wx.LEFT | wx.RIGHT)
|
||||
self.selectfield = selectfield
|
||||
if optkey != None and optmask != 0:
|
||||
try:
|
||||
options = int(self.parent.model.get(optkey))
|
||||
except:
|
||||
options = default_options
|
||||
else:
|
||||
chkboxes = {}
|
||||
for i in range(0, 31):
|
||||
optnr = optmask & 1 << i
|
||||
val = options & 1 << i
|
||||
if optnr > 0:
|
||||
try:
|
||||
this_opttext = opttext[optnr]
|
||||
except:
|
||||
this_opttext = 'Unlisted Option: ' + hex(optnr)
|
||||
else:
|
||||
chkboxes[i] = wx.CheckBox(optionspanel, -1, this_opttext)
|
||||
chkboxes[i].SetForegroundColour(fgcolour)
|
||||
optionsvbox.Add(chkboxes[i], 1, border=5, flag=wx.ALIGN_LEFT | wx.ALL)
|
||||
if val > 0:
|
||||
chkboxes[i].SetValue(1)
|
||||
|
||||
optionspanel.SetSizer(optionsvbox)
|
||||
optionsvbox.SetMinSize((250, 10))
|
||||
mainvbox.Add(optionspanel, 0, border=10, flag=wx.LEFT | wx.RIGHT)
|
||||
self.chkboxes = chkboxes
|
||||
self.OK_button = wx.Button(buttonspanel, 1, OKtext)
|
||||
self.OK_button.Enable(OK_Enable)
|
||||
self.OK_button.Show(OK_Show)
|
||||
buttonshbox.Add(self.OK_button, 1, border=0, flag=wx.ALL)
|
||||
if OK_Only == False:
|
||||
buttonshbox.Add(wx.Button(buttonspanel, 2, Canceltext), 1, border=0, flag=wx.ALL)
|
||||
buttonspanel.SetSizer(buttonshbox)
|
||||
if OK_Only == True:
|
||||
buttonshbox.SetMinSize((75, self.frame_height))
|
||||
else:
|
||||
buttonshbox.SetMinSize((150, self.frame_height))
|
||||
mainvbox.Add(buttonspanel, 0, border=5, flag=wx.ALL)
|
||||
self.SetSizerAndFit(mainvbox)
|
||||
self.Centre()
|
||||
self.textvbox = textvbox
|
||||
self.SetBackgroundColour(bgcolour)
|
||||
self.Bind(wx.EVT_TEXT_ENTER, self.OnOK, id=3)
|
||||
self.Bind(wx.EVT_COMBOBOX, self.OnCombo, id=30)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnOK, id=1)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnCancel, id=2)
|
||||
self.CenterOnScreen()
|
||||
self.mainvbox = mainvbox
|
||||
self.response = None
|
||||
self.initialSize = self.GetSize()
|
||||
self.initialPosition = self.GetPosition()
|
||||
return
|
||||
|
||||
def OnCombo(self, evt):
|
||||
self.Raise()
|
||||
return
|
||||
|
||||
def OnEraseBackground(self, evt):
|
||||
"""
|
||||
Add a picture to the background
|
||||
"""
|
||||
dc = evt.GetDC()
|
||||
if not dc:
|
||||
dc = wx.ClientDC(self)
|
||||
rect = self.GetUpdateRegion().GetBox()
|
||||
dc.SetClippingRect(rect)
|
||||
dc.Clear()
|
||||
bmp = wx.Bitmap(self.bg)
|
||||
dc.DrawBitmap(bmp, 0, 0)
|
||||
self.Raise()
|
||||
return
|
||||
|
||||
def OnOK(self, evt):
|
||||
self.response = 'OK'
|
||||
try:
|
||||
if self.textkey != None and self.Set == True:
|
||||
val = self.textfield.GetValue()
|
||||
if self.max != None:
|
||||
try:
|
||||
if float(val) > self.max:
|
||||
val = self.max
|
||||
except:
|
||||
pass
|
||||
|
||||
self.parent.set_value(self.textkey, val)
|
||||
if self.optkey != None and self.optmask != 0:
|
||||
try:
|
||||
options = int(self.parent.model.get(self.optkey))
|
||||
except:
|
||||
options = self.default_options
|
||||
else:
|
||||
for i in range(0, 31):
|
||||
optnr = self.optmask & 1 << i
|
||||
val = 1 << i
|
||||
if optnr > 0:
|
||||
if self.chkboxes[i].GetValue() == True:
|
||||
options |= val
|
||||
else:
|
||||
options &= 4294967295L - val
|
||||
|
||||
if self.Set == True:
|
||||
self.parent.set_value(self.optkey, options)
|
||||
self.options = options
|
||||
if self.selectkey != None and self.Set == True:
|
||||
s = self.selectfield.GetStringSelection()
|
||||
for (k, v) in self.choices.items():
|
||||
if v == s:
|
||||
v = k
|
||||
print mytime.displayTime() + ' setting to', v, 'mask', self.value_mask
|
||||
if self.value_mask != None:
|
||||
val = int(self.parent.model.get(self.selectkey)) & (4294967295L ^ self.value_mask)
|
||||
val |= int(v)
|
||||
v = val
|
||||
self.parent.set_value(self.selectkey, v)
|
||||
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
|
||||
if self.IsModal() == False:
|
||||
self.Destroy()
|
||||
else:
|
||||
self.Close()
|
||||
return
|
||||
|
||||
def OnCancel(self, evt):
|
||||
if self.IsModal == False:
|
||||
self.Destroy()
|
||||
else:
|
||||
self.Close()
|
||||
return
|
||||
|
||||
def Update(self, text):
|
||||
while self.updating == True:
|
||||
mytime.sleep(0.1)
|
||||
|
||||
self.updating = True
|
||||
self.infostring = unicode(text)
|
||||
if os.name in mac_names:
|
||||
self.textvbox.Detach(self.infotext)
|
||||
self.infotext.Destroy()
|
||||
self.infotext = wx.StaticText(self.textpanel, -1, self.infostring, style=wx.ALIGN_LEFT | wx.ST_NO_AUTORESIZE)
|
||||
self.textvbox.Add(self.infotext, 1, wx.EXPAND)
|
||||
else:
|
||||
self.infotext.SetLabel(self.infostring)
|
||||
self.infotext.Wrap(self.wrap)
|
||||
self.Layout()
|
||||
self.SetSizerAndFit(self.mainvbox)
|
||||
self.updating = False
|
||||
return
|
||||
|
||||
def EnableOK(self, OK_Enable):
|
||||
self.OK_button.Enable(OK_Enable)
|
||||
return
|
||||
|
||||
def ShowOK(self, OK_Enable):
|
||||
self.OK_button.Show(OK_Enable)
|
||||
return
|
||||
|
||||
|
||||
aantalBits = 32
|
||||
|
||||
class mapOutputToInput(wx.Dialog):
|
||||
|
||||
def __init__(self, parent, bits, title):
|
||||
self.parent = parent
|
||||
x = 50 + len(self.parent.unit_channels) * 50
|
||||
y = 110 + 18 * aantalBits
|
||||
size = (x, y)
|
||||
wx.Dialog.__init__(self, None, wx.ID_ANY, title, size=size, style=wx.STAY_ON_TOP | wx.CAPTION | wx.DEFAULT_DIALOG_STYLE)
|
||||
self.p = wx.Panel(self)
|
||||
self.p.SetSize(size)
|
||||
self.res = bits
|
||||
self.response = 'Cancel'
|
||||
self.OK_button = wx.Button(self.p, 1, 'OK', pos=(size[0] - 200, size[1] - 60), size=(80,
|
||||
20))
|
||||
self.Cancel_button = wx.Button(self.p, 2, 'Cancel', pos=(size[0] - 100, size[1] - 60), size=(80,
|
||||
20))
|
||||
self.Bind(wx.EVT_BUTTON, self.OnOK, id=1)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnCancel, id=2)
|
||||
self.flags = {}
|
||||
self.enable = {}
|
||||
x = 30
|
||||
for channel in sorted(bits.keys()):
|
||||
if channel < 128:
|
||||
wx.StaticText(self.p, -1, 'In ' + str(channel + 1), pos=(x, 20))
|
||||
else:
|
||||
wx.StaticText(self.p, -1, 'Out ' + str(channel - 127), pos=(x, 20))
|
||||
val = bits[channel]
|
||||
self.flags[channel] = {}
|
||||
for i in range(aantalBits):
|
||||
y = 40 + i * 18
|
||||
channelString = str(i + 1)
|
||||
self.flags[channel][i] = wx.CheckBox(self.p, -1, channelString, pos=(x, y), size=(50,
|
||||
18))
|
||||
self.flags[channel][i].SetValue(val & 1 << i)
|
||||
|
||||
x += 50
|
||||
|
||||
return
|
||||
|
||||
def OnOK(self, evt):
|
||||
for channel in self.parent.unit_channels:
|
||||
val = 0
|
||||
for i in range(aantalBits):
|
||||
val += self.flags[channel][i].GetValue() << i
|
||||
|
||||
self.res[channel] = val
|
||||
|
||||
self.response = 'OK'
|
||||
if self.IsModal() == False:
|
||||
self.Destroy()
|
||||
else:
|
||||
self.Close()
|
||||
return
|
||||
|
||||
def OnCancel(self, evt):
|
||||
if self.IsModal == False:
|
||||
self.Destroy()
|
||||
else:
|
||||
self.Close()
|
||||
return
|
||||
|
||||
|
||||
|
||||
# okay decompiling pycode/dialog.pyc
|
||||
@@ -0,0 +1,394 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: fir_dialog.pyc
|
||||
# Compiled at: 2022-04-20 07:08:28
|
||||
import mytime, wx, os, data_model, traceback, one_unit, sys, math, dialog
|
||||
mac_names = 'posix'
|
||||
accepted = '+-.0123456789Ee'
|
||||
|
||||
def safeNumber(text):
|
||||
res = ''
|
||||
for c in text:
|
||||
if c in accepted:
|
||||
res += c
|
||||
|
||||
return res
|
||||
|
||||
|
||||
def getString(strID):
|
||||
return one_unit.getString(strID)
|
||||
|
||||
|
||||
class Dialog(wx.Dialog):
|
||||
|
||||
def __init__(self, parent, id, title, infotext='', optkey=None, optmask=0, opttext={}, bgcolour=(220, 220, 220), fgcolour=(70, 70, 70), OK_Only=False, textkey=None, default_text=None, IsPassword=False, Set=True, Wrap=400, size=(250, 10), bg=None, choices={}, value_mask=None, selectkey=None, default_choice=0, OK_Enable=True, OKtext='Ok', Canceltext='Cancel', OK_Show=True, max=None, default_options=0, numtaps=0, maxnumtaps=0, Fs=48828):
|
||||
wx.Dialog.__init__(self, None, wx.ID_ANY, title, size=size, style=wx.CAPTION | wx.DEFAULT_DIALOG_STYLE)
|
||||
self.parent = parent
|
||||
if bg != None:
|
||||
self.bg = bg
|
||||
self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
|
||||
self.value_mask = value_mask
|
||||
self.optkey = optkey
|
||||
self.numtaps = numtaps
|
||||
self.textkey = textkey
|
||||
self.selectkey = selectkey
|
||||
self.options = default_options
|
||||
self.choices = choices
|
||||
self.default_options = default_options
|
||||
self.max = max
|
||||
self.maxnumtaps = maxnumtaps
|
||||
self.Fs = Fs
|
||||
self.optmask = optmask
|
||||
self.frame_height = 2 * wx.SystemSettings.GetMetric(wx.SYS_CAPTION_Y) + wx.SystemSettings.GetMetric(wx.SYS_BORDER_Y)
|
||||
if os.name in mac_names:
|
||||
self.frame_height = 24
|
||||
self.chkboxes = {}
|
||||
self.Set = Set
|
||||
self.infotext = None
|
||||
textpanel = wx.Panel(self, -1)
|
||||
textvbox = wx.BoxSizer(wx.VERTICAL)
|
||||
textfieldpanel = wx.Panel(self, -1)
|
||||
textfieldvbox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
loadbuttonpanel = wx.Panel(self, -1)
|
||||
loadbuttonvbox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
selectfieldpanel = wx.Panel(self, -1)
|
||||
selectfieldvbox = wx.BoxSizer(wx.VERTICAL)
|
||||
optionspanel = wx.Panel(self, -1)
|
||||
optionsvbox = wx.BoxSizer(wx.VERTICAL)
|
||||
buttonspanel = wx.Panel(self, -1)
|
||||
buttonshbox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
mainvbox = wx.BoxSizer(wx.VERTICAL)
|
||||
if infotext != '':
|
||||
textstring = wx.StaticText(textpanel, -1, infotext, style=wx.ALIGN_LEFT | wx.ST_NO_AUTORESIZE)
|
||||
textstring.Wrap(Wrap)
|
||||
textstring.SetForegroundColour(fgcolour)
|
||||
textvbox.Add(textstring, 1, wx.EXPAND)
|
||||
textpanel.SetSizer(textvbox)
|
||||
if Wrap > 0:
|
||||
textvbox.SetMinSize((Wrap, 10))
|
||||
else:
|
||||
textvbox.SetMinSize(size)
|
||||
mainvbox.Add(textpanel, 0, border=10, flag=wx.ALL)
|
||||
self.infotext = textstring
|
||||
self.infostring = infotext
|
||||
self.wrap = Wrap
|
||||
self.Bind(wx.EVT_BUTTON, self.OnLoad, id=3)
|
||||
if numtaps > 0:
|
||||
numtapstring = wx.StaticText(textfieldpanel, -1, 'Number of Taps:', style=wx.ALIGN_LEFT | wx.ST_NO_AUTORESIZE, pos=(0,
|
||||
30))
|
||||
textfieldvbox.Add(numtapstring, 1, border=5, flag=wx.ALIGN_LEFT | wx.ALL)
|
||||
textval = str(numtaps)
|
||||
textfield = wx.TextCtrl(textfieldpanel, 3, unicode(textval), style=wx.TE_PROCESS_ENTER, pos=(100,
|
||||
30))
|
||||
textfieldvbox.Add(textfield, 1, border=5, flag=wx.ALIGN_LEFT | wx.ALL)
|
||||
self.textfield = textfield
|
||||
textfield.Bind(wx.EVT_TEXT_ENTER, self.OnTextEnter, textfield)
|
||||
sample_time = 1.0 / self.Fs
|
||||
latency = str(round(numtaps * sample_time * 500, 2)) + 'ms'
|
||||
self.latencyfield = wx.StaticText(textfieldpanel, -1, '(' + latency + ' latency)', style=wx.ALIGN_LEFT | wx.ST_NO_AUTORESIZE)
|
||||
textfieldvbox.Add(self.latencyfield, 1, border=5, flag=wx.ALIGN_LEFT | wx.ALL)
|
||||
textfieldpanel.SetSizer(textfieldvbox)
|
||||
mainvbox.Add(textfieldpanel, 0, border=10, flag=wx.LEFT | wx.RIGHT)
|
||||
if selectkey != None:
|
||||
selectval = None
|
||||
try:
|
||||
selectval = self.parent.model.get(selectkey)
|
||||
if value_mask != None:
|
||||
selectval = int(int(selectval) & value_mask)
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
else:
|
||||
if selectval == None:
|
||||
selectval = default_choice
|
||||
if selectval not in self.choices.keys():
|
||||
selectval = default_choice
|
||||
style = wx.BORDER_NONE | wx.CB_READONLY
|
||||
mychoices = []
|
||||
for i in sorted(choices.keys()):
|
||||
mychoices.append(choices[i])
|
||||
|
||||
selectfield = wx.ComboBox(selectfieldpanel, 30, choices=mychoices, style=style)
|
||||
selectfield.SetStringSelection(self.choices[selectval])
|
||||
selectfieldvbox.Add(selectfield, 1, border=5, flag=wx.ALIGN_LEFT | wx.ALL)
|
||||
selectfieldpanel.SetSizer(selectfieldvbox)
|
||||
mainvbox.Add(selectfieldpanel, 0, border=10, flag=wx.LEFT | wx.RIGHT)
|
||||
self.selectfield = selectfield
|
||||
if optkey != None and optmask != 0:
|
||||
try:
|
||||
options = int(self.parent.model.get(optkey))
|
||||
except:
|
||||
options = default_options
|
||||
else:
|
||||
chkboxes = {}
|
||||
for i in range(0, 31):
|
||||
optnr = optmask & 1 << i
|
||||
val = options & 1 << i
|
||||
if optnr > 0:
|
||||
try:
|
||||
this_opttext = opttext[optnr]
|
||||
except:
|
||||
this_opttext = 'Unlisted Option: ' + hex(optnr)
|
||||
else:
|
||||
chkboxes[i] = wx.CheckBox(optionspanel, i, this_opttext)
|
||||
chkboxes[i].SetForegroundColour(fgcolour)
|
||||
optionsvbox.Add(chkboxes[i], 1, border=5, flag=wx.ALIGN_LEFT | wx.ALL)
|
||||
if val > 0:
|
||||
chkboxes[i].SetValue(1)
|
||||
if optnr == 32768:
|
||||
if self.parent.fir_file != '':
|
||||
chkboxes[i].SetLabel(self.parent.fir_file)
|
||||
chkboxes[i].SetSize((100, 150))
|
||||
if self.parent.parent.fir_taps_from_file == None:
|
||||
chkboxes[i].Enable(False)
|
||||
self.file_chkbox = chkboxes[i]
|
||||
self.load_button = wx.Button(optionspanel, 3, 'Load File')
|
||||
self.load_button.Enable(True)
|
||||
self.load_button.Show(True)
|
||||
optionsvbox.Add(self.load_button, 1, border=5, flag=wx.ALIGN_RIGHT | wx.ALL)
|
||||
self.Bind(wx.EVT_CHECKBOX, self.OnEnabled, id=i)
|
||||
|
||||
optionspanel.SetSizer(optionsvbox)
|
||||
optionsvbox.SetMinSize((250, 10))
|
||||
mainvbox.Add(optionspanel, 0, border=10, flag=wx.LEFT | wx.RIGHT)
|
||||
self.chkboxes = chkboxes
|
||||
self.OK_button = wx.Button(buttonspanel, 1, OKtext)
|
||||
self.OK_button.Enable(OK_Enable)
|
||||
self.OK_button.Show(OK_Show)
|
||||
buttonshbox.Add(self.OK_button, 1, border=3, flag=wx.ALL)
|
||||
if OK_Only == False:
|
||||
buttonshbox.Add(wx.Button(buttonspanel, 2, Canceltext), 1, border=3, flag=wx.ALL)
|
||||
buttonspanel.SetSizer(buttonshbox)
|
||||
if OK_Only == True:
|
||||
buttonshbox.SetMinSize((75, self.frame_height))
|
||||
else:
|
||||
buttonshbox.SetMinSize((150, self.frame_height))
|
||||
mainvbox.Add(buttonspanel, 0, border=5, flag=wx.ALL)
|
||||
self.SetSizerAndFit(mainvbox)
|
||||
self.Centre()
|
||||
self.textvbox = textvbox
|
||||
self.SetBackgroundColour(bgcolour)
|
||||
self.Bind(wx.EVT_TEXT_ENTER, self.OnOK, id=3)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnOK, id=1)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnCancel, id=2)
|
||||
self.CenterOnScreen()
|
||||
self.mainvbox = mainvbox
|
||||
self.response = None
|
||||
return
|
||||
|
||||
def OnEnabled(self, e):
|
||||
id = e.GetId()
|
||||
try:
|
||||
if self.chkboxes[id].GetValue() == 1:
|
||||
if id == 15:
|
||||
for i in range(15):
|
||||
self.chkboxes[i].SetValue(0)
|
||||
|
||||
else:
|
||||
self.chkboxes[15].SetValue(0)
|
||||
except:
|
||||
pass
|
||||
|
||||
return
|
||||
|
||||
def OnTextEnter(self, e):
|
||||
try:
|
||||
numtaps = int(self.textfield.GetValue())
|
||||
except:
|
||||
self.textfield.SetValue(str(self.numtaps))
|
||||
numtaps = self.numtaps
|
||||
|
||||
if numtaps > self.maxnumtaps:
|
||||
self.textfield.SetValue(str(self.maxnumtaps))
|
||||
numtaps = self.maxnumtaps
|
||||
sample_time = 1.0 / self.Fs
|
||||
latency = str(round(numtaps * sample_time * 500, 2)) + 'ms'
|
||||
self.latencyfield.SetLabel('(' + latency + ' latency)')
|
||||
return
|
||||
|
||||
def OnEraseBackground(self, evt):
|
||||
"""
|
||||
Add a picture to the background
|
||||
"""
|
||||
dc = evt.GetDC()
|
||||
if not dc:
|
||||
dc = wx.ClientDC(self)
|
||||
rect = self.GetUpdateRegion().GetBox()
|
||||
dc.SetClippingRect(rect)
|
||||
dc.Clear()
|
||||
bmp = wx.Bitmap(self.bg)
|
||||
dc.DrawBitmap(bmp, 0, 0)
|
||||
return
|
||||
|
||||
def OnLoad(self, e):
|
||||
wildcard = 'Text File (*.txt)|*.txt|Comma Separated Values File (*.csv)|*.csv'
|
||||
path = None
|
||||
dlg = wx.FileDialog(self, message='Select File....', defaultDir=one_unit.app.library_path, defaultFile='', wildcard=wildcard, style=wx.OPEN | wx.CHANGE_DIR)
|
||||
answer = dlg.Show()
|
||||
dlg.Destroy()
|
||||
dlg = wx.FileDialog(self, message='Select File....', defaultDir=one_unit.app.library_path, defaultFile='', wildcard=wildcard, style=wx.OPEN | wx.CHANGE_DIR)
|
||||
answer = dlg.ShowModal()
|
||||
if answer == wx.ID_OK:
|
||||
path = dlg.GetPath()
|
||||
else:
|
||||
path = None
|
||||
dlg.Destroy()
|
||||
if path:
|
||||
one_unit.app.library_path = os.path.split(path)[0]
|
||||
print mytime.displayTime() + ' Loading FIR file:', path
|
||||
f = open(path, 'r')
|
||||
content = f.readlines()
|
||||
f.close()
|
||||
if path.endswith('.csv'):
|
||||
split_content = []
|
||||
for line in content:
|
||||
split_content += line.split(',')
|
||||
|
||||
content = split_content
|
||||
coefs_raw = []
|
||||
coefs_float = []
|
||||
scaled_coefs = []
|
||||
max_val = 0
|
||||
floating_point = False
|
||||
checked_content = []
|
||||
q = 0
|
||||
for value in content:
|
||||
try:
|
||||
checked_content.append(float(safeNumber(value)))
|
||||
q += 1
|
||||
if str(value).find('.') > 0:
|
||||
floating_point = True
|
||||
except:
|
||||
pass
|
||||
|
||||
content = checked_content
|
||||
if floating_point:
|
||||
for coef in content:
|
||||
scaled_coefs.append(coef)
|
||||
|
||||
else:
|
||||
for raw_coef in content:
|
||||
coef = int(raw_coef)
|
||||
coefs_raw.append(coef)
|
||||
if abs(coef) > max_val:
|
||||
max_val = abs(coef)
|
||||
|
||||
scale = 8388607
|
||||
if max_val >= 16777215:
|
||||
scale = 2147483647
|
||||
scale = scale * 1.0
|
||||
for coef in coefs_raw:
|
||||
coef = coef / scale
|
||||
scaled_coefs.append(coef)
|
||||
|
||||
if len(scaled_coefs) > self.parent.maxnumtaps + 1:
|
||||
print mytime.displayTime() + ' Filter too long:', len(scaled_coefs)
|
||||
dlgMessage = getString('lffmt1') + ' ' + str(len(scaled_coefs)) + ' ' + getString('lffmt2') + ' ' + str(self.parent.maxnumtaps) + ' ' + getString('lffmt3')
|
||||
dlgTitle = getString('lff')
|
||||
res = wx.MessageBox(dlgMessage, dlgTitle, wx.OK | wx.CANCEL)
|
||||
if res != wx.OK:
|
||||
print 'fd.ol.Customer declined filter resampling'
|
||||
return
|
||||
taps = self.parent.RecalculateFIR(scaled_coefs, int(self.parent.maxnumtaps))
|
||||
print mytime.displayTime() + ' Resampled to ', len(taps), 'taps'
|
||||
else:
|
||||
taps = scaled_coefs
|
||||
self.textfield.SetValue(str(len(taps)))
|
||||
self.parent.parent.numtaps = len(taps)
|
||||
self.parent.parent.fir_taps_from_file = taps
|
||||
self.parent.calc_fir_options |= 32768
|
||||
self.file_chkbox.Enable(True)
|
||||
self.file_chkbox.SetValue(1)
|
||||
self.parent.fir_file = os.path.split(path)[1]
|
||||
self.chkboxes[15].SetLabel(self.parent.fir_file)
|
||||
font = self.chkboxes[15].GetFont()
|
||||
dc = wx.ScreenDC()
|
||||
dc.SetFont(font)
|
||||
(w, h) = dc.GetTextExtent(self.parent.fir_file)
|
||||
print 'Size:', w, h
|
||||
self.chkboxes[15].SetSize((w + 50, h + 10))
|
||||
if w + 100 > self.GetSize()[0]:
|
||||
self.SetSize((w + 100, self.GetSize()[1]))
|
||||
for i in range(15):
|
||||
try:
|
||||
self.chkboxes[i].SetValue(0)
|
||||
except:
|
||||
pass
|
||||
|
||||
self.chkboxes[15].SetValue(1)
|
||||
return
|
||||
|
||||
def OnOK(self, evt):
|
||||
self.response = 'OK'
|
||||
try:
|
||||
self.numtaps = self.textfield.GetValue()
|
||||
if self.optkey != None and self.optmask != 0:
|
||||
try:
|
||||
options = int(self.parent.model.get(self.optkey))
|
||||
except:
|
||||
options = self.default_options
|
||||
else:
|
||||
for i in range(0, 31):
|
||||
optnr = self.optmask & 1 << i
|
||||
val = 1 << i
|
||||
if optnr > 0:
|
||||
if self.chkboxes[i].GetValue() == True:
|
||||
options |= val
|
||||
else:
|
||||
options &= 4294967295L - val
|
||||
|
||||
if self.Set == True:
|
||||
self.parent.set_value(self.optkey, options)
|
||||
self.options = options
|
||||
if self.selectkey != None and self.Set == True:
|
||||
s = self.selectfield.GetStringSelection()
|
||||
for (k, v) in self.choices.items():
|
||||
if v == s:
|
||||
v = k
|
||||
if self.value_mask != None:
|
||||
val = int(self.parent.model.get(self.selectkey)) & (4294967295L ^ self.value_mask)
|
||||
val |= int(v)
|
||||
v = val
|
||||
self.parent.set_value(self.selectkey, v)
|
||||
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
|
||||
if self.IsModal() == False:
|
||||
self.Destroy()
|
||||
else:
|
||||
self.Close()
|
||||
return
|
||||
|
||||
def OnCancel(self, evt):
|
||||
self.response = 'Cancel'
|
||||
if self.IsModal == False:
|
||||
self.Destroy()
|
||||
else:
|
||||
self.Close()
|
||||
return
|
||||
|
||||
def Update(self, text):
|
||||
if self.infotext == None:
|
||||
return
|
||||
else:
|
||||
if unicode(text) != self.infostring:
|
||||
self.infostring = unicode(text)
|
||||
self.infotext.SetLabel(self.infostring)
|
||||
self.infotext.Wrap(self.wrap)
|
||||
self.Layout()
|
||||
self.SetSizerAndFit(self.mainvbox)
|
||||
return
|
||||
|
||||
def EnableOK(self, OK_Enable):
|
||||
self.OK_button.Enable(OK_Enable)
|
||||
return
|
||||
|
||||
def ShowOK(self, OK_Enable):
|
||||
self.OK_button.Show(OK_Enable)
|
||||
return
|
||||
|
||||
|
||||
|
||||
# okay decompiling pycode/fir_dialog.pyc
|
||||
@@ -0,0 +1,56 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: future.pyc
|
||||
# Compiled at: 2022-04-20 07:08:29
|
||||
from threading import *
|
||||
import copy, mytime, traceback, sys, inspect, mytime, wx
|
||||
|
||||
class Future:
|
||||
|
||||
def __init__(self, delay, func, *param):
|
||||
self.__done = 0
|
||||
self.__result = None
|
||||
self.__status = 'working'
|
||||
self.__C = Condition()
|
||||
self.__T = Thread(target=self.Wrapper, args=(func, param, delay))
|
||||
self.__T.setName('FutureThread')
|
||||
self.__T.start()
|
||||
self.calledFrom = inspect.getouterframes(inspect.currentframe(), 2)[1][3]
|
||||
self.funcName = func.__name__
|
||||
curframe = inspect.currentframe()
|
||||
calframe = inspect.getouterframes(curframe, 2)
|
||||
return
|
||||
|
||||
def __repr__(self):
|
||||
return '<Future at ' + hex(id(self)) + ':' + self.__status + '>'
|
||||
|
||||
def __call__(self):
|
||||
self.__C.acquire()
|
||||
while self.__done == 0:
|
||||
self.__C.wait()
|
||||
|
||||
self.__C.release()
|
||||
a = copy.deepcopy(self.__result)
|
||||
return a
|
||||
|
||||
def Wrapper(self, func, param, delay):
|
||||
self.__C.acquire()
|
||||
mytime.sleep(delay)
|
||||
try:
|
||||
self.__result = wx.CallAfter(func, *param)
|
||||
except:
|
||||
self.__result = 'Exception raised within Future, function ' + self.funcName + ' called from ' + self.calledFrom
|
||||
print mytime.displayTime(), self.__result
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
|
||||
self.__done = 1
|
||||
self.__status = `(self.__result)`
|
||||
self.__C.notify()
|
||||
self.__C.release()
|
||||
return
|
||||
|
||||
|
||||
|
||||
# okay decompiling pycode/future.pyc
|
||||
@@ -0,0 +1,9 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: keyfile.pyc
|
||||
# Compiled at: 2025-05-23 11:22:14
|
||||
preset_encryption_key = 'nvbhfwieahscoiuafnrakjdfhaskjdhvlskdjncailsuydkdfjnalsuvhesrioiclioswoqweymdpwkxmnakcnxenwoawkomoqxsojdinoskdcmskjdfmaxkjnsdcjkndlkscntnvlakjsbxnlkjdbhvkjdgnlfcusxnl'
|
||||
|
||||
# okay decompiling pycode/keyfile.pyc
|
||||
@@ -0,0 +1,18 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: main.pyc
|
||||
# Compiled at: 2024-11-13 09:37:24
|
||||
import sys, scipy, one_unit
|
||||
|
||||
def run():
|
||||
frame = one_unit.main_application(sys.argv)
|
||||
frame.start()
|
||||
return
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
||||
# okay decompiling pycode/main.pyc
|
||||
@@ -0,0 +1,50 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: makePDF.pyc
|
||||
# Compiled at: 2022-04-20 07:08:45
|
||||
import my_pyfpdf as pyfpdf, ConfigParser, traceback, os, sys, shutil, struct
|
||||
from odf.opendocument import Spreadsheet
|
||||
from odf.opendocument import load
|
||||
from odf.table import TableRow, TableCell
|
||||
from odf.text import P
|
||||
from odf.opendocument import OpenDocumentSpreadsheet
|
||||
from odf.style import Style, TextProperties, TableColumnProperties, Map
|
||||
from odf.number import NumberStyle, CurrencyStyle, CurrencySymbol, Number, Text
|
||||
from odf.text import P
|
||||
from odf.table import Table, TableColumn, TableRow, TableCell
|
||||
newline = '\n'
|
||||
|
||||
class MyPDF(pyfpdf.FPDF):
|
||||
|
||||
def __init__(self, headerText=''):
|
||||
self.headerText = headerText
|
||||
self.default_text_colour = (0, 0, 0)
|
||||
self.header_colour = (0, 0, 0)
|
||||
self.header_pos = (190, 0)
|
||||
self.header_size = 11
|
||||
self.icon_pos = (195, 5)
|
||||
pyfpdf.FPDF.__init__(self)
|
||||
self.set_text_color(self.header_colour[0], self.header_colour[1], self.header_colour[2])
|
||||
return
|
||||
|
||||
def header(self):
|
||||
self.set_font('Arial', size=self.header_size)
|
||||
self.cell(self.header_pos[0], self.header_pos[1], self.headerText, ln=0, align='C')
|
||||
self.ln(10)
|
||||
return
|
||||
|
||||
def footer(self):
|
||||
"""
|
||||
Footer on each page
|
||||
"""
|
||||
self.set_y(-8.7)
|
||||
self.set_font('Arial', style='I', size=8)
|
||||
pageNum = 'Page %s' % self.page_no()
|
||||
self.cell(0, 10, pageNum, align='R')
|
||||
return
|
||||
|
||||
|
||||
|
||||
# okay decompiling pycode/makePDF.pyc
|
||||
@@ -0,0 +1,304 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: my_menu.pyc
|
||||
# Compiled at: 2023-05-16 13:01:50
|
||||
import mytime, wx, wx.lib.agw.flatmenu as flm, os.path, sys, traceback, one_unit, string
|
||||
mac_names = 'posix'
|
||||
|
||||
class my_MenuBar(flm.FlatMenuBar):
|
||||
|
||||
def __init__(self, parent, buttons=True):
|
||||
import inspect
|
||||
self.parent = parent
|
||||
self.program_title = ''
|
||||
self.buttons = buttons
|
||||
self.display_buffer = None
|
||||
self.menuCount = 0
|
||||
self.spacing = 5
|
||||
self.close_button = None
|
||||
self.minimize_button = None
|
||||
self.maximize_button = None
|
||||
flm.FlatMenuBar.__init__(self, self.parent, -1, options=flm.FM_OPT_IS_LCD | flm.FM_OPT_MINIBAR)
|
||||
if os.name in mac_names or one_unit.app.highDPI == False:
|
||||
self.font = wx.Font(8, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
|
||||
else:
|
||||
self.font = wx.Font(8.0 / one_unit.app.displayScale[0], wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
|
||||
if os.name not in mac_names:
|
||||
self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
|
||||
self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
|
||||
self.Bind(wx.EVT_MOTION, self.OnMotion)
|
||||
self.display_buffer = None
|
||||
self.close_button = None
|
||||
self.minimize_button = None
|
||||
self.maximize_button = None
|
||||
self.left_down = False
|
||||
self.moved_screen = False
|
||||
self.mousePointAtClick = 0
|
||||
self.mousePointInFocus = 0
|
||||
self.Bind(wx.EVT_MOUSE_CAPTURE_LOST, (lambda x: None))
|
||||
if os.name in mac_names:
|
||||
self.osxbar = wx.MenuBar()
|
||||
return
|
||||
|
||||
def SetSize(self, size):
|
||||
if os.name in mac_names:
|
||||
super(my_MenuBar, self).SetSize((size[0], 0))
|
||||
self.parent.SetMenuBar(self.osxbar)
|
||||
else:
|
||||
super(my_MenuBar, self).SetSize(size)
|
||||
if size[0] > 500:
|
||||
self.spacing = (size[0] - 500) / 10
|
||||
if self.spacing > 25:
|
||||
self.spacing = 25
|
||||
return
|
||||
|
||||
def SetTitle(self, title):
|
||||
if self.GetSize()[0] > 300:
|
||||
self.program_title = title
|
||||
else:
|
||||
self.program_title = ''
|
||||
self.Refresh()
|
||||
return
|
||||
|
||||
def GetTitle(self):
|
||||
return self.program_title
|
||||
|
||||
def Append(self, menu, text):
|
||||
self.menuCount += 1
|
||||
super(my_MenuBar, self).Append(menu, text)
|
||||
if os.name in mac_names:
|
||||
self.osxbar.Append(menu.osxmenu, text)
|
||||
return
|
||||
|
||||
def AppendIcons(self):
|
||||
if self.buttons == False:
|
||||
return
|
||||
bitmapdir = os.path.normpath(one_unit.app.cwd + '/bitmaps')
|
||||
self.close_button = wx.Bitmap(bitmapdir + '/close.png')
|
||||
self.minimize_button = wx.Bitmap(bitmapdir + '/minimize.png')
|
||||
try:
|
||||
CanMaximize = self.parent.CanMaximize
|
||||
except:
|
||||
CanMaximize = False
|
||||
|
||||
if CanMaximize == True:
|
||||
self.maximize_button = wx.Bitmap(bitmapdir + '/maximize.png')
|
||||
self.restore_button = wx.Bitmap(bitmapdir + '/restore.png')
|
||||
if os.name in mac_names:
|
||||
self.parent.SetMenuBar(self.osxbar)
|
||||
return
|
||||
|
||||
def OnLeftDown(self, e):
|
||||
x = e.GetX()
|
||||
self.left_down = True
|
||||
self.getOrReleaseMouseCapture(True)
|
||||
self.mousePointAtClick = e.GetPosition()
|
||||
self.parent.OnLeftDown(e)
|
||||
w = self.GetSize()[0] - 10
|
||||
if self.spacing > 5:
|
||||
w -= self.spacing / 2
|
||||
if self.close_button:
|
||||
if x < w and x > w - self.close_button.GetSize()[0]:
|
||||
self.parent.OnClose(e)
|
||||
self.left_down = False
|
||||
return
|
||||
w = w - self.close_button.GetSize()[0] - self.spacing
|
||||
if self.maximize_button:
|
||||
if x < w and x > w - self.maximize_button.GetSize()[0]:
|
||||
if self.parent.IsMaximized():
|
||||
self.parent.Maximize(False)
|
||||
else:
|
||||
self.parent.Maximize(True)
|
||||
return
|
||||
w = w - self.maximize_button.GetSize()[0] - self.spacing
|
||||
if self.minimize_button:
|
||||
if x < w and x > w - self.minimize_button.GetSize()[0]:
|
||||
self.parent.Iconize(True)
|
||||
self.left_down = False
|
||||
return
|
||||
w = w - self.minimize_button.GetSize()[0] - self.spacing
|
||||
super(my_MenuBar, self).OnLeftDown(e)
|
||||
return
|
||||
|
||||
def OnPaint(self, e):
|
||||
if self.left_down:
|
||||
dc = wx.WindowDC(self)
|
||||
return
|
||||
else:
|
||||
super(my_MenuBar, self).OnPaint(e)
|
||||
if self.display_buffer == None:
|
||||
(w, h) = self.GetSize()
|
||||
self.display_buffer = wx.EmptyBitmap(w, h)
|
||||
if self.GetSize() != self.display_buffer.GetSize():
|
||||
(w, h) = self.GetSize()
|
||||
self.display_buffer = wx.EmptyBitmap(w, h)
|
||||
dc = wx.WindowDC(self)
|
||||
w = self.GetSize()[0] - 10
|
||||
if self.spacing > 5:
|
||||
w -= self.spacing / 2
|
||||
if self.close_button:
|
||||
w = w - self.close_button.GetSize()[0]
|
||||
dc.DrawBitmap(self.close_button, w, -3)
|
||||
if self.maximize_button:
|
||||
w = w - self.maximize_button.GetSize()[0] - self.spacing
|
||||
if self.parent.maximized == False:
|
||||
dc.DrawBitmap(self.maximize_button, w, -3)
|
||||
else:
|
||||
dc.DrawBitmap(self.restore_button, w, -3)
|
||||
if self.minimize_button:
|
||||
w = w - self.minimize_button.GetSize()[0] - self.spacing
|
||||
dc.DrawBitmap(self.minimize_button, w, -3)
|
||||
dc.SetFont(self.font)
|
||||
(tw, th) = dc.GetTextExtent(self.program_title)
|
||||
left = self.menuCount * 44
|
||||
right = w
|
||||
pos = (left + right) / 2 - tw / 2
|
||||
dc.DrawText(self.program_title, pos, self.GetSize()[1] / 2 - 5)
|
||||
return
|
||||
|
||||
def OnLeftUp(self, event):
|
||||
self.left_down = False
|
||||
self.getOrReleaseMouseCapture(False)
|
||||
if self.moved_screen == True:
|
||||
self.moved_screen = False
|
||||
self.changed = True
|
||||
self.Refresh()
|
||||
self.parent.OnLeftUp(event)
|
||||
return
|
||||
|
||||
def OnMotion(self, e):
|
||||
if self.parent.__name__ == 'GraphicalNetworkWindow':
|
||||
self.parent.OnMotion(e)
|
||||
return
|
||||
if e.Dragging() and self.left_down == True:
|
||||
actMousePoint = e.GetPosition()
|
||||
oldAppScreenPos = self.parent.GetPosition()
|
||||
mouseMoveDelta = actMousePoint - self.mousePointAtClick
|
||||
newAppScreenPos = oldAppScreenPos + mouseMoveDelta
|
||||
self.parent.Move(newAppScreenPos)
|
||||
self.moved_screen = True
|
||||
return
|
||||
|
||||
def OnMenuDismissed(self, *args, **kwargs):
|
||||
"""
|
||||
Called whenever a menu item (even the main menu entry itself) was selected.
|
||||
This method is used to make sure that the mouse capture for the flat menu bar
|
||||
(i.e. the window it belongs to) is released. Else the user might do unwanted
|
||||
window movements or is not able to click on action buttons (needs to click twice)
|
||||
|
||||
@param self: The class object itself
|
||||
@param e: The event handler object
|
||||
"""
|
||||
self.left_down = False
|
||||
self.getOrReleaseMouseCapture(False)
|
||||
return flm.FlatMenuBar.OnMenuDismissed(self, *args, **kwargs)
|
||||
|
||||
def getOrReleaseMouseCapture(self, capture):
|
||||
"""
|
||||
Captures the mouse for this class object (which keeps a wxWidgets frame or a compatible
|
||||
wxWidgets object). The mouse will only be captured or released if the class object hasCapture
|
||||
method returns the correct value.
|
||||
|
||||
@param self: The class object itself
|
||||
@param capture: True or false. True get the mouse capture for this class, false release it
|
||||
"""
|
||||
if capture and not self.HasCapture():
|
||||
self.CaptureMouse()
|
||||
if not capture and self.HasCapture():
|
||||
self.ReleaseMouse()
|
||||
return
|
||||
|
||||
|
||||
class my_Menu(flm.FlatMenu):
|
||||
|
||||
def __init__(self, parent):
|
||||
self.parent = parent
|
||||
self.menuItems = {}
|
||||
self._mousePtAtStartup = None
|
||||
flm.FlatMenu.__init__(self)
|
||||
if os.name in mac_names:
|
||||
self.osxmenu = wx.Menu()
|
||||
return
|
||||
|
||||
def Append(self, id, t1, t2):
|
||||
if os.name in mac_names:
|
||||
item = self.osxmenu.Append(id, t1, t2)
|
||||
else:
|
||||
item = super(my_Menu, self).Append(id, t1, t2, None)
|
||||
self.menuItems[id] = item
|
||||
return item
|
||||
|
||||
def AppendSeparator(self):
|
||||
if os.name in mac_names:
|
||||
return self.osxmenu.AppendSeparator()
|
||||
return super(my_Menu, self).AppendSeparator()
|
||||
|
||||
def AppendMenu(self, id, t1, menu):
|
||||
if os.name in mac_names:
|
||||
return self.osxmenu.AppendMenu(id, t1, menu.osxmenu)
|
||||
else:
|
||||
return super(my_Menu, self).AppendMenu(id, t1, menu, None)
|
||||
|
||||
def AppendRadioItem(self, id, t1, t2):
|
||||
if os.name in mac_names:
|
||||
return self.osxmenu.AppendRadioItem(id, t1, t2)
|
||||
return super(my_Menu, self).AppendRadioItem(id, t1, t2)
|
||||
|
||||
def AppendCheckItem(self, id, t1, t2):
|
||||
if os.name in mac_names:
|
||||
return self.osxmenu.AppendCheckItem(id, t1, t2)
|
||||
return super(my_Menu, self).AppendCheckItem(id, t1, t2)
|
||||
|
||||
def Check(self, id, val):
|
||||
item = self.FindItem(id)
|
||||
if item != None:
|
||||
item.Check()
|
||||
else:
|
||||
try:
|
||||
if os.name in mac_names:
|
||||
self.osxmenu.Check(id, val)
|
||||
super(my_Menu, self).Check(id, val)
|
||||
except:
|
||||
pass
|
||||
|
||||
return
|
||||
|
||||
def SetLabel(self, id, val):
|
||||
if os.name in mac_names:
|
||||
self.osxmenu.SetLabel(id, val)
|
||||
else:
|
||||
item = self.FindItem(id)
|
||||
item.SetText(val)
|
||||
return
|
||||
|
||||
def GetLabel(self, id):
|
||||
if os.name in mac_names:
|
||||
return self.osxmenu.GetLabel(id)
|
||||
else:
|
||||
item = self.FindItem(id)
|
||||
return item.GetText()
|
||||
return
|
||||
|
||||
def GetMenuItems(self):
|
||||
return self.menuItems
|
||||
|
||||
def FindItemById(self, id):
|
||||
if os.name in mac_names:
|
||||
return self.osxmenu.FindItemById(id)
|
||||
else:
|
||||
return self.menuItems[id]
|
||||
return
|
||||
|
||||
def Destroy(self, id):
|
||||
if os.name in mac_names:
|
||||
self.osxmenu.Delete(id)
|
||||
else:
|
||||
super(my_Menu, self).Destroy(self.menuItems[id])
|
||||
del self.menuItems[id]
|
||||
return
|
||||
|
||||
|
||||
|
||||
# okay decompiling pycode/my_menu.pyc
|
||||
@@ -0,0 +1,49 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: mytime.pyc
|
||||
# Compiled at: 2022-04-20 07:08:40
|
||||
import time, os
|
||||
if os.name == 'nt':
|
||||
start_time = time.clock()
|
||||
|
||||
def clock():
|
||||
return round(time.clock() - start_time, 4)
|
||||
|
||||
|
||||
def displayTime():
|
||||
tijd = str(clock())
|
||||
return (tijd + '0000')[:tijd.find('.') + 4]
|
||||
|
||||
|
||||
def sleep(seconds):
|
||||
if seconds < 0.01:
|
||||
print displayTime() + ' too small sleep value, will sleep 13ms', seconds
|
||||
seconds = 0.013
|
||||
time.sleep(seconds)
|
||||
return
|
||||
|
||||
|
||||
else:
|
||||
start_time = time.time()
|
||||
|
||||
def clock():
|
||||
return round(time.time() - start_time, 4)
|
||||
|
||||
|
||||
def displayTime():
|
||||
tijd = str(clock())
|
||||
return (tijd + '0000')[:tijd.find('.') + 3]
|
||||
|
||||
|
||||
def sleep(seconds):
|
||||
if seconds < 0.01:
|
||||
print displayTime() + ' too small sleep value, will sleep 13ms', seconds
|
||||
seconds = 0.013
|
||||
time.sleep(seconds)
|
||||
return
|
||||
|
||||
|
||||
|
||||
# okay decompiling pycode/mytime.pyc
|
||||
@@ -0,0 +1,258 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: network_settings.pyc
|
||||
# Compiled at: 2023-12-05 14:43:06
|
||||
import wx, wx.lib, os, data_model, traceback, one_unit, protocol, sys, future, mytime
|
||||
from definitions import *
|
||||
import wx.lib.buttons
|
||||
|
||||
def getString(str):
|
||||
return one_unit.getString(str)
|
||||
|
||||
|
||||
class Dialog(wx.Dialog):
|
||||
|
||||
def __init__(self, parent, id, title, infotext='', optkey=None, optmask=0, opttext={}, bgcolour=(220, 220, 220), fgcolour=(70, 70, 70), OK_Only=False, ipkey=None, maskkey=None, default_text=None, IsPassword=False, Set=True, Wrap=0, size=(400, 270), bg=None):
|
||||
wx.Dialog.__init__(self, None, wx.ID_ANY, title, size=size, style=wx.DEFAULT_DIALOG_STYLE)
|
||||
self.parent = parent
|
||||
if bg != None:
|
||||
self.bg = bg
|
||||
self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
|
||||
print mytime.displayTime() + ' wxPython version: ' + str(wx.VERSION_STRING)
|
||||
self.optkey = optkey
|
||||
self.ipkey = ipkey
|
||||
self.maskkey = maskkey
|
||||
self.optmask = protocol.confTelnetEnabled
|
||||
self.frame_height = 2 * wx.SystemSettings.GetMetric(wx.SYS_CAPTION_Y) + wx.SystemSettings.GetMetric(wx.SYS_BORDER_Y)
|
||||
if os.name in mac_names:
|
||||
self.frame_height = 24
|
||||
self.chkboxes = {}
|
||||
self.Set = Set
|
||||
self.infotext = None
|
||||
if infotext != '':
|
||||
textstring = wx.StaticText(self, -1, infotext, style=wx.ALIGN_LEFT, pos=(25,
|
||||
10))
|
||||
textstring.SetForegroundColour(fgcolour)
|
||||
self.infotext = textstring
|
||||
self.infostring = infotext
|
||||
if os.name in mac_names:
|
||||
textstring.SetFont(wx.Font(11, wx.SWISS, wx.NORMAL, wx.NORMAL))
|
||||
textstring.Wrap(350)
|
||||
try:
|
||||
self.telnet_enabled = int(self.parent.model.get(optkey)) & protocol.confTelnetEnabled
|
||||
except:
|
||||
self.telnet_enabled = 0
|
||||
|
||||
if self.telnet_enabled > 0:
|
||||
self.telnet_enabled = True
|
||||
else:
|
||||
self.telnet_enabled = False
|
||||
print mytime.displayTime() + ' Open Interface Enabled:', self.telnet_enabled
|
||||
mvlabel = wx.StaticText(self, -1, '3rd Party Control', style=wx.ALIGN_LEFT, pos=(25,
|
||||
180))
|
||||
if self.telnet_enabled == True:
|
||||
self.mvindication = wx.StaticText(self, -1, 'Enabled', style=wx.ALIGN_LEFT, pos=(170,
|
||||
180))
|
||||
self.mv_button = wx.lib.buttons.GenButton(self, 13, 'Disable', pos=(280,
|
||||
180), size=(100,
|
||||
20))
|
||||
else:
|
||||
self.mvindication = wx.StaticText(self, -1, 'Disabled', style=wx.ALIGN_LEFT, pos=(170,
|
||||
180))
|
||||
self.mv_button = wx.lib.buttons.GenButton(self, 13, 'Enable', pos=(280,
|
||||
180), size=(100,
|
||||
20))
|
||||
self.DHCP_checkbox1 = wx.RadioButton(self, -1, 'Configure Network Automatically (DHCP)', pos=(25,
|
||||
75), style=wx.RB_GROUP)
|
||||
self.DHCP_checkbox2 = wx.RadioButton(self, -1, 'Configure Network Manually:', pos=(25,
|
||||
95))
|
||||
iplabel = wx.StaticText(self, -1, 'IP Address:', style=wx.ALIGN_LEFT, pos=(50,
|
||||
120))
|
||||
ipstring = None
|
||||
if ipkey != None:
|
||||
textval = ''
|
||||
try:
|
||||
ip = int(self.parent.model.get(ipkey))
|
||||
ip1 = str(ip / 16777216)
|
||||
ip -= int(ip1) * 256 * 256 * 256
|
||||
ip2 = str(ip / 65536)
|
||||
ip -= int(ip2) * 256 * 256
|
||||
ip3 = str(ip / 256)
|
||||
ip -= int(ip3) * 256
|
||||
ip4 = str(ip)
|
||||
ipstring = ip1 + '.' + ip2 + '.' + ip3 + '.' + ip4
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
if ipstring == None:
|
||||
ipstring = ' . . . '
|
||||
if default_text != None:
|
||||
ipstring = default_text
|
||||
style = wx.TE_PROCESS_ENTER
|
||||
ipfield = wx.TextCtrl(self, 3, unicode(ipstring), style=style, pos=(170,
|
||||
120))
|
||||
ipfield.SetFocus()
|
||||
self.ipfield = ipfield
|
||||
masklabel = wx.StaticText(self, -1, 'Subnet Mask:', style=wx.ALIGN_LEFT, pos=(50,
|
||||
150))
|
||||
ipstring = None
|
||||
if maskkey != None:
|
||||
textval = ''
|
||||
try:
|
||||
ip = int(self.parent.model.get(maskkey))
|
||||
ip1 = str(ip / 16777216)
|
||||
ip -= int(ip1) * 256 * 256 * 256
|
||||
ip2 = str(ip / 65536)
|
||||
ip -= int(ip2) * 256 * 256
|
||||
ip3 = str(ip / 256)
|
||||
ip -= int(ip3) * 256
|
||||
ip4 = str(ip)
|
||||
ipstring = ip1 + '.' + ip2 + '.' + ip3 + '.' + ip4
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
if ipstring == None:
|
||||
ipstring = ' . . . '
|
||||
if default_text != None:
|
||||
ipstring = default_text
|
||||
maskfield = wx.TextCtrl(self, 3, unicode(ipstring), style=style, pos=(170,
|
||||
150))
|
||||
self.maskfield = maskfield
|
||||
ok_button = wx.lib.buttons.GenButton(self, 1, 'Ok', pos=(235, 220), size=(70,
|
||||
20))
|
||||
cancel_button = wx.lib.buttons.GenButton(self, 2, 'Cancel', pos=(315, 220), size=(70,
|
||||
20))
|
||||
if self.parent.model.get(ipkey) == 0:
|
||||
self.ipfield.Disable()
|
||||
self.maskfield.Disable()
|
||||
self.DHCP_checkbox1.SetValue(1)
|
||||
else:
|
||||
self.DHCP_checkbox2.SetValue(1)
|
||||
self.Centre()
|
||||
self.parent = parent
|
||||
self.SetBackgroundColour(bgcolour)
|
||||
self.Bind(wx.EVT_TEXT_ENTER, self.OnOK, id=3)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnOK, id=1)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnCancel, id=2)
|
||||
self.Bind(wx.EVT_RADIOBUTTON, self.OnDHCPSelect, id=self.DHCP_checkbox1.GetId())
|
||||
self.Bind(wx.EVT_RADIOBUTTON, self.OnDHCPSelect, id=self.DHCP_checkbox2.GetId())
|
||||
self.Bind(wx.EVT_BUTTON, self.OnMV, id=13)
|
||||
self.CenterOnScreen()
|
||||
self.response = None
|
||||
return
|
||||
|
||||
def OnMV(self, e):
|
||||
if self.telnet_enabled == True:
|
||||
self.telnet_enabled = False
|
||||
self.mvindication.SetLabel('Disabled')
|
||||
self.mv_button.SetLabel('Enable')
|
||||
else:
|
||||
print 'ns.verify PIC version', self.parent.active_unit.PICVersion
|
||||
dlgMessage = getString('ifvn')
|
||||
if self.parent.verifyInterfaceVersion(dlgMessage) == False:
|
||||
print 'ns.PIC version too low, disabling open interface'
|
||||
self.telnet_enabled = False
|
||||
self.mvindication.SetLabel('Disabled')
|
||||
self.mv_button.SetLabel('Enable')
|
||||
return
|
||||
self.telnet_enabled = True
|
||||
self.mvindication.SetLabel('Enabled')
|
||||
self.mv_button.SetLabel('Disable')
|
||||
return
|
||||
|
||||
def OnDHCPSelect(self, e):
|
||||
if self.DHCP_checkbox1.GetValue() == True:
|
||||
self.ipfield.Disable()
|
||||
self.maskfield.Disable()
|
||||
else:
|
||||
self.ipfield.Enable()
|
||||
self.maskfield.Enable()
|
||||
return
|
||||
|
||||
def OnEraseBackground(self, evt):
|
||||
"""
|
||||
Add a picture to the background
|
||||
"""
|
||||
dc = evt.GetDC()
|
||||
if not dc:
|
||||
dc = wx.ClientDC(self)
|
||||
rect = self.GetUpdateRegion().GetBox()
|
||||
dc.SetClippingRect(rect)
|
||||
dc.Clear()
|
||||
bmp = wx.Bitmap(self.bg)
|
||||
dc.DrawBitmap(bmp, 0, 0)
|
||||
return
|
||||
|
||||
def msgNW(self, msg):
|
||||
dial = wx.MessageDialog(None, msg, 'Error', wx.OK | wx.ICON_ERROR)
|
||||
dial.Raise()
|
||||
dial.ShowModal()
|
||||
dial.Destroy()
|
||||
return
|
||||
|
||||
def OnOK(self, evt):
|
||||
if self.DHCP_checkbox1.GetValue() == True:
|
||||
self.parent.set_value(self.ipkey, 0)
|
||||
self.parent.set_value(self.maskkey, 0)
|
||||
elif self.ipkey != None and self.Set == True:
|
||||
ipval = 0
|
||||
try:
|
||||
iplist = self.ipfield.GetValue().split('.')
|
||||
if int(iplist[3]) > 223:
|
||||
msg = 'Class D and E addresses are not supported. Please specify a value between 1 and 223 for the 4th octet.'
|
||||
future.Future(0.1, self.msgNW, msg)
|
||||
return
|
||||
for i in iplist:
|
||||
ipval *= 256
|
||||
ipval += int(i)
|
||||
|
||||
self.parent.set_value(self.ipkey, ipval)
|
||||
except:
|
||||
msg = 'Please enter a valid IP address.'
|
||||
future.Future(0.1, self.msgNW, msg)
|
||||
return
|
||||
|
||||
if self.maskkey != None and self.Set == True:
|
||||
ipval = 0
|
||||
try:
|
||||
iplist = self.maskfield.GetValue().split('.')
|
||||
for i in iplist:
|
||||
ipval *= 256
|
||||
ipval += int(i)
|
||||
|
||||
self.parent.set_value(self.maskkey, ipval)
|
||||
except:
|
||||
msg = 'Please enter a valid subnet mask.'
|
||||
future.Future(0.1, self.msgNW, msg)
|
||||
return
|
||||
|
||||
if self.optkey != None and self.optmask != 0:
|
||||
try:
|
||||
options = int(self.parent.model.get(self.optkey))
|
||||
options &= protocol.confTelnetEnabled ^ 268435455
|
||||
if self.telnet_enabled:
|
||||
options |= protocol.confTelnetEnabled
|
||||
self.parent.set_value(self.optkey, options)
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
|
||||
self.response = 'OK'
|
||||
if self.IsModal() == False:
|
||||
self.Destroy()
|
||||
else:
|
||||
self.Close()
|
||||
return
|
||||
|
||||
def OnCancel(self, evt):
|
||||
self.response = 'Cancel'
|
||||
if self.IsModal == False:
|
||||
self.Destroy()
|
||||
else:
|
||||
self.Close()
|
||||
return
|
||||
|
||||
|
||||
|
||||
# okay decompiling pycode/network_settings.pyc
|
||||
@@ -0,0 +1,4 @@
|
||||
def full(*a, **k): pass
|
||||
def profile(*a, **k): pass
|
||||
def bind(*a, **k): pass
|
||||
def cannotcompile(*a, **k): pass
|
||||
@@ -0,0 +1,7 @@
|
||||
# Linux-Stub (COM)
|
||||
def CoInitialize(*a, **k):
|
||||
return None
|
||||
def CoUninitialize(*a, **k):
|
||||
return None
|
||||
class com_error(Exception):
|
||||
pass
|
||||
@@ -0,0 +1,278 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: record.pyc
|
||||
# Compiled at: 2022-04-20 07:08:45
|
||||
if __name__ == '__main__':
|
||||
import main
|
||||
main.run()
|
||||
import multiprocessing
|
||||
from array import array
|
||||
import pyaudio, numpy as np
|
||||
from numpy.lib import stride_tricks
|
||||
from scipy.ndimage.filters import gaussian_filter
|
||||
import mytime, traceback, sys, math, threading
|
||||
if __name__ == '__main__':
|
||||
|
||||
class _app(object):
|
||||
|
||||
def __init__(self):
|
||||
self.application_stopping = False
|
||||
return
|
||||
|
||||
|
||||
class _one_unit(object):
|
||||
|
||||
def __init__(self):
|
||||
self.app = _app()
|
||||
return
|
||||
|
||||
|
||||
one_unit = _one_unit()
|
||||
else:
|
||||
import one_unit
|
||||
CHUNK_SIZE = 512
|
||||
FORMAT = pyaudio.paInt16
|
||||
CHANNELS = 1
|
||||
RATE = 48000
|
||||
DEFAULT_SMOOTHING = 0.33
|
||||
factor = 0.01
|
||||
testfreqs = [_[1] for i in range(330)]
|
||||
|
||||
class _rtadata(object):
|
||||
|
||||
def __init__(self):
|
||||
self.avg_data = []
|
||||
self.active = -100
|
||||
self.recording = False
|
||||
self.input = None
|
||||
return
|
||||
|
||||
|
||||
def reset_rta_avg():
|
||||
rtadata.avg_data = []
|
||||
return
|
||||
|
||||
|
||||
rtadata = _rtadata()
|
||||
|
||||
def open_stream():
|
||||
try:
|
||||
p = pyaudio.PyAudio()
|
||||
info = p.get_host_api_info_by_index(0)
|
||||
numdevices = info.get('deviceCount')
|
||||
print mytime.displayTime() + ' Found audio input devices:'
|
||||
for i in range(0, numdevices):
|
||||
if p.get_device_info_by_host_api_device_index(0, i).get('maxInputChannels') > 0:
|
||||
name = p.get_device_info_by_host_api_device_index(0, i).get('name')
|
||||
print mytime.displayTime() + ' Input Device id', i, ':', name
|
||||
one_unit.app.available_audio_devices[i] = name
|
||||
|
||||
if len(one_unit.app.available_audio_devices.keys()) == 0:
|
||||
print mytime.displayTime() + ' No available audio devices!'
|
||||
return (None, None)
|
||||
input_device = one_unit.app.audio_input_device
|
||||
input_device_index = None
|
||||
for i in one_unit.app.available_audio_devices.keys():
|
||||
dev = one_unit.app.available_audio_devices[i]
|
||||
if dev == input_device:
|
||||
input_device_index = i
|
||||
break
|
||||
|
||||
if input_device_index == None:
|
||||
print mytime.displayTime() + ' Input device', one_unit.app.audio_input_device, 'not available, reverting to default'
|
||||
input_device_index = one_unit.app.available_audio_devices.keys()[0]
|
||||
one_unit.app.audio_input_device = one_unit.app.available_audio_devices[input_device_index]
|
||||
print mytime.displayTime() + ' Selected input device', one_unit.app.available_audio_devices[input_device_index]
|
||||
rtadata.input = one_unit.app.available_audio_devices[input_device_index]
|
||||
stream = p.open(format=FORMAT, channels=CHANNELS, rate=RATE, input=True, output=True, input_device_index=input_device_index, frames_per_buffer=CHUNK_SIZE)
|
||||
print mytime.clock(), 'Opened audio stream for RTA'
|
||||
return (stream, p)
|
||||
except:
|
||||
if one_unit.app.mijnpc == True:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
print mytime.clock(), 'Failed to open RTA audio stream'
|
||||
return (None, None)
|
||||
|
||||
return
|
||||
|
||||
|
||||
def record(stream, size):
|
||||
rtadata.recording = True
|
||||
data = array('h')
|
||||
for i in range(0, size / CHUNK_SIZE):
|
||||
chunk = array('h', stream.read(CHUNK_SIZE))
|
||||
data.extend(chunk)
|
||||
|
||||
rtadata.recording = False
|
||||
return data[:size]
|
||||
|
||||
|
||||
def stft(sig, frameSize, overlapFac=0.5, window=np.hamming):
|
||||
win = window(frameSize)
|
||||
hopSize = int(frameSize - np.floor(overlapFac * frameSize))
|
||||
fs = frameSize / 2.0
|
||||
fs = int(np.floor(fs))
|
||||
fsl = np.zeros(fs)
|
||||
samples = np.append(fsl, sig)
|
||||
cols = int(np.ceil((len(samples) - frameSize) / float(hopSize)) + 1)
|
||||
samples = np.append(samples, np.zeros(frameSize))
|
||||
mstrides = (
|
||||
samples.strides[0] * hopSize, samples.strides[0])
|
||||
fs = int(frameSize)
|
||||
frames = stride_tricks.as_strided(samples, shape=(cols, fs), strides=mstrides).copy()
|
||||
frames *= win
|
||||
return np.fft.rfft(frames)
|
||||
|
||||
|
||||
def makefft(stream):
|
||||
size = one_unit.app.FFT_len
|
||||
start_time = mytime.clock()
|
||||
samples = None
|
||||
for i in range(3):
|
||||
try:
|
||||
samples = record(stream, size)
|
||||
break
|
||||
except:
|
||||
pass
|
||||
|
||||
if samples == None:
|
||||
if one_unit.app.mijnpc == True:
|
||||
print mytime.displayTime() + ' Failed to read RTA stream'
|
||||
res = [
|
||||
0.0] * size
|
||||
rtadata.avg_data = res
|
||||
return (
|
||||
res, False)
|
||||
else:
|
||||
res = abs(stft(samples, size * 2))[0]
|
||||
if len(rtadata.avg_data) == len(res):
|
||||
res = (rtadata.avg_data * (one_unit.app.rta_time_avg - 1) + res) / one_unit.app.rta_time_avg
|
||||
rtadata.avg_data = res
|
||||
return (res, True)
|
||||
|
||||
|
||||
def resample_fft(data, outbins, avg=None, smoothing=DEFAULT_SMOOTHING):
|
||||
in_size = len(data)
|
||||
try:
|
||||
fft_scale = math.sqrt((len(data) - 1) / 4096.0)
|
||||
except:
|
||||
fft_scale = 1.0
|
||||
|
||||
out_size = len(outbins)
|
||||
out = [1e-30] * out_size
|
||||
if in_size == 0:
|
||||
return (out, avg)
|
||||
else:
|
||||
freqstep = float(RATE) / float(in_size) / 2
|
||||
bin = 0
|
||||
num = 0.0
|
||||
for i in range(in_size):
|
||||
freq = freqstep * i
|
||||
num += 1.0
|
||||
df = 0.0115 * freq
|
||||
if freq > outbins[bin] + df:
|
||||
out[bin] /= num
|
||||
out[bin] /= fft_scale
|
||||
num = 0.0
|
||||
bin += 1
|
||||
if bin < out_size:
|
||||
while freq > outbins[bin] + df:
|
||||
out[bin] = out[bin - 1]
|
||||
bin += 1
|
||||
if bin >= out_size:
|
||||
break
|
||||
|
||||
if bin < out_size:
|
||||
out[bin] += data[i]
|
||||
else:
|
||||
break
|
||||
|
||||
if smoothing > 0.0:
|
||||
f_smoothing = smoothing * (out_size / 20)
|
||||
out = gaussian_filter(out, f_smoothing)
|
||||
f_low = 0
|
||||
f_high = 0
|
||||
for i in range(out_size):
|
||||
if outbins[i] < 250:
|
||||
f_low = i
|
||||
if outbins[i] > 10000:
|
||||
f_high = i
|
||||
break
|
||||
|
||||
out = 20.0 * np.log10(out)
|
||||
if avg == None:
|
||||
avg = np.mean(out[f_low:f_high])
|
||||
pk = np.amax(out)
|
||||
if pk > 15:
|
||||
diff = pk - 15
|
||||
if diff > avg:
|
||||
avg = diff
|
||||
out -= avg
|
||||
return (
|
||||
out, avg)
|
||||
|
||||
|
||||
def process():
|
||||
stream = None
|
||||
p = None
|
||||
while one_unit.app.application_stopping == False:
|
||||
if one_unit.app.rta_on == True:
|
||||
if stream == None:
|
||||
(stream, p) = open_stream()
|
||||
mytime.sleep(0.01)
|
||||
continue
|
||||
(rtadata.res, allIsOK) = makefft(stream)
|
||||
if allIsOK == False:
|
||||
(stream, p) = open_stream()
|
||||
one_unit.app.rta_new_data = True
|
||||
if rtadata.input != one_unit.app.audio_input_device:
|
||||
stream.stop_stream()
|
||||
stream.close()
|
||||
p.terminate()
|
||||
stream = None
|
||||
print mytime.clock(), 'Closed RTA stream'
|
||||
mytime.sleep(0.1)
|
||||
elif stream != None and rtadata.recording == False:
|
||||
stream.stop_stream()
|
||||
stream.close()
|
||||
p.terminate()
|
||||
stream = None
|
||||
print mytime.clock(), 'Closed RTA stream'
|
||||
mytime.sleep(0.01)
|
||||
|
||||
try:
|
||||
stream.stop_stream()
|
||||
stream.close()
|
||||
print mytime.clock(), 'Closed RTA stream'
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
p.terminate()
|
||||
print mytime.clock(), 'Terminated audio handle'
|
||||
except:
|
||||
pass
|
||||
|
||||
print mytime.clock(), 'Closed RTA thread'
|
||||
return
|
||||
|
||||
|
||||
def getfft():
|
||||
rtadata.active = mytime.clock()
|
||||
return rtadata.avg_data
|
||||
|
||||
|
||||
recording_thread = threading.Thread(name='ALLDSP RTA', target=process)
|
||||
recording_thread.start()
|
||||
if __name__ == '__main__':
|
||||
i = 0
|
||||
while i < 30:
|
||||
data = getfft(testfreqs)
|
||||
mytime.sleep(0.05)
|
||||
i += 1
|
||||
|
||||
one_unit.app.application_stopping = True
|
||||
|
||||
# okay decompiling pycode/record.pyc
|
||||
@@ -0,0 +1,301 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: rta_measurements.pyc
|
||||
# Compiled at: 2022-04-20 07:08:45
|
||||
import wx, os, data_model, traceback, one_unit, sys, mytime
|
||||
mac_names = 'posix'
|
||||
default_colours = (
|
||||
(128, 0, 0), (128, 128, 0), (0, 128, 0), (0, 128, 128), (0, 0, 168), (128, 0, 128), (128, 50, 90), (90, 120, 60), (0, 64, 128), (80, 0, 160))
|
||||
smoothing_choices = {'1 Octave': 1, '1/2 Octave': 0.5, '1/3 Octave': 0.33, '1/6 Octave': 0.167, '1/12 Octave': 0.083, '1/24 Octave': 0.042, 'Off': 0}
|
||||
smoothing_list = ('1 Octave', '1/2 Octave', '1/3 Octave', '1/6 Octave', '1/12 Octave',
|
||||
'1/24 Octave', 'Off')
|
||||
FFT_choices = {'1k': 1024, '2k': 2048, '4k': 4096, '8k': 8192, '16k': 16384, '32k': 32768}
|
||||
FFT_list = ('1k', '2k', '4k', '8k', '16k', '32k')
|
||||
|
||||
class rtaDialog(wx.Dialog):
|
||||
|
||||
def __init__(self, parent, settings=False):
|
||||
if settings == True:
|
||||
title = 'RTA Setup'
|
||||
else:
|
||||
title = 'Save Measurement'
|
||||
wx.Dialog.__init__(self, None, wx.ID_ANY, title, size=(440, 100), style=wx.STAY_ON_TOP | wx.CAPTION | wx.DEFAULT_DIALOG_STYLE)
|
||||
self.parent = parent
|
||||
self.frame_height = 2 * wx.SystemSettings.GetMetric(wx.SYS_CAPTION_Y) + wx.SystemSettings.GetMetric(wx.SYS_BORDER_Y)
|
||||
if os.name in mac_names:
|
||||
self.frame_height = 24
|
||||
self.settings = settings
|
||||
fgcolour = 'red'
|
||||
optionspanel = wx.Panel(self, -1)
|
||||
optionsvbox = wx.BoxSizer(wx.VERTICAL)
|
||||
buttonspanel = wx.Panel(self, -1)
|
||||
buttonshbox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
mainvbox = wx.BoxSizer(wx.VERTICAL)
|
||||
self.colourData = wx.ColourData()
|
||||
self.linepanel = {}
|
||||
self.linebox = {}
|
||||
self.visible = {}
|
||||
self.enabled = {}
|
||||
self.name = {}
|
||||
self.weight = {}
|
||||
self.weightlabel = {}
|
||||
self.colour_button = {}
|
||||
self.f1 = {}
|
||||
self.f1label = {}
|
||||
self.f2 = {}
|
||||
self.f2label = {}
|
||||
if self.settings == True:
|
||||
self.settings_panel = wx.Panel(optionspanel, -1, size=(740, 25))
|
||||
smoothinglabel = wx.StaticText(self.settings_panel, label='Smoothing', pos=(23,
|
||||
5))
|
||||
self.smoothing = wx.Choice(self.settings_panel, -1, pos=(100, 3), size=(120,
|
||||
20), choices=smoothing_list)
|
||||
for val in smoothing_choices.keys():
|
||||
if smoothing_choices[val] == one_unit.app.rta_smoothing:
|
||||
self.smoothing.SetStringSelection(val)
|
||||
|
||||
avglabel = wx.StaticText(self.settings_panel, label='Avg', pos=(243, 5))
|
||||
self.avg = wx.TextCtrl(self.settings_panel, -1, value=str(int(one_unit.app.rta_time_avg)), size=(50,
|
||||
20), pos=(273,
|
||||
3))
|
||||
FFT_lenlabel = wx.StaticText(self.settings_panel, label='FFT Size', pos=(330,
|
||||
5))
|
||||
self.FFT_len = wx.Choice(self.settings_panel, -1, pos=(390, 3), size=(70,
|
||||
20), choices=FFT_list)
|
||||
for val in FFT_choices.keys():
|
||||
if FFT_choices[val] == one_unit.app.FFT_len:
|
||||
self.FFT_len.SetStringSelection(val)
|
||||
|
||||
self.one_shot = wx.CheckBox(self.settings_panel, -1, 'One Shot', size=(100,
|
||||
20), pos=(500,
|
||||
3))
|
||||
self.one_shot.SetValue(one_unit.app.rta_one_shot)
|
||||
self.auto_mute = wx.CheckBox(self.settings_panel, -1, 'Auto Unmute / Mute', size=(150,
|
||||
20), pos=(600,
|
||||
3))
|
||||
self.auto_mute.SetValue(one_unit.app.rta_auto_mute)
|
||||
optionsvbox.Add(self.settings_panel, 1, border=0, flag=wx.ALIGN_LEFT | wx.ALL)
|
||||
self.settings_panel_line_2 = wx.Panel(optionspanel, -1, size=(740, 25))
|
||||
inputlabel = wx.StaticText(self.settings_panel_line_2, label='Input', pos=(23,
|
||||
5))
|
||||
self.input = wx.Choice(self.settings_panel_line_2, -1, pos=(100, 3), size=(223,
|
||||
20), choices=one_unit.app.available_audio_devices.values())
|
||||
if one_unit.app.audio_input_device == None:
|
||||
if len(one_unit.app.available_audio_devices.values()) == 0:
|
||||
self.input.SetStringSelection('No available input devices.')
|
||||
else:
|
||||
self.input.SetStringSelection(one_unit.app.available_audio_devices.values()[0])
|
||||
else:
|
||||
self.input.SetStringSelection(one_unit.app.audio_input_device)
|
||||
self.auto_scale = wx.CheckBox(self.settings_panel_line_2, -1, 'Auto Scale', size=(100,
|
||||
20), pos=(500,
|
||||
3))
|
||||
self.auto_scale.SetValue(one_unit.app.rta_auto_scale)
|
||||
self.auto_scale.Show(False)
|
||||
self.show_peq = wx.CheckBox(self.settings_panel_line_2, -1, 'Show Filters', size=(100,
|
||||
20), pos=(600,
|
||||
3))
|
||||
self.show_peq.SetValue(one_unit.app.rta_show_peq)
|
||||
optionsvbox.Add(self.settings_panel_line_2, 1, border=0, flag=wx.ALIGN_LEFT | wx.ALL)
|
||||
else:
|
||||
one_unit.app.rta_data[len(one_unit.app.rta_data)] = (
|
||||
1.0, 'Measurement ' + str(len(one_unit.app.rta_data) - 1), True, True, default_colours[(len(one_unit.app.rta_data) - 2) % len(default_colours)], one_unit.app.rta_data[0][5], 0, 20000)
|
||||
for i in range(0, len(one_unit.app.rta_data)):
|
||||
self.linepanel[i] = wx.Panel(optionspanel, -1, size=(780, 25))
|
||||
if i > 1:
|
||||
self.enabled[i] = wx.CheckBox(self.linepanel[i], 100 + i, '', size=(20,
|
||||
20), pos=(3,
|
||||
3))
|
||||
self.enabled[i].SetValue(one_unit.app.rta_data[i][2])
|
||||
self.Bind(wx.EVT_CHECKBOX, self.OnEnabled, self.enabled[i])
|
||||
self.name[i] = wx.TextCtrl(self.linepanel[i], 200 + i, style=wx.TE_PROCESS_ENTER, value=one_unit.app.rta_data[i][1], size=(300,
|
||||
20), pos=(23,
|
||||
3))
|
||||
self.name[i].Bind(wx.EVT_TEXT_ENTER, self.OnNameEnter, self.name[i])
|
||||
if i > 1:
|
||||
self.weightlabel[i] = wx.StaticText(self.linepanel[i], label='Weight', pos=(335,
|
||||
5))
|
||||
self.weight[i] = wx.TextCtrl(self.linepanel[i], 400 + i, value=str(round(one_unit.app.rta_data[i][0], 1)), size=(50,
|
||||
20), pos=(383,
|
||||
3))
|
||||
self.weight[i].Bind(wx.EVT_TEXT_ENTER, self.OnWeightEnter, self.weight[i])
|
||||
self.f1label[i] = wx.StaticText(self.linepanel[i], label='From', pos=(447,
|
||||
5))
|
||||
self.f1[i] = wx.TextCtrl(self.linepanel[i], 500 + i, value=str(int(one_unit.app.rta_data[i][6])), size=(50,
|
||||
20), pos=(483,
|
||||
3))
|
||||
self.f1[i].Bind(wx.EVT_TEXT_ENTER, self.OnF1Enter, self.f1[i])
|
||||
self.f2label[i] = wx.StaticText(self.linepanel[i], label='To', pos=(547,
|
||||
5))
|
||||
self.f2[i] = wx.TextCtrl(self.linepanel[i], 600 + i, value=str(int(one_unit.app.rta_data[i][7])), size=(50,
|
||||
20), pos=(568,
|
||||
3))
|
||||
self.f2[i].Bind(wx.EVT_TEXT_ENTER, self.OnF2Enter, self.f2[i])
|
||||
self.visible[i] = wx.CheckBox(self.linepanel[i], -1, 'Visible', size=(70,
|
||||
20), pos=(630,
|
||||
3))
|
||||
self.visible[i].SetValue(one_unit.app.rta_data[i][3])
|
||||
self.colour_button[i] = wx.Button(self.linepanel[i], 300 + i, 'Colour', pos=(700,
|
||||
3), size=(70,
|
||||
24))
|
||||
self.colour_button[i].SetBackgroundColour(one_unit.app.rta_data[i][4])
|
||||
self.Bind(wx.EVT_BUTTON, self.OnSelectColour, self.colour_button[i])
|
||||
if i > 1:
|
||||
self.enable(i)
|
||||
optionsvbox.Add(self.linepanel[i], 1, border=0, flag=wx.ALIGN_LEFT | wx.ALL)
|
||||
|
||||
optionspanel.SetSizer(optionsvbox)
|
||||
optionsvbox.SetMinSize((250, 10))
|
||||
mainvbox.Add(optionspanel, 0, border=10, flag=wx.LEFT | wx.RIGHT)
|
||||
self.OK_button = wx.Button(buttonspanel, 1, 'OK')
|
||||
self.OK_button.Enable(True)
|
||||
self.OK_button.Show(True)
|
||||
buttonshbox.Add(self.OK_button, 1, border=3, flag=wx.ALL)
|
||||
buttonshbox.Add(wx.Button(buttonspanel, 2, 'Cancel'), 1, border=3, flag=wx.ALL)
|
||||
buttonspanel.SetSizer(buttonshbox)
|
||||
buttonshbox.SetMinSize((150, self.frame_height))
|
||||
mainvbox.Add(buttonspanel, 0, border=5, flag=wx.ALL)
|
||||
self.SetSizerAndFit(mainvbox)
|
||||
self.Centre()
|
||||
self.Bind(wx.EVT_BUTTON, self.OnOK, id=1)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnCancel, id=2)
|
||||
self.CenterOnScreen()
|
||||
self.mainvbox = mainvbox
|
||||
return
|
||||
|
||||
def OnF1Enter(self, e):
|
||||
i = e.GetId() - 500
|
||||
self.f2[i].SetFocus()
|
||||
return
|
||||
|
||||
def OnF2Enter(self, e):
|
||||
i = e.GetId() - 600
|
||||
self.SetFocus()
|
||||
return
|
||||
|
||||
def OnNameEnter(self, e):
|
||||
i = e.GetId() - 200
|
||||
self.weight[i].SetFocus()
|
||||
return
|
||||
|
||||
def OnWeightEnter(self, e):
|
||||
i = e.GetId() - 400
|
||||
self.f1[i].SetFocus()
|
||||
return
|
||||
|
||||
def OnSelectColour(self, e):
|
||||
i = e.GetId() - 300
|
||||
print mytime.displayTime() + ' Pick a colour'
|
||||
data = wx.ColourData()
|
||||
data.SetChooseFull(True)
|
||||
data.SetColour(one_unit.app.rta_data[i][4])
|
||||
dlg = wx.ColourDialog(self, data)
|
||||
if os.name in mac_names:
|
||||
self.Show(False)
|
||||
if dlg.ShowModal():
|
||||
col = dlg.GetColourData().GetColour()
|
||||
print mytime.displayTime() + ' Selected', col
|
||||
self.colour_button[i].SetBackgroundColour(col)
|
||||
dlg.Destroy()
|
||||
if os.name in mac_names:
|
||||
self.Show(True)
|
||||
return
|
||||
|
||||
def OnEnabled(self, e):
|
||||
i = e.GetId() - 100
|
||||
self.enable(i)
|
||||
return
|
||||
|
||||
def enable(self, i):
|
||||
if self.enabled[i].GetValue() == True:
|
||||
self.name[i].Enable(True)
|
||||
self.weight[i].Enable(True)
|
||||
self.visible[i].Enable(True)
|
||||
self.f1[i].Enable(True)
|
||||
self.f2[i].Enable(True)
|
||||
self.name[i].SetForegroundColour('black')
|
||||
self.weight[i].SetForegroundColour('black')
|
||||
self.f1[i].SetForegroundColour('black')
|
||||
self.f2[i].SetForegroundColour('black')
|
||||
else:
|
||||
self.name[i].Enable(False)
|
||||
self.weight[i].Enable(False)
|
||||
self.visible[i].Enable(False)
|
||||
self.f1[i].Enable(False)
|
||||
self.f2[i].Enable(False)
|
||||
self.name[i].SetForegroundColour('light grey')
|
||||
self.weight[i].SetForegroundColour('light grey')
|
||||
self.f1[i].SetForegroundColour('light grey')
|
||||
self.f2[i].SetForegroundColour('light grey')
|
||||
return
|
||||
|
||||
def OnOK(self, evt):
|
||||
for i in range(0, len(one_unit.app.rta_data)):
|
||||
name = self.name[i].GetValue()
|
||||
if i > 1:
|
||||
try:
|
||||
weight = float(self.weight[i].GetValue())
|
||||
except:
|
||||
weight = 1.0
|
||||
else:
|
||||
try:
|
||||
f1 = int(self.f1[i].GetValue())
|
||||
except:
|
||||
f1 = 0
|
||||
else:
|
||||
if f1 < 0:
|
||||
f1 = 0
|
||||
if f1 > 20000:
|
||||
f1 = 20000
|
||||
try:
|
||||
f2 = int(self.f2[i].GetValue())
|
||||
except:
|
||||
f2 = 20000
|
||||
else:
|
||||
if f2 < 0:
|
||||
f2 = 0
|
||||
if f2 > 20000:
|
||||
f2 = 20000
|
||||
enabled = self.enabled[i].GetValue()
|
||||
else:
|
||||
weight = 1.0
|
||||
enabled = True
|
||||
f1 = 0
|
||||
f2 = 20000
|
||||
visible = self.visible[i].GetValue()
|
||||
colour = self.colour_button[i].GetBackgroundColour()
|
||||
one_unit.app.rta_data[i] = list((weight, name, enabled, visible, colour, one_unit.app.rta_data[i][5], f1, f2))
|
||||
|
||||
if self.settings == True:
|
||||
one_unit.app.rta_smoothing = smoothing_choices[self.smoothing.GetStringSelection()]
|
||||
one_unit.app.FFT_len = FFT_choices[self.FFT_len.GetStringSelection()]
|
||||
try:
|
||||
avg = int(self.avg.GetValue())
|
||||
if avg < 1:
|
||||
avg = 1
|
||||
except:
|
||||
avg = 3
|
||||
else:
|
||||
if avg > 100:
|
||||
avg = 100
|
||||
one_unit.app.rta_time_avg = avg
|
||||
one_unit.app.rta_one_shot = self.one_shot.GetValue()
|
||||
one_unit.app.rta_auto_mute = self.auto_mute.GetValue()
|
||||
one_unit.app.audio_input_device = self.input.GetStringSelection()
|
||||
one_unit.app.rta_show_peq = self.show_peq.GetValue()
|
||||
one_unit.app.rta_auto_scale = True
|
||||
one_unit.app.last_rta_measurement_saved = True
|
||||
self.Close()
|
||||
return
|
||||
|
||||
def OnCancel(self, evt):
|
||||
if self.settings == False:
|
||||
del one_unit.app.rta_data[len(one_unit.app.rta_data) - 1]
|
||||
self.Close()
|
||||
return
|
||||
|
||||
|
||||
|
||||
# okay decompiling pycode/rta_measurements.pyc
|
||||
@@ -0,0 +1,24 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: select.pyc
|
||||
# Compiled at: 2025-05-23 11:22:56
|
||||
|
||||
|
||||
def __load():
|
||||
import imp, os, sys
|
||||
try:
|
||||
dirname = os.path.dirname(__loader__.archive)
|
||||
except NameError:
|
||||
dirname = sys.prefix
|
||||
|
||||
path = os.path.join(dirname, 'select.pyd')
|
||||
mod = imp.load_dynamic(__name__, path)
|
||||
return
|
||||
|
||||
|
||||
__load()
|
||||
del __load
|
||||
|
||||
# okay decompiling pycode/select.pyc
|
||||
@@ -0,0 +1,708 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: select_keys.pyc
|
||||
# Compiled at: 2025-03-13 16:01:06
|
||||
import wx, os, data_model, traceback, one_unit, ConfigParser, protocol, sys, mytime, wx.lib.buttons
|
||||
mac_names = 'posix'
|
||||
if os.name in mac_names:
|
||||
newline = '\n'
|
||||
else:
|
||||
newline = '\r\n'
|
||||
global_text = {}
|
||||
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CHECK_PASSWORD, 0, 0)
|
||||
global_text[key] = 'Password'
|
||||
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CHECK_PIN, 0, 0)
|
||||
global_text[key] = 'PIN'
|
||||
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_GAIN, 0, 0)
|
||||
global_text[key] = 'Master Volume'
|
||||
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_GAIN, 0, 1)
|
||||
global_text[key] = 'Bass'
|
||||
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_GAIN, 0, 2)
|
||||
global_text[key] = 'Mid'
|
||||
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_GAIN, 0, 3)
|
||||
global_text[key] = 'Treble'
|
||||
key = data_model.Key(protocol.STRUCT_ID_PRESET_GLOBAL, protocol.MEMBER_ID_PRESET_NUMBER, 0, 0)
|
||||
global_text[key] = 'Preset Selection'
|
||||
key = data_model.Key(protocol.STRUCT_ID_PRESET_GLOBAL, protocol.MEMBER_ID_SHORT_NAME, 0, 0)
|
||||
global_text[key] = 'Preset Name'
|
||||
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_HARDWARE_STATUS_FLAGS, 0, 0)
|
||||
global_text[key] = 'Hardware Settings'
|
||||
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_SHORT_NAME, 0, 0)
|
||||
global_text[key] = 'Unit Name'
|
||||
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_STANDBY_DELAY, 0, 0)
|
||||
global_text[key] = 'Standby Delay'
|
||||
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CONNECTOR_NAME, 0, 0)
|
||||
global_text[key] = 'Hardware Input 1'
|
||||
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CONNECTOR_NAME, 1, 0)
|
||||
global_text[key] = 'Hardware Input 2'
|
||||
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CONNECTOR_NAME, 2, 0)
|
||||
global_text[key] = 'Hardware Input 3'
|
||||
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CONNECTOR_NAME, 3, 0)
|
||||
global_text[key] = 'Hardware Input 4'
|
||||
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CONNECTOR_NAME, 4, 0)
|
||||
global_text[key] = 'Hardware Input 5'
|
||||
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CONNECTOR_NAME, 5, 0)
|
||||
global_text[key] = 'Hardware Input 6'
|
||||
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CONNECTOR_NAME, 6, 0)
|
||||
global_text[key] = 'Hardware Input 7'
|
||||
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CONNECTOR_NAME, 7, 0)
|
||||
global_text[key] = 'Hardware Input 8'
|
||||
cmd_text = {}
|
||||
key = data_model.Key(protocol.STRUCT_ID_COMMAND, protocol.MEMBER_ID_COMMAND, 0, protocol.cmdLoadPreset)
|
||||
cmd_text[key] = 'Load Preset'
|
||||
key = data_model.Key(protocol.STRUCT_ID_COMMAND, protocol.MEMBER_ID_COMMAND, 0, protocol.cmdSavePreset)
|
||||
cmd_text[key] = 'Save Preset'
|
||||
key = data_model.Key(protocol.STRUCT_ID_COMMAND, protocol.MEMBER_ID_COMMAND, 0, protocol.cmdGotoStandby)
|
||||
cmd_text[key] = 'Go to Standby'
|
||||
key = data_model.Key(protocol.STRUCT_ID_COMMAND, protocol.MEMBER_ID_COMMAND, 0, protocol.cmdExitStandby)
|
||||
cmd_text[key] = 'Exit Standby'
|
||||
key = data_model.Key(protocol.STRUCT_ID_COMMAND, protocol.MEMBER_ID_COMMAND, 0, protocol.cmdActivateNewNetworkSettings)
|
||||
cmd_text[key] = 'Apply Network Settings'
|
||||
relative_structure_ids = (
|
||||
protocol.STRUCT_ID_GAIN,
|
||||
protocol.STRUCT_ID_DELAY)
|
||||
|
||||
class Dialog(wx.Dialog):
|
||||
|
||||
def __init__(self, parent, id, title, infotext='', unit_type=None, existing_links=[], bg=None, size=(510, 500), bgcolour=(
|
||||
220, 220, 220), fgcolour=(70, 70, 70), only_numbers=False, group_type=None, restrictMemberFormat=False, restrictDataType=None, blockPEQBandsOver10=True):
|
||||
wx.Dialog.__init__(self, None, wx.ID_ANY, title, size=size, style=wx.STAY_ON_TOP | wx.DEFAULT_DIALOG_STYLE)
|
||||
self.result = existing_links
|
||||
if bg != None:
|
||||
self.bg = bg
|
||||
self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
|
||||
self.frame_height = 2 * wx.SystemSettings.GetMetric(wx.SYS_CAPTION_Y) + wx.SystemSettings.GetMetric(wx.SYS_BORDER_Y)
|
||||
if os.name in mac_names:
|
||||
self.frame_height = 24
|
||||
self.infotext = None
|
||||
if infotext != '':
|
||||
textstring = wx.StaticText(self, -1, infotext, style=wx.ALIGN_LEFT, pos=(25,
|
||||
10))
|
||||
textstring.SetForegroundColour(fgcolour)
|
||||
self.infotext = textstring
|
||||
self.infostring = infotext
|
||||
if os.name in mac_names:
|
||||
textstring.SetFont(wx.Font(11, wx.SWISS, wx.NORMAL, wx.NORMAL))
|
||||
textstring.Wrap(350)
|
||||
self.group_type = group_type
|
||||
self.existing_links = ''
|
||||
self.first_time = True
|
||||
self.member_ids = []
|
||||
self.last_member_id = None
|
||||
style = wx.TE_READONLY
|
||||
existinglabel = wx.StaticText(self, -1, 'Active Links:', style=wx.ALIGN_LEFT, pos=(25,
|
||||
30))
|
||||
self.existing = wx.TextCtrl(self, 4, self.existing_links, style=style | wx.TE_MULTILINE, pos=(130,
|
||||
30), size=(370,
|
||||
280))
|
||||
self.keys = []
|
||||
levels = [
|
||||
5, 18, 19, 20, 21]
|
||||
models = [_[1] for fw in range(0, 255)]
|
||||
models.append('')
|
||||
paths = []
|
||||
for model in models:
|
||||
for level in levels:
|
||||
path = os.path.join(one_unit.app.cwd, one_unit.app.skin_path, unit_type + model + level, 'default.cfg')
|
||||
if os.path.exists(path):
|
||||
paths.append(path)
|
||||
|
||||
model_firmware = 0
|
||||
self.exclusions = []
|
||||
self.exclusions.append(data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_HARDWARE_STATUS_FLAGS, 0, 0))
|
||||
self.keys.append(data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CHECK_PASSWORD, 0, 0))
|
||||
self.keys.append(data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CHECK_PIN, 0, 0))
|
||||
self.keys.append(data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_GAIN, 0, 0))
|
||||
self.keys.append(data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_GAIN, 0, 1))
|
||||
self.keys.append(data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_GAIN, 0, 2))
|
||||
self.keys.append(data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_GAIN, 0, 3))
|
||||
self.keys.append(data_model.Key(protocol.STRUCT_ID_COMMAND, protocol.MEMBER_ID_COMMAND, 0, protocol.cmdLoadPreset))
|
||||
self.keys.append(data_model.Key(protocol.STRUCT_ID_COMMAND, protocol.MEMBER_ID_COMMAND, 0, protocol.cmdSavePreset))
|
||||
self.keys.append(data_model.Key(protocol.STRUCT_ID_COMMAND, protocol.MEMBER_ID_COMMAND, 0, protocol.cmdGotoStandby))
|
||||
self.keys.append(data_model.Key(protocol.STRUCT_ID_COMMAND, protocol.MEMBER_ID_COMMAND, 0, protocol.cmdExitStandby))
|
||||
self.keys.append(data_model.Key(protocol.STRUCT_ID_PRESET_GLOBAL, protocol.MEMBER_ID_PRESET_NUMBER, 0, 0))
|
||||
self.keys.append(data_model.Key(protocol.STRUCT_ID_PRESET_GLOBAL, protocol.MEMBER_ID_SHORT_NAME, 0, 0))
|
||||
for path in paths:
|
||||
try:
|
||||
print mytime.displayTime() + 'sk.Reading config from', path
|
||||
self.config = ConfigParser.ConfigParser()
|
||||
self.config.read(path)
|
||||
for var in self.config.sections():
|
||||
try:
|
||||
struct_id = self.config.getint(var, 'struct_id')
|
||||
member_id = self.config.getint(var, 'member_id')
|
||||
num = self.config.getint(var, 'num')
|
||||
except:
|
||||
continue
|
||||
|
||||
if struct_id in (
|
||||
protocol.STRUCT_ID_VU,
|
||||
protocol.STRUCT_ID_GR,
|
||||
protocol.STRUCT_ID_INTERNAL):
|
||||
continue
|
||||
if member_id in (
|
||||
protocol.MEMBER_ID_AMP_READINGS,
|
||||
protocol.MEMBER_ID_CURRENT_USER,
|
||||
protocol.MEMBER_ID_AMP_READINGS_2,
|
||||
protocol.MEMBER_ID_AES_FS,
|
||||
protocol.MEMBER_ID_MODEL_NUMBER,
|
||||
protocol.MEMBER_ID_MODEL_FIRMWARE,
|
||||
protocol.MEMBER_ID_MODEL_NAME):
|
||||
continue
|
||||
channels = self.channels_for_var(var)
|
||||
for channel in channels:
|
||||
key = data_model.Key(struct_id, member_id, channel, num)
|
||||
if key not in self.keys:
|
||||
self.keys.append(key)
|
||||
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
|
||||
model_firmware += 1
|
||||
|
||||
if self.group_type == 'Relative':
|
||||
new_keys = []
|
||||
for key in self.keys:
|
||||
if key.struct_id not in relative_structure_ids:
|
||||
continue
|
||||
new_keys.append(key)
|
||||
|
||||
self.keys = new_keys
|
||||
if self.group_type == 'Advanced':
|
||||
try:
|
||||
struct_ids = eval(one_unit.app.main_config.get('ROOT', 'advanced_structure_ids'))
|
||||
new_keys = []
|
||||
for key in self.keys:
|
||||
if key.struct_id not in struct_ids:
|
||||
continue
|
||||
new_keys.append(key)
|
||||
|
||||
self.keys = new_keys
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
struct_id_exclusions = eval(one_unit.app.main_config.get('ROOT', 'grouping_struct_id_exclusions'))
|
||||
print 'sk.found exclusions', struct_id_exclusions
|
||||
new_keys = []
|
||||
for key in self.keys:
|
||||
if key in self.exclusions:
|
||||
continue
|
||||
if key.struct_id in struct_id_exclusions.keys():
|
||||
if key.channel in struct_id_exclusions[key.struct_id]:
|
||||
continue
|
||||
new_keys.append(key)
|
||||
|
||||
self.keys = new_keys
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
key_exclusions = eval(one_unit.app.main_config.get('ROOT', 'grouping_key_exclusions'))
|
||||
new_keys = []
|
||||
for key in self.keys:
|
||||
if key in key_exclusions:
|
||||
continue
|
||||
new_keys.append(key)
|
||||
|
||||
self.keys = new_keys
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
key_exclusions = eval(one_unit.app.main_config.get('ROOT', 'grouping_channel_exclusions'))
|
||||
new_keys = []
|
||||
for key in self.keys:
|
||||
try:
|
||||
if key.channel >= 128 and 'outputs' in key_exclusions or key.channel < 128 and 'inputs' in key_exclusions:
|
||||
continue
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
if key.channel in key_exclusions:
|
||||
continue
|
||||
except:
|
||||
pass
|
||||
|
||||
new_keys.append(key)
|
||||
|
||||
self.keys = new_keys
|
||||
except:
|
||||
pass
|
||||
|
||||
if only_numbers == True:
|
||||
new_keys = []
|
||||
for key in self.keys:
|
||||
if protocol.get_member_format(key.member_id) not in ('>h', '>H', '>L',
|
||||
'>l'):
|
||||
continue
|
||||
new_keys.append(key)
|
||||
|
||||
self.keys = new_keys
|
||||
if restrictMemberFormat == True and len(self.result) > 0:
|
||||
memberFormat = protocol.get_member_format(self.result[0].member_id)
|
||||
print 'sk.restricting member formats to', memberFormat
|
||||
new_keys = []
|
||||
for key in self.keys:
|
||||
if protocol.get_member_format(key.member_id) == memberFormat:
|
||||
new_keys.append(key)
|
||||
|
||||
self.keys = new_keys
|
||||
if restrictDataType != None:
|
||||
print 'sk.restricting data type to', restrictDataType
|
||||
new_keys = []
|
||||
for key in self.keys:
|
||||
if protocol.get_member_data_type(key.member_id) == restrictDataType:
|
||||
new_keys.append(key)
|
||||
|
||||
self.keys = new_keys
|
||||
if blockPEQBandsOver10 == True:
|
||||
print 'sk.restricting PEQ index to 0...9'
|
||||
new_keys = []
|
||||
for key in self.keys:
|
||||
if key.struct_id == protocol.STRUCT_ID_PEQ and key.num > 9:
|
||||
continue
|
||||
new_keys.append(key)
|
||||
|
||||
self.keys = new_keys
|
||||
self.struct_ids = []
|
||||
self.struct_id_text = {'All': 'All'}
|
||||
for key in self.keys:
|
||||
if key.struct_id < 0:
|
||||
continue
|
||||
if key.struct_id not in self.struct_ids:
|
||||
self.struct_ids.append(key.struct_id)
|
||||
|
||||
self.struct_ids.sort()
|
||||
try:
|
||||
struct_id_renames = eval(one_unit.app.main_config.get('ROOT', 'grouping_struct_id_renames'))
|
||||
except:
|
||||
struct_id_renames = {}
|
||||
|
||||
for struct_id in self.struct_ids:
|
||||
try:
|
||||
if struct_id in struct_id_renames.keys():
|
||||
self.struct_id_text[struct_id] = struct_id_renames[struct_id]
|
||||
elif struct_id == protocol.STRUCT_ID_PRESET_GLOBAL:
|
||||
self.struct_id_text[struct_id] = 'Presets'
|
||||
else:
|
||||
self.struct_id_text[struct_id] = protocol.STRUCT_ID_TEXT[struct_id]
|
||||
except:
|
||||
print mytime.displayTime() + ' undefined structure ID:', struct_id
|
||||
|
||||
style = wx.BORDER_NONE | wx.CB_READONLY
|
||||
cat_label = wx.StaticText(self, -1, 'Category:', style=wx.ALIGN_LEFT, pos=(25,
|
||||
323))
|
||||
par_label = wx.StaticText(self, -1, 'Parameter:', style=wx.ALIGN_LEFT, pos=(25,
|
||||
353))
|
||||
chan_label = wx.StaticText(self, -1, 'Channel:', style=wx.ALIGN_LEFT, pos=(25,
|
||||
383))
|
||||
index_label = wx.StaticText(self, -1, 'Index:', style=wx.ALIGN_LEFT, pos=(25,
|
||||
413))
|
||||
self.select_category = wx.ComboBox(self, 30, choices=self.struct_id_text.values(), style=style, pos=(130,
|
||||
320), size=(250,
|
||||
25))
|
||||
self.select_category.SetStringSelection(self.struct_id_text[self.struct_id_text.keys()[0]])
|
||||
self.select_parameter = wx.ComboBox(self, 30, choices=[], style=style, pos=(130,
|
||||
350), size=(250,
|
||||
25))
|
||||
self.select_channel = wx.ComboBox(self, 30, choices=[], style=style, pos=(130,
|
||||
380), size=(250,
|
||||
25))
|
||||
self.select_index = wx.ComboBox(self, 30, choices=[], style=style, pos=(130,
|
||||
410), size=(250,
|
||||
25))
|
||||
self.add_button = wx.lib.buttons.GenButton(self, 3, 'Add', pos=(400, 320), size=(100,
|
||||
20))
|
||||
self.remove_button = wx.lib.buttons.GenButton(self, 4, 'Remove', pos=(400,
|
||||
350), size=(100,
|
||||
20))
|
||||
ok_button = wx.Button(self, 1, 'Ok', pos=(335, 445), size=(70, 20))
|
||||
cancel_button = wx.Button(self, 2, 'Cancel', pos=(415, 445), size=(70, 20))
|
||||
self.Centre()
|
||||
self.parent = parent
|
||||
self.SetBackgroundColour(bgcolour)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnOK, id=1)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnCancel, id=2)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnAdd, id=3)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnRemove, id=4)
|
||||
self.CenterOnScreen()
|
||||
self.response = None
|
||||
self.last_struct_id = -1
|
||||
self.last_selected_channel = 'All'
|
||||
self.refresh_timer = wx.Timer(self)
|
||||
self.Bind(wx.EVT_TIMER, self.on_timer, self.refresh_timer)
|
||||
self.refresh_timer.Start(100)
|
||||
return
|
||||
|
||||
def getStructIDText(self, struct_id):
|
||||
if struct_id not in self.struct_id_text:
|
||||
self.struct_id_text[struct_id] = protocol.STRUCT_ID_TEXT[struct_id]
|
||||
return self.struct_id_text[struct_id]
|
||||
|
||||
def OnAdd(self, e):
|
||||
struct_ids = self.get_struct_id_from_text(self.select_category.GetStringSelection())
|
||||
member_ids = self.get_member_id_from_text(self.select_parameter.GetStringSelection())
|
||||
channels = self.get_channel_from_text(self.select_channel.GetStringSelection())
|
||||
nums = self.get_num_from_text(self.select_index.GetStringSelection())
|
||||
for struct_id in struct_ids:
|
||||
for member_id in member_ids:
|
||||
for channel in channels:
|
||||
for num in nums:
|
||||
key = data_model.Key(struct_id, member_id, channel, num)
|
||||
if key in self.keys and key not in self.result:
|
||||
self.result.append(key)
|
||||
|
||||
self.SetText()
|
||||
return
|
||||
|
||||
def OnRemove(self, e):
|
||||
struct_ids = self.get_struct_id_from_text(self.select_category.GetStringSelection())
|
||||
member_ids = self.get_member_id_from_text(self.select_parameter.GetStringSelection())
|
||||
channels = self.get_channel_from_text(self.select_channel.GetStringSelection())
|
||||
nums = self.get_num_from_text(self.select_index.GetStringSelection())
|
||||
remove_keys = []
|
||||
for struct_id in struct_ids:
|
||||
for member_id in member_ids:
|
||||
for channel in channels:
|
||||
for num in nums:
|
||||
key = data_model.Key(struct_id, member_id, channel, num)
|
||||
if key in self.keys:
|
||||
remove_keys.append(key)
|
||||
|
||||
links = []
|
||||
for key in self.result:
|
||||
if key not in remove_keys:
|
||||
links.append(key)
|
||||
|
||||
self.result = links
|
||||
self.SetText()
|
||||
return
|
||||
|
||||
def on_timer(self, e):
|
||||
if self.select_category.GetStringSelection() == 'All':
|
||||
all_struct_ids = True
|
||||
struct_id = 'All'
|
||||
else:
|
||||
all_struct_ids = False
|
||||
struct_id = self.get_struct_id_from_text(self.select_category.GetStringSelection())[0]
|
||||
member_id = None
|
||||
try:
|
||||
if self.select_parameter.Enabled == True:
|
||||
member_ids = self.get_member_id_from_text(self.select_parameter.GetStringSelection())
|
||||
if len(member_ids) > 1:
|
||||
member_id = None
|
||||
else:
|
||||
member_id = member_ids[0]
|
||||
except:
|
||||
pass
|
||||
|
||||
selected_channel = None
|
||||
try:
|
||||
if self.select_channel.Enabled == True:
|
||||
selected_channels = self.get_channel_from_text(self.select_channel.GetStringSelection())
|
||||
if len(selected_channels) > 1:
|
||||
selected_channel = 'All'
|
||||
else:
|
||||
selected_channel = selected_channels[0]
|
||||
except:
|
||||
pass
|
||||
|
||||
if selected_channel == None:
|
||||
selected_channel = 'All'
|
||||
if self.last_struct_id != struct_id or self.last_member_id != member_id or self.last_selected_channel != selected_channel:
|
||||
print 'sk.1'
|
||||
if self.last_struct_id != struct_id:
|
||||
member_id = None
|
||||
selected_channel = None
|
||||
if self.last_member_id != member_id:
|
||||
selected_channel = None
|
||||
self.last_struct_id = struct_id
|
||||
self.last_member_id = member_id
|
||||
self.last_selected_channel = selected_channel
|
||||
if member_id == None:
|
||||
self.member_ids = []
|
||||
self.member_id_text = ['All']
|
||||
for key in self.keys:
|
||||
if key.struct_id == struct_id or all_struct_ids == True:
|
||||
if key.member_id not in self.member_ids:
|
||||
self.member_ids.append(key.member_id)
|
||||
|
||||
self.member_ids.sort()
|
||||
for mymember_id in self.member_ids:
|
||||
if struct_id == protocol.STRUCT_ID_GLOBAL and mymember_id == protocol.MEMBER_ID_GAIN:
|
||||
self.member_id_text.append('Levels')
|
||||
elif struct_id == protocol.STRUCT_ID_GLOBAL and mymember_id == protocol.MEMBER_ID_SHORT_NAME:
|
||||
self.member_id_text.append('Unit Name')
|
||||
elif struct_id == protocol.STRUCT_ID_PRESET_GLOBAL and mymember_id == protocol.MEMBER_ID_PRESET_NUMBER:
|
||||
self.member_id_text.append('Preset Selection')
|
||||
else:
|
||||
self.member_id_text.append(protocol.get_member_text(mymember_id))
|
||||
|
||||
print 'sk.4', self.member_ids, struct_id, self.member_id_text
|
||||
if len(self.member_ids) <= 1 or struct_id in (protocol.STRUCT_ID_GAIN, protocol.STRUCT_ID_MUTE, protocol.STRUCT_ID_LINK, protocol.STRUCT_ID_COMMAND):
|
||||
if len(self.member_ids) == 1:
|
||||
try:
|
||||
self.select_parameter.SetItems(self.member_id_text)
|
||||
self.select_parameter.SetStringSelection(self.member_id_text[1])
|
||||
member_id = self.member_ids[0]
|
||||
except:
|
||||
traceback.proint_exc(file=sys.stdout)
|
||||
|
||||
else:
|
||||
self.select_parameter.SetStringSelection('')
|
||||
self.select_parameter.Disable()
|
||||
else:
|
||||
self.select_parameter.SetItems(self.member_id_text)
|
||||
self.select_parameter.SetStringSelection(self.member_id_text[0])
|
||||
self.select_parameter.Enable()
|
||||
if struct_id not in (protocol.STRUCT_ID_GLOBAL, protocol.STRUCT_ID_PRESET_GLOBAL, protocol.STRUCT_ID_COMMAND) or member_id == protocol.MEMBER_ID_INPUT_SELECT:
|
||||
self.select_channel.Enable()
|
||||
else:
|
||||
self.select_channel.Disable()
|
||||
if selected_channel == None:
|
||||
selected_channel = 'All'
|
||||
self.last_selected_channel = 'All'
|
||||
self.channels = []
|
||||
self.channel_text = ['All']
|
||||
for key in self.keys:
|
||||
if key.struct_id == struct_id and (key.member_id == member_id or member_id == None) or all_struct_ids == True:
|
||||
if key.channel not in self.channels:
|
||||
self.channels.append(key.channel)
|
||||
|
||||
self.channels.sort()
|
||||
for channel in self.channels:
|
||||
if member_id == protocol.MEMBER_ID_INPUT_SELECT and channel >= 128:
|
||||
continue
|
||||
if channel < 128:
|
||||
channel_name = 'Input ' + str(channel + 1)
|
||||
if struct_id == protocol.STRUCT_ID_LINK:
|
||||
channel_name += ' & ' + str(channel + 2)
|
||||
else:
|
||||
channel_name = 'Output ' + str(channel - 127)
|
||||
if struct_id == protocol.STRUCT_ID_LINK:
|
||||
channel_name += ' & ' + str(channel - 126)
|
||||
self.channel_text.append(channel_name)
|
||||
|
||||
if len(self.channel_text) <= 2:
|
||||
self.select_channel.Disable()
|
||||
self.select_channel.SetItems(('', ' '))
|
||||
self.select_channel.SetStringSelection('')
|
||||
else:
|
||||
self.select_channel.SetItems(self.channel_text)
|
||||
self.select_channel.SetStringSelection(self.channel_text[0])
|
||||
self.indexes = []
|
||||
self.index_text = [
|
||||
'All']
|
||||
for key in self.keys:
|
||||
if key.struct_id == struct_id and (key.member_id == member_id or member_id == None) and (key.channel == selected_channel or selected_channel == 'All') or all_struct_ids == True:
|
||||
if key.num not in self.indexes:
|
||||
self.indexes.append(key.num)
|
||||
|
||||
self.indexes.sort()
|
||||
for index in self.indexes:
|
||||
index_name = str(index + 1)
|
||||
txtkey = data_model.Key(struct_id, member_id, 0, index)
|
||||
if key.struct_id == protocol.STRUCT_ID_GLOBAL and key.member_id == protocol.MEMBER_ID_INPUT_SELECT:
|
||||
continue
|
||||
if struct_id == protocol.STRUCT_ID_GLOBAL:
|
||||
try:
|
||||
self.index_text.append(global_text[txtkey])
|
||||
except:
|
||||
self.index_text.append(index_name)
|
||||
|
||||
elif struct_id == protocol.STRUCT_ID_COMMAND:
|
||||
if txtkey in cmd_text:
|
||||
self.index_text.append(cmd_text[txtkey])
|
||||
elif struct_id == protocol.STRUCT_ID_COMPRESSOR:
|
||||
if index == 0:
|
||||
self.index_text.append('Full Range')
|
||||
else:
|
||||
self.index_text.append('BLC band ' + str(index))
|
||||
elif struct_id == protocol.STRUCT_ID_PEQ:
|
||||
if index > 9:
|
||||
self.index_text.append('BLC band ' + str(index - 9))
|
||||
else:
|
||||
self.index_text.append('band ' + str(index + 1))
|
||||
else:
|
||||
self.index_text.append(index_name)
|
||||
|
||||
if len(self.indexes) <= 1:
|
||||
if len(self.indexes) == 1 and len(self.index_text[0]) > 1 and False:
|
||||
self.select_index.SetStringSelection(self.index_text[0])
|
||||
else:
|
||||
self.select_index.SetStringSelection('')
|
||||
self.select_index.SetItems(('', ' '))
|
||||
self.select_index.Disable()
|
||||
else:
|
||||
self.select_index.SetItems(self.index_text)
|
||||
self.select_index.SetStringSelection(self.index_text[0])
|
||||
self.select_index.Enable()
|
||||
if self.first_time:
|
||||
self.first_time = False
|
||||
self.SetText()
|
||||
self.Show(True)
|
||||
self.Raise()
|
||||
return
|
||||
|
||||
def SetText(self):
|
||||
text = ''
|
||||
for key in self.result:
|
||||
if key.struct_id in (protocol.STRUCT_ID_GLOBAL, protocol.STRUCT_ID_PRESET_GLOBAL) and key in global_text:
|
||||
text += global_text[key]
|
||||
elif key.struct_id == protocol.STRUCT_ID_COMMAND and key in cmd_text:
|
||||
text += cmd_text[key]
|
||||
else:
|
||||
text += self.getStructIDText(key.struct_id)
|
||||
if key.struct_id in (protocol.STRUCT_ID_PEQ, protocol.STRUCT_ID_LPF, protocol.STRUCT_ID_HPF, protocol.STRUCT_ID_LIMITER, protocol.STRUCT_ID_MIXER, protocol.STRUCT_ID_COMPRESSOR) or key.member_id == protocol.MEMBER_ID_INPUT_SELECT:
|
||||
text += ' ' + protocol.get_member_text(key.member_id)
|
||||
if key.channel < 128:
|
||||
channel_name = ' Input ' + str(key.channel + 1)
|
||||
else:
|
||||
channel_name = ' Output ' + str(key.channel - 127)
|
||||
if key.struct_id not in (protocol.STRUCT_ID_GLOBAL, protocol.STRUCT_ID_PRESET_GLOBAL, protocol.STRUCT_ID_COMMAND) or key.member_id == protocol.MEMBER_ID_INPUT_SELECT:
|
||||
text += channel_name
|
||||
if key.struct_id == protocol.STRUCT_ID_MIXER:
|
||||
text += ' no. ' + str(key.num + 1)
|
||||
if key.struct_id == protocol.STRUCT_ID_COMPRESSOR and key.num > 0:
|
||||
text += ' BLC band ' + str(key.num)
|
||||
if key.struct_id == protocol.STRUCT_ID_PEQ:
|
||||
if key.num > 9:
|
||||
text += ' BLC band ' + str(key.num - 9)
|
||||
else:
|
||||
text += ' band ' + str(key.num + 1)
|
||||
text += newline
|
||||
|
||||
self.existing.SetValue(text)
|
||||
return
|
||||
|
||||
def get_struct_id_from_text(self, text):
|
||||
i = 1
|
||||
if text == 'All':
|
||||
return self.struct_ids
|
||||
res = []
|
||||
for testval in self.struct_id_text.keys():
|
||||
if testval == 'All':
|
||||
continue
|
||||
if self.struct_id_text[testval] == text:
|
||||
res.append(testval)
|
||||
return res
|
||||
i += 1
|
||||
|
||||
if text == 'All':
|
||||
return self.struct_ids
|
||||
return
|
||||
|
||||
def get_member_id_from_text(self, text):
|
||||
i = 1
|
||||
if len(self.member_ids) <= 1:
|
||||
return self.member_ids
|
||||
else:
|
||||
if text == 'All':
|
||||
return self.member_ids
|
||||
res = []
|
||||
for testval in self.member_id_text:
|
||||
if testval == 'All':
|
||||
continue
|
||||
if testval == text:
|
||||
res.append(self.member_ids[i - 1])
|
||||
return res
|
||||
i += 1
|
||||
|
||||
if text in ('All', '', ' ', None, 'None'):
|
||||
return self.member_ids
|
||||
return
|
||||
|
||||
def get_channel_from_text(self, text):
|
||||
i = 1
|
||||
if text in ('All', '', ' ', None, 'None'):
|
||||
return self.channels
|
||||
else:
|
||||
res = []
|
||||
try:
|
||||
for testval in self.channel_text:
|
||||
if testval == 'All':
|
||||
continue
|
||||
if testval == text:
|
||||
res.append(self.channels[i - 1])
|
||||
return res
|
||||
i += 1
|
||||
|
||||
except:
|
||||
res.append('All')
|
||||
return res
|
||||
|
||||
return
|
||||
|
||||
def get_num_from_text(self, text):
|
||||
i = 1
|
||||
if len(self.indexes) <= 1:
|
||||
return self.indexes
|
||||
else:
|
||||
if text in ('All', '', ' ', None, 'None'):
|
||||
return self.indexes
|
||||
res = []
|
||||
for testval in self.index_text:
|
||||
if testval == 'All':
|
||||
continue
|
||||
if testval == text:
|
||||
res.append(self.indexes[i - 1])
|
||||
return res
|
||||
i += 1
|
||||
|
||||
return
|
||||
|
||||
def channels_for_var(self, var):
|
||||
channels = []
|
||||
try:
|
||||
channels = self.config.get(var, 'channels')
|
||||
except ConfigParser.NoOptionError:
|
||||
try:
|
||||
channel = self.config.get(var, 'channel')
|
||||
except ConfigParser.NoOptionError:
|
||||
print mytime.displayTime() + " variable '%s' has neither 'channels' nor 'channel' attributes defined. This is wrong, variable ignored." % var
|
||||
return []
|
||||
else:
|
||||
channel = int(channel, 0)
|
||||
channels = [channel]
|
||||
else:
|
||||
channels = [_[1] for s in channels.split(',')]
|
||||
|
||||
return channels
|
||||
|
||||
def OnEraseBackground(self, evt):
|
||||
"""
|
||||
Add a picture to the background
|
||||
"""
|
||||
dc = evt.GetDC()
|
||||
if not dc:
|
||||
dc = wx.ClientDC(self)
|
||||
rect = self.GetUpdateRegion().GetBox()
|
||||
dc.SetClippingRect(rect)
|
||||
dc.Clear()
|
||||
bmp = wx.Bitmap(self.bg)
|
||||
dc.DrawBitmap(bmp, 0, 0)
|
||||
return
|
||||
|
||||
def OnOK(self, evt):
|
||||
self.response = 'OK'
|
||||
if self.IsModal() == False:
|
||||
self.Destroy()
|
||||
else:
|
||||
self.Close()
|
||||
return
|
||||
|
||||
def OnCancel(self, evt):
|
||||
self.response = 'Cancel'
|
||||
if self.IsModal == False:
|
||||
self.Destroy()
|
||||
else:
|
||||
self.Close()
|
||||
return
|
||||
|
||||
|
||||
|
||||
# okay decompiling pycode/select_keys.pyc
|
||||
@@ -0,0 +1,236 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: select_unit_types.pyc
|
||||
# Compiled at: 2022-09-28 15:54:53
|
||||
import wx, os, data_model, traceback, one_unit, ConfigParser, protocol, wx.lib.mixins.listctrl as listmix, mytime, wx.lib.buttons
|
||||
mac_names = 'posix'
|
||||
if os.name in mac_names:
|
||||
newline = '\n'
|
||||
else:
|
||||
newline = '\r\n'
|
||||
|
||||
class UnitList(wx.Panel, listmix.ColumnSorterMixin):
|
||||
|
||||
def __init__(self, parent, units, size, pos):
|
||||
wx.Panel.__init__(self, parent, -1, style=wx.WANTS_CHARS, size=size, pos=pos)
|
||||
self.index = 0
|
||||
self.units = units
|
||||
self.list_ctrl = wx.ListCtrl(self, size=size, style=wx.LC_REPORT | wx.BORDER_SUNKEN | wx.LC_SORT_ASCENDING | wx.LC_EDIT_LABELS)
|
||||
self.list_ctrl.InsertColumn(0, 'Item', width=55)
|
||||
self.list_ctrl.InsertColumn(1, 'Model Name', width=200)
|
||||
self.list_ctrl.InsertColumn(2, 'Available', width=55)
|
||||
self.RefreshList()
|
||||
listmix.ColumnSorterMixin.__init__(self, 3)
|
||||
self.selected = None
|
||||
self.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.OnPositionChange, self.list_ctrl)
|
||||
return
|
||||
|
||||
def GetListCtrl(self):
|
||||
return self.list_ctrl
|
||||
|
||||
def RefreshList(self):
|
||||
self.list_ctrl.DeleteAllItems()
|
||||
self.itemDataMap = {}
|
||||
self.index = 0
|
||||
for name in sorted(self.units.keys()):
|
||||
self.itemDataMap[self.index] = (
|
||||
self.index, name, 'Yes')
|
||||
self.index += 1
|
||||
|
||||
keys = self.itemDataMap.keys()
|
||||
keys.sort()
|
||||
for key in keys:
|
||||
pos = self.list_ctrl.InsertStringItem(key, str(self.itemDataMap[key][0]))
|
||||
self.list_ctrl.SetStringItem(pos, 1, str(self.itemDataMap[key][1]))
|
||||
self.list_ctrl.SetStringItem(pos, 2, str(self.itemDataMap[key][2]))
|
||||
self.list_ctrl.SetItemData(pos, key)
|
||||
|
||||
return
|
||||
|
||||
def OnPositionChange(self, e):
|
||||
item = e.m_itemIndex
|
||||
MAC = self.itemDataMap[self.list_ctrl.GetItemData(item)][1]
|
||||
self.units[MAC] = (self.units[MAC][0], self.units[MAC][1], e.GetText())
|
||||
self.index = 0
|
||||
for MAC in self.units.keys():
|
||||
if len(self.units[MAC]) < 2:
|
||||
continue
|
||||
pos = self.units[MAC][2]
|
||||
try:
|
||||
pos = int(pos)
|
||||
except:
|
||||
pass
|
||||
|
||||
self.itemDataMap[self.index] = (
|
||||
pos, MAC, self.units[MAC][0])
|
||||
self.index += 1
|
||||
|
||||
return
|
||||
|
||||
def GetSelected(self):
|
||||
item = -1
|
||||
selected = []
|
||||
count = 1000
|
||||
while count > 0:
|
||||
count -= 1
|
||||
item = self.list_ctrl.GetNextItem(item, wx.LIST_NEXT_ALL, wx.LIST_STATE_SELECTED)
|
||||
if item == -1:
|
||||
break
|
||||
selected.append(self.itemDataMap[self.list_ctrl.GetItemData(item)][1])
|
||||
|
||||
return selected
|
||||
|
||||
|
||||
class Dialog(wx.Dialog):
|
||||
|
||||
def __init__(self, parent, id, title, infotext='', unit_type=None, existing_members={}, bg=None, size=(800, 385), bgcolour=(220, 220, 220), fgcolour=(70, 70, 70)):
|
||||
wx.Dialog.__init__(self, None, wx.ID_ANY, title, size=size, style=wx.STAY_ON_TOP | wx.DEFAULT_DIALOG_STYLE)
|
||||
self.parent = parent
|
||||
self.result = {}
|
||||
if bg != None:
|
||||
self.bg = bg
|
||||
self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
|
||||
self.frame_height = 2 * wx.SystemSettings.GetMetric(wx.SYS_CAPTION_Y) + wx.SystemSettings.GetMetric(wx.SYS_BORDER_Y)
|
||||
if os.name in mac_names:
|
||||
self.frame_height = 24
|
||||
self.infotext = None
|
||||
if infotext != '':
|
||||
textstring = wx.StaticText(self, -1, infotext, style=wx.ALIGN_LEFT, pos=(25,
|
||||
10))
|
||||
textstring.SetForegroundColour(fgcolour)
|
||||
self.infotext = textstring
|
||||
self.infostring = infotext
|
||||
if os.name in mac_names:
|
||||
textstring.SetFont(wx.Font(11, wx.SWISS, wx.NORMAL, wx.NORMAL))
|
||||
textstring.Wrap(350)
|
||||
style = wx.TE_READONLY
|
||||
existinglabel = wx.StaticText(self, -1, 'Supported Models:', style=wx.ALIGN_LEFT, pos=(440,
|
||||
15))
|
||||
availablelabel = wx.StaticText(self, -1, 'Available Models:', style=wx.ALIGN_LEFT, pos=(10,
|
||||
15))
|
||||
self.existing = UnitList(self, self.result, (350, 280), pos=(440, 40))
|
||||
my_units = {}
|
||||
all_units = {}
|
||||
counter = 1
|
||||
for unittype in self.parent.supported_units.keys():
|
||||
my_units[self.parent.supported_units[unittype]] = (
|
||||
counter, 'basetype', counter)
|
||||
counter += 1
|
||||
|
||||
names = sorted(my_units.keys())
|
||||
for name in names:
|
||||
all_units[name] = my_units[name]
|
||||
|
||||
try:
|
||||
config = ConfigParser.ConfigParser()
|
||||
config.read(one_unit.app.cwd + '/subtypes.cfg')
|
||||
print mytime.displayTime() + ' List Unit Types: Found Subtypes:', config.sections()
|
||||
for subtype in sorted(config.sections()):
|
||||
if config.get(subtype, 'oem') != self.parent.active_unit.type:
|
||||
continue
|
||||
if config.get(subtype, 'name') not in all_units.keys():
|
||||
all_units[config.get(subtype, 'name')] = (
|
||||
config.getint(subtype, 'number'), 'subtype', config.getint(subtype, 'number'))
|
||||
|
||||
except:
|
||||
pass
|
||||
|
||||
self.available = UnitList(self, all_units, (350, 280), pos=(10, 40))
|
||||
self.add_all_button = wx.lib.buttons.GenButton(self, 3, '>>', pos=(380, 76), size=(40,
|
||||
40))
|
||||
self.add_button = wx.lib.buttons.GenButton(self, 4, '>', pos=(380, 132), size=(40,
|
||||
40))
|
||||
self.remove_button = wx.lib.buttons.GenButton(self, 5, '<', pos=(380, 188), size=(40,
|
||||
40))
|
||||
self.remove_all_button = wx.lib.buttons.GenButton(self, 6, '<<', pos=(380,
|
||||
244), size=(40,
|
||||
40))
|
||||
ok_button = wx.Button(self, 1, 'Ok', pos=(615, 330), size=(70, 20))
|
||||
cancel_button = wx.Button(self, 2, 'Cancel', pos=(705, 330), size=(70, 20))
|
||||
self.Centre()
|
||||
self.parent = parent
|
||||
self.SetBackgroundColour(bgcolour)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnOK, id=1)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnCancel, id=2)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnAddAll, id=3)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnAdd, id=4)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnRemove, id=5)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnRemoveAll, id=6)
|
||||
self.CenterOnScreen()
|
||||
self.response = None
|
||||
self.last_struct_id = -1
|
||||
return
|
||||
|
||||
def OnAddAll(self, e):
|
||||
for unittype in self.parent.supported_units.keys():
|
||||
if self.parent.supported_units[unittype] in self.result.keys():
|
||||
continue
|
||||
self.result[self.parent.supported_units[unittype]] = (
|
||||
self.parent.supported_units[unittype], 'whatever', 'Any')
|
||||
|
||||
self.existing.RefreshList()
|
||||
return
|
||||
|
||||
def OnRemoveAll(self, e):
|
||||
for name in self.result.keys():
|
||||
del self.result[name]
|
||||
|
||||
self.existing.RefreshList()
|
||||
return
|
||||
|
||||
def OnAdd(self, e):
|
||||
selected = self.available.GetSelected()
|
||||
for name in selected:
|
||||
try:
|
||||
self.result[name] = (
|
||||
name, 'whatever', 'Any')
|
||||
except:
|
||||
pass
|
||||
|
||||
self.existing.RefreshList()
|
||||
return
|
||||
|
||||
def OnRemove(self, e):
|
||||
selected = self.existing.GetSelected()
|
||||
for name in selected:
|
||||
if name in self.result.keys():
|
||||
del self.result[name]
|
||||
|
||||
self.existing.RefreshList()
|
||||
return
|
||||
|
||||
def OnEraseBackground(self, evt):
|
||||
"""
|
||||
Add a picture to the background
|
||||
"""
|
||||
dc = evt.GetDC()
|
||||
if not dc:
|
||||
dc = wx.ClientDC(self)
|
||||
rect = self.GetUpdateRegion().GetBox()
|
||||
dc.SetClippingRect(rect)
|
||||
dc.Clear()
|
||||
bmp = wx.Bitmap(self.bg)
|
||||
dc.DrawBitmap(bmp, 0, 0)
|
||||
return
|
||||
|
||||
def OnOK(self, evt):
|
||||
self.response = 'OK'
|
||||
if self.IsModal() == False:
|
||||
self.Destroy()
|
||||
else:
|
||||
self.Close()
|
||||
return
|
||||
|
||||
def OnCancel(self, evt):
|
||||
self.response = 'Cancel'
|
||||
if self.IsModal == False:
|
||||
self.Destroy()
|
||||
else:
|
||||
self.Close()
|
||||
return
|
||||
|
||||
|
||||
|
||||
# okay decompiling pycode/select_unit_types.pyc
|
||||
@@ -0,0 +1,451 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: select_units.pyc
|
||||
# Compiled at: 2023-01-25 11:38:51
|
||||
import wx, os, data_model, traceback, one_unit, ConfigParser, protocol, wx.lib.mixins.listctrl as listmix, mytime, time, dialog, wx.lib.buttons
|
||||
mac_names = 'posix'
|
||||
if os.name in mac_names:
|
||||
newline = '\n'
|
||||
else:
|
||||
newline = '\r\n'
|
||||
|
||||
class UnitList(wx.Panel, listmix.ColumnSorterMixin):
|
||||
|
||||
def __init__(self, parent, units, size, pos, project=False, isExistingList=False):
|
||||
wx.Panel.__init__(self, parent, -1, style=wx.WANTS_CHARS, size=size, pos=pos)
|
||||
self.parent = parent
|
||||
self.isExistingList = isExistingList
|
||||
self.index = 0
|
||||
self.units = units
|
||||
self.list_ctrl = wx.ListCtrl(self, size=size, style=wx.LC_REPORT | wx.BORDER_SUNKEN | wx.LC_SORT_ASCENDING)
|
||||
self.list_ctrl.InsertColumn(0, 'Reference', width=70)
|
||||
self.list_ctrl.InsertColumn(1, 'MAC Address', width=130)
|
||||
self.list_ctrl.InsertColumn(2, 'Name', width=145)
|
||||
listmix.ColumnSorterMixin.__init__(self, 3)
|
||||
self.selected = None
|
||||
self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnClick, self.list_ctrl)
|
||||
return
|
||||
|
||||
def GetListCtrl(self):
|
||||
return self.list_ctrl
|
||||
|
||||
def RefreshList(self):
|
||||
try:
|
||||
(sortedColumn, ascending) = self.GetSortState()
|
||||
except:
|
||||
sortedColumn = 2
|
||||
ascending = 1
|
||||
print 'su.RL.Default sorting'
|
||||
|
||||
if sortedColumn == -1:
|
||||
sortedColumn = 2
|
||||
ascending = 1
|
||||
self.list_ctrl.DeleteAllItems()
|
||||
self.itemDataMap = {}
|
||||
self.index = 1
|
||||
for MAC in sorted(self.units.keys()):
|
||||
if len(self.units[MAC]) < 2:
|
||||
continue
|
||||
pos = self.units[MAC][2]
|
||||
try:
|
||||
index = int(pos)
|
||||
except:
|
||||
index = self.index
|
||||
|
||||
name = self.units[MAC][0]
|
||||
if MAC[:4] in ('VN::', 'DEMO'):
|
||||
name = name.strip() + ' (Virtual)'
|
||||
elif MAC[:5] == 'Group':
|
||||
name = name.strip()
|
||||
elif MAC not in one_unit.app.server.peers.units or one_unit.app.server.peers.units[MAC].link_status != 'available':
|
||||
name = name.strip() + ' (Offline)'
|
||||
self.itemDataMap[index] = (
|
||||
pos, MAC, name)
|
||||
self.index += 1
|
||||
|
||||
keys = self.itemDataMap.keys()
|
||||
for key in keys:
|
||||
pos = self.list_ctrl.InsertStringItem(key, str(self.itemDataMap[key][0]))
|
||||
self.list_ctrl.SetStringItem(pos, 1, str(self.itemDataMap[key][1]))
|
||||
self.list_ctrl.SetStringItem(pos, 2, str(self.itemDataMap[key][2]))
|
||||
self.list_ctrl.SetItemData(pos, key)
|
||||
|
||||
try:
|
||||
self.SortListItems(sortedColumn, ascending)
|
||||
except:
|
||||
pass
|
||||
|
||||
return
|
||||
|
||||
def GetSelected(self):
|
||||
item = -1
|
||||
selected = []
|
||||
count = 1000
|
||||
while count > 0:
|
||||
count -= 1
|
||||
item = self.list_ctrl.GetNextItem(item, wx.LIST_NEXT_ALL, wx.LIST_STATE_SELECTED)
|
||||
if item == -1:
|
||||
break
|
||||
selected.append(self.itemDataMap[self.list_ctrl.GetItemData(item)][1])
|
||||
|
||||
return selected
|
||||
|
||||
def OnClick(self, e):
|
||||
item = e.m_itemIndex
|
||||
col = e.m_col
|
||||
(pos, mac, name) = self.itemDataMap[self.list_ctrl.GetItemData(item)]
|
||||
if pos == '' and self.isExistingList == True:
|
||||
pos = 'Reference'
|
||||
else:
|
||||
pos = ''
|
||||
self.itemDataMap[item] = (
|
||||
pos, mac, name)
|
||||
if self.isExistingList == True:
|
||||
for tmpMac in self.parent.result:
|
||||
self.parent.result[tmpMac] = (
|
||||
self.parent.result[tmpMac][0], self.parent.result[tmpMac][1], '')
|
||||
self.units[tmpMac] = (self.units[tmpMac][0], self.units[tmpMac][1], '')
|
||||
|
||||
self.units[mac] = (
|
||||
self.units[mac][0], self.units[mac][1], pos)
|
||||
self.parent.result[mac] = self.units[mac]
|
||||
self.RefreshList()
|
||||
return
|
||||
|
||||
|
||||
class Dialog(wx.Dialog):
|
||||
|
||||
def __init__(self, parent, id, title, infotext='', unit_type=None, existing_members={}, bg=None, size=(800, 385), bgcolour=(220, 220, 220), fgcolour=(70, 70, 70), add_virtual=False, allocate=False, groupID=None, group_type=None):
|
||||
wx.Dialog.__init__(self, None, wx.ID_ANY, title, size=size, style=wx.STAY_ON_TOP | wx.DEFAULT_DIALOG_STYLE)
|
||||
self.allocate = allocate
|
||||
self.parent = parent
|
||||
self.groupID = groupID
|
||||
self.group_type = group_type
|
||||
self.result = {}
|
||||
if self.group_type in one_unit.app.group_membership_filter:
|
||||
if 'virtual unit' not in one_unit.app.group_membership_filter[self.group_type]:
|
||||
add_virtual = False
|
||||
self.vn_nr = 0
|
||||
self.virtualUnits = {}
|
||||
for MAC in existing_members:
|
||||
if existing_members[MAC][2] in (0, '0', 'Master', 'Reference'):
|
||||
self.result[MAC] = (
|
||||
existing_members[MAC][0], existing_members[MAC][1], 'Reference')
|
||||
else:
|
||||
self.result[MAC] = (
|
||||
existing_members[MAC][0], existing_members[MAC][1], '')
|
||||
if MAC[:4] == 'VN::':
|
||||
self.vn_nr += 1
|
||||
self.virtualUnits[MAC] = ('Virtual Unit ' + ('00' + str(self.vn_nr))[-2:], one_unit.app.main_frame.supported_unit_ids[0], '')
|
||||
|
||||
if bg != None:
|
||||
self.bg = bg
|
||||
self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
|
||||
self.frame_height = 2 * wx.SystemSettings.GetMetric(wx.SYS_CAPTION_Y) + wx.SystemSettings.GetMetric(wx.SYS_BORDER_Y)
|
||||
if os.name in mac_names:
|
||||
self.frame_height = 24
|
||||
self.infotext = None
|
||||
if infotext != '':
|
||||
textstring = wx.StaticText(self, -1, infotext, style=wx.ALIGN_LEFT, pos=(25,
|
||||
10))
|
||||
textstring.SetForegroundColour(fgcolour)
|
||||
self.infotext = textstring
|
||||
self.infostring = infotext
|
||||
if os.name in mac_names:
|
||||
textstring.SetFont(wx.Font(11, wx.SWISS, wx.NORMAL, wx.NORMAL))
|
||||
textstring.Wrap(350)
|
||||
style = wx.TE_READONLY
|
||||
existinglabel = wx.StaticText(self, -1, 'Group Members (double click to select reference):', style=wx.ALIGN_LEFT, pos=(440,
|
||||
15))
|
||||
availablelabel = wx.StaticText(self, -1, 'Available Units:', style=wx.ALIGN_LEFT, pos=(10,
|
||||
15))
|
||||
self.existing = UnitList(self, self.result, (350, 280), pos=(440, 40), project=add_virtual | allocate, isExistingList=True)
|
||||
self.getAllUnits()
|
||||
self.available = UnitList(self, self.all_units, (350, 280), pos=(10, 40), project=add_virtual | allocate)
|
||||
if allocate == True:
|
||||
link_button = wx.lib.buttons.GenButton(self, 13, 'Link', pos=(370, 76), size=(60,
|
||||
40))
|
||||
link_button = wx.lib.buttons.GenButton(self, 14, 'Unlink', pos=(370, 132), size=(60,
|
||||
40))
|
||||
self.Bind(wx.EVT_BUTTON, self.OnLink, id=13)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnUnlink, id=14)
|
||||
else:
|
||||
self.add_all_button = wx.lib.buttons.GenButton(self, 3, '>>', pos=(380,
|
||||
76), size=(40,
|
||||
40))
|
||||
self.add_button = wx.lib.buttons.GenButton(self, 4, '>', pos=(380, 132), size=(40,
|
||||
40))
|
||||
self.remove_button = wx.lib.buttons.GenButton(self, 5, '<', pos=(380, 188), size=(40,
|
||||
40))
|
||||
self.remove_all_button = wx.lib.buttons.GenButton(self, 6, '<<', pos=(380,
|
||||
244), size=(40,
|
||||
40))
|
||||
self.Bind(wx.EVT_BUTTON, self.OnAddAll, id=3)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnAdd, id=4)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnRemove, id=5)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnRemoveAll, id=6)
|
||||
if add_virtual == True:
|
||||
self.add_virtual_button = wx.lib.buttons.GenButton(self, 7, 'Add Virtual Unit', pos=(240,
|
||||
15), size=(120,
|
||||
20))
|
||||
ok_button = wx.Button(self, 1, 'Ok', pos=(615, 330), size=(70, 20))
|
||||
cancel_button = wx.Button(self, 2, 'Cancel', pos=(705, 330), size=(70, 20))
|
||||
self.Centre()
|
||||
self.parent = parent
|
||||
self.vn_nr = len(self.result) + len(self.all_units)
|
||||
self.SetBackgroundColour(bgcolour)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnOK, id=1)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnCancel, id=2)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnVirtualUnit, id=7)
|
||||
self.CenterOnScreen()
|
||||
self.response = None
|
||||
self.last_struct_id = -1
|
||||
self.refresh_timer = wx.Timer(self)
|
||||
self.Bind(wx.EVT_TIMER, self.on_timer, self.refresh_timer)
|
||||
self.refresh_timer.Start(500)
|
||||
self.available.RefreshList()
|
||||
self.existing.RefreshList()
|
||||
return
|
||||
|
||||
def getAllUnits(self):
|
||||
all_units = {}
|
||||
listUnits = False
|
||||
if self.group_type in one_unit.app.group_membership_filter:
|
||||
if 'unit' in one_unit.app.group_membership_filter[self.group_type]:
|
||||
listUnits = True
|
||||
else:
|
||||
listUnits = True
|
||||
unitsAreExclusive = False
|
||||
if self.group_type in one_unit.app.group_membership_filter and 'exclusiveUnits' in one_unit.app.group_membership_filter[self.group_type]:
|
||||
unitsAreExclusive = True
|
||||
if listUnits:
|
||||
for MAC in self.parent.parent.parent.parent.parent.peers.units.keys():
|
||||
if MAC[:4] in 'DEMO' and self.parent.parent.parent.parent.demo_mode == False:
|
||||
continue
|
||||
if MAC[:4] in ('Choo', 'Star', 'GRP_'):
|
||||
continue
|
||||
if MAC[:4] == 'VN::' and self.allocate == True:
|
||||
continue
|
||||
if MAC in self.result.keys() and self.allocate == False:
|
||||
continue
|
||||
priority = ''
|
||||
if MAC in self.result:
|
||||
priority = self.result[MAC][2]
|
||||
if unitsAreExclusive:
|
||||
add = True
|
||||
for groupMembers in one_unit.app.groups.values():
|
||||
if MAC in groupMembers:
|
||||
add = False
|
||||
break
|
||||
|
||||
if add == False:
|
||||
continue
|
||||
all_units[MAC] = (
|
||||
self.parent.parent.parent.parent.parent.peers.units[MAC].name, self.parent.parent.parent.parent.parent.peers.units[MAC].type, '')
|
||||
|
||||
listVirtualUnits = False
|
||||
if self.group_type in one_unit.app.group_membership_filter:
|
||||
if 'virtual unit' in one_unit.app.group_membership_filter[self.group_type]:
|
||||
listVirtualUnits = True
|
||||
else:
|
||||
listVirtualUnits = True
|
||||
if listVirtualUnits:
|
||||
for MAC in self.virtualUnits:
|
||||
all_units[MAC] = self.virtualUnits[MAC]
|
||||
|
||||
for groupID in one_unit.app.group_names:
|
||||
if self.group_type in one_unit.app.group_membership_filter and one_unit.app.group_type[groupID] not in one_unit.app.group_membership_filter[self.group_type]:
|
||||
continue
|
||||
if self.findOwnGroupMembership(groupID) == True:
|
||||
continue
|
||||
all_units['Group ' + str(groupID)] = (
|
||||
one_unit.app.group_names[groupID], one_unit.app.group_type[groupID], str(groupID))
|
||||
|
||||
self.all_units = all_units
|
||||
return
|
||||
|
||||
def OnLink(self, e):
|
||||
try:
|
||||
selected_unit = self.available.GetSelected()[0]
|
||||
selected_member = self.existing.GetSelected()[0]
|
||||
except:
|
||||
dial = dialog.Dialog(self, -1, 'Link Unit', 'Select a unit and a project member first.', Set=False, OK_Only=True)
|
||||
dial.ShowModal()
|
||||
dial.Destroy()
|
||||
return
|
||||
|
||||
if selected_unit in self.result.keys():
|
||||
dial = dialog.Dialog(self, -1, 'Link Unit', 'This unit is already a project member. To re-allocate it, unlink it from the existing member first.', Set=False, OK_Only=True)
|
||||
dial.ShowModal()
|
||||
dial.Destroy()
|
||||
return
|
||||
print mytime.displayTime() + ' Linking', selected_unit, 'to', selected_member
|
||||
priority = self.result[selected_member][2]
|
||||
self.all_units[selected_unit] = (self.all_units[selected_unit][0], self.all_units[selected_unit][1], '')
|
||||
self.result[selected_unit] = (self.all_units[selected_unit][0], self.all_units[selected_unit][1], '')
|
||||
del self.result[selected_member]
|
||||
self.available.units = self.all_units
|
||||
self.available.RefreshList()
|
||||
self.existing.RefreshList()
|
||||
return
|
||||
|
||||
def OnUnlink(self, e):
|
||||
print 'su.OnUnlink'
|
||||
selected_units = self.available.GetSelected()
|
||||
if selected_units == None:
|
||||
selected_units = []
|
||||
existing_units = self.existing.GetSelected()
|
||||
if existing_units == None:
|
||||
existing_units = []
|
||||
selected_units.extend(existing_units)
|
||||
if len(selected_units) == 0:
|
||||
dial = dialog.Dialog(self, -1, 'Unlink Unit', 'Select a unit and / or a project member first.', Set=False, OK_Only=True)
|
||||
dial.ShowModal()
|
||||
dial.Destroy()
|
||||
return
|
||||
else:
|
||||
for unit in selected_units:
|
||||
if unit not in self.result or unit not in self.all_units:
|
||||
continue
|
||||
priority = self.result[unit][2]
|
||||
type = self.result[unit][1]
|
||||
releasetime = time.localtime()
|
||||
timestring = 'VN::' + str(releasetime.tm_year)[-2:] + ':' + ('00' + str(releasetime.tm_mon))[-2:] + ':' + ('00' + str(releasetime.tm_mday))[-2:] + ':' + ('00' + str(releasetime.tm_hour))[-2:] + ':' + ('00' + str(releasetime.tm_min))[-2:] + ':' + ('00' + str(releasetime.tm_sec))[-2:]
|
||||
self.result[timestring] = ('Virtual Unit', type, '')
|
||||
del self.result[unit]
|
||||
self.all_units[unit] = (self.all_units[unit][0], self.all_units[unit][1], '')
|
||||
|
||||
self.available.units = self.all_units
|
||||
self.existing.RefreshList()
|
||||
self.rebuildAvailableList()
|
||||
return
|
||||
|
||||
def OnVirtualUnit(self, e):
|
||||
releasetime = time.localtime()
|
||||
self.vn_nr += 1
|
||||
timestring = 'VN::' + str(releasetime.tm_sec)[-2:] + ':' + ('00' + str(releasetime.tm_min))[-2:] + ':' + ('00' + str(releasetime.tm_hour))[-2:] + ':' + ('00' + str(releasetime.tm_mday))[-2:] + ':' + ('00' + str(releasetime.tm_mon))[-2:] + ':' + ('00' + str(releasetime.tm_year + self.vn_nr))[-2:]
|
||||
self.virtualUnits[timestring] = ('Virtual Unit ' + ('00' + str(self.vn_nr))[-2:], one_unit.app.main_frame.supported_unit_ids[0], '')
|
||||
self.rebuildAvailableList()
|
||||
return
|
||||
|
||||
def OnAddAll(self, e):
|
||||
for MAC in sorted(self.all_units.keys()):
|
||||
if MAC in self.result.keys():
|
||||
continue
|
||||
free_priority = 0
|
||||
for testMAC in self.result:
|
||||
try:
|
||||
if int(self.result[testMAC][2]) > free_priority:
|
||||
free_priority = int(self.result[testMAC][2])
|
||||
except:
|
||||
continue
|
||||
|
||||
self.result[MAC] = (
|
||||
self.all_units[MAC][0], self.all_units[MAC][1], '')
|
||||
|
||||
self.existing.RefreshList()
|
||||
self.rebuildAvailableList()
|
||||
return
|
||||
|
||||
def OnRemoveAll(self, e):
|
||||
for MAC in self.result.keys():
|
||||
del self.result[MAC]
|
||||
|
||||
self.existing.RefreshList()
|
||||
self.rebuildAvailableList()
|
||||
return
|
||||
|
||||
def OnAdd(self, e):
|
||||
selected = self.available.GetSelected()
|
||||
for MAC in selected:
|
||||
free_priority = 0
|
||||
for testMAC in self.result:
|
||||
try:
|
||||
if int(self.result[testMAC][2]) > free_priority:
|
||||
free_priority = int(self.result[testMAC][2])
|
||||
except:
|
||||
continue
|
||||
|
||||
try:
|
||||
self.result[MAC] = (
|
||||
self.all_units[MAC][0], self.all_units[MAC][1], '')
|
||||
except:
|
||||
pass
|
||||
|
||||
self.existing.RefreshList()
|
||||
self.rebuildAvailableList()
|
||||
return
|
||||
|
||||
def OnRemove(self, e):
|
||||
selected = self.existing.GetSelected()
|
||||
for MAC in selected:
|
||||
if MAC in self.result.keys():
|
||||
print 'su.Removed', MAC
|
||||
del self.result[MAC]
|
||||
|
||||
self.existing.RefreshList()
|
||||
self.rebuildAvailableList()
|
||||
return
|
||||
|
||||
def on_timer(self, e):
|
||||
self.rebuildAvailableList()
|
||||
return
|
||||
|
||||
def findOwnGroupMembership(self, groupID):
|
||||
if groupID == self.groupID:
|
||||
return True
|
||||
for member in one_unit.app.groups[groupID].keys():
|
||||
if member.replace('Group ', '') == self.groupID:
|
||||
return True
|
||||
if member.startswith('Group '):
|
||||
return self.findOwnGroupMembership(member.replace('Group ', ''))
|
||||
|
||||
return False
|
||||
|
||||
def rebuildAvailableList(self):
|
||||
self.getAllUnits()
|
||||
tmpUnits = {}
|
||||
for unit in self.all_units:
|
||||
if unit not in self.existing.units:
|
||||
tmpUnits[unit] = self.all_units[unit]
|
||||
|
||||
if self.available.units.items() != tmpUnits.items():
|
||||
self.available.units = tmpUnits
|
||||
self.available.RefreshList()
|
||||
return
|
||||
|
||||
def OnEraseBackground(self, evt):
|
||||
"""
|
||||
Add a picture to the background
|
||||
"""
|
||||
dc = evt.GetDC()
|
||||
if not dc:
|
||||
dc = wx.ClientDC(self)
|
||||
rect = self.GetUpdateRegion().GetBox()
|
||||
dc.SetClippingRect(rect)
|
||||
dc.Clear()
|
||||
bmp = wx.Bitmap(self.bg)
|
||||
dc.DrawBitmap(bmp, 0, 0)
|
||||
return
|
||||
|
||||
def OnOK(self, evt):
|
||||
self.response = 'OK'
|
||||
if self.IsModal() == False:
|
||||
self.Destroy()
|
||||
else:
|
||||
self.Close()
|
||||
return
|
||||
|
||||
def OnCancel(self, evt):
|
||||
self.response = 'Cancel'
|
||||
if self.IsModal == False:
|
||||
self.Destroy()
|
||||
else:
|
||||
self.Close()
|
||||
return
|
||||
|
||||
|
||||
|
||||
# okay decompiling pycode/select_units.pyc
|
||||
@@ -0,0 +1,712 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: user_config.pyc
|
||||
# Compiled at: 2024-12-11 13:13:37
|
||||
import wx, os, data_model, traceback, one_unit, ConfigParser, protocol, sys, select_keys, select_units, d_protocol, mytime, user_config_dc, user_config_keys, user_config_leds, user_config_audio, user_config_model, user_config_various, user_config_network, user_config_vu, user_config_display, user_config_timer, user_config_tcs
|
||||
from user_config_helpers import *
|
||||
|
||||
def readable(val):
|
||||
val = [_[1] for c in val]
|
||||
v = val[0]
|
||||
if v == 0:
|
||||
return 'Disabled'
|
||||
if v < 16:
|
||||
return 'ADC ' + str(v - 1)
|
||||
if v < 32:
|
||||
return 'GPI ' + str(v - 16)
|
||||
if v < 88:
|
||||
return 'Key ' + str(v - 32)
|
||||
if v < 96:
|
||||
return 'Rotary ' + str(v - 88)
|
||||
if v < 112:
|
||||
return 'AC In ' + str(v - 96)
|
||||
if v < 128:
|
||||
return 'Unused ' + str(v - 112)
|
||||
if v == 128:
|
||||
return 'Reserved'
|
||||
if v == 129:
|
||||
return 'Unused 129'
|
||||
if v < 146:
|
||||
return 'Output Configuration ' + str(v - 130)
|
||||
if v == 146:
|
||||
if val[1] == 0:
|
||||
return 'Input Channels Show / Hide'
|
||||
if val[1] == 4:
|
||||
return 'Output Channels Show / Hide'
|
||||
if v == 147:
|
||||
return 'Unused 147'
|
||||
if v < 152:
|
||||
return 'Model Info ' + str(v - 148)
|
||||
if v < 168:
|
||||
return 'Input Audio Routing ' + str(v - 152)
|
||||
if v < 184:
|
||||
return 'Output Audio Routing ' + str(v - 168)
|
||||
if v == 184:
|
||||
return 'LED number ' + str(val[2])
|
||||
if v == 185:
|
||||
return 'FIR Flavour'
|
||||
if v == 186:
|
||||
return 'Network Configuration'
|
||||
if v == 187:
|
||||
return 'VU LED function ' + str(val[2])
|
||||
if v == 188:
|
||||
return 'VU LED bar ' + str(val[2])
|
||||
if v == 189:
|
||||
d = val[1] & 63
|
||||
if d == 0:
|
||||
return 'Q Configuration'
|
||||
if d in (1, 2, 3):
|
||||
return 'Stacking Configuration'
|
||||
if d == 4:
|
||||
return 'ADC and DAC Settings'
|
||||
if d == 5:
|
||||
return 'Display Selection'
|
||||
return 'Undefined'
|
||||
|
||||
|
||||
class CategoryPanel(wx.Panel):
|
||||
|
||||
def __init__(self, parent, frame, category, infotext='', group='', bg=None, size=(1000, 480), bgcolour=(220, 220, 220), fgcolour=(70, 70, 70)):
|
||||
wx.Panel.__init__(self, parent, size=size)
|
||||
self.parent = parent
|
||||
self.frame = frame
|
||||
self.categories = frame.categories
|
||||
self.name = self.categories[category][1]
|
||||
self.category = category
|
||||
self.activePageNumber = 0
|
||||
self.frame_height = 2 * wx.SystemSettings.GetMetric(wx.SYS_CAPTION_Y) + wx.SystemSettings.GetMetric(wx.SYS_BORDER_Y)
|
||||
if os.name in mac_names:
|
||||
self.frame_height = 24
|
||||
self.SetSize((self.GetSize()[0], self.GetSize()[1] + self.frame_height))
|
||||
self.p = wx.Panel(self)
|
||||
self.p.SetSize((self.GetSize()[0], self.GetSize()[1] + self.frame_height))
|
||||
self.p.SetPosition((0, 0))
|
||||
print mytime.displayTime(), 'uc.creating category', category
|
||||
self.uiPanels = {}
|
||||
val = self.categories[category][0]
|
||||
try:
|
||||
sortedList = eval(self.frame.parent.config.get('DEFAULT', category + '_sort_order'))
|
||||
except:
|
||||
sortedList = sorted(val.keys())
|
||||
|
||||
if category in ('user_config_front_panel_keys', 'user_config_front_panel_leds',
|
||||
'user_config_vu'):
|
||||
print mytime.displayTime(), 'uc.CP.checking display configuration for', self.name
|
||||
uiKeys = getKeys(self, 189)
|
||||
primaryDisplay = 0
|
||||
secondaryDisplay = 0
|
||||
numberOfKeys = 0
|
||||
for uiIndex in uiKeys:
|
||||
(key, dVal) = uiKeys[uiIndex]
|
||||
if dVal[1] == 5:
|
||||
if numberOfKeys > 0:
|
||||
self.frame.clear(self, 0, key=key)
|
||||
continue
|
||||
print mytime.displayTime(), ' -> key:', key, 'dVal', dVal
|
||||
primaryDisplay = dVal[2] & 15
|
||||
secondaryDisplay = dVal[3] & 15
|
||||
print mytime.displayTime(), ' -> Primary Display:', primaryDisplay, user_config_display.primaryDisplayTypes[primaryDisplay]
|
||||
print mytime.displayTime(), ' -> Secondary Display:', secondaryDisplay, user_config_display.secondaryDisplayTypes[secondaryDisplay]
|
||||
numberOfKeys = 1
|
||||
|
||||
if primaryDisplay != 0:
|
||||
if secondaryDisplay != 0 and user_config_display.secondaryDisplayTypes[secondaryDisplay] == 'XM' and user_config_display.primaryDisplayTypes[primaryDisplay] == 'D2':
|
||||
cfgName = 'configurations/DPD2DSXM.cfg'
|
||||
else:
|
||||
cfgName = 'configurations/DP' + user_config_display.primaryDisplayTypes[primaryDisplay] + '.cfg'
|
||||
print mytime.displayTime(), 'uc.reading config', cfgName
|
||||
cfg = ConfigParser.ConfigParser()
|
||||
cfg.read(cfgName)
|
||||
if category == 'user_config_vu':
|
||||
try:
|
||||
self.frame.vuMeters = eval(cfg.get('DEFAULT', 'vuMeters'))
|
||||
print mytime.displayTime(), 'uc.VU meters changed to:', self.frame.vuMeters
|
||||
except:
|
||||
pass
|
||||
|
||||
else:
|
||||
try:
|
||||
val = eval(self.frame.parent.config.get('DEFAULT', category))
|
||||
print mytime.displayTime(), ' -> val 1:', val, 'for', category
|
||||
try:
|
||||
sortedList = eval(self.frame.parent.config.get('DEFAULT', category + '_sort_order'))
|
||||
except:
|
||||
sortedList = sorted(val.keys())
|
||||
|
||||
except:
|
||||
try:
|
||||
val = eval(cfg.get('DEFAULT', category))
|
||||
print mytime.displayTime(), ' -> val 2:', val, 'for', category
|
||||
try:
|
||||
sortedList = eval(cfg.get('DEFAULT', category + '_sort_order'))
|
||||
except:
|
||||
sortedList = sorted(val.keys())
|
||||
|
||||
except:
|
||||
print mytime.displayTime(), 'uc.error in display config for', user_config_display.primaryDisplayTypes[primaryDisplay]
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
val = {}
|
||||
sortedList = []
|
||||
|
||||
else:
|
||||
print mytime.displayTime(), 'uc.sortedList changed to', sortedList
|
||||
print mytime.displayTime(), 'uc.val changed to:', val
|
||||
sortedList = list(sortedList)
|
||||
if category == 'user_config_front_panel_keys':
|
||||
for i in range(32):
|
||||
if i + 32 not in val.keys():
|
||||
val[i + 32] = str(i + 32) + ': Spare ' + str(i + 1)
|
||||
sortedList.append(i + 32)
|
||||
|
||||
if category == 'user_config_gpi':
|
||||
for i in range(8):
|
||||
if i + 96 not in val.keys():
|
||||
val[i + 96] = 'Clip ' + str(i + 1)
|
||||
sortedList.append(i + 96)
|
||||
|
||||
for i in range(4):
|
||||
if i + 96 + 8 not in val.keys():
|
||||
val[i + 96 + 8] = 'Protect ' + str(i + 1)
|
||||
sortedList.append(i + 96 + 8)
|
||||
|
||||
for i in range(4):
|
||||
if i + 96 + 12 not in val.keys():
|
||||
val[i + 96 + 12] = 'FB ' + str(i + 12)
|
||||
sortedList.append(i + 96 + 12)
|
||||
|
||||
for i in range(16):
|
||||
if i + 96 + 16 not in val.keys():
|
||||
val[i + 96 + 16] = 'GPI ' + str(i)
|
||||
sortedList.append(i + 96 + 16)
|
||||
|
||||
if category == 'user_config_front_panel_leds':
|
||||
for i in range(32):
|
||||
if i not in val.keys():
|
||||
val[i] = 'Spare ' + str(i + 1)
|
||||
sortedList.append(i)
|
||||
|
||||
sortedList = list(sortedList)
|
||||
if len(val) > 10 and os.name in mac_names:
|
||||
self.nb = wx.Choicebook(self.p, -1, pos=(0, 0))
|
||||
self.nb.Bind(wx.EVT_CHOICEBOOK_PAGE_CHANGED, self.onTabChange)
|
||||
self.nb.SetSize((936, 440))
|
||||
else:
|
||||
self.nb = wx.Notebook(self.p, pos=(0, 0))
|
||||
self.nb.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.onTabChange)
|
||||
self.nb.SetSize((946, 440))
|
||||
for i in val.keys():
|
||||
if i not in sortedList:
|
||||
sortedList.append(i)
|
||||
|
||||
force = True
|
||||
self.sortedListOfPanels = sortedList
|
||||
try:
|
||||
for uiNumber in sortedList:
|
||||
panelName = val[uiNumber]
|
||||
if panelName[0] == '_':
|
||||
continue
|
||||
self.uiPanels[uiNumber] = handlers[category](self.nb, self, uiNumber, panelName)
|
||||
self.nb.AddPage(self.uiPanels[uiNumber], panelName)
|
||||
self.uiPanels[uiNumber].initMe(force)
|
||||
force = False
|
||||
|
||||
except:
|
||||
print mytime.displayTime(), 'uc.error in sorted list', sortedList, val
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
|
||||
self.nb.Layout()
|
||||
self.Show(True)
|
||||
print mytime.displayTime() + ' Category', self.name, 'finished'
|
||||
return
|
||||
|
||||
def initMe(self, force=False):
|
||||
print mytime.displayTime(), 'uc.cp.initMe', self.name, len(self.uiPanels), 'panels'
|
||||
self.Show(True)
|
||||
force = True
|
||||
for uiNumber in self.sortedListOfPanels:
|
||||
page = self.uiPanels[uiNumber]
|
||||
page.initMe(force)
|
||||
page.Show(force)
|
||||
force = False
|
||||
|
||||
return
|
||||
|
||||
def onTabChange(self, e):
|
||||
pageNumber = e.Selection
|
||||
self.changeTabTo(pageNumber)
|
||||
e.StopPropagation()
|
||||
e.Skip()
|
||||
return
|
||||
|
||||
def changeTabTo(self, pageNumber):
|
||||
self.activePageNumber = pageNumber
|
||||
page = self.nb.GetPage(pageNumber)
|
||||
print mytime.displayTime(), 'uc.cp.OnTabChange:: UI panel', self.name, 'to', page.name
|
||||
page.initMe(force=True)
|
||||
for otherPage in self.uiPanels.values():
|
||||
if otherPage == page:
|
||||
otherPage.Show(True)
|
||||
else:
|
||||
otherPage.Show(False)
|
||||
|
||||
return
|
||||
|
||||
|
||||
class Dialog(wx.Dialog):
|
||||
|
||||
def __init__(self, parent, id, title, infotext='', group='', bg=None, size=(1000, 500), bgcolour=(220, 220, 220), fgcolour=(70, 70, 70), showCategories={}, panelName='all'):
|
||||
wx.Dialog.__init__(self, None, wx.ID_ANY, title, size=size, style=wx.STAY_ON_TOP | wx.DEFAULT_DIALOG_STYLE)
|
||||
self.parent = parent
|
||||
self.title = title
|
||||
self.panelName = panelName
|
||||
self.showCategories = showCategories
|
||||
self.getConfigParams()
|
||||
self.activePageNumber = 0
|
||||
self.frame_height = 2 * wx.SystemSettings.GetMetric(wx.SYS_CAPTION_Y) + wx.SystemSettings.GetMetric(wx.SYS_BORDER_Y)
|
||||
if os.name in mac_names:
|
||||
self.frame_height = 24
|
||||
self.SetSize((self.GetSize()[0], self.GetSize()[1] + self.frame_height))
|
||||
self.p = wx.Panel(self)
|
||||
self.p.SetSize((self.GetSize()[0], self.GetSize()[1] + self.frame_height))
|
||||
self.p.SetPosition((0, 0))
|
||||
self.nb = wx.Notebook(self.p, pos=(20, 0))
|
||||
self.nb.SetSize((960, 460))
|
||||
self.buildPanels()
|
||||
self.ok_button = wx.Button(self.p, 1, 'Apply', pos=(760, 470), size=(100, 20))
|
||||
cancel_button = wx.Button(self.p, 2, 'Close', pos=(880, 470), size=(100, 20))
|
||||
if one_unit.app.mijnpc == True:
|
||||
save_button = wx.Button(self.p, 3, 'Save', pos=(20, 470), size=(70, 20))
|
||||
clear_button = wx.Button(self.p, 4, 'Clear', pos=(110, 470), size=(70,
|
||||
20))
|
||||
load_button = wx.Button(self.p, 5, 'Load', pos=(200, 470), size=(70, 20))
|
||||
self.Bind(wx.EVT_BUTTON, self.OnSave, id=3)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnClear, id=4)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnLoad, id=5)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnOK, id=1)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnCancel, id=2)
|
||||
self.CenterOnScreen()
|
||||
self.response = None
|
||||
self.nb.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.onTabChange)
|
||||
return
|
||||
|
||||
def buildPanels(self):
|
||||
print mytime.displayTime() + ' uc.Building Panels...'
|
||||
self.categoryPanels = {}
|
||||
for category in self.showCategories:
|
||||
(val, name) = self.categories[category]
|
||||
try:
|
||||
mylen = len(val)
|
||||
except:
|
||||
print mytime.displayTime(), 'uc.i.invalid type for category', category
|
||||
continue
|
||||
|
||||
self.categoryPanels[category] = CategoryPanel(self.nb, self, category)
|
||||
self.nb.AddPage(self.categoryPanels[category], name)
|
||||
if os.name in mac_names:
|
||||
self.categoryPanels[category].SetPosition((-3, -7))
|
||||
else:
|
||||
self.categoryPanels[category].SetPosition((-3, 20))
|
||||
self.categoryPanels[category].SetSize((960, 430))
|
||||
|
||||
if self.parent.active_unit.MAC[:4] not in ('DEMO', 'VN::', 'GRP_') and self.parent.model.completion() < 100:
|
||||
progressDial = wx.ProgressDialog('One moment please....', 'Collecting Panels...')
|
||||
progressDial.SetSize((300, 110))
|
||||
progressDial.Update(50, 'Building Panels...')
|
||||
progressDial.Update(80, 'Fetching Data...')
|
||||
self.parent.waitForSync('uc.init')
|
||||
progressDial.Destroy()
|
||||
print mytime.displayTime() + ' uc.Building Panels Done'
|
||||
return
|
||||
|
||||
def refreshPanels(self):
|
||||
print mytime.displayTime(), 'uc.rP: ja dit werkt nog niet, later naar kijken. Notebook delete en add etc niet vergeten.'
|
||||
return
|
||||
|
||||
def getConfigParams(self):
|
||||
self.categories = {}
|
||||
for category in self.showCategories:
|
||||
if category == 'user_config_a_enabled_channels':
|
||||
val = {146: 'Show / Hide Channels'}
|
||||
elif category == 'user_config_dc_in':
|
||||
val = {}
|
||||
for i in range(12):
|
||||
val[i + 1] = 'DC input ' + str(i + 1)
|
||||
|
||||
elif category == 'user_config_display_selection':
|
||||
val = {189: 'Display Selection'}
|
||||
elif category == 'user_config_audio_routing':
|
||||
res = {}
|
||||
for channel in self.parent.unit_channels:
|
||||
if channel == 0:
|
||||
res[channel + 152] = 'Input ' + str(channel + 1)
|
||||
elif channel == 128:
|
||||
res[channel + 40] = getString('op') + ' ' + str(channel - 127)
|
||||
elif channel > 128:
|
||||
res[channel + 40] = str(channel - 127)
|
||||
elif channel < 128:
|
||||
res[channel + 152] = str(channel + 1)
|
||||
|
||||
val = res
|
||||
elif category == 'user_config_az_output_configuration':
|
||||
res = {}
|
||||
for channel in self.parent.unit_channels:
|
||||
if channel >= 128:
|
||||
try:
|
||||
channelNameKey = data_model.Key(protocol.STRUCT_ID_CHANNEL, protocol.MEMBER_ID_SHORT_NAME, channel, 0)
|
||||
channelName = self.parent.model.get(channelNameKey).strip()
|
||||
if channelName.strip() == '':
|
||||
channelName = getString('op') + ' ' + str(channel - 127)
|
||||
res[channel + 2] = channelName
|
||||
except:
|
||||
res[channel + 2] = getString('op') + ' ' + str(channel - 127)
|
||||
|
||||
val = res
|
||||
elif category == 'tcsLevel':
|
||||
res = {}
|
||||
res[131] = 'Level 1'
|
||||
res[132] = 'Level 2'
|
||||
res[133] = 'Turbo'
|
||||
val = res
|
||||
elif category == 'user_config_model_definition':
|
||||
val = {148: 'DSP', 149: 'DSP Assembly', 150: 'Amplifier Assembly', 151: 'End Product', 191: 'Reserved 1'}
|
||||
elif category == 'user_config_network':
|
||||
val = {186: 'Network'}
|
||||
elif category == 'user_config_vu':
|
||||
val = {187: 'VU LED functions', 188: 'VU meters'}
|
||||
try:
|
||||
self.vuMeters = eval(self.parent.config.get('DEFAULT', 'vuMeters'))
|
||||
except:
|
||||
self.vuMeters = {}
|
||||
for i in range(32):
|
||||
self.vuMeters[i] = 'VU meter ' + str(i + 1)
|
||||
|
||||
else:
|
||||
if category == 'user_config_various':
|
||||
try:
|
||||
val = eval(self.parent.config.get('DEFAULT', 'user_config_FIR'))
|
||||
except:
|
||||
val = {}
|
||||
else:
|
||||
val['189a'] = 'Various 1'
|
||||
val['189b'] = 'Various 2'
|
||||
val['189i'] = 'Various 3'
|
||||
val['189c'] = 'Reserved 1'
|
||||
val['189d'] = 'Reserved 2'
|
||||
val['189e'] = 'Reserved 3'
|
||||
val['189f'] = 'Latency'
|
||||
val['189g'] = 'Fan Control'
|
||||
val['189h'] = 'Limits and Calibration'
|
||||
elif category == 'timer':
|
||||
val = {'190a': 'Page 1', '190b': 'Page 2', '190c': 'Page 3'}
|
||||
else:
|
||||
try:
|
||||
val = eval(self.parent.config.get('DEFAULT', category))
|
||||
except:
|
||||
val = {}
|
||||
|
||||
try:
|
||||
name = eval(self.parent.config.get('DEFAULT', category + '_name'))
|
||||
except:
|
||||
name = getString(categoryNames[category])
|
||||
|
||||
self.categories[category] = (
|
||||
val, name)
|
||||
|
||||
return
|
||||
|
||||
def onTabChange(self, e):
|
||||
pageNumber = e.Selection
|
||||
self.changeTabTo(pageNumber)
|
||||
e.Skip()
|
||||
return
|
||||
|
||||
def changeTabTo(self, pageNumber):
|
||||
self.activePageNumber = pageNumber
|
||||
page = self.nb.GetPage(pageNumber)
|
||||
print mytime.displayTime(), 'uc.d.OnTabChange:: Category Panel', page.name
|
||||
page.initMe(force=True)
|
||||
for otherPage in self.categoryPanels.values():
|
||||
if otherPage == page:
|
||||
otherPage.Show(True)
|
||||
otherPage.changeTabTo(otherPage.activePageNumber)
|
||||
else:
|
||||
otherPage.Show(False)
|
||||
|
||||
return
|
||||
|
||||
def getKeys(self, initAll=False):
|
||||
keySet = {}
|
||||
for panelName in self.categoryPanels.keys():
|
||||
panel = self.categoryPanels[panelName]
|
||||
if panelName == 'user_config_audio':
|
||||
continue
|
||||
if initAll:
|
||||
panel.initMe(force=True)
|
||||
for subPanelName in panel.uiPanels.keys():
|
||||
subPanel = panel.uiPanels[subPanelName]
|
||||
if hasattr(subPanel, 'subPanels'):
|
||||
subPanels = subPanel.subPanels.values()
|
||||
else:
|
||||
subPanels = [
|
||||
subPanel]
|
||||
fkWissen = None
|
||||
for subPanel in subPanels:
|
||||
if initAll:
|
||||
subPanel.initMe(force=True)
|
||||
for lineNumber in subPanel.lines:
|
||||
line = subPanel.lines[lineNumber]
|
||||
try:
|
||||
if line.key.channel == 1 and line.key.index >= 128:
|
||||
continue
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
res = subPanel.evaluateLine(line)
|
||||
except:
|
||||
print mytime.displayTime() + ' uc.oo.Failed to evaluate line', panelName, subPanelName, lineNumber
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
dlgMessage = 'Line ' + str(int(lineNumber) + 1) + ' in ' + panel.name + ' for ' + subPanel.name + ' contains illegal data. This line will be ignored.'
|
||||
dlgTitle = 'Warning'
|
||||
res = wx.MessageBox(dlgMessage, dlgTitle, wx.OK)
|
||||
continue
|
||||
|
||||
if res != None:
|
||||
key = line.key
|
||||
if key == None:
|
||||
freeUIslot = findFreeUI(self.parent, keySet)
|
||||
if freeUIslot == None:
|
||||
if self.parent.active_unit.MAC.startswith('DEMO') == True:
|
||||
freeUIslot = 0
|
||||
else:
|
||||
print mytime.displayTime(), 'uc.oo.No more free UI slots!'
|
||||
continue
|
||||
key = data_model.Key(protocol.STRUCT_ID_UI_CONTROL, protocol.MEMBER_ID_UI_CONTROL, freeUIslot / 256, freeUIslot % 256)
|
||||
line.key = key
|
||||
keySet[key] = res
|
||||
else:
|
||||
key = line.key
|
||||
if key == None:
|
||||
continue
|
||||
print mytime.displayTime(), 'uc.oo.deactivating key:', key, 'value', self.parent.model.get(key)
|
||||
res = '' + chr(0)
|
||||
res += chr(0)
|
||||
res += chr(0)
|
||||
res += chr(0)
|
||||
res += chr(0)
|
||||
res += chr(0)
|
||||
res += chr(0)
|
||||
res += chr(0)
|
||||
keySet[key] = res
|
||||
|
||||
return keySet
|
||||
|
||||
def OnOK(self, evt):
|
||||
self.executeOK()
|
||||
return
|
||||
|
||||
def executeOK(self):
|
||||
self.response = 'OK'
|
||||
self.ok_button.SetLabel('Applying...')
|
||||
keySet = self.getKeys()
|
||||
for key in keySet:
|
||||
self.parent.set_value(key, keySet[key])
|
||||
|
||||
self.parent.refreshUIControls()
|
||||
one_unit.tryYield()
|
||||
mytime.sleep(0.5)
|
||||
for key in keySet:
|
||||
self.parent.waitForSync('uc.oO.exit', key=key)
|
||||
|
||||
self.ok_button.SetLabel('Apply')
|
||||
return
|
||||
|
||||
def OnCancel(self, evt):
|
||||
self.response = 'Close'
|
||||
if self.IsModal == False:
|
||||
self.Destroy()
|
||||
else:
|
||||
self.Close()
|
||||
return
|
||||
|
||||
def OnSave(self, e):
|
||||
self.save('all', initAll=True)
|
||||
return
|
||||
|
||||
def save(self, scope, filename='UI keys for', initAll=False):
|
||||
keySet = self.getKeys(initAll)
|
||||
if scope == 'all':
|
||||
f = open(filename + ' ' + self.panelName + '.csv', 'wb')
|
||||
f.write('s|m|c|i|v0|v1|v2|v3|v4|v5|v6|v7|uf|category|description' + '\n')
|
||||
for key in keySet:
|
||||
line = protocol.csvString(key)
|
||||
val = keySet[key]
|
||||
if val[0] == 0:
|
||||
continue
|
||||
for v in val:
|
||||
line += '|' + str(ord(v))
|
||||
|
||||
if key.channel == 1 and key.num >= 128:
|
||||
continue
|
||||
else:
|
||||
line = line + '|User'
|
||||
line = line + '|' + readable(val)
|
||||
f.write(line + '\n')
|
||||
|
||||
f.close()
|
||||
return
|
||||
|
||||
def OnLoad(self, e):
|
||||
self.load()
|
||||
self.refreshAll()
|
||||
return
|
||||
|
||||
def load(self, path=None):
|
||||
if path == None:
|
||||
dlg = wx.FileDialog(self, message='Choose a UI file', defaultDir='', defaultFile='', wildcard='UI File (*.csv)|*.csv', style=wx.OPEN | wx.CHANGE_DIR)
|
||||
if dlg.ShowModal() == wx.ID_OK:
|
||||
path = dlg.GetPath()
|
||||
dlg.Destroy()
|
||||
if path:
|
||||
f = open(path, 'rb')
|
||||
data = f.readlines()
|
||||
f.close()
|
||||
for line in data:
|
||||
arr = line.split('|')
|
||||
try:
|
||||
a = [_[1] for a in arr[:12]]
|
||||
key = data_model.Key(a[0], a[1], a[2], a[3])
|
||||
val = ''
|
||||
for c in a[4:12]:
|
||||
val += chr(c)
|
||||
|
||||
freeUIslot = findFreeUI(self.parent, {})
|
||||
if freeUIslot == None:
|
||||
if self.parent.active_unit.MAC.startswith('DEMO') == True:
|
||||
freeUIslot = 0
|
||||
else:
|
||||
print mytime.displayTime(), 'uc.oo.No more free UI slots!'
|
||||
continue
|
||||
key = data_model.Key(protocol.STRUCT_ID_UI_CONTROL, protocol.MEMBER_ID_UI_CONTROL, freeUIslot / 256, freeUIslot % 256)
|
||||
print mytime.displayTime(), 'setting ui key:', key, 'to', a[4:12]
|
||||
self.parent.set_value(key, val)
|
||||
except:
|
||||
continue
|
||||
|
||||
return
|
||||
|
||||
def refreshAll(self):
|
||||
self.refreshPanels()
|
||||
self.response = 'OK'
|
||||
self.ok_button.SetLabel('Applying...')
|
||||
keySet = self.getKeys()
|
||||
self.parent.refreshUIControls()
|
||||
one_unit.tryYield()
|
||||
mytime.sleep(2)
|
||||
for key in keySet:
|
||||
self.parent.waitForSync('uc.oO.exit', key=key)
|
||||
|
||||
self.ok_button.SetLabel('Apply')
|
||||
wx.CallAfter(self.parent.restoreUserConfigurationPanel, self.title, self.showCategories, self.panelName)
|
||||
if self.IsModal == False:
|
||||
self.Destroy()
|
||||
else:
|
||||
self.Close()
|
||||
return
|
||||
|
||||
def OnClear(self, e):
|
||||
print mytime.displayTime(), 'uc.oc.1'
|
||||
dlgMessage = 'All keys will be cleared. Continue?'
|
||||
dlgTitle = 'Clear User Keys'
|
||||
res = wx.MessageBox(dlgMessage, dlgTitle, wx.OK | wx.CANCEL)
|
||||
if res != wx.OK:
|
||||
return
|
||||
self.clear(self, 'all')
|
||||
self.refreshAll()
|
||||
return
|
||||
|
||||
def clear(self, parent, uiNumber, memberID=None, structID=None, key=None):
|
||||
print mytime.displayTime(), 'uc.c.1', uiNumber, memberID, structID
|
||||
if key != None:
|
||||
if key.channel == 1 and key.num == 128:
|
||||
return
|
||||
print mytime.displayTime(), 'uc.c.Clearing', key
|
||||
res = '' + chr(0)
|
||||
res += chr(0)
|
||||
res += chr(0)
|
||||
res += chr(0)
|
||||
res += chr(0)
|
||||
res += chr(0)
|
||||
res += chr(0)
|
||||
res += chr(0)
|
||||
self.parent.set_value(key, res)
|
||||
elif uiNumber == 'all':
|
||||
keySet = self.getKeys()
|
||||
for key in keySet:
|
||||
if key.channel == 1 and key.num == 128:
|
||||
continue
|
||||
print mytime.displayTime(), 'uc.c.Clearing', key,
|
||||
print [_[1] for c in keySet[key]]
|
||||
res = '' + chr(0)
|
||||
res += chr(0)
|
||||
res += chr(0)
|
||||
res += chr(0)
|
||||
res += chr(0)
|
||||
res += chr(0)
|
||||
res += chr(0)
|
||||
res += chr(0)
|
||||
self.parent.set_value(key, res)
|
||||
|
||||
else:
|
||||
keySet = getKeys(parent, uiNumber, memberID=memberID, structID=structID)
|
||||
print mytime.displayTime(), 'uc.c.keySet:', keySet
|
||||
for index in keySet.keys():
|
||||
key = keySet[index][0]
|
||||
if key.channel == 1 and key.num == 128:
|
||||
continue
|
||||
print mytime.displayTime(), 'uc.c.Clearing', key, keySet[index][1]
|
||||
res = '' + chr(0)
|
||||
res += chr(0)
|
||||
res += chr(0)
|
||||
res += chr(0)
|
||||
res += chr(0)
|
||||
res += chr(0)
|
||||
res += chr(0)
|
||||
res += chr(0)
|
||||
self.parent.set_value(key, res)
|
||||
|
||||
return
|
||||
|
||||
|
||||
handlers = {'user_config_a_enabled_channels': (user_config_audio.enableChannels),
|
||||
'user_config_audio_routing': (user_config_audio.audioRouting),
|
||||
'user_config_az_output_configuration': (user_config_audio.outputConfiguration),
|
||||
'tcsLevel': (user_config_tcs.outputConfiguration),
|
||||
'user_config_dc_in': (user_config_dc.ADC_input),
|
||||
'user_config_gpi': (user_config_keys.frontPanelKeys),
|
||||
'user_config_front_panel_keys': (user_config_keys.frontPanelKeys),
|
||||
'user_config_front_panel_leds': (user_config_leds.frontPanelLeds),
|
||||
'user_config_various': (user_config_various.FIR),
|
||||
'user_config_model_definition': (user_config_model.modelConfiguration),
|
||||
'user_config_network': (user_config_network.networkConfiguration),
|
||||
'user_config_vu': (user_config_vu.vuMeterSelectPanel),
|
||||
'user_config_display_selection': (user_config_display.displayConfiguration),
|
||||
'timer': (user_config_timer.setTimer)}
|
||||
categoryNames = {'user_config_a_enabled_channels': 'uccc',
|
||||
'user_config_audio_routing': 'ucar',
|
||||
'user_config_az_output_configuration': 'ucoc',
|
||||
'user_config_dc_in': 'ucdi',
|
||||
'user_config_gpi': 'ucgpi',
|
||||
'user_config_front_panel_keys': 'uck',
|
||||
'user_config_front_panel_leds': 'ucl',
|
||||
'user_config_vu': 'ucv',
|
||||
'user_config_various': 'ucgs',
|
||||
'user_config_model_definition': 'ucps',
|
||||
'user_config_network': 'ucn',
|
||||
'user_config_display_selection': 'ucds',
|
||||
'timer': 'ucst',
|
||||
'tcsLevel': 'ucoc'}
|
||||
|
||||
# okay decompiling pycode/user_config.pyc
|
||||
@@ -0,0 +1,402 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: user_config_display.pyc
|
||||
# Compiled at: 2025-03-06 16:11:21
|
||||
import wx, os, data_model, traceback, one_unit, ConfigParser, protocol, sys, select_keys, select_units, d_protocol, mytime
|
||||
from definitions import *
|
||||
from user_config_helpers import *
|
||||
primaryDisplayTypes = {0: 'None', 1: 'D2', 2: 'D3', 3: 'D4', 5: 'PLP', 6: 'XM', 7: 'Reserved', 8: 'CP88'}
|
||||
secondaryDisplayTypes = {0: 'None', 4: 'IO2', 6: 'XM'}
|
||||
displayNavigationStyles = {0: 'No Menu', 1: '2 Buttons and one Rotary Encoder (e.g. D2)', 2: '6 Buttons and one Rotary Encoder (e.g. PLP)'}
|
||||
lclkTypes = {0: 'Default', 1: 'LCLK 1', 2: 'LCLK 2', 3: 'LCLK 3'}
|
||||
displayLineInfoChoices = {0: 'Default',
|
||||
1: 'Unit Name',
|
||||
2: 'Preset Name',
|
||||
3: 'IP Address',
|
||||
4: 'MAC Address',
|
||||
5: 'Temperature',
|
||||
6: 'Nothing',
|
||||
7: 'Sample rate',
|
||||
8: 'AVB Listener State',
|
||||
9: 'DSP Model Name',
|
||||
10: 'DSP Assembly Model Name',
|
||||
11: 'Amplifier Assembly Model Name',
|
||||
12: 'End Product Model Name',
|
||||
13: 'DSP Version String',
|
||||
14: 'DSP Assembly Version String',
|
||||
15: 'Amplifier Assembly Version String',
|
||||
16: 'End Product Version String',
|
||||
30: 'Skip (do not overwrite)',
|
||||
31: '"Initializing..."'}
|
||||
displayInputSignalChoices = {0: 'GPI 2', 1: 'GPI 1', 2: 'D_MISO', 3: 'GPI 0'}
|
||||
|
||||
def getString(str):
|
||||
return one_unit.getString(str)
|
||||
|
||||
|
||||
class displayConfiguration(wx.Panel):
|
||||
|
||||
def __init__(self, parent, frame, uiNumber, panelName):
|
||||
self.frame = frame
|
||||
self.name = panelName
|
||||
self.uiNumber = uiNumber
|
||||
self.parent = parent
|
||||
self.lines = {}
|
||||
wx.Panel.__init__(self, parent, size=(964, 600))
|
||||
self.lines = {0: (self.createLine(0))}
|
||||
self.initFinished = False
|
||||
self.Show(True)
|
||||
return
|
||||
|
||||
def initMe(self, force=False):
|
||||
if self.IsShown() == False and force == False:
|
||||
return
|
||||
if self.initFinished == True:
|
||||
return 0
|
||||
print mytime.displayTime(), 'ucd.initMe configDisplay', self.name
|
||||
self.checkBoxes = {}
|
||||
frame = self.frame
|
||||
uiNumber = self.uiNumber
|
||||
self.uiKeys = getKeys(frame, uiNumber)
|
||||
try:
|
||||
for uiIndex in self.uiKeys:
|
||||
(key, val) = self.uiKeys[uiIndex]
|
||||
if key.channel == 1 and key.num == 128:
|
||||
continue
|
||||
if val[1] == 5:
|
||||
p = self.lines[0]
|
||||
p.key = key
|
||||
p.checkBox.SetValue(1)
|
||||
p.primaryDisplayChoice.SetStringSelection(primaryDisplayTypes[val[2] & 15])
|
||||
p.displayInBitChoice.SetStringSelection(displayInputSignalChoices[val[2] >> 4 & 3])
|
||||
p.secondaryDisplayChoice.SetStringSelection(secondaryDisplayTypes[val[3] & 15])
|
||||
p.displayNavigationChoice.SetStringSelection(displayNavigationStyles[val[4] & 3])
|
||||
flags = val[5]
|
||||
if flags & 1:
|
||||
p.precede8Bits.SetValue(1)
|
||||
if flags & 2:
|
||||
p.showKeys.SetValue(1)
|
||||
if flags & 4 == 0:
|
||||
p.blinkAllForWink.SetValue(1)
|
||||
if flags & 8 == 0:
|
||||
p.lclkDuplicateIO2.SetValue(1)
|
||||
if flags & 16:
|
||||
p.enableSecondaryVUClock.SetValue(1)
|
||||
if flags & 32:
|
||||
p.enableSecondaryLCDClock.SetValue(1)
|
||||
if flags & 64:
|
||||
p.forceSerial.SetValue(1)
|
||||
if flags & 128:
|
||||
p.turnOffLedsDuringMute.SetValue(1)
|
||||
keyBytes = val[6] & 3
|
||||
p.keyBytesChoice.SetStringSelection(str(keyBytes + 1))
|
||||
ledShift = (val[6] & 124) >> 2
|
||||
p.ledShiftChoice.SetStringSelection(str(ledShift))
|
||||
p.displayLineInfoChoice1.SetStringSelection(displayLineInfoChoices[val[4] >> 2 & 31])
|
||||
p.displayLineInfoChoice2.SetStringSelection(displayLineInfoChoices[val[7] & 31])
|
||||
line3Choice = val[4] >> 3 & 16 | val[3] >> 4 & 15
|
||||
p.displayLineInfoChoice3.SetStringSelection(displayLineInfoChoices[line3Choice])
|
||||
line4Choice = val[7] >> 3 & 28 | val[2] >> 6 & 3
|
||||
p.displayLineInfoChoice4.SetStringSelection(displayLineInfoChoices[line4Choice])
|
||||
self.enable(p)
|
||||
break
|
||||
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
|
||||
self.initFinished = True
|
||||
self.Show(True)
|
||||
return
|
||||
|
||||
def createLine(self, lineNumber):
|
||||
p = wx.Panel(self, size=(950, 400))
|
||||
p.checkBox = wx.CheckBox(p, 0, ' Select Display', pos=(13, 10), size=(180,
|
||||
20))
|
||||
p.checkBox.SetValue(False)
|
||||
p.primaryDisplayLabel = wx.StaticText(p, -1, 'Primary Display Type', pos=(40,
|
||||
40))
|
||||
p.primaryDisplayChoice = wx.Choice(p, 30, choices=sorted(primaryDisplayTypes.values()), style=wx.BORDER_NONE, pos=(350,
|
||||
38), size=(300,
|
||||
26))
|
||||
p.primaryDisplayConfigureButton = wx.Button(p, 1, 'Auto Configure', pos=(670,
|
||||
40), size=(130,
|
||||
20))
|
||||
self.Bind(wx.EVT_BUTTON, self.OnConfigurePrimary, id=1)
|
||||
p.secondaryDisplayLabel = wx.StaticText(p, -1, 'Secondary Display Type', pos=(40,
|
||||
68))
|
||||
p.secondaryDisplayChoice = wx.Choice(p, 40, choices=sorted(secondaryDisplayTypes.values()), style=wx.BORDER_NONE, pos=(350,
|
||||
66), size=(300,
|
||||
26))
|
||||
p.secondaryDisplayConfigureButton = wx.Button(p, 2, 'Auto Configure', pos=(570,
|
||||
68), size=(130,
|
||||
20))
|
||||
self.Bind(wx.EVT_BUTTON, self.OnConfigureSecondary, id=2)
|
||||
p.secondaryDisplayConfigureButton.Show(False)
|
||||
p.displayNavigationLabel = wx.StaticText(p, -1, 'Display Navigation Style', pos=(40,
|
||||
96))
|
||||
p.displayNavigationChoice = wx.Choice(p, 50, choices=sorted(displayNavigationStyles.values()), style=wx.BORDER_NONE, pos=(350,
|
||||
94), size=(300,
|
||||
26))
|
||||
p.keyBytesLabel = wx.StaticText(p, -1, 'Number Of Key Registers & Secondary Key Offset', pos=(40,
|
||||
124))
|
||||
p.keyBytesChoice = wx.Choice(p, 70, choices=('1', '2', '3', '4'), style=wx.BORDER_NONE, pos=(350,
|
||||
122), size=(300,
|
||||
26))
|
||||
p.ledShiftLabel = wx.StaticText(p, -1, 'Secondary Display LED offset', pos=(40,
|
||||
152))
|
||||
p.ledShiftChoice = wx.Choice(p, 70, choices=[_[1] for i in range(32)], style=wx.BORDER_NONE, pos=(350,
|
||||
150), size=(300,
|
||||
26))
|
||||
p.precede8Bits = wx.CheckBox(p, 60, ' Shift LCD register by 8 bits', pos=(40,
|
||||
180))
|
||||
p.showKeys = wx.CheckBox(p, 61, ' Show key UI code', pos=(40, 208))
|
||||
p.blinkAllForWink = wx.CheckBox(p, 61, ' Blink all front panel LEDs for Wink / Locate', pos=(40,
|
||||
236))
|
||||
p.lclkDuplicateIO2 = wx.CheckBox(p, 62, ' IO2 Display connected to LCLK (P02293)', pos=(40,
|
||||
264))
|
||||
p.enableSecondaryVUClock = wx.CheckBox(p, 63, ' Enable secondary VU clock', pos=(348,
|
||||
180))
|
||||
p.enableSecondaryLCDClock = wx.CheckBox(p, 63, ' Enable secondary LCD clock', pos=(348,
|
||||
208))
|
||||
p.forceSerial = wx.CheckBox(p, 63, ' Force serial key interface', pos=(348,
|
||||
236))
|
||||
p.turnOffLedsDuringMute = wx.CheckBox(p, 64, ' Turn off VU when muted', pos=(348,
|
||||
264))
|
||||
p.displayLineInfoLabelmain = wx.StaticText(p, -1, 'Normal Operation', pos=(350,
|
||||
290))
|
||||
p.displayLineInfoLabelstart = wx.StaticText(p, -1, 'During Startup', pos=(670,
|
||||
290))
|
||||
p.displayLineInfoLabel1 = wx.StaticText(p, -1, 'Display Information Line 1', pos=(40,
|
||||
310))
|
||||
p.displayLineInfoChoice1 = wx.Choice(p, 50, choices=[_[2] for i in sorted(displayLineInfoChoices.keys())], style=wx.BORDER_NONE, pos=(350,
|
||||
310), size=(300,
|
||||
26))
|
||||
p.displayLineInfoLabel2 = wx.StaticText(p, -1, 'Display Information Line 2', pos=(40,
|
||||
336))
|
||||
p.displayLineInfoChoice2 = wx.Choice(p, 50, choices=[_[3] for i in sorted(displayLineInfoChoices.keys())], style=wx.BORDER_NONE, pos=(350,
|
||||
334), size=(300,
|
||||
26))
|
||||
p.displayLineInfoChoice3 = wx.Choice(p, 50, choices=[_[4] for i in sorted(displayLineInfoChoices.keys())], style=wx.BORDER_NONE, pos=(670,
|
||||
310), size=(250,
|
||||
26))
|
||||
p.displayLineInfoChoice4 = wx.Choice(p, 50, choices=[_[5] for i in sorted(displayLineInfoChoices.keys())], style=wx.BORDER_NONE, pos=(670,
|
||||
334), size=(250,
|
||||
26))
|
||||
p.displayInBitLabel = wx.StaticText(p, -1, 'Display Input Signal', pos=(40,
|
||||
360))
|
||||
p.displayInBitChoice = wx.Choice(p, 50, choices=sorted(displayInputSignalChoices.values()), style=wx.BORDER_NONE, pos=(350,
|
||||
360), size=(300,
|
||||
26))
|
||||
self.enable(p)
|
||||
p.key = None
|
||||
self.Bind(wx.EVT_CHECKBOX, self.OnEnabled, id=lineNumber)
|
||||
p.lineNumber = lineNumber
|
||||
return p
|
||||
|
||||
def OnConfigurePrimary(self, e):
|
||||
self.frame.frame.executeOK()
|
||||
line = self.lines[0]
|
||||
pDC = line.primaryDisplayChoice.GetStringSelection()
|
||||
pDCval = 0
|
||||
for s in primaryDisplayTypes.keys():
|
||||
if primaryDisplayTypes[s] == pDC:
|
||||
pDCval = s
|
||||
|
||||
print mytime.displayTime(), 'ucd.OCP', pDCval, pDC
|
||||
dlgMessage = getString('ocp')
|
||||
dlgTitle = getString('acd')
|
||||
self.frame.Show(False)
|
||||
if isMAC():
|
||||
style = wx.OK | wx.CANCEL | wx.STAY_ON_TOP
|
||||
else:
|
||||
style = wx.OK | wx.CANCEL
|
||||
res = wx.MessageBox(dlgMessage, dlgTitle, style)
|
||||
if res != wx.OK:
|
||||
self.frame.Show(True)
|
||||
return
|
||||
self.frame.frame.executeOK()
|
||||
keyBytes = int(line.keyBytesChoice.GetStringSelection())
|
||||
ledShift = int(line.ledShiftChoice.GetStringSelection())
|
||||
cfgName = 'configurations/DP' + pDC + '.cfg'
|
||||
cfg = ConfigParser.ConfigParser()
|
||||
cfg.read(cfgName)
|
||||
print mytime.displayTime(), 'ucd.OCP.reading config', cfgName
|
||||
try:
|
||||
keyBytes = (len(eval(cfg.get('DEFAULT', 'user_config_front_panel_keys'))) + 7) / 8
|
||||
print mytime.displayTime(), 'ucd.OCP.keyBytes:', keyBytes
|
||||
line.keyBytesChoice.SetStringSelection(str(keyBytes))
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
|
||||
try:
|
||||
ledShift = len(eval(cfg.get('DEFAULT', 'user_config_front_panel_leds')))
|
||||
print mytime.displayTime(), 'ucd.OCP.ledShift:', ledShift
|
||||
line.ledShiftChoice.SetStringSelection(str(ledShift))
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
|
||||
try:
|
||||
menuType = int(cfg.get('DEFAULT', 'menuType'))
|
||||
line.displayNavigationChoice.SetStringSelection(displayNavigationStyles[menuType])
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
|
||||
for keyNumber in range(keyBytes * 8):
|
||||
self.frame.frame.clear(self.frame, keyNumber + 32)
|
||||
|
||||
for ledNumber in range(ledShift):
|
||||
self.frame.frame.clear(self.frame, 184, memberID=ledNumber)
|
||||
|
||||
self.frame.frame.clear(self.frame, 88)
|
||||
self.frame.frame.clear(self.frame, 187)
|
||||
self.frame.frame.clear(self.frame, 188)
|
||||
configurationFileName = 'configurations/DP' + pDC + '.csv'
|
||||
f = open(configurationFileName, 'rb')
|
||||
data = f.readlines()
|
||||
f.close()
|
||||
for csvLine in data:
|
||||
try:
|
||||
uiNumber = int(csvLine.split('|')[4])
|
||||
structID = int(csvLine.split('|')[5])
|
||||
except:
|
||||
continue
|
||||
|
||||
if uiNumber == 189 and structID == 5:
|
||||
self.frame.frame.clear(self.frame, uiNumber, structID=5)
|
||||
|
||||
self.frame.frame.parent.waitForSync(msg='ucd.autoconf.Syncing erased keys')
|
||||
self.frame.frame.load(configurationFileName)
|
||||
self.frame.frame.refreshAll()
|
||||
return
|
||||
|
||||
def OnConfigureSecondary(self, e):
|
||||
line = self.lines[0]
|
||||
sDC = line.secondaryDisplayChoice.GetStringSelection()
|
||||
sDCval = 0
|
||||
for s in secondaryDisplayTypes.keys():
|
||||
if secondaryDisplayTypes[s] == sDC:
|
||||
sDCval = s
|
||||
|
||||
print mytime.displayTime(), 'ucd.OCS', sDCval, sDC
|
||||
dlgMessage = getString('ocs')
|
||||
dlgTitle = getString('acd')
|
||||
res = wx.MessageBox(dlgMessage, dlgTitle, wx.OK | wx.CANCEL)
|
||||
if res != wx.OK:
|
||||
return
|
||||
return
|
||||
|
||||
def OnEnabled(self, e):
|
||||
self.enable(self.lines[0])
|
||||
return
|
||||
|
||||
def enable(self, line):
|
||||
val = line.checkBox.GetValue()
|
||||
line.primaryDisplayChoice.Enable(val)
|
||||
line.secondaryDisplayChoice.Enable(val)
|
||||
line.displayNavigationChoice.Enable(val)
|
||||
line.precede8Bits.Enable(val)
|
||||
line.showKeys.Enable(val)
|
||||
line.keyBytesChoice.Enable(val)
|
||||
line.blinkAllForWink.Enable(val)
|
||||
line.ledShiftChoice.Enable(val)
|
||||
return
|
||||
|
||||
def evaluateLine(self, line):
|
||||
if self.lines[0].checkBox.GetValue() == False:
|
||||
return
|
||||
else:
|
||||
pDC = line.primaryDisplayChoice.GetStringSelection()
|
||||
pDCval = 0
|
||||
for s in primaryDisplayTypes.keys():
|
||||
if primaryDisplayTypes[s] == pDC:
|
||||
pDCval = s
|
||||
|
||||
sDC = line.secondaryDisplayChoice.GetStringSelection()
|
||||
sDCval = 0
|
||||
for s in secondaryDisplayTypes.keys():
|
||||
if secondaryDisplayTypes[s] == sDC:
|
||||
sDCval = s
|
||||
|
||||
dNC = line.displayNavigationChoice.GetStringSelection()
|
||||
dNCval = 0
|
||||
for s in displayNavigationStyles.keys():
|
||||
if displayNavigationStyles[s] == dNC:
|
||||
dNCval = s
|
||||
|
||||
line1Choice = line.displayLineInfoChoice1.GetStringSelection()
|
||||
for i in displayLineInfoChoices.keys():
|
||||
if displayLineInfoChoices[i] == line1Choice:
|
||||
line1Choice = i
|
||||
break
|
||||
|
||||
line2Choice = line.displayLineInfoChoice2.GetStringSelection()
|
||||
for i in displayLineInfoChoices.keys():
|
||||
if displayLineInfoChoices[i] == line2Choice:
|
||||
line2Choice = i
|
||||
break
|
||||
|
||||
line3Choice = line.displayLineInfoChoice3.GetStringSelection()
|
||||
for i in displayLineInfoChoices.keys():
|
||||
if displayLineInfoChoices[i] == line3Choice:
|
||||
line3Choice = i
|
||||
break
|
||||
|
||||
line4Choice = line.displayLineInfoChoice4.GetStringSelection()
|
||||
for i in displayLineInfoChoices.keys():
|
||||
if displayLineInfoChoices[i] == line4Choice:
|
||||
line4Choice = i
|
||||
break
|
||||
|
||||
flags = 0
|
||||
if line.precede8Bits.GetValue():
|
||||
flags += 1
|
||||
if line.showKeys.GetValue():
|
||||
flags += 2
|
||||
if line.blinkAllForWink.GetValue() == 0:
|
||||
flags += 4
|
||||
if line.lclkDuplicateIO2.GetValue() == 0:
|
||||
flags += 8
|
||||
if line.enableSecondaryVUClock.GetValue() == 1:
|
||||
flags += 16
|
||||
if line.enableSecondaryLCDClock.GetValue() == 1:
|
||||
flags += 32
|
||||
if line.forceSerial.GetValue() == 1:
|
||||
flags += 64
|
||||
if line.turnOffLedsDuringMute.GetValue() == 1:
|
||||
flags += 128
|
||||
keyBytes = int(line.keyBytesChoice.GetStringSelection()) - 1
|
||||
ledShift = int(line.ledShiftChoice.GetStringSelection())
|
||||
bit = line.displayInBitChoice.GetStringSelection()
|
||||
for i in range(len(displayInputSignalChoices)):
|
||||
if displayInputSignalChoices[i] == bit:
|
||||
bit = i
|
||||
break
|
||||
|
||||
try:
|
||||
sendString = '' + chr(self.uiNumber)
|
||||
sendString += chr(5)
|
||||
sendString += chr(pDCval | bit << 4 | (line4Choice & 3) << 6)
|
||||
sendString += chr(sDCval | (line3Choice & 15) << 4)
|
||||
sendString += chr(dNCval | line1Choice << 2 | (line3Choice & 16) << 3)
|
||||
sendString += chr(flags)
|
||||
sendString += chr(keyBytes | ledShift << 2)
|
||||
sendString += chr(line2Choice | (line4Choice & 28) << 3)
|
||||
mys = 'ucd.eL.String: '
|
||||
for c in sendString:
|
||||
mys += hex(ord(c)) + ':'
|
||||
|
||||
print mys, line.lineNumber
|
||||
self.settingsVerified = True
|
||||
return sendString
|
||||
except:
|
||||
print mytime.displayTime(), 'ucd.ec.eL.failed to build string'
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
||||
# okay decompiling pycode/user_config_display.pyc
|
||||
@@ -0,0 +1,51 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: user_config_helpers.pyc
|
||||
# Compiled at: 2022-04-20 07:08:28
|
||||
import wx, os, data_model, traceback, one_unit, ConfigParser, protocol, sys, select_keys, select_units, d_protocol, mytime
|
||||
mac_names = 'posix'
|
||||
strid_fixed_membid = {'Gain': 'Gain', 'Mute': 'Mute', 'Protect': 'Protect'}
|
||||
|
||||
def findFreeUI(parent, keySet):
|
||||
for j in range(512):
|
||||
key = data_model.Key(protocol.STRUCT_ID_UI_CONTROL, protocol.MEMBER_ID_UI_CONTROL, j / 256, j % 256)
|
||||
try:
|
||||
val = [_[1] for c in parent.model.get(key)]
|
||||
except:
|
||||
continue
|
||||
|
||||
if val[0] == 0 and key not in keySet:
|
||||
return j
|
||||
|
||||
return
|
||||
|
||||
|
||||
def getString(strID):
|
||||
return one_unit.getString(strID)
|
||||
|
||||
|
||||
def getKeys(frame, uiNumber, memberID=None, structID=None):
|
||||
uiIndex = 0
|
||||
keys = {}
|
||||
if frame.frame.parent.MAC[:4] in ('DEMO', 'VN::'):
|
||||
return keys
|
||||
else:
|
||||
for j in range(512):
|
||||
key = data_model.Key(protocol.STRUCT_ID_UI_CONTROL, protocol.MEMBER_ID_UI_CONTROL, j / 256, j % 256)
|
||||
try:
|
||||
val = [_[1] for c in frame.frame.parent.model.get(key, fast=True)]
|
||||
except:
|
||||
continue
|
||||
|
||||
if val[0] == uiNumber and (memberID == None or memberID == val[2]) and (structID == None or structID == val[1] & 63):
|
||||
keys[uiIndex] = (
|
||||
key, val)
|
||||
uiIndex += 1
|
||||
|
||||
return keys
|
||||
|
||||
|
||||
|
||||
# okay decompiling pycode/user_config_helpers.pyc
|
||||
@@ -0,0 +1,723 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: user_config_keys.pyc
|
||||
# Compiled at: 2025-05-16 12:34:05
|
||||
import wx, os, data_model, traceback, one_unit, ConfigParser, protocol, sys, select_keys, select_units, d_protocol, mytime
|
||||
from user_config_helpers import *
|
||||
keyFunctionNone = 0
|
||||
keyFunctionSystemMenu = 1
|
||||
keyFunctionEscExit = 2
|
||||
keyFunctionToggleMute = 3
|
||||
keyFunctionChannelSelect = 4
|
||||
keyFunctionItemSelect = 5
|
||||
keyFunctionChannelUp = 6
|
||||
keyFunctionChannelDown = 7
|
||||
keyFunctionItemUp = 8
|
||||
keyFunctionItemDown = 9
|
||||
keyFunctionModifyValue = 10
|
||||
keyFunctionNotUsed1 = 11
|
||||
keyFunctionNextPreset = 12
|
||||
keyFunctionEnterConfirm = 13
|
||||
keyFunctionSetValueTo = 14
|
||||
keyFunctionLoadPreset = 15
|
||||
keyFunctionNetworkReset = 16
|
||||
keyFunctionFactoryReset = 17
|
||||
keyFunctionLockKeys = 18
|
||||
keyFunctionCopy = 19
|
||||
keyFunctionPaste = 20
|
||||
keyFunctionLockUnlock = 21
|
||||
keyFunctionToggleOnOff = 22
|
||||
keyFunctionToggleStandby = 23
|
||||
keyFunctionResetPIN = 24
|
||||
keyFunctionMuteSystem = 25
|
||||
keyFunctionToggleBridgeMode = 26
|
||||
keyFunctionEraseUserPresets = 27
|
||||
keyFunctionSafeMode = 28
|
||||
keyFunctionGotoStandby = 29
|
||||
keyFunctionExitStandby = 30
|
||||
keyFunctions = {keyFunctionNone: 'None',
|
||||
keyFunctionSystemMenu: 'System Menu',
|
||||
keyFunctionEscExit: 'Esc / Exit',
|
||||
keyFunctionToggleMute: 'Toggle Mute',
|
||||
keyFunctionChannelSelect: 'Channel Select',
|
||||
keyFunctionItemSelect: 'None',
|
||||
keyFunctionChannelUp: 'Channel Up',
|
||||
keyFunctionChannelDown: 'Channel Down',
|
||||
keyFunctionItemUp: 'Item Up',
|
||||
keyFunctionItemDown: 'Item Down',
|
||||
keyFunctionModifyValue: 'Modify Value By',
|
||||
keyFunctionNotUsed1: 'Invalid',
|
||||
keyFunctionNextPreset: 'Next Preset',
|
||||
keyFunctionEnterConfirm: 'Enter / Confirm',
|
||||
keyFunctionSetValueTo: 'Set Value To',
|
||||
keyFunctionLoadPreset: 'Load Preset',
|
||||
keyFunctionNetworkReset: 'Network Reset',
|
||||
keyFunctionFactoryReset: 'Factory Reset',
|
||||
keyFunctionLockKeys: 'Lock / Unlock Keys',
|
||||
keyFunctionCopy: 'Copy',
|
||||
keyFunctionPaste: 'Paste',
|
||||
keyFunctionLockUnlock: 'Lock / Unlock Unit',
|
||||
keyFunctionToggleOnOff: 'Toggle On / Off',
|
||||
keyFunctionToggleStandby: 'Toggle Standby',
|
||||
keyFunctionResetPIN: 'Reset PIN',
|
||||
keyFunctionMuteSystem: 'Fire Mute',
|
||||
keyFunctionToggleBridgeMode: 'Toggle Bridge Mode',
|
||||
keyFunctionEraseUserPresets: 'Erase User presets',
|
||||
keyFunctionSafeMode: 'Startup in Safe Mode',
|
||||
keyFunctionGotoStandby: 'Go to Standby',
|
||||
keyFunctionExitStandby: 'Exit Standby'}
|
||||
keySelectOptions = {keyFunctionNone: '',
|
||||
keyFunctionSystemMenu: '',
|
||||
keyFunctionEscExit: '',
|
||||
keyFunctionToggleMute: 'c',
|
||||
keyFunctionChannelSelect: 'c',
|
||||
keyFunctionItemSelect: 'sm',
|
||||
keyFunctionChannelUp: '',
|
||||
keyFunctionChannelDown: '',
|
||||
keyFunctionItemUp: '',
|
||||
keyFunctionItemDown: '',
|
||||
keyFunctionModifyValue: 'smciv',
|
||||
keyFunctionNotUsed1: 'smciv',
|
||||
keyFunctionNextPreset: 'v',
|
||||
keyFunctionEnterConfirm: '',
|
||||
keyFunctionSetValueTo: 'scmiv',
|
||||
keyFunctionLoadPreset: 'v',
|
||||
keyFunctionNetworkReset: '',
|
||||
keyFunctionFactoryReset: '',
|
||||
keyFunctionLockKeys: '',
|
||||
keyFunctionCopy: '',
|
||||
keyFunctionPaste: '',
|
||||
keyFunctionLockUnlock: '',
|
||||
keyFunctionToggleOnOff: 'sci',
|
||||
keyFunctionToggleStandby: '',
|
||||
keyFunctionResetPIN: '',
|
||||
keyFunctionMuteSystem: 'v',
|
||||
keyFunctionToggleBridgeMode: 'c',
|
||||
keyFunctionEraseUserPresets: '',
|
||||
keyFunctionSafeMode: '',
|
||||
keyFunctionGotoStandby: '',
|
||||
keyFunctionExitStandby: ''}
|
||||
keyTriggerOptions = {0: 'On Push',
|
||||
1: 'Click',
|
||||
2: 'Hold 3 sec',
|
||||
3: 'Hold 10 sec',
|
||||
4: 'Hold 20 sec',
|
||||
5: 'Hold 30 sec',
|
||||
6: 'Depressed',
|
||||
7: 'Not pressed',
|
||||
8: 'Hold 1 sec',
|
||||
9: 'Hold 2 sec',
|
||||
10: 'On Release',
|
||||
11: 'Hold Until Action',
|
||||
12: 'Release Until Action'}
|
||||
gpiTriggerOptions = {0: 'Falling Edge',
|
||||
1: 'Pulse 0.5 sec',
|
||||
2: 'Pulse 5 sec',
|
||||
3: 'Pulse 15 sec',
|
||||
4: 'Pulse 25 sec',
|
||||
5: 'Pulse 35 sec',
|
||||
6: 'Active',
|
||||
7: 'Not Active',
|
||||
8: 'Pulse 1.5 sec',
|
||||
9: 'Pulse 2.5 sec',
|
||||
10: 'Rising Edge',
|
||||
11: 'Active Until Action',
|
||||
12: 'Not Active Until Action'}
|
||||
keyTriggerChoices = [
|
||||
71,
|
||||
81,
|
||||
72,
|
||||
79,
|
||||
80,
|
||||
73,
|
||||
74,
|
||||
75,
|
||||
76,
|
||||
77,
|
||||
82,
|
||||
78,
|
||||
83]
|
||||
gpiTriggerChoices = [
|
||||
94,
|
||||
84,
|
||||
90,
|
||||
95,
|
||||
91,
|
||||
96,
|
||||
85,
|
||||
92,
|
||||
93,
|
||||
86,
|
||||
87,
|
||||
88,
|
||||
89]
|
||||
defaultRotaryFunctions = {16: 'Channel Gain',
|
||||
48: 'Channel Delay',
|
||||
32: 'PEQ 1 Gain',
|
||||
33: 'PEQ 2 Gain',
|
||||
34: 'PEQ 3 Gain',
|
||||
35: 'PEQ 4 Gain',
|
||||
36: 'PEQ 5 Gain',
|
||||
37: 'PEQ 6 Gain',
|
||||
38: 'PEQ 7 Gain',
|
||||
39: 'PEQ 8 Gain',
|
||||
40: 'PEQ 9 Gain',
|
||||
41: 'PEQ 10 Gain',
|
||||
255: 'Disabled'}
|
||||
|
||||
class frontPanelKeys(wx.Panel):
|
||||
|
||||
def __init__(self, parent, frame, uiNumber, panelName):
|
||||
self.frame = frame
|
||||
self.name = panelName
|
||||
self.uiNumber = uiNumber
|
||||
self.panelName = panelName
|
||||
self.parent = parent
|
||||
if uiNumber >= 96:
|
||||
self.keyTriggerOptions = gpiTriggerOptions
|
||||
self.keyTriggerChoices = gpiTriggerChoices
|
||||
else:
|
||||
self.keyTriggerOptions = keyTriggerOptions
|
||||
self.keyTriggerChoices = keyTriggerChoices
|
||||
wx.Panel.__init__(self, parent, size=(964, 500))
|
||||
self.lines = {}
|
||||
self.initFinished = False
|
||||
self.frame = frame
|
||||
self.Show(True)
|
||||
return
|
||||
|
||||
def initMe(self, force=False):
|
||||
if self.IsShown() == False and force == False:
|
||||
return
|
||||
else:
|
||||
if self.initFinished == True:
|
||||
return 0
|
||||
print mytime.displayTime(), 'uck.initMe FrontPanelKeys', self.name
|
||||
i = 0
|
||||
frame = self.frame
|
||||
uiNumber = self.uiNumber
|
||||
self.struct_id_choices = ['Selected']
|
||||
for strID in (0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 17):
|
||||
self.struct_id_choices.append(protocol.get_strid_text(strID))
|
||||
|
||||
self.member_id_choices = [
|
||||
'Selected']
|
||||
for membID in (0, 1, 2, 3, 4, 5, 6, 7, 8, 14, 15, 24, 27):
|
||||
self.member_id_choices.append(protocol.get_member_text(membID))
|
||||
|
||||
self.channels = {127: 'All Inputs', 255: 'All Outputs'}
|
||||
for c in self.frame.frame.parent.unit_channels:
|
||||
if c < 128:
|
||||
s = 'Input ' + str(c + 1)
|
||||
else:
|
||||
s = 'Output ' + str(c - 127)
|
||||
self.channels[c] = s
|
||||
|
||||
self.uiKeys = getKeys(frame, uiNumber)
|
||||
print 'uck.Keys for ui number', uiNumber, ':', self.uiKeys
|
||||
self.offset = 40
|
||||
labelOffset = 20
|
||||
self.factoryItems = 0
|
||||
self.rotaryKeys = None
|
||||
pos = self.panelName.lower().find('rotary')
|
||||
if pos >= 0:
|
||||
rotaryNumber = 0
|
||||
try:
|
||||
rotaryNumber = int(self.panelName[-1]) - 1
|
||||
if rotaryNumber < 0:
|
||||
rotaryNumber = 0
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
print mytime.displayTime(), 'uck.found rotary number', rotaryNumber
|
||||
self.rotaryKeys = getKeys(frame, 88 + rotaryNumber)
|
||||
if rotaryNumber == 3:
|
||||
self.frame.frame.clear(self.frame, 92)
|
||||
self.frame.frame.clear(self.frame, 93)
|
||||
self.frame.frame.clear(self.frame, 94)
|
||||
self.frame.frame.clear(self.frame, 95)
|
||||
self.createRotaryLine(0)
|
||||
self.lines[0].uiNumber = 88 + rotaryNumber
|
||||
i = 1
|
||||
self.offset = 40
|
||||
labelOffset = 48
|
||||
if len(self.rotaryKeys) > 0:
|
||||
for uiIndex in self.rotaryKeys:
|
||||
(key, val) = self.rotaryKeys[uiIndex]
|
||||
print mytime.displayTime(), 'uck.found rotary key for rotary number', rotaryNumber, ':', key, val
|
||||
if key.channel == 1 and key.index >= 128:
|
||||
continue
|
||||
else:
|
||||
self.lines[0].key = key
|
||||
self.lines[0].uiNumber = val[0]
|
||||
self.lines[0].bit1Choice.SetStringSelection(str(val[5]))
|
||||
self.lines[0].bit2Choice.SetStringSelection(str(val[6]))
|
||||
try:
|
||||
self.lines[0].functionChoice.SetStringSelection(str(defaultRotaryFunctions[val[7]]))
|
||||
except:
|
||||
self.lines[0].functionChoice.SetStringSelection('Disabled')
|
||||
|
||||
try:
|
||||
channelString = self.channels[val[3]]
|
||||
except:
|
||||
channelString = 'Input 1'
|
||||
|
||||
self.lines[0].channelChoice.SetStringSelection(channelString)
|
||||
self.lines[0].bit1Choice.Enable(True)
|
||||
self.lines[0].bit2Choice.Enable(True)
|
||||
self.lines[0].functionChoice.Enable(True)
|
||||
self.lines[0].channelChoice.Enable(True)
|
||||
self.lines[0].checkBox.SetValue(True)
|
||||
|
||||
self.strTrigger = wx.StaticText(self, -1, 'Trigger', pos=(80, labelOffset))
|
||||
self.strFunction = wx.StaticText(self, -1, 'Function', pos=(230, labelOffset))
|
||||
self.strItem = wx.StaticText(self, -1, 'Process', pos=(370, labelOffset))
|
||||
self.strSubItem = wx.StaticText(self, -1, 'Parameter', pos=(480, labelOffset))
|
||||
self.strChannel = wx.StaticText(self, -1, 'Channel', pos=(590, labelOffset))
|
||||
self.strIndex = wx.StaticText(self, -1, 'Index', pos=(700, labelOffset))
|
||||
self.strValue = wx.StaticText(self, -1, 'Value', pos=(750, labelOffset))
|
||||
for uiIndex in self.uiKeys:
|
||||
(key, val) = self.uiKeys[uiIndex]
|
||||
if key.channel != 1 or key.index < 128:
|
||||
continue
|
||||
self.createLine(i, self.offset)
|
||||
self.lines[i].key = key
|
||||
self.lines[i].checkBox.Enable(False)
|
||||
self.lines[i].checkBox.SetLabel('Factory')
|
||||
self.lines[i].struct_id_choice.Enable(False)
|
||||
self.lines[i].member_id_choice.Enable(False)
|
||||
self.lines[i].channel_choice.Enable(False)
|
||||
self.lines[i].index_choice.Enable(False)
|
||||
self.lines[i].keyTriggerChoice.Enable(False)
|
||||
self.lines[i].checkBox.SetValue(True)
|
||||
self.lines[i].struct_id_choice.SetStringSelection(protocol.get_strid_text(val[1]))
|
||||
self.lines[i].member_id_choice.SetStringSelection(protocol.get_member_text(val[2]))
|
||||
channel = val[3]
|
||||
if channel == 255:
|
||||
channel = 'All Outputs'
|
||||
elif channel == 127:
|
||||
channel = 'All Inputs'
|
||||
elif channel < 128:
|
||||
channel = 'Input ' + str(channel + 1)
|
||||
else:
|
||||
channel = 'Output ' + str(channel - 128 + 1)
|
||||
self.lines[i].channel_choice.SetStringSelection(channel)
|
||||
self.lines[i].index_choice.SetStringSelection(str(val[4] + 1))
|
||||
keyFunction = val[5]
|
||||
self.lines[i].keyFunctionChoice.SetStringSelection(keyFunctions[keyFunction])
|
||||
self.lines[i].keyTriggerChoice.SetStringSelection(self.keyTriggerOptions[val[6]])
|
||||
self.enable(i)
|
||||
self.lines[i].keyFunctionChoice.Enable(False)
|
||||
if keyFunction in (keyFunctionNextPreset, keyFunctionLoadPreset, keyFunctionMuteSystem):
|
||||
self.lines[i].value.SetValue(str(val[2]))
|
||||
elif keyFunction in (keyFunctionModifyValue, keyFunctionSetValueTo):
|
||||
self.lines[i].value.SetValue(str(val[7] - 128))
|
||||
i += 1
|
||||
self.factoryItems += 1
|
||||
|
||||
for uiIndex in self.uiKeys:
|
||||
(key, val) = self.uiKeys[uiIndex]
|
||||
if key.channel == 1 and key.index >= 128:
|
||||
continue
|
||||
self.createLine(i, self.offset)
|
||||
self.lines[i].key = key
|
||||
self.lines[i].checkBox.SetValue(True)
|
||||
keyFunction = val[5]
|
||||
self.lines[i].keyFunctionChoice.SetStringSelection(keyFunctions[keyFunction])
|
||||
self.lines[i].keyTriggerChoice.SetStringSelection(self.keyTriggerOptions[val[6]])
|
||||
if keyFunction in (keyFunctionNextPreset, keyFunctionLoadPreset, keyFunctionMuteSystem):
|
||||
self.lines[i].value.SetValue(str(val[2]))
|
||||
elif keyFunction in (keyFunctionModifyValue, keyFunctionSetValueTo):
|
||||
self.lines[i].value.SetValue(str((val[7] - 128) / 4.0))
|
||||
self.enable(i)
|
||||
self.lines[i].struct_id_choice.SetStringSelection(protocol.get_strid_text(val[1]))
|
||||
self.lines[i].member_id_choice.SetStringSelection(protocol.get_member_text(val[2]))
|
||||
channel = val[3]
|
||||
if channel == 255:
|
||||
channel = 'All Outputs'
|
||||
elif channel == 127:
|
||||
channel = 'All Inputs'
|
||||
elif channel < 128:
|
||||
channel = 'Input ' + str(channel + 1)
|
||||
else:
|
||||
channel = 'Output ' + str(channel - 128 + 1)
|
||||
self.lines[i].channel_choice.SetStringSelection(channel)
|
||||
self.lines[i].index_choice.SetStringSelection(str(val[4] + 1))
|
||||
i += 1
|
||||
|
||||
if i - self.factoryItems < 8:
|
||||
self.createLine(i, self.offset)
|
||||
self.initFinished = True
|
||||
return
|
||||
|
||||
def createRotaryLine(self, i):
|
||||
p = wx.Panel(self, size=(964, 28))
|
||||
p.type = 'rotary'
|
||||
p.Show(False)
|
||||
p.checkBox = wx.CheckBox(p, 10 + i, 'Enable Rotary', pos=(10, 2))
|
||||
p.label2 = wx.StaticText(p, -1, 'bit 1', pos=(120, 3))
|
||||
p.bit1Choice = wx.Choice(p, 20 + i, choices=[_[1] for nr in range(32)], style=wx.BORDER_NONE, pos=(160,
|
||||
0), size=(60,
|
||||
26))
|
||||
p.label3 = wx.StaticText(p, -1, 'bit 2', pos=(240, 3))
|
||||
p.bit2Choice = wx.Choice(p, 30 + i, choices=[_[2] for nr in range(32)], style=wx.BORDER_NONE, pos=(280,
|
||||
0), size=(60,
|
||||
26))
|
||||
p.label4 = wx.StaticText(p, -1, 'Default Function', pos=(360, 3))
|
||||
p.functionChoice = wx.Choice(p, 40 + i, choices=defaultRotaryFunctions.values(), style=wx.BORDER_NONE, pos=(480,
|
||||
0), size=(150,
|
||||
26))
|
||||
p.functionChoice.SetStringSelection('Disabled')
|
||||
p.label4 = wx.StaticText(p, -1, 'Channel', pos=(670, 3))
|
||||
channels = self.channels.values()
|
||||
channels.remove('All Inputs')
|
||||
channels.remove('All Outputs')
|
||||
p.channelChoice = wx.Choice(p, 60 + i, choices=sorted(channels), style=wx.BORDER_NONE, pos=(730,
|
||||
0), size=(100,
|
||||
26))
|
||||
p.channelChoice.SetStringSelection(channels[0])
|
||||
p.bit1Choice.Enable(False)
|
||||
p.bit2Choice.Enable(False)
|
||||
p.functionChoice.Enable(False)
|
||||
p.channelChoice.Enable(False)
|
||||
p.SetPosition((0, 12))
|
||||
p.checkBox.SetValue(0)
|
||||
p.checkBox.Enable(True)
|
||||
p.checkBox.Show(True)
|
||||
p.key = None
|
||||
self.Bind(wx.EVT_CHECKBOX, self.OnEnabledRotary, id=10 + i)
|
||||
self.lines[i] = p
|
||||
p.Show(True)
|
||||
return
|
||||
|
||||
def OnEnabledRotary(self, e):
|
||||
i = e.GetId() - 10
|
||||
if i != 0:
|
||||
return
|
||||
val = self.lines[i].checkBox.GetValue()
|
||||
self.lines[i].bit1Choice.Enable(val)
|
||||
self.lines[i].bit2Choice.Enable(val)
|
||||
self.lines[i].functionChoice.Enable(val)
|
||||
self.lines[i].channelChoice.Enable(val)
|
||||
return
|
||||
|
||||
def createLine(self, i, offset):
|
||||
p = wx.Panel(self, size=(964, 28))
|
||||
p.type = 'key'
|
||||
p.Show(False)
|
||||
p.checkBox = wx.CheckBox(p, 10 + i, ' User', pos=(10, 2), size=(70, 20))
|
||||
p.keyTriggerChoice = wx.Choice(p, 80 + i, choices=self.keyTriggerChoices, style=wx.BORDER_NONE, pos=(80,
|
||||
0), size=(140,
|
||||
26))
|
||||
p.keyTriggerChoice.SetStringSelection(sorted(self.keyTriggerOptions.values())[0])
|
||||
p.keyFunctionChoice = wx.Choice(p, 30 + i, choices=sorted(keyFunctions.values()), style=wx.BORDER_NONE, pos=(230,
|
||||
0), size=(130,
|
||||
26))
|
||||
p.keyFunctionChoice.SetStringSelection(keyFunctions.values()[0])
|
||||
p.struct_id_choice = wx.Choice(p, 40 + i, choices=self.struct_id_choices, style=wx.BORDER_NONE, pos=(370,
|
||||
0), size=(100,
|
||||
26))
|
||||
p.struct_id_choice.SetStringSelection(self.struct_id_choices[0])
|
||||
p.member_id_choice = wx.Choice(p, 50 + i, choices=self.member_id_choices, style=wx.BORDER_NONE, pos=(480,
|
||||
0), size=(100,
|
||||
26))
|
||||
p.member_id_choice.SetStringSelection(self.member_id_choices[0])
|
||||
p.channel_choice = wx.Choice(p, 60 + i, choices=sorted(self.channels.values()), style=wx.BORDER_NONE, pos=(590,
|
||||
0), size=(100,
|
||||
26))
|
||||
p.channel_choice.SetStringSelection(self.channels.values()[0])
|
||||
p.index_choice = wx.Choice(p, 70 + i, choices=[_[1] for j in range(10)], style=wx.BORDER_NONE, pos=(700,
|
||||
0), size=(45,
|
||||
26))
|
||||
p.index_choice.SetStringSelection('1')
|
||||
p.value = wx.TextCtrl(p, 20 + i, '', pos=(750, 1), size=(100, 20))
|
||||
p.value.Show(False)
|
||||
p.strParameter = wx.StaticText(p, -1, '', pos=(590, 3), size=(120, 20))
|
||||
p.strParameter.Show(False)
|
||||
p.SetPosition((0, offset + 28 * i))
|
||||
p.checkBox.SetValue(0)
|
||||
p.checkBox.Enable(True)
|
||||
p.key = None
|
||||
self.Bind(wx.EVT_CHECKBOX, self.OnEnabled, id=10 + i)
|
||||
self.Bind(wx.EVT_CHOICE, self.OnStructId, id=40 + i)
|
||||
self.Bind(wx.EVT_CHOICE, self.OnChangeKeyFunction, id=30 + i)
|
||||
self.lines[i] = p
|
||||
self.enable(i)
|
||||
p.Show(True)
|
||||
return
|
||||
|
||||
def enable(self, i):
|
||||
val = self.lines[i].checkBox.GetValue()
|
||||
self.showChoices(i, self.getKeyFunction(self.lines[i]), val)
|
||||
return
|
||||
|
||||
def showChoices(self, i, keyFunctionInt, enabled):
|
||||
self.lines[i].keyFunctionChoice.Enable(enabled)
|
||||
try:
|
||||
keyFunctionFields = keySelectOptions[keyFunctionInt]
|
||||
except:
|
||||
keyFunctionFields = None
|
||||
|
||||
self.lines[i].struct_id_choice.Show(False)
|
||||
self.lines[i].member_id_choice.Show(False)
|
||||
self.lines[i].channel_choice.Show(False)
|
||||
self.lines[i].index_choice.Show(False)
|
||||
self.lines[i].value.Show(False)
|
||||
self.lines[i].strParameter.Show(False)
|
||||
if keyFunctionFields.find('s') >= 0:
|
||||
self.lines[i].struct_id_choice.Show(True)
|
||||
if self.lines[i].struct_id_choice.GetStringSelection() not in ('Selected',
|
||||
'All'):
|
||||
if keyFunctionFields.find('m') >= 0:
|
||||
self.lines[i].member_id_choice.Show(True)
|
||||
if keyFunctionFields.find('c') >= 0:
|
||||
self.lines[i].channel_choice.Show(True)
|
||||
if keyFunctionFields.find('i') >= 0:
|
||||
self.lines[i].index_choice.Show(True)
|
||||
elif keyFunctionFields.find('m') >= 0:
|
||||
self.lines[i].member_id_choice.Show(True)
|
||||
if keyFunctionFields.find('c') >= 0:
|
||||
self.lines[i].channel_choice.Show(True)
|
||||
if keyFunctionFields.find('i') >= 0:
|
||||
self.lines[i].index_choice.Show(True)
|
||||
if keyFunctionFields.find('v') >= 0:
|
||||
self.lines[i].value.Show(True)
|
||||
if keyFunctionInt == keyFunctionNextPreset:
|
||||
self.lines[i].strParameter.SetLabel('Looping Range:')
|
||||
self.lines[i].strParameter.Show(True)
|
||||
elif keyFunctionInt == keyFunctionLoadPreset:
|
||||
self.lines[i].strParameter.SetLabel('Preset To Load:')
|
||||
self.lines[i].strParameter.Show(True)
|
||||
if keyFunctionFields == 'sm':
|
||||
self.lines[i].struct_id_choice.Show(True)
|
||||
self.lines[i].member_id_choice.Show(True)
|
||||
self.struct_id_choices = []
|
||||
if keyFunctionInt == keyFunctionToggleOnOff:
|
||||
for strID in (3, 4, 5):
|
||||
self.struct_id_choices.append(protocol.get_strid_text(strID))
|
||||
|
||||
elif keyFunctionInt == keyFunctionModifyValue:
|
||||
for strID in (0, 5, 12):
|
||||
self.struct_id_choices.append(protocol.get_strid_text(strID))
|
||||
|
||||
elif keyFunctionInt == keyFunctionSetValueTo:
|
||||
for strID in (0, 5, 7, 17):
|
||||
self.struct_id_choices.append(protocol.get_strid_text(strID))
|
||||
|
||||
else:
|
||||
for strID in (0, 1, 2, 3, 4, 5, 6, 7, 8, 12):
|
||||
self.struct_id_choices.append(protocol.get_strid_text(strID))
|
||||
|
||||
currentSelection = self.lines[i].struct_id_choice.GetStringSelection()
|
||||
self.lines[i].struct_id_choice.Clear()
|
||||
self.lines[i].struct_id_choice.AppendItems(self.struct_id_choices)
|
||||
if currentSelection in self.struct_id_choices:
|
||||
self.lines[i].struct_id_choice.SetStringSelection(currentSelection)
|
||||
else:
|
||||
self.lines[i].struct_id_choice.SetStringSelection(self.struct_id_choices[0])
|
||||
self.member_id_choices = []
|
||||
if keyFunctionInt in (keyFunctionSetValueTo, keyFunctionModifyValue):
|
||||
for membID in (0, protocol.MEMBER_ID_THRESHOLD, 7, 65):
|
||||
self.member_id_choices.append(protocol.get_member_text(membID))
|
||||
|
||||
else:
|
||||
for membID in (0, 1, 2, 3, 4, 5, 6, 7, 8, 14, 15, 24, 27):
|
||||
self.member_id_choices.append(protocol.get_member_text(membID))
|
||||
|
||||
currentSelection = self.lines[i].member_id_choice.GetStringSelection()
|
||||
self.lines[i].member_id_choice.Clear()
|
||||
self.lines[i].member_id_choice.AppendItems(self.member_id_choices)
|
||||
if currentSelection in self.member_id_choices:
|
||||
self.lines[i].member_id_choice.SetStringSelection(currentSelection)
|
||||
else:
|
||||
self.lines[i].member_id_choice.SetStringSelection(self.member_id_choices[0])
|
||||
return
|
||||
|
||||
def OnEnabled(self, e):
|
||||
i = e.GetId() - 10
|
||||
self.enable(i)
|
||||
if i == len(self.lines) - 1 and self.lines[i].checkBox.GetValue() == True and i < 7 + self.factoryItems:
|
||||
self.createLine(i + 1, self.offset)
|
||||
return
|
||||
|
||||
def OnChangeKeyFunction(self, e):
|
||||
i = e.GetId() - 30
|
||||
self.showChoices(i, self.getKeyFunction(self.lines[i]), 1)
|
||||
print mytime.displayTime() + ' on change key function', self.lines[i].keyFunctionChoice.GetStringSelection()
|
||||
return
|
||||
|
||||
def OnStructId(self, e):
|
||||
print mytime.displayTime() + ' OnStructid'
|
||||
i = e.GetId() - 40
|
||||
self.showChoices(i, self.getKeyFunction(self.lines[i]), True)
|
||||
return
|
||||
|
||||
def getKeyFunction(self, line):
|
||||
fName = line.keyFunctionChoice.GetStringSelection()
|
||||
for k in keyFunctions.keys():
|
||||
if keyFunctions[k] == fName:
|
||||
return k
|
||||
|
||||
return
|
||||
|
||||
def getKeyTrigger(self, line):
|
||||
fName = line.keyTriggerChoice.GetStringSelection()
|
||||
for k in self.keyTriggerOptions.keys():
|
||||
if self.keyTriggerOptions[k] == fName:
|
||||
return k
|
||||
|
||||
return
|
||||
|
||||
def evaluateLine(self, line):
|
||||
if line.checkBox.GetValue() == False:
|
||||
return
|
||||
else:
|
||||
if line.type == 'rotary':
|
||||
try:
|
||||
bit1 = int(line.bit1Choice.GetStringSelection())
|
||||
bit2 = int(line.bit2Choice.GetStringSelection())
|
||||
functionChoice = line.functionChoice.GetStringSelection()
|
||||
functionChoiceInt = 255
|
||||
for c in defaultRotaryFunctions:
|
||||
v = defaultRotaryFunctions[c]
|
||||
if v == functionChoice:
|
||||
functionChoiceInt = c
|
||||
break
|
||||
|
||||
channelChoice = line.channelChoice.GetStringSelection()
|
||||
if channelChoice.find('Input ') >= 0:
|
||||
channel = int(channelChoice.replace('Input ', '')) - 1
|
||||
elif channelChoice.find('Output ') >= 0:
|
||||
channel = int(channelChoice.replace('Output ', '')) - 1 + 128
|
||||
sendString = '' + chr(line.uiNumber)
|
||||
sendString += chr(0)
|
||||
sendString += chr(0)
|
||||
sendString += chr(channel)
|
||||
sendString += chr(0)
|
||||
sendString += chr(bit1)
|
||||
sendString += chr(bit2)
|
||||
sendString += chr(functionChoiceInt)
|
||||
mys = 'String: '
|
||||
for c in sendString:
|
||||
mys += hex(ord(c)) + ':'
|
||||
|
||||
print mys
|
||||
return sendString
|
||||
except:
|
||||
print mytime.displayTime(), 'uck.fpk.eL.failed to build string'
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
return
|
||||
|
||||
return
|
||||
try:
|
||||
if line.key.channel == 1 and line.key.index >= 128:
|
||||
return
|
||||
except:
|
||||
pass
|
||||
|
||||
value = 0
|
||||
keyFunction = self.getKeyFunction(line)
|
||||
if keyFunction in (keyFunctionModifyValue, keyFunctionSetValueTo):
|
||||
strID = protocol.get_strid_by_text(line.struct_id_choice.GetStringSelection())
|
||||
membID = protocol.get_membid_by_text(line.member_id_choice.GetStringSelection())
|
||||
channel = line.channel_choice.GetStringSelection()
|
||||
if channel == 'All Inputs':
|
||||
channel = 127
|
||||
elif channel == 'All Outputs':
|
||||
channel = 255
|
||||
elif channel.find('Input ') >= 0:
|
||||
channel = int(channel.replace('Input ', '')) - 1
|
||||
elif channel.find('Output ') >= 0:
|
||||
channel = int(channel.replace('Output ', '')) - 1 + 128
|
||||
index = int(line.index_choice.GetStringSelection()) - 1
|
||||
try:
|
||||
value = int(float(line.value.GetValue()) * 4.0)
|
||||
except:
|
||||
value = 0
|
||||
else:
|
||||
if value > 127:
|
||||
value = 127
|
||||
if value < -127:
|
||||
value = -127
|
||||
line.value.SetValue(str(value / 4.0))
|
||||
value += 128
|
||||
elif keyFunction in (keyFunctionToggleMute, keyFunctionChannelSelect, keyFunctionToggleBridgeMode):
|
||||
strID = 0
|
||||
membID = 0
|
||||
channel = line.channel_choice.GetStringSelection()
|
||||
if channel == 'All Inputs':
|
||||
channel = 127
|
||||
elif channel == 'All Outputs':
|
||||
channel = 255
|
||||
elif channel.find('Input ') >= 0:
|
||||
channel = int(channel.replace('Input ', '')) - 1
|
||||
elif channel.find('Output ') >= 0:
|
||||
channel = int(channel.replace('Output ', '')) - 1 + 128
|
||||
index = 0
|
||||
elif keyFunction in (keyFunctionNextPreset, keyFunctionLoadPreset, keyFunctionMuteSystem):
|
||||
strID = 0
|
||||
channel = 0
|
||||
index = 0
|
||||
membID = line.value.GetValue()
|
||||
try:
|
||||
membID = int(membID)
|
||||
if keyFunction == keyFunctionMuteSystem:
|
||||
if membID < 0:
|
||||
membID = 0
|
||||
if membID > 1:
|
||||
membID = 1
|
||||
elif membID < 1:
|
||||
membID = 1
|
||||
if membID > self.frame.frame.parent.number_of_presets:
|
||||
print mytime.displayTime(), 'Limiting preset selection to max preset range of', self.frame.frame.parent.number_of_presets
|
||||
membID = self.frame.frame.parent.number_of_presets
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
membID = 1
|
||||
|
||||
elif keyFunction == keyFunctionToggleOnOff:
|
||||
strID = protocol.get_strid_by_text(line.struct_id_choice.GetStringSelection())
|
||||
membID = protocol.MEMBER_ID_ON
|
||||
channel = line.channel_choice.GetStringSelection()
|
||||
if channel == 'All Inputs':
|
||||
channel = 127
|
||||
elif channel == 'All Outputs':
|
||||
channel = 255
|
||||
elif channel.find('Input ') >= 0:
|
||||
channel = int(channel.replace('Input ', '')) - 1
|
||||
elif channel.find('Output ') >= 0:
|
||||
channel = int(channel.replace('Output ', '')) - 1 + 128
|
||||
index = int(line.index_choice.GetStringSelection()) - 1
|
||||
elif keyFunction == keyFunctionLockKeys:
|
||||
strID = 0
|
||||
membID = 0
|
||||
channel = 0
|
||||
index = 0
|
||||
else:
|
||||
strID = 0
|
||||
membID = 0
|
||||
channel = 0
|
||||
index = 0
|
||||
keyTrigger = self.getKeyTrigger(line)
|
||||
try:
|
||||
sendString = '' + chr(self.uiNumber)
|
||||
sendString += chr(strID)
|
||||
sendString += chr(membID)
|
||||
sendString += chr(channel)
|
||||
sendString += chr(index)
|
||||
sendString += chr(keyFunction)
|
||||
sendString += chr(keyTrigger)
|
||||
sendString += chr(value)
|
||||
return sendString
|
||||
except:
|
||||
print mytime.displayTime(), 'uck.fpk.eL.failed to build string'
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
||||
# okay decompiling pycode/user_config_keys.pyc
|
||||
@@ -0,0 +1,600 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: user_config_leds.pyc
|
||||
# Compiled at: 2024-11-13 12:27:47
|
||||
import wx, os, data_model, traceback, one_unit, ConfigParser, protocol, sys, select_keys, select_units, d_protocol, mytime, string
|
||||
from user_config_helpers import *
|
||||
ledFunctionNone = 0
|
||||
ledFunctionSignal = 1
|
||||
ledFunctionGainReduction = 2
|
||||
ledFunctionPresetNumber = 3
|
||||
ledFunctionWink = 4
|
||||
ledFunctionStandby = 5
|
||||
ledFunctionPresetChanged = 6
|
||||
ledFunctionShowValue = 7
|
||||
ledFunctionAutoIndicatePeakInput = 8
|
||||
ledFunctionIndicateNetworkConnected = 9
|
||||
ledFunctionProtection = 10
|
||||
ledFunctionDHCPBound = 11
|
||||
ledFunctionLinkUp = 12
|
||||
ledFunctionClockSynced = 13
|
||||
ledFunctionDanteModuleDetected = 14
|
||||
ledFunctionFault = 15
|
||||
ledFunctionBridgeMode = 16
|
||||
ledFunctionAESSampleRate = 17
|
||||
ledFunctionAESSelected = 18
|
||||
ledFunctionAsCapable = 19
|
||||
ledFunctionAvbStreamActive = 20
|
||||
ledFunctionTemperature = 21
|
||||
ledFunctionSystemMuted = 22
|
||||
ledFunctionBlink = 23
|
||||
ledFunctionOn = 24
|
||||
ledFunctionOff = 25
|
||||
ledFunctionClip = 27
|
||||
ledFlagHideDuringStandby = 1
|
||||
ledFlagBlinkWhenChanged = 2
|
||||
ledFunctions = {ledFunctionNone: 'None',
|
||||
ledFunctionSignal: 'Signal Level',
|
||||
ledFunctionGainReduction: 'Gain Reduction',
|
||||
ledFunctionPresetNumber: 'Preset Number',
|
||||
ledFunctionWink: 'Wink (Locate)',
|
||||
ledFunctionStandby: 'Standby',
|
||||
ledFunctionPresetChanged: 'Setting Change',
|
||||
ledFunctionShowValue: 'Is Enabled',
|
||||
ledFunctionAutoIndicatePeakInput: 'Show Peaking Input',
|
||||
ledFunctionIndicateNetworkConnected: 'Software Connected',
|
||||
ledFunctionProtection: 'Protection',
|
||||
ledFunctionDHCPBound: 'DHCP Bound',
|
||||
ledFunctionLinkUp: 'Link Status',
|
||||
ledFunctionClockSynced: 'Clock Synced',
|
||||
ledFunctionDanteModuleDetected: 'Digital Audio Module Installed',
|
||||
ledFunctionFault: 'Fault',
|
||||
ledFunctionBridgeMode: 'Bridge Mode',
|
||||
ledFunctionAESSampleRate: 'AES/EBU Sample rate',
|
||||
ledFunctionAESSelected: 'AES/EBU Selected',
|
||||
ledFunctionAsCapable: 'AVB Detected',
|
||||
ledFunctionAvbStreamActive: 'AVB Connected',
|
||||
ledFunctionTemperature: 'Temperature',
|
||||
ledFunctionSystemMuted: 'Fire Mute',
|
||||
ledFunctionBlink: 'Blink',
|
||||
ledFunctionOn: 'On',
|
||||
ledFunctionOff: 'Off',
|
||||
ledFunctionClip: 'Clip'}
|
||||
ledSelectOptions = {ledFunctionNone: '',
|
||||
ledFunctionSignal: 'cv',
|
||||
ledFunctionGainReduction: 'cv',
|
||||
ledFunctionPresetNumber: 'v',
|
||||
ledFunctionWink: 'v',
|
||||
ledFunctionStandby: 'v',
|
||||
ledFunctionPresetChanged: 'v',
|
||||
ledFunctionShowValue: 'sciv',
|
||||
ledFunctionAutoIndicatePeakInput: 'cv',
|
||||
ledFunctionIndicateNetworkConnected: 'v',
|
||||
ledFunctionProtection: 'v',
|
||||
ledFunctionDHCPBound: 'v',
|
||||
ledFunctionLinkUp: 'cv',
|
||||
ledFunctionClockSynced: 'v',
|
||||
ledFunctionDanteModuleDetected: 'v',
|
||||
ledFunctionFault: 'v',
|
||||
ledFunctionBridgeMode: 'cv',
|
||||
ledFunctionAESSampleRate: 'v',
|
||||
ledFunctionAESSelected: 'v',
|
||||
ledFunctionAsCapable: 'cv',
|
||||
ledFunctionAvbStreamActive: 'cv',
|
||||
ledFunctionTemperature: 'cv',
|
||||
ledFunctionSystemMuted: 'v',
|
||||
ledFunctionBlink: '',
|
||||
ledFunctionOn: '',
|
||||
ledFunctionOff: '',
|
||||
ledFunctionClip: 'cv'}
|
||||
ledAdditionalText = {ledFunctionNone: '',
|
||||
ledFunctionSignal: 'The signal level of',
|
||||
ledFunctionGainReduction: 'The gain reduction of',
|
||||
ledFunctionPresetNumber: 'The active preset number',
|
||||
ledFunctionWink: '',
|
||||
ledFunctionStandby: '',
|
||||
ledFunctionPresetChanged: '',
|
||||
ledFunctionShowValue: '',
|
||||
ledFunctionAutoIndicatePeakInput: 'The gain reduction contribution by',
|
||||
ledFunctionIndicateNetworkConnected: 'The remote software connection state',
|
||||
ledFunctionProtection: '',
|
||||
ledFunctionDHCPBound: 'The DHCP connection state',
|
||||
ledFunctionLinkUp: 'The link status of network link',
|
||||
ledFunctionClockSynced: 'The digital clock sync status',
|
||||
ledFunctionDanteModuleDetected: 'Digital Audio Module Installed',
|
||||
ledFunctionFault: '',
|
||||
ledFunctionBridgeMode: '',
|
||||
ledFunctionAESSampleRate: 'The AES/EBU sample rate in kHz',
|
||||
ledFunctionAESSelected: 'At least one input is set to AES/EBU',
|
||||
ledFunctionAsCapable: 'An AVB network is detected',
|
||||
ledFunctionAvbStreamActive: 'A valid AVB stream is being received',
|
||||
ledFunctionTemperature: 'Temperature of channel',
|
||||
ledFunctionSystemMuted: 'Fire (External) Mute is asserted',
|
||||
ledFunctionBlink: '',
|
||||
ledFunctionOn: '',
|
||||
ledFunctionOff: '',
|
||||
ledFunctionClip: 'The clip signal of'}
|
||||
keyComparisonOptions = {0: 'Is Equal To',
|
||||
1: 'Is Equal To Or Greater Than',
|
||||
2: 'Is Equal To Or Smaller Than',
|
||||
3: 'Is Not Equal To',
|
||||
4: 'Is Greater Than',
|
||||
5: 'Is Smaller Than'}
|
||||
|
||||
class frontPanelLeds(wx.Panel):
|
||||
|
||||
def __init__(self, parent, frame, uiNumber, panelName):
|
||||
self.frame = frame
|
||||
self.name = panelName
|
||||
self.ledIndex = uiNumber
|
||||
uiNumber = 184
|
||||
self.uiNumber = uiNumber
|
||||
self.parent = parent
|
||||
wx.Panel.__init__(self, parent, size=(964, 500))
|
||||
self.lines = {}
|
||||
self.factoryItems = 0
|
||||
self.frame = frame
|
||||
self.Show(True)
|
||||
self.initFinished = False
|
||||
return
|
||||
|
||||
def initMe(self, force=False):
|
||||
if self.IsShown() == False and force == False:
|
||||
return
|
||||
if self.initFinished == True:
|
||||
return 0
|
||||
print mytime.displayTime(), 'ucl.initMe FrontPanelLeds', self.name
|
||||
frame = self.frame
|
||||
uiNumber = self.uiNumber
|
||||
self.struct_id_choices = ['Selected']
|
||||
i = 0
|
||||
for strID in (3, 4, 5, 7, 8, 18):
|
||||
self.struct_id_choices.append(protocol.get_strid_text(strID))
|
||||
|
||||
self.member_id_choices = [
|
||||
'Selected']
|
||||
for membID in (0, 1, 2, 3, 4, 5, 6, 7, 8, 14, 15, 24, 27):
|
||||
self.member_id_choices.append(protocol.get_member_text(membID))
|
||||
|
||||
self.channels = {127: 'Any Input', 255: 'Any Output'}
|
||||
for c in self.frame.frame.parent.unit_channels:
|
||||
if c < 128:
|
||||
s = 'Input ' + str(c + 1)
|
||||
else:
|
||||
s = 'Output ' + str(c - 127)
|
||||
self.channels[c] = s
|
||||
|
||||
self.strFunction = wx.StaticText(self, -1, 'Function', pos=(80, 20))
|
||||
self.strItem = wx.StaticText(self, -1, 'Process', pos=(220, 20))
|
||||
self.strSubItem = wx.StaticText(self, -1, 'Parameter', pos=(330, 20))
|
||||
self.strChannel = wx.StaticText(self, -1, 'Channel', pos=(440, 20))
|
||||
self.strIndex = wx.StaticText(self, -1, 'Index', pos=(550, 20))
|
||||
self.strComparison = wx.StaticText(self, -1, 'Comparison', pos=(600, 20))
|
||||
self.strBlnkWhenChanged = wx.StaticText(self, -1, 'BwC HdS IwM Pre', pos=(820,
|
||||
20))
|
||||
self.uiKeys = getKeys(frame, uiNumber, memberID=self.ledIndex)
|
||||
for uiIndex in self.uiKeys:
|
||||
(key, val) = self.uiKeys[uiIndex]
|
||||
print mytime.displayTime(), 'ucl.key:', key, val
|
||||
if key.channel != 1 or key.index < 128:
|
||||
continue
|
||||
self.createLine(i)
|
||||
self.lines[i].key = key
|
||||
self.lines[i].checkBox.Enable(False)
|
||||
self.lines[i].checkBox.SetLabel('Factory')
|
||||
self.lines[i].struct_id_choice.Enable(False)
|
||||
self.lines[i].member_id_choice.Enable(False)
|
||||
self.lines[i].index_choice.Enable(False)
|
||||
self.lines[i].keyComparisonChoice.Enable(False)
|
||||
self.lines[i].checkBox.SetValue(True)
|
||||
try:
|
||||
self.lines[i].struct_id_choice.SetStringSelection(protocol.get_strid_text(val[1] & 63))
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
self.lines[i].member_id_choice.SetStringSelection(protocol.get_member_text(0))
|
||||
except:
|
||||
pass
|
||||
|
||||
channel = val[3]
|
||||
if channel == 255:
|
||||
channel = 'Any Output'
|
||||
elif channel == 127:
|
||||
channel = 'Any Input'
|
||||
elif channel < 128:
|
||||
channel = 'Input ' + str(channel + 1)
|
||||
else:
|
||||
channel = 'Output ' + str(channel - 128 + 1)
|
||||
self.lines[i].channel_choice.SetStringSelection(channel)
|
||||
self.lines[i].index_choice.SetStringSelection(str((val[6] >> 4 & 15) + 1))
|
||||
ledFunction = val[4]
|
||||
if ledFunction == ledFunctionSignal and val[1] & 1 == 1:
|
||||
self.lines[i].preBox.SetValue(1)
|
||||
self.lines[i].ledFunctionChoice.SetStringSelection(ledFunctions[ledFunction])
|
||||
self.lines[i].keyComparisonChoice.SetStringSelection(keyComparisonOptions[val[6] & 15])
|
||||
if ledFunction in (ledFunctionSignal, ledFunctionGainReduction, ledFunctionAutoIndicatePeakInput):
|
||||
self.lines[i].value.SetValue(str(val[5] - 128) + 'dBu')
|
||||
else:
|
||||
self.lines[i].value.SetValue(str(val[5]))
|
||||
self.enable(i)
|
||||
self.lines[i].channel_choice.Enable(False)
|
||||
self.lines[i].ledFunctionChoice.Enable(False)
|
||||
self.lines[i].struct_id_choice.Enable(False)
|
||||
self.lines[i].member_id_choice.Enable(False)
|
||||
self.lines[i].index_choice.Enable(False)
|
||||
self.lines[i].keyComparisonChoice.Enable(False)
|
||||
self.lines[i].value.Enable(False)
|
||||
i += 1
|
||||
self.factoryItems += 1
|
||||
|
||||
for uiIndex in self.uiKeys:
|
||||
(key, val) = self.uiKeys[uiIndex]
|
||||
if key.channel == 1 and key.index >= 128:
|
||||
continue
|
||||
self.createLine(i)
|
||||
self.lines[i].key = key
|
||||
self.lines[i].checkBox.SetValue(True)
|
||||
try:
|
||||
self.lines[i].struct_id_choice.SetStringSelection(protocol.get_strid_text(val[1] & 63))
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
self.lines[i].member_id_choice.SetStringSelection(protocol.get_member_text(0))
|
||||
except:
|
||||
pass
|
||||
|
||||
channel = val[3]
|
||||
if channel == 255:
|
||||
channel = 'Any Output'
|
||||
elif channel == 127:
|
||||
channel = 'Any Input'
|
||||
elif channel < 128:
|
||||
channel = 'Input ' + str(channel + 1)
|
||||
else:
|
||||
channel = 'Output ' + str(channel - 128 + 1)
|
||||
self.lines[i].channel_choice.SetStringSelection(channel)
|
||||
self.lines[i].index_choice.SetStringSelection(str((val[6] >> 4 & 15) + 1))
|
||||
ledFunction = val[4]
|
||||
if ledFunction == ledFunctionSignal and val[1] & 1 == 1:
|
||||
self.lines[i].preBox.SetValue(1)
|
||||
self.lines[i].ledFunctionChoice.SetStringSelection(ledFunctions[ledFunction])
|
||||
self.lines[i].keyComparisonChoice.SetStringSelection(keyComparisonOptions[val[6] & 15])
|
||||
if ledFunction == ledFunctionSignal:
|
||||
self.lines[i].value.SetValue(str(val[5] - 128) + 'dBu')
|
||||
elif ledFunction in (ledFunctionGainReduction, ledFunctionAutoIndicatePeakInput):
|
||||
self.lines[i].value.SetValue(str(val[5] - 128) + 'dB')
|
||||
else:
|
||||
self.lines[i].value.SetValue(str(val[5]))
|
||||
if val[7] & 4 == 4:
|
||||
self.lines[i].invertBox.SetValue(1)
|
||||
if val[7] & 2 == 2:
|
||||
self.lines[i].blinkBox.SetValue(1)
|
||||
if val[7] & 1 == 1:
|
||||
self.lines[i].standbyBox.SetValue(1)
|
||||
self.enable(i)
|
||||
i += 1
|
||||
|
||||
if i - self.factoryItems < 8:
|
||||
self.createLine(i)
|
||||
self.initFinished = True
|
||||
return
|
||||
|
||||
def createLine(self, i):
|
||||
p = wx.Panel(self, size=(964, 28))
|
||||
p.Show(False)
|
||||
p.checkBox = wx.CheckBox(p, 10 + i, ' User', pos=(10, 2), size=(70, 20))
|
||||
p.keyComparisonChoice = wx.Choice(p, 80 + i, choices=keyComparisonOptions.values(), style=wx.BORDER_NONE, pos=(600,
|
||||
0), size=(160,
|
||||
26))
|
||||
p.keyComparisonChoice.SetStringSelection(keyComparisonOptions.values()[0])
|
||||
p.ledFunctionChoice = wx.Choice(p, 30 + i, choices=sorted(ledFunctions.values()), style=wx.BORDER_NONE, pos=(80,
|
||||
0), size=(130,
|
||||
26))
|
||||
p.ledFunctionChoice.SetStringSelection(ledFunctions.values()[0])
|
||||
p.struct_id_choice = wx.Choice(p, 40 + i, choices=self.struct_id_choices, style=wx.BORDER_NONE, pos=(220,
|
||||
0), size=(100,
|
||||
26))
|
||||
p.struct_id_choice.SetStringSelection(self.struct_id_choices[0])
|
||||
p.member_id_choice = wx.Choice(p, 50 + i, choices=self.member_id_choices, style=wx.BORDER_NONE, pos=(330,
|
||||
0), size=(100,
|
||||
26))
|
||||
p.member_id_choice.SetStringSelection(self.member_id_choices[0])
|
||||
p.channel_choice = wx.Choice(p, 60 + i, choices=sorted(self.channels.values()), style=wx.BORDER_NONE, pos=(440,
|
||||
0), size=(100,
|
||||
26))
|
||||
p.channel_choice.SetStringSelection(self.channels.values()[0])
|
||||
p.index_choice = wx.Choice(p, 70 + i, choices=[_[1] for j in range(10)], style=wx.BORDER_NONE, pos=(550,
|
||||
0), size=(40,
|
||||
26))
|
||||
p.index_choice.SetStringSelection('1')
|
||||
p.value = wx.TextCtrl(p, 20 + i, '', pos=(770, 1), size=(40, 20))
|
||||
p.value.Show(False)
|
||||
p.additionalLabel = wx.StaticText(p, -1, '', pos=(220, 5))
|
||||
p.additionalLabel.Show(False)
|
||||
p.blinkBox = wx.CheckBox(p, 80 + i, '', pos=(830, 2), size=(20, 20))
|
||||
p.standbyBox = wx.CheckBox(p, 80 + i, '', pos=(860, 2), size=(20, 20))
|
||||
p.invertBox = wx.CheckBox(p, 80 + i, '', pos=(890, 2), size=(20, 20))
|
||||
p.preBox = wx.CheckBox(p, 80 + i, '', pos=(920, 2), size=(20, 20))
|
||||
p.SetPosition((0, 40 + 28 * i))
|
||||
p.checkBox.SetValue(0)
|
||||
p.checkBox.Enable(True)
|
||||
p.key = None
|
||||
self.Bind(wx.EVT_CHECKBOX, self.OnEnabled, id=10 + i)
|
||||
self.Bind(wx.EVT_CHOICE, self.OnStructId, id=40 + i)
|
||||
self.Bind(wx.EVT_CHOICE, self.OnChangeledFunction, id=30 + i)
|
||||
self.lines[i] = p
|
||||
self.enable(i)
|
||||
p.Show(True)
|
||||
return
|
||||
|
||||
def enable(self, i):
|
||||
val = self.lines[i].checkBox.GetValue()
|
||||
self.showChoices(i, self.getledFunction(self.lines[i]), val)
|
||||
return
|
||||
|
||||
def showChoices(self, i, ledFunctionInt, enabled):
|
||||
self.lines[i].ledFunctionChoice.Enable(enabled)
|
||||
try:
|
||||
ledFunctionFields = ledSelectOptions[ledFunctionInt]
|
||||
except:
|
||||
ledFunctionFields = None
|
||||
|
||||
self.lines[i].struct_id_choice.Show(False)
|
||||
self.lines[i].member_id_choice.Show(False)
|
||||
self.lines[i].channel_choice.Show(False)
|
||||
self.lines[i].index_choice.Show(False)
|
||||
self.lines[i].keyComparisonChoice.Show(enabled)
|
||||
self.lines[i].struct_id_choice.Enable(enabled)
|
||||
self.lines[i].member_id_choice.Enable(enabled)
|
||||
self.lines[i].channel_choice.Enable(enabled)
|
||||
self.lines[i].index_choice.Enable(enabled)
|
||||
self.lines[i].keyComparisonChoice.Show(enabled)
|
||||
self.lines[i].value.Show(False)
|
||||
if ledFunctionFields.find('s') >= 0:
|
||||
self.lines[i].struct_id_choice.Show(True)
|
||||
if self.lines[i].struct_id_choice.GetStringSelection() not in ('Selected',
|
||||
'All'):
|
||||
if ledFunctionFields.find('m') >= 0:
|
||||
self.lines[i].member_id_choice.Show(True)
|
||||
if ledFunctionFields.find('c') >= 0:
|
||||
self.lines[i].channel_choice.Show(True)
|
||||
if ledFunctionFields.find('i') >= 0:
|
||||
self.lines[i].index_choice.Show(True)
|
||||
elif ledFunctionFields.find('m') >= 0:
|
||||
self.lines[i].member_id_choice.Show(True)
|
||||
if ledFunctionFields.find('c') >= 0:
|
||||
self.lines[i].channel_choice.Show(True)
|
||||
if ledFunctionFields.find('i') >= 0:
|
||||
self.lines[i].index_choice.Show(True)
|
||||
if ledFunctionFields.find('v') >= 0:
|
||||
self.lines[i].value.Show(True)
|
||||
if ledFunctionFields == 'sm':
|
||||
self.lines[i].struct_id_choice.Show(True)
|
||||
self.lines[i].member_id_choice.Show(True)
|
||||
if ledAdditionalText[ledFunctionInt] == '':
|
||||
self.lines[i].additionalLabel.Show(False)
|
||||
else:
|
||||
self.lines[i].additionalLabel.SetLabel(ledAdditionalText[ledFunctionInt])
|
||||
self.lines[i].additionalLabel.Show(True)
|
||||
return
|
||||
|
||||
def OnEnabled(self, e):
|
||||
i = e.GetId() - 10
|
||||
self.enable(i)
|
||||
if i == len(self.lines) - 1 and self.lines[i].checkBox.GetValue() == True and i < 7 + self.factoryItems:
|
||||
self.createLine(i + 1)
|
||||
return
|
||||
|
||||
def OnChangeledFunction(self, e):
|
||||
i = e.GetId() - 30
|
||||
self.showChoices(i, self.getledFunction(self.lines[i]), 1)
|
||||
print mytime.displayTime() + ' on change key function', self.lines[i].ledFunctionChoice.GetStringSelection()
|
||||
return
|
||||
|
||||
def OnStructId(self, e):
|
||||
print mytime.displayTime() + ' OnStructid'
|
||||
i = e.GetId() - 40
|
||||
self.showChoices(i, self.getledFunction(self.lines[i]), True)
|
||||
return
|
||||
|
||||
def getledFunction(self, line):
|
||||
fName = line.ledFunctionChoice.GetStringSelection()
|
||||
for k in ledFunctions.keys():
|
||||
if ledFunctions[k] == fName:
|
||||
return k
|
||||
|
||||
return
|
||||
|
||||
def getKeyComparison(self, line):
|
||||
fName = line.keyComparisonChoice.GetStringSelection()
|
||||
for k in keyComparisonOptions.keys():
|
||||
if keyComparisonOptions[k] == fName:
|
||||
return k
|
||||
|
||||
return
|
||||
|
||||
def stripValue(self, v):
|
||||
for s in data_model.validFilenameChars + data_model.forbiddenFilenameChars:
|
||||
if s in string.digits:
|
||||
continue
|
||||
if s in ('-', '.'):
|
||||
continue
|
||||
if s == ',':
|
||||
v = v.replace(s, '.')
|
||||
continue
|
||||
v = v.replace(s, '')
|
||||
|
||||
try:
|
||||
return float(v)
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
return v
|
||||
|
||||
return
|
||||
|
||||
def evaluateLine(self, line):
|
||||
if line.checkBox.GetValue() == False:
|
||||
return
|
||||
else:
|
||||
ledFunction = self.getledFunction(line)
|
||||
channel = line.channel_choice.GetStringSelection()
|
||||
signalSource = 0
|
||||
if channel == 'Any Input':
|
||||
channel = 127
|
||||
elif channel == 'Any Output':
|
||||
channel = 255
|
||||
elif channel.find('Input ') >= 0:
|
||||
channel = int(channel.replace('Input ', '')) - 1
|
||||
elif channel.find('Output ') >= 0:
|
||||
channel = int(channel.replace('Output ', '')) - 1 + 128
|
||||
keyComparison = self.getKeyComparison(line)
|
||||
strID = 0
|
||||
flags = 0
|
||||
if ledFunction in (ledFunctionSignal, ledFunctionGainReduction, ledFunctionAutoIndicatePeakInput):
|
||||
if line.preBox.GetValue() == 1 and ledFunction == ledFunctionSignal:
|
||||
signalSource = 1
|
||||
strID = signalSource
|
||||
index = ledFunction
|
||||
flags = 0
|
||||
try:
|
||||
value = int(self.stripValue(line.value.GetValue()))
|
||||
if value > 120:
|
||||
value = 120
|
||||
if value < -120:
|
||||
value = -120
|
||||
value += 128
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
value = 0
|
||||
|
||||
elif ledFunction in (ledFunctionPresetNumber, ledFunctionBridgeMode, ledFunctionAESSampleRate, ledFunctionAESSelected, ledFunctionTemperature):
|
||||
strID = 0
|
||||
flags = 0
|
||||
try:
|
||||
value = int(self.stripValue(line.value.GetValue()))
|
||||
if value > 250:
|
||||
value = 250
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
value = 1
|
||||
|
||||
elif ledFunction == ledFunctionStandby:
|
||||
strID = 0
|
||||
flags = 0
|
||||
try:
|
||||
value = int(self.stripValue(line.value.GetValue()))
|
||||
if value > 250:
|
||||
value = 250
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
value = 1
|
||||
|
||||
elif ledFunction == ledFunctionWink:
|
||||
strID = 0
|
||||
flags = 0
|
||||
try:
|
||||
value = int(self.stripValue(line.value.GetValue()))
|
||||
if value > 250:
|
||||
value = 250
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
value = 1
|
||||
|
||||
elif ledFunction == ledFunctionPresetChanged:
|
||||
strID = 0
|
||||
flags = 0
|
||||
try:
|
||||
value = int(self.stripValue(line.value.GetValue()))
|
||||
if value > 250:
|
||||
value = 250
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
value = 1
|
||||
|
||||
elif ledFunction == ledFunctionShowValue:
|
||||
strID = protocol.get_strid_by_text(line.struct_id_choice.GetStringSelection())
|
||||
if strID == None:
|
||||
print mytime.displayTime(), 'ucl. None Structure ID Text for structure ID', line.struct_id_choice.GetStringSelection()
|
||||
strID = 0
|
||||
index = int(line.index_choice.GetStringSelection()) - 1
|
||||
keyComparison |= index << 4
|
||||
flags = 0
|
||||
try:
|
||||
value = int(self.stripValue(line.value.GetValue()))
|
||||
if value > 250:
|
||||
value = 250
|
||||
if value < 0:
|
||||
value = 0
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
value = 1
|
||||
|
||||
elif ledFunction in (ledFunctionLinkUp, ledFunctionAsCapable, ledFunctionAvbStreamActive, ledFunctionSystemMuted):
|
||||
strID = 0
|
||||
flags = 0
|
||||
try:
|
||||
value = int(self.stripValue(line.value.GetValue()))
|
||||
if value > 1:
|
||||
value = 1
|
||||
if value < 0:
|
||||
value = 0
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
value = 1
|
||||
|
||||
elif ledFunction == ledFunctionClip:
|
||||
strID = 0
|
||||
flags = 0
|
||||
try:
|
||||
value = int(self.stripValue(line.value.GetValue()))
|
||||
if value > 1:
|
||||
value = 1
|
||||
if value < 0:
|
||||
value = 0
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
value = 1
|
||||
|
||||
else:
|
||||
strID = 0
|
||||
channel = 0
|
||||
flags = 0
|
||||
try:
|
||||
value = int(line.value.GetValue().replace('dBu', ''))
|
||||
if value > 250:
|
||||
value = 250
|
||||
if value < 0:
|
||||
value = 0
|
||||
except:
|
||||
value = 1
|
||||
|
||||
if line.standbyBox.GetValue() == 1:
|
||||
flags |= 1
|
||||
if line.blinkBox.GetValue() == 1:
|
||||
flags |= 2
|
||||
if line.invertBox.GetValue() == 1:
|
||||
flags |= 4
|
||||
try:
|
||||
sendString = '' + chr(self.uiNumber)
|
||||
sendString += chr(strID)
|
||||
sendString += chr(self.ledIndex)
|
||||
sendString += chr(channel)
|
||||
sendString += chr(ledFunction)
|
||||
sendString += chr(value)
|
||||
sendString += chr(keyComparison)
|
||||
sendString += chr(flags)
|
||||
return sendString
|
||||
except:
|
||||
print mytime.displayTime(), 'ucl.fpk.eL.failed to build string'
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
||||
# okay decompiling pycode/user_config_leds.pyc
|
||||
@@ -0,0 +1,266 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: user_config_model.pyc
|
||||
# Compiled at: 2024-11-13 12:19:50
|
||||
import wx, os, data_model, traceback, one_unit, ConfigParser, protocol, sys, select_keys, select_units, d_protocol, mytime
|
||||
from user_config_helpers import *
|
||||
|
||||
class modelConfiguration(wx.Panel):
|
||||
|
||||
def __init__(self, parent, frame, uiNumber, panelName):
|
||||
self.frame = frame
|
||||
self.name = panelName
|
||||
self.uiNumber = uiNumber
|
||||
self.parent = parent
|
||||
wx.Panel.__init__(self, parent, size=(964, 600))
|
||||
self.Show(True)
|
||||
self.lines = {}
|
||||
self.initFinished = False
|
||||
return
|
||||
|
||||
def initMe(self, force=False):
|
||||
if self.IsShown() == False and force == False:
|
||||
return
|
||||
if self.initFinished == True:
|
||||
return 0
|
||||
print mytime.displayTime(), 'ucm.initMe modelConfiguration', self.name
|
||||
frame = self.frame
|
||||
uiNumber = self.uiNumber
|
||||
self.lines = {0: (self.createLine(0)), 1: (self.dummyLine(1)), 2: (self.dummyLine(2)), 3: (self.dummyLine(3)), 4: (self.dummyLine(4)), 5: (self.dummyLine(5))}
|
||||
self.checkBoxes = {}
|
||||
self.uiKeys = getKeys(frame, uiNumber)
|
||||
print 'ucm.i.keys:', self.uiKeys
|
||||
self.modelName = ''
|
||||
self.serialNumber = ''
|
||||
self.decodeLines = {}
|
||||
try:
|
||||
for uiIndex in self.uiKeys:
|
||||
(key, val) = self.uiKeys[uiIndex]
|
||||
lineNumber = val[1] & 7
|
||||
self.decodeLines[lineNumber] = val
|
||||
self.lines[lineNumber].key = key
|
||||
|
||||
for lineNumber in range(6):
|
||||
val = self.decodeLines[lineNumber]
|
||||
if lineNumber == 0:
|
||||
if val[1] & 8 == 8:
|
||||
self.lines[0].restrictModelOnOff.SetValue(True)
|
||||
try:
|
||||
restrictTo = int(val[2])
|
||||
except:
|
||||
retrictTo = 0
|
||||
|
||||
self.lines[0].restrictModelNumber.SetValue(str(restrictTo))
|
||||
for i in range(4):
|
||||
self.modelName += chr(val[i + 4])
|
||||
|
||||
elif lineNumber in (1, 2):
|
||||
for i in range(6):
|
||||
self.modelName += chr(val[i + 2])
|
||||
|
||||
elif lineNumber == 3:
|
||||
for i in range(4):
|
||||
self.serialNumber += chr(val[i + 4])
|
||||
|
||||
elif lineNumber in (4, 5):
|
||||
for i in range(6):
|
||||
self.serialNumber += chr(val[i + 2])
|
||||
|
||||
print mytime.displayTime(), 'ucm.i.Found model name:', self.modelName
|
||||
print mytime.displayTime(), 'ucm.i.Found serial number:', self.serialNumber
|
||||
self.lines[0].checkBox.SetValue(True)
|
||||
self.enable(self.lines[0])
|
||||
self.lines[0].nameValue.SetValue(self.modelName)
|
||||
self.lines[0].serialValue.SetValue(self.serialNumber)
|
||||
except:
|
||||
self.modelName = ''
|
||||
self.serialNumber = ''
|
||||
|
||||
self.settingsVerified = False
|
||||
self.initFinished = True
|
||||
self.Show(True)
|
||||
return
|
||||
|
||||
def createLine(self, lineNumber):
|
||||
p = wx.Panel(self, size=(800, 400))
|
||||
p.checkBox = wx.CheckBox(p, 0, ' Setup Model Information', pos=(13, 10), size=(180,
|
||||
20))
|
||||
p.checkBox.SetValue(False)
|
||||
p.nameLabel = wx.StaticText(p, -1, 'Model Name', pos=(40, 40))
|
||||
p.nameValue = wx.TextCtrl(p, -1, '', pos=(230, 40), size=(200, 20))
|
||||
p.nameValue.SetMaxLength(16)
|
||||
p.serialLabel = wx.StaticText(p, -1, 'Version String', pos=(40, 68))
|
||||
p.serialValue = wx.TextCtrl(p, -1, '', pos=(230, 68), size=(200, 20))
|
||||
p.serialValue.SetMaxLength(16)
|
||||
p.restrictModelOnOff = wx.CheckBox(p, 22, ' Restrict to Model Number', pos=(40,
|
||||
98))
|
||||
p.restrictModelOnOff.SetValue(False)
|
||||
p.restrictModelNumber = wx.TextCtrl(p, 20, '', pos=(230, 95), size=(40, 20))
|
||||
self.enable(p)
|
||||
p.key = None
|
||||
self.Bind(wx.EVT_CHECKBOX, self.OnEnabled, id=lineNumber)
|
||||
self.Bind(wx.EVT_CHECKBOX, self.OnRestrict, id=22)
|
||||
p.lineNumber = lineNumber
|
||||
return p
|
||||
|
||||
def dummyLine(self, lineNumber):
|
||||
p = wx.Panel(self)
|
||||
p.checkBox = wx.CheckBox(p, 0, '')
|
||||
p.checkBox.SetValue(False)
|
||||
p.key = None
|
||||
p.lineNumber = lineNumber
|
||||
p.Show(False)
|
||||
return p
|
||||
|
||||
def OnRestrict(self, e):
|
||||
self.lines[0].restrictModelNumber.Enable(self.lines[0].restrictModelOnOff.GetValue())
|
||||
return
|
||||
|
||||
def OnEnabled(self, e):
|
||||
self.enable(self.lines[0])
|
||||
return
|
||||
|
||||
def enable(self, line):
|
||||
val = line.checkBox.GetValue()
|
||||
line.nameLabel.Enable(val)
|
||||
line.nameValue.Enable(val)
|
||||
line.serialLabel.Enable(val)
|
||||
line.serialValue.Enable(val)
|
||||
line.restrictModelOnOff.Enable(val)
|
||||
line.restrictModelNumber.Enable(line.restrictModelOnOff.GetValue())
|
||||
return
|
||||
|
||||
def evaluateLine(self, line):
|
||||
if self.lines[0].checkBox.GetValue() == False:
|
||||
return
|
||||
else:
|
||||
flags = line.lineNumber
|
||||
if line.lineNumber == 0:
|
||||
self.modelName = ' NoNameNoName'
|
||||
self.settingsVerified = False
|
||||
if line.restrictModelOnOff.GetValue() == True:
|
||||
flags += 8
|
||||
modelNumber = line.restrictModelNumber.GetValue()
|
||||
try:
|
||||
modelNumber = int(modelNumber)
|
||||
except:
|
||||
return
|
||||
else:
|
||||
if modelNumber > 255:
|
||||
modelNumber = 255
|
||||
if modelNumber < 0:
|
||||
modelNumber = 0
|
||||
else:
|
||||
modelNumber = 0
|
||||
modelName = line.nameValue.GetValue()
|
||||
try:
|
||||
modelName = str(('').join(c for c in modelName if c in data_model.validFilenameChars))
|
||||
except:
|
||||
return
|
||||
else:
|
||||
modelName += ' '
|
||||
modelName = modelName[:16]
|
||||
self.modelName = modelName
|
||||
print mytime.displayTime(), 'ucm.eL.Model Name:', modelName
|
||||
self.serialNumber = ' '
|
||||
serialNumber = line.serialValue.GetValue()
|
||||
try:
|
||||
serialNumber = str(('').join(c for c in serialNumber if c in data_model.validFilenameChars))
|
||||
except:
|
||||
return
|
||||
else:
|
||||
serialNumber += ' '
|
||||
serialNumber = serialNumber[:16]
|
||||
self.serialNumber = serialNumber
|
||||
print mytime.displayTime(), 'ucm.eL.Serial Number:', serialNumber
|
||||
try:
|
||||
sendString = '' + chr(self.uiNumber)
|
||||
sendString += chr(flags)
|
||||
sendString += chr(modelNumber)
|
||||
sendString += chr(0)
|
||||
sendString += modelName[0]
|
||||
sendString += modelName[1]
|
||||
sendString += modelName[2]
|
||||
sendString += modelName[3]
|
||||
mys = 'ucm.eL.String: '
|
||||
for c in sendString:
|
||||
mys += hex(ord(c)) + ':'
|
||||
|
||||
print mys, line.lineNumber
|
||||
self.settingsVerified = True
|
||||
return sendString
|
||||
except:
|
||||
print mytime.displayTime(), 'ucm.ec.eL.failed to build string'
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
return
|
||||
|
||||
elif line.lineNumber in (1, 2):
|
||||
if self.settingsVerified == False:
|
||||
return
|
||||
try:
|
||||
sendString = '' + chr(self.uiNumber)
|
||||
sendString += chr(flags)
|
||||
sendString += self.modelName[4 + (line.lineNumber - 1) * 6]
|
||||
sendString += self.modelName[5 + (line.lineNumber - 1) * 6]
|
||||
sendString += self.modelName[6 + (line.lineNumber - 1) * 6]
|
||||
sendString += self.modelName[7 + (line.lineNumber - 1) * 6]
|
||||
sendString += self.modelName[8 + (line.lineNumber - 1) * 6]
|
||||
sendString += self.modelName[9 + (line.lineNumber - 1) * 6]
|
||||
mys = 'ucm.eL.String: ' + hex(self.uiNumber) + ':' + hex(line.lineNumber) + ': ' + sendString[2:]
|
||||
print mys, line.lineNumber
|
||||
return sendString
|
||||
except:
|
||||
print mytime.displayTime(), 'ucm.ec.eL.failed to build string'
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
return
|
||||
|
||||
elif line.lineNumber == 3:
|
||||
if self.settingsVerified == False:
|
||||
return
|
||||
try:
|
||||
sendString = '' + chr(self.uiNumber)
|
||||
sendString += chr(flags)
|
||||
sendString += chr(0)
|
||||
sendString += chr(0)
|
||||
sendString += self.serialNumber[0]
|
||||
sendString += self.serialNumber[1]
|
||||
sendString += self.serialNumber[2]
|
||||
sendString += self.serialNumber[3]
|
||||
mys = 'ucm.eL.String: '
|
||||
for c in sendString:
|
||||
mys += hex(ord(c)) + ':'
|
||||
|
||||
print mys, line.lineNumber
|
||||
return sendString
|
||||
except:
|
||||
print mytime.displayTime(), 'ucm.ec.eL.failed to build string'
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
return
|
||||
|
||||
elif line.lineNumber in (4, 5):
|
||||
if self.settingsVerified == False:
|
||||
return
|
||||
try:
|
||||
sendString = '' + chr(self.uiNumber)
|
||||
sendString += chr(flags)
|
||||
sendString += self.serialNumber[4 + (line.lineNumber - 4) * 6]
|
||||
sendString += self.serialNumber[5 + (line.lineNumber - 4) * 6]
|
||||
sendString += self.serialNumber[6 + (line.lineNumber - 4) * 6]
|
||||
sendString += self.serialNumber[7 + (line.lineNumber - 4) * 6]
|
||||
sendString += self.serialNumber[8 + (line.lineNumber - 4) * 6]
|
||||
sendString += self.serialNumber[9 + (line.lineNumber - 4) * 6]
|
||||
mys = 'ucm.eL.String: ' + hex(self.uiNumber) + ':' + hex(line.lineNumber) + ': ' + sendString[2:]
|
||||
print mys, line.lineNumber
|
||||
return sendString
|
||||
except:
|
||||
print mytime.displayTime(), 'ucm.ec.eL.failed to build string'
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
||||
# okay decompiling pycode/user_config_model.pyc
|
||||
@@ -0,0 +1,372 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: user_config_network.pyc
|
||||
# Compiled at: 2025-05-07 14:29:41
|
||||
import wx, os, data_model, traceback, one_unit, ConfigParser, protocol, sys, select_keys, select_units, d_protocol, mytime
|
||||
from user_config_helpers import *
|
||||
inactivityChoices = [
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10]
|
||||
|
||||
class networkConfiguration(wx.Panel):
|
||||
|
||||
def __init__(self, parent, frame, uiNumber, panelName):
|
||||
self.frame = frame
|
||||
self.name = panelName
|
||||
self.uiNumber = uiNumber
|
||||
self.parent = parent
|
||||
wx.Panel.__init__(self, parent, size=(964, 600))
|
||||
self.Show(True)
|
||||
self.lines = {}
|
||||
self.initFinished = False
|
||||
return
|
||||
|
||||
def initMe(self, force=False):
|
||||
if self.IsShown() == False:
|
||||
return
|
||||
if self.initFinished == True:
|
||||
return 0
|
||||
print mytime.displayTime(), 'ucn.initMe networkConfiguration', self.name
|
||||
frame = self.frame
|
||||
uiNumber = self.uiNumber
|
||||
self.lines = {0: (self.createLine(0)), 1: (self.createLine(1)), 2: (self.createLine(2)), 3: (self.createLine(3)), 4: (self.createLine(4))}
|
||||
optkey = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_HARDWARE_STATUS_FLAGS, 0, 0)
|
||||
try:
|
||||
hardwareStatusFlags = int(self.frame.frame.parent.model.get(optkey))
|
||||
if hardwareStatusFlags & protocol.confTelnetEnabled == protocol.confTelnetEnabled:
|
||||
self.lines[0].enableTelnet.SetValue(1)
|
||||
else:
|
||||
self.lines[0].enableTelnet.SetValue(0)
|
||||
except:
|
||||
pass
|
||||
|
||||
self.checkBoxes = {}
|
||||
self.uiKeys = getKeys(frame, uiNumber)
|
||||
self.encryptionKey = ''
|
||||
self.milanKey = ''
|
||||
for uiIndex in self.uiKeys:
|
||||
(key, val) = self.uiKeys[uiIndex]
|
||||
if val[1] == 0:
|
||||
line = self.lines[0]
|
||||
line.key = key
|
||||
flags = val[2]
|
||||
if flags & 1 == 1:
|
||||
line.enableTEA.SetValue(1)
|
||||
else:
|
||||
line.enableTEA.SetValue(0)
|
||||
if flags & 2 == 2:
|
||||
line.enableBroadcast.SetValue(1)
|
||||
else:
|
||||
line.enableBroadcast.SetValue(0)
|
||||
if flags & 4 == 4:
|
||||
line.stopWhenMFPActive.SetValue(1)
|
||||
else:
|
||||
line.stopWhenMFPActive.SetValue(0)
|
||||
if flags & 8 == 8:
|
||||
line.stopWhenTelnetActive.SetValue(1)
|
||||
else:
|
||||
line.stopWhenTelnetActive.SetValue(0)
|
||||
if flags & 16 == 16:
|
||||
line.enableBasicTelnet.SetValue(0)
|
||||
else:
|
||||
line.enableBasicTelnet.SetValue(1)
|
||||
if flags & 96 == 32:
|
||||
line.switchInput.SetStringSelection(getString('installed'))
|
||||
if flags & 96 == 64:
|
||||
line.switchInput.SetStringSelection(getString('notInstalled'))
|
||||
timeoutValue = val[3]
|
||||
line.timeoutInput.SetStringSelection(inactivityChoices[timeoutValue])
|
||||
nibble = '' + chr(val[4]) + chr(val[5]) + chr(val[6]) + chr(val[7])
|
||||
self.encryptionKey = nibble + self.encryptionKey[4:]
|
||||
if val[1] == 1:
|
||||
line = self.lines[1]
|
||||
line.key = key
|
||||
nibble = '' + chr(val[2]) + chr(val[3]) + chr(val[4]) + chr(val[5]) + chr(val[6]) + chr(val[7])
|
||||
self.encryptionKey = self.encryptionKey[:4] + nibble + self.encryptionKey[10:]
|
||||
if val[1] == 2:
|
||||
line = self.lines[2]
|
||||
line.key = key
|
||||
nibble = '' + chr(val[2]) + chr(val[3]) + chr(val[4]) + chr(val[5]) + chr(val[6]) + chr(val[7])
|
||||
self.encryptionKey = self.encryptionKey[:10] + nibble
|
||||
if val[1] == 3:
|
||||
line = self.lines[3]
|
||||
line.key = key
|
||||
flags = val[2]
|
||||
if flags & 1 == 1:
|
||||
self.lines[0].avbMode.SetStringSelection('MILAN')
|
||||
else:
|
||||
self.lines[0].avbMode.SetStringSelection('Disabled')
|
||||
nibble = '' + chr(val[4]) + chr(val[5]) + chr(val[6]) + chr(val[7])
|
||||
self.milanKey = nibble + self.milanKey[4:]
|
||||
if val[1] == 4:
|
||||
line = self.lines[4]
|
||||
line.key = key
|
||||
nibble = '' + chr(val[2]) + chr(val[3]) + chr(val[4]) + chr(val[5])
|
||||
self.milanKey = self.milanKey[:4] + nibble
|
||||
|
||||
if self.encryptionKey.strip() == '':
|
||||
self.encryptionKey = ''
|
||||
if self.milanKey.strip() == '':
|
||||
self.milanKey = ''
|
||||
self.lines[0].keyInput.SetValue(self.encryptionKey)
|
||||
self.lines[0].milanKey.SetValue(self.milanKey)
|
||||
self.enable(self.lines[0])
|
||||
self.initFinished = True
|
||||
self.Show(True)
|
||||
return
|
||||
|
||||
def createLine(self, lineNumber):
|
||||
p = wx.Panel(self, size=(924, 440))
|
||||
p.Show(False)
|
||||
networkPanel = wx.Panel(p, size=(884, 100), pos=(10, 10))
|
||||
telnetPanel = wx.Panel(p, size=(884, 110), pos=(10, 120))
|
||||
switchPanel = wx.Panel(p, size=(884, 60), pos=(10, 240))
|
||||
milanPanel = wx.Panel(p, size=(884, 60), pos=(10, 320))
|
||||
if lineNumber == 0:
|
||||
p.enableBroadcast = wx.CheckBox(networkPanel, 0, 'Enable Device Discovery Broadcast', pos=(13,
|
||||
10))
|
||||
p.enableBroadcast.SetValue(True)
|
||||
p.stopWhenMFPActive = wx.CheckBox(networkPanel, 3, 'Stop when AllControl is connected', pos=(33,
|
||||
40))
|
||||
p.stopWhenMFPActive.SetValue(False)
|
||||
p.stopWhenTelnetActive = wx.CheckBox(networkPanel, 4, 'Stop when Open Interface (Telnet) is connected', pos=(33,
|
||||
70))
|
||||
p.stopWhenTelnetActive.SetValue(False)
|
||||
p.telnetLabel = wx.StaticText(telnetPanel, -1, '3rd Party Control (Telnet)', pos=(10,
|
||||
10))
|
||||
p.enableTelnet = wx.CheckBox(telnetPanel, 1, 'Enable', pos=(170, 10))
|
||||
p.enableTelnet.SetValue(False)
|
||||
p.enableBasicTelnet = wx.CheckBox(telnetPanel, 1, 'Enable Text Commands', pos=(400,
|
||||
10))
|
||||
p.enableBasicTelnet.SetValue(True)
|
||||
p.enableTEA = wx.CheckBox(telnetPanel, 2, 'Use encryption', pos=(170, 40))
|
||||
p.enableTEA.SetValue(False)
|
||||
p.encryptionKeyLabel = wx.StaticText(telnetPanel, -1, 'Key:', pos=(350,
|
||||
42))
|
||||
p.keyInput = wx.TextCtrl(telnetPanel, -1, pos=(400, 40), size=(200, 24))
|
||||
p.timeoutLabel = wx.StaticText(telnetPanel, -1, 'Time to automatically disconnect after inactivity', pos=(10,
|
||||
72))
|
||||
p.timeoutInput = wx.Choice(telnetPanel, -1, choices=inactivityChoices, style=wx.BORDER_NONE, pos=(400,
|
||||
70), size=(200,
|
||||
24))
|
||||
p.timeoutInput.SetStringSelection(inactivityChoices[0])
|
||||
p.switchLabel = wx.StaticText(switchPanel, -1, 'Hardware Network Switch', pos=(10,
|
||||
10))
|
||||
p.switchInput = wx.Choice(switchPanel, -1, choices=[getString('auto'), getString('installed'), getString('notInstalled')], style=wx.BORDER_NONE, pos=(400,
|
||||
10), size=(200,
|
||||
24))
|
||||
p.switchInput.SetStringSelection(getString('auto'))
|
||||
p.milanLabel = wx.StaticText(milanPanel, -1, 'AVB Options', pos=(10, 10))
|
||||
p.avbMode = wx.Choice(milanPanel, -1, choices=['Disabled', 'MILAN'], style=wx.BORDER_NONE, pos=(400,
|
||||
10), size=(150,
|
||||
24))
|
||||
p.avbMode.SetStringSelection('Disabled')
|
||||
p.keyLabel = wx.StaticText(milanPanel, -1, 'Key:', pos=(600, 10))
|
||||
p.milanKey = wx.TextCtrl(milanPanel, -1, pos=(650, 10), size=(200, 24), style=wx.TE_PASSWORD)
|
||||
self.Bind(wx.EVT_CHECKBOX, self.OnTEAEnabled, id=2)
|
||||
self.Bind(wx.EVT_CHECKBOX, self.OnBroadcastEnabled, id=0)
|
||||
self.Bind(wx.EVT_CHECKBOX, self.OnTelnetEnabled, id=1)
|
||||
p.Show(True)
|
||||
networkPanel.SetBackgroundColour((200, 200, 200))
|
||||
networkPanel.Show(True)
|
||||
telnetPanel.SetBackgroundColour((200, 200, 200))
|
||||
telnetPanel.Show(True)
|
||||
switchPanel.SetBackgroundColour((200, 200, 200))
|
||||
switchPanel.Show(True)
|
||||
milanPanel.SetBackgroundColour((200, 200, 200))
|
||||
milanPanel.Show(True)
|
||||
p.SetPosition((0, 0))
|
||||
p.key = None
|
||||
p.lineNumber = lineNumber
|
||||
return p
|
||||
|
||||
def OnBroadcastEnabled(self, e):
|
||||
self.enable(self.lines[0])
|
||||
return
|
||||
|
||||
def OnTelnetEnabled(self, e):
|
||||
self.enable(self.lines[0])
|
||||
return
|
||||
|
||||
def OnTEAEnabled(self, e):
|
||||
self.enable(self.lines[0])
|
||||
return
|
||||
|
||||
def enable(self, line):
|
||||
val = line.enableBroadcast.GetValue()
|
||||
line.stopWhenMFPActive.Enable(val)
|
||||
line.stopWhenTelnetActive.Enable(val)
|
||||
val = line.enableTelnet.GetValue()
|
||||
line.enableTEA.Enable(val)
|
||||
line.timeoutInput.Enable(val)
|
||||
line.timeoutLabel.Enable(val)
|
||||
line.enableBasicTelnet.Enable(val)
|
||||
val = line.enableTEA.GetValue()
|
||||
line.keyInput.Enable(val)
|
||||
line.encryptionKeyLabel.Enable(val)
|
||||
if val == True:
|
||||
line.enableBasicTelnet.SetValue(False)
|
||||
line.enableBasicTelnet.Enable(False)
|
||||
return
|
||||
|
||||
def evaluateLine(self, line):
|
||||
try:
|
||||
encryptionKey = self.lines[0].keyInput.GetValue() + ' '
|
||||
print mytime.displayTime(), 'ucn. TEA Key:', encryptionKey
|
||||
encryptionKey = data_model.safeName(encryptionKey)[:16]
|
||||
print mytime.displayTime(), 'set to', encryptionKey
|
||||
encryptionAllowed = True
|
||||
self.lines[0].keyInput.SetValue(encryptionKey)
|
||||
except:
|
||||
encryptionKey = ' '
|
||||
encryptionAllowed = False
|
||||
|
||||
try:
|
||||
milanKey = self.lines[0].milanKey.GetValue() + ' '
|
||||
print mytime.displayTime(), 'ucn. MILAN Key:', milanKey
|
||||
milanKey = data_model.safeName(milanKey)[:8]
|
||||
print mytime.displayTime(), 'set to', milanKey
|
||||
self.lines[0].milanKey.SetValue(milanKey)
|
||||
except:
|
||||
milanKey = ' '
|
||||
|
||||
if line.lineNumber == 0:
|
||||
flags = 0
|
||||
if self.lines[0].enableTEA.GetValue() == True and encryptionAllowed:
|
||||
flags |= 1
|
||||
timeoutString = line.timeoutInput.GetStringSelection()
|
||||
timeoutValue = 0
|
||||
for i in range(len(inactivityChoices)):
|
||||
if inactivityChoices[i] == timeoutString:
|
||||
timeoutValue = i
|
||||
break
|
||||
|
||||
if self.lines[0].enableBroadcast.GetValue() == True:
|
||||
flags |= 2
|
||||
if self.lines[0].stopWhenMFPActive.GetValue() == True:
|
||||
flags |= 4
|
||||
if self.lines[0].stopWhenTelnetActive.GetValue() == True:
|
||||
flags |= 8
|
||||
if self.lines[0].enableBasicTelnet.GetValue() == False:
|
||||
flags |= 16
|
||||
if self.lines[0].switchInput.GetStringSelection() == getString('installed'):
|
||||
flags |= 32
|
||||
if self.lines[0].switchInput.GetStringSelection() == getString('notInstalled'):
|
||||
flags |= 64
|
||||
optkey = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_HARDWARE_STATUS_FLAGS, 0, 0)
|
||||
try:
|
||||
hardwareStatusFlags = int(self.frame.frame.parent.model.get(optkey))
|
||||
if line.enableTelnet.GetValue() == True:
|
||||
hardwareStatusFlags |= protocol.confTelnetEnabled
|
||||
else:
|
||||
hardwareStatusFlags &= 4294967295L ^ protocol.confTelnetEnabled
|
||||
self.frame.frame.parent.set_value(optkey, hardwareStatusFlags)
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
else:
|
||||
try:
|
||||
encryptionKey = encryptionKey[:4]
|
||||
print mytime.displayTime(), 'ucn.1', encryptionKey
|
||||
sendString = '' + chr(self.uiNumber)
|
||||
sendString += chr(line.lineNumber)
|
||||
sendString += chr(flags)
|
||||
sendString += chr(timeoutValue)
|
||||
sendString += encryptionKey
|
||||
mys = 'String: '
|
||||
for c in sendString:
|
||||
mys += hex(ord(c)) + ':'
|
||||
|
||||
print mys
|
||||
return sendString
|
||||
except:
|
||||
print mytime.displayTime(), 'uca.ec.eL.failed to build string'
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
return
|
||||
|
||||
elif line.lineNumber == 1:
|
||||
try:
|
||||
encryptionKey = encryptionKey[4:10]
|
||||
print mytime.displayTime(), 'ucn.2', encryptionKey
|
||||
sendString = '' + chr(self.uiNumber)
|
||||
sendString += chr(line.lineNumber)
|
||||
sendString += encryptionKey
|
||||
mys = 'String: '
|
||||
for c in sendString:
|
||||
mys += hex(ord(c)) + ':'
|
||||
|
||||
print mys
|
||||
return sendString
|
||||
except:
|
||||
print mytime.displayTime(), 'uca.ec.eL.failed to build string'
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
return
|
||||
|
||||
elif line.lineNumber == 2:
|
||||
try:
|
||||
encryptionKey = encryptionKey[10:16]
|
||||
sendString = '' + chr(self.uiNumber)
|
||||
sendString += chr(line.lineNumber)
|
||||
sendString += encryptionKey
|
||||
return sendString
|
||||
except:
|
||||
print mytime.displayTime(), 'uca.ec.eL.failed to build string'
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
return
|
||||
|
||||
elif line.lineNumber == 3:
|
||||
flags = 0
|
||||
avbMode = self.lines[0].avbMode.GetStringSelection()
|
||||
if avbMode == 'MILAN':
|
||||
flags |= 1
|
||||
try:
|
||||
milanKey = milanKey[:4]
|
||||
print mytime.displayTime(), 'ucn.1b', milanKey
|
||||
sendString = '' + chr(self.uiNumber)
|
||||
sendString += chr(line.lineNumber)
|
||||
sendString += chr(flags)
|
||||
sendString += chr(0)
|
||||
sendString += milanKey
|
||||
mys = 'String: '
|
||||
for c in sendString:
|
||||
mys += hex(ord(c)) + ':'
|
||||
|
||||
print mys
|
||||
return sendString
|
||||
except:
|
||||
print mytime.displayTime(), 'uca.ec.eL.failed to build string'
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
return
|
||||
|
||||
elif line.lineNumber == 4:
|
||||
try:
|
||||
milanKey = milanKey[4:8]
|
||||
print mytime.displayTime(), 'ucn.2b', milanKey
|
||||
sendString = '' + chr(self.uiNumber)
|
||||
sendString += chr(line.lineNumber)
|
||||
sendString += milanKey
|
||||
sendString += chr(0)
|
||||
sendString += chr(0)
|
||||
mys = 'String: '
|
||||
for c in sendString:
|
||||
mys += hex(ord(c)) + ':'
|
||||
|
||||
print mys
|
||||
return sendString
|
||||
except:
|
||||
print mytime.displayTime(), 'uca.ec.eL.failed to build string'
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
||||
# okay decompiling pycode/user_config_network.pyc
|
||||
@@ -0,0 +1,206 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: user_config_tcs.pyc
|
||||
# Compiled at: 2022-05-31 09:29:42
|
||||
import wx, os, data_model, traceback, one_unit, ConfigParser, protocol, sys, select_keys, select_units, d_protocol, mytime
|
||||
from user_config_helpers import *
|
||||
inputSourceSelectOptions = {16: 'Signal Input ',
|
||||
32: 'Gain Fader Output',
|
||||
48: 'DSP Core Output',
|
||||
64: 'Delay Output'}
|
||||
outputSourceSelectOptions = {16: 'Link Bus ',
|
||||
32: 'Mixer & Gain Fader Output',
|
||||
48: 'DSP Core Output',
|
||||
64: 'Delay Output'}
|
||||
|
||||
class outputConfiguration(wx.Panel):
|
||||
|
||||
def __init__(self, parent, frame, uiNumber, panelName):
|
||||
self.frame = frame
|
||||
self.name = panelName
|
||||
self.uiNumber = uiNumber
|
||||
self.parent = parent
|
||||
wx.Panel.__init__(self, parent, size=(964, 500))
|
||||
self.lines = {}
|
||||
self.Show(True)
|
||||
self.initFinished = False
|
||||
return
|
||||
|
||||
def initMe(self, force=False):
|
||||
if self.IsShown() == False and force == False:
|
||||
return
|
||||
if self.initFinished == True:
|
||||
return 0
|
||||
print mytime.displayTime(), 'uct.initMe outputConfiguration', self.name
|
||||
frame = self.frame
|
||||
uiNumber = self.uiNumber
|
||||
if os.name in mac_names:
|
||||
y = 5
|
||||
else:
|
||||
y = 12
|
||||
self.targetGain = wx.StaticText(self, -1, 'Power Level (0...10)', pos=(640, y), size=(100,
|
||||
26))
|
||||
self.targetGain.Wrap(100)
|
||||
self.lines = {}
|
||||
self.uiKeys = getKeys(frame, uiNumber)
|
||||
i = 0
|
||||
self.factoryItems = 0
|
||||
for uiIndex in self.uiKeys:
|
||||
(key, val) = self.uiKeys[uiIndex]
|
||||
if key.channel != 1 or key.index < 128:
|
||||
continue
|
||||
targetGain = str(val[7] / 4.0)
|
||||
self.createLine(i)
|
||||
self.lines[i].key = key
|
||||
self.lines[i].checkBox.SetLabel('Factory')
|
||||
self.lines[i].targetGain.SetValue(targetGain)
|
||||
self.lines[i].checkBox.Enable(False)
|
||||
self.lines[i].targetGain.Enable(False)
|
||||
i += 1
|
||||
self.factoryItems += 1
|
||||
|
||||
for uiIndex in self.uiKeys:
|
||||
(key, val) = self.uiKeys[uiIndex]
|
||||
if key.channel == 1 and key.index >= 128:
|
||||
continue
|
||||
targetGain = str(val[7] / 4.0)
|
||||
self.createLine(i)
|
||||
self.lines[i].key = key
|
||||
self.lines[i].checkBox.SetValue(True)
|
||||
self.lines[i].targetGain.SetValue(targetGain)
|
||||
self.enable(i)
|
||||
i += 1
|
||||
|
||||
if i - self.factoryItems < 1:
|
||||
self.createLine(i)
|
||||
self.initFinished = True
|
||||
self.Show(True)
|
||||
return
|
||||
|
||||
def createLine(self, i):
|
||||
if os.name in mac_names:
|
||||
y = 3
|
||||
else:
|
||||
y = 4
|
||||
p = wx.Panel(self, size=(964, 28))
|
||||
p.Show(False)
|
||||
p.checkBox = wx.CheckBox(p, 10 + i, ' User', pos=(10, 2), size=(70, 20))
|
||||
p.targetGain = wx.TextCtrl(p, 70 + i, '', pos=(640, 1), size=(60, 20))
|
||||
p.targetGainUnit = wx.StaticText(p, -1, '', pos=(702, y), size=(30, 26))
|
||||
p.SetPosition((0, 40 + 28 * i))
|
||||
p.checkBox.SetValue(0)
|
||||
p.checkBox.Enable(True)
|
||||
p.key = None
|
||||
p.lineNumber = i
|
||||
self.Bind(wx.EVT_CHECKBOX, self.OnEnabled, id=10 + i)
|
||||
self.lines[i] = p
|
||||
self.enable(i)
|
||||
p.Show(True)
|
||||
return
|
||||
|
||||
def enable(self, i):
|
||||
val = self.lines[i].checkBox.GetValue()
|
||||
self.lines[i].targetGain.Enable(val)
|
||||
return
|
||||
|
||||
def OnEnabled(self, e):
|
||||
i = e.GetId() - 10
|
||||
self.enable(i)
|
||||
if i == len(self.lines) - 1 and self.lines[i].checkBox.GetValue() == True and i < 1 + self.factoryItems:
|
||||
if i > 0:
|
||||
t = self.lines[i]
|
||||
s = self.lines[0]
|
||||
t.targetGain.SetValue(s.targetGain.GetValue())
|
||||
else:
|
||||
t = self.lines[i]
|
||||
t.targetGain.SetValue('0')
|
||||
return
|
||||
|
||||
def evaluateLine(self, line):
|
||||
if line.checkBox.GetValue() == False:
|
||||
return
|
||||
else:
|
||||
flags = int(0)
|
||||
amplifierGain = 0
|
||||
calibrationGain = 0
|
||||
try:
|
||||
amplifierInputImpedance = 0
|
||||
except:
|
||||
amplifierInputImpedance = ''
|
||||
|
||||
hardwareOutput = 0
|
||||
loadImpedance = 0
|
||||
targetGain = float(line.targetGain.GetValue())
|
||||
if flags > 15:
|
||||
print mytime.displayTime(), 'uc.oc.invalid flags:', hex(flags)
|
||||
flags = 0
|
||||
amplifierGain *= 4
|
||||
amplifierGain = int(round(amplifierGain, 0))
|
||||
if amplifierGain > 255:
|
||||
amplifierGain = 255
|
||||
if amplifierGain < 0:
|
||||
amplifierGain = 0
|
||||
calibrationGain *= 100.0
|
||||
calibrationGain += 128
|
||||
calibrationGain = int(round(calibrationGain, 0))
|
||||
if calibrationGain < 28:
|
||||
calibrationGain = 28
|
||||
if calibrationGain > 228:
|
||||
calibrationGain = 228
|
||||
try:
|
||||
amplifierInputImpedance /= 100
|
||||
amplifierInputImpedance = int(round(amplifierInputImpedance, 0))
|
||||
if amplifierInputImpedance < 1:
|
||||
amplifierInputImpedance = 1
|
||||
if amplifierInputImpedance > 250:
|
||||
amplifierInputImpedance = 250
|
||||
except:
|
||||
amplifierInputImpedance = 255
|
||||
|
||||
hardwareOutput -= 1
|
||||
hardwareOutput = int(round(hardwareOutput, 0))
|
||||
if hardwareOutput < 0:
|
||||
hardwareOutput = 0
|
||||
if hardwareOutput > max(self.frame.frame.parent.unit_channels):
|
||||
hardwareOutput = max(self.frame.frame.parent.unit_channels)
|
||||
loadImpedance *= 4
|
||||
loadImpedance = int(round(loadImpedance))
|
||||
if loadImpedance > 255:
|
||||
loadImpedance = 255
|
||||
if loadImpedance < 1:
|
||||
loadImpedance = 1
|
||||
targetGain *= 4
|
||||
targetGain = int(round(targetGain))
|
||||
if targetGain > 255:
|
||||
targetGain = 255
|
||||
if targetGain < 0:
|
||||
targetGain = 0
|
||||
i = line.lineNumber
|
||||
self.lines[i].targetGain.SetValue(str(targetGain / 4.0))
|
||||
try:
|
||||
sendString = '' + chr(self.uiNumber)
|
||||
sendString += chr(flags)
|
||||
sendString += chr(calibrationGain)
|
||||
sendString += chr(amplifierInputImpedance)
|
||||
sendString += chr(hardwareOutput)
|
||||
sendString += chr(loadImpedance)
|
||||
sendString += chr(amplifierGain)
|
||||
sendString += chr(targetGain)
|
||||
mys = 'String: '
|
||||
for c in sendString:
|
||||
mys += hex(ord(c)) + ':'
|
||||
|
||||
print mys
|
||||
return sendString
|
||||
except:
|
||||
print mytime.displayTime(), 'uc.oc.eL.failed to build string'
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
||||
# okay decompiling pycode/user_config_tcs.pyc
|
||||
@@ -0,0 +1,401 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: user_config_timer.pyc
|
||||
# Compiled at: 2022-05-31 09:29:42
|
||||
import wx, os, data_model, traceback, one_unit, ConfigParser, protocol, sys, select_keys, select_units, d_protocol, mytime
|
||||
from user_config_helpers import *
|
||||
hourChoices = [_[1] for c in range(2, 23, 1)]
|
||||
minuteChoices = [_[2] for c in range(0, 60, 5)]
|
||||
import string
|
||||
print string.ascii_lowercase
|
||||
days = (getString('monday'), getString('tuesday'), getString('wednesday'), getString('thursday'), getString('friday'), getString('saturday'), getString('sunday'))
|
||||
numberOfLines = 10
|
||||
pageOffset = {'a': 0, 'b': numberOfLines, 'c': (numberOfLines * 2)}
|
||||
|
||||
class setTimer(wx.Panel):
|
||||
|
||||
def __init__(self, parent, frame, uiNumber, panelName):
|
||||
self.frame = frame
|
||||
self.name = panelName
|
||||
self.uiNumber = int(uiNumber[:-1])
|
||||
page = uiNumber[-1]
|
||||
self.pageOffset = pageOffset[page]
|
||||
self.parent = parent
|
||||
self.lines = {}
|
||||
wx.Panel.__init__(self, parent, size=(934, 500))
|
||||
self.Show(True)
|
||||
self.initFinished = False
|
||||
return
|
||||
|
||||
def initMe(self, force=False):
|
||||
if self.IsShown() == False and force == False:
|
||||
return
|
||||
else:
|
||||
if self.initFinished == True:
|
||||
return 0
|
||||
print mytime.displayTime(), 'uct.initMe setTimer', self.name
|
||||
frame = self.frame
|
||||
uiNumber = self.uiNumber
|
||||
self.checkBoxes = {}
|
||||
self.uiKeys = getKeys(frame, self.uiNumber)
|
||||
self.preset_names = {}
|
||||
for i in range(255):
|
||||
namekey = data_model.Key(protocol.STRUCT_ID_PRESET_GLOBAL, protocol.MEMBER_ID_SHORT_NAME, i, 0)
|
||||
name = self.frame.frame.parent.model.get(namekey)
|
||||
if name == None:
|
||||
continue
|
||||
if name.lower().strip() in ('empty preset', 'empty'):
|
||||
continue
|
||||
self.preset_names[name] = i
|
||||
|
||||
self.lines = {}
|
||||
wx.StaticText(self, -1, 'Preset', pos=(220, 14))
|
||||
wx.StaticText(self, -1, 'M', pos=(330, 14))
|
||||
wx.StaticText(self, -1, 'T', pos=(346, 14))
|
||||
wx.StaticText(self, -1, 'W', pos=(362, 14))
|
||||
wx.StaticText(self, -1, 'T', pos=(378, 14))
|
||||
wx.StaticText(self, -1, 'F', pos=(394, 14))
|
||||
wx.StaticText(self, -1, 'S', pos=(410, 14))
|
||||
wx.StaticText(self, -1, 'S', pos=(426, 14))
|
||||
wx.StaticText(self, -1, 'Preset', pos=(670, 14))
|
||||
wx.StaticText(self, -1, 'M', pos=(780, 14))
|
||||
wx.StaticText(self, -1, 'T', pos=(796, 14))
|
||||
wx.StaticText(self, -1, 'W', pos=(812, 14))
|
||||
wx.StaticText(self, -1, 'T', pos=(828, 14))
|
||||
wx.StaticText(self, -1, 'F', pos=(844, 14))
|
||||
wx.StaticText(self, -1, 'S', pos=(860, 14))
|
||||
wx.StaticText(self, -1, 'S', pos=(876, 14))
|
||||
for i in range(numberOfLines):
|
||||
self.createLine(i)
|
||||
|
||||
if self.pageOffset == 0:
|
||||
self.createLine(numberOfLines)
|
||||
for uiIndex in self.uiKeys:
|
||||
(key, val) = self.uiKeys[uiIndex]
|
||||
print mytime.displayTime(), 'uct.key:', key, val
|
||||
lineNumber = (val[1] & 31) - self.pageOffset
|
||||
if lineNumber >= 0 and lineNumber < numberOfLines:
|
||||
self.lines[lineNumber].key = key
|
||||
if lineNumber == 0 and self.pageOffset == 0:
|
||||
if val[1] & 32 == 32:
|
||||
self.lines[numberOfLines - 1].enable.SetValue(1)
|
||||
self.enable()
|
||||
p = self.lines[lineNumber]
|
||||
time = val[2]
|
||||
preset = val[3]
|
||||
for presetString in self.preset_names.keys():
|
||||
if self.preset_names[presetString] == preset:
|
||||
preset = presetString
|
||||
break
|
||||
|
||||
days = val[4]
|
||||
hours = time / 12
|
||||
minutes = (time - hours * 12) * 5
|
||||
hours += 2
|
||||
p.hour1.SetStringSelection(('0' + str(hours))[-2:])
|
||||
p.minute1.SetStringSelection(('0' + str(minutes))[-2:])
|
||||
try:
|
||||
p.preset1.SetStringSelection(preset)
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
p.enable1.SetValue(days & 128)
|
||||
p.mon1.SetValue(days & 64)
|
||||
p.tue1.SetValue(days & 32)
|
||||
p.wed1.SetValue(days & 16)
|
||||
p.thu1.SetValue(days & 8)
|
||||
p.fri1.SetValue(days & 4)
|
||||
p.sat1.SetValue(days & 2)
|
||||
p.sun1.SetValue(days & 1)
|
||||
time = val[5]
|
||||
preset = val[6]
|
||||
for presetString in self.preset_names.keys():
|
||||
if self.preset_names[presetString] == preset:
|
||||
preset = presetString
|
||||
break
|
||||
|
||||
days = val[7]
|
||||
hours = time / 12
|
||||
minutes = (time - hours * 12) * 5
|
||||
hours += 2
|
||||
p.hour2.SetStringSelection(('0' + str(hours))[-2:])
|
||||
p.minute2.SetStringSelection(('0' + str(minutes))[-2:])
|
||||
try:
|
||||
p.preset2.SetStringSelection(preset)
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
p.enable2.SetValue(days & 128)
|
||||
p.mon2.SetValue(days & 64)
|
||||
p.tue2.SetValue(days & 32)
|
||||
p.wed2.SetValue(days & 16)
|
||||
p.thu2.SetValue(days & 8)
|
||||
p.fri2.SetValue(days & 4)
|
||||
p.sat2.SetValue(days & 2)
|
||||
p.sun2.SetValue(days & 1)
|
||||
self.enableLine(lineNumber)
|
||||
self.enableLine(lineNumber | 128)
|
||||
if val[1] & 31 == 31 and self.pageOffset == 0:
|
||||
self.rtc = str(val[2]) + '-' + str(val[3]) + '-' + str(val[4]) + ' ' + str(val[5]) + ':' + str(val[6]) + ':' + str(val[7])
|
||||
print mytime.displayTime(), 'uct.RTC', self.rtc
|
||||
self.lines[numberOfLines].currentTime.SetLabel(self.rtc)
|
||||
self.lines[numberOfLines].key = key
|
||||
|
||||
self.initFinished = True
|
||||
self.Show(True)
|
||||
return
|
||||
|
||||
def createLine(self, lineNumber):
|
||||
if lineNumber >= numberOfLines - 1:
|
||||
h = 100
|
||||
else:
|
||||
h = 26
|
||||
p = wx.Panel(self, size=(934, h))
|
||||
p.lineNumber = lineNumber
|
||||
p.Show(False)
|
||||
if lineNumber < numberOfLines:
|
||||
p.hour1 = wx.Choice(p, -1, choices=hourChoices, style=wx.BORDER_NONE, pos=(100,
|
||||
0), size=(50,
|
||||
26))
|
||||
p.hour1.SetStringSelection(hourChoices[0])
|
||||
p.l2 = wx.StaticText(p, -1, ':', pos=(151, 3))
|
||||
p.minute1 = wx.Choice(p, -1, choices=minuteChoices, style=wx.BORDER_NONE, pos=(160,
|
||||
0), size=(50,
|
||||
26))
|
||||
p.minute1.SetStringSelection(minuteChoices[0])
|
||||
p.preset1 = wx.Choice(p, -1, choices=self.preset_names.keys(), style=wx.BORDER_NONE, pos=(220,
|
||||
0), size=(100,
|
||||
26))
|
||||
p.preset1.SetStringSelection(self.preset_names.keys()[0])
|
||||
p.enable1 = wx.CheckBox(p, lineNumber, 'Enable', pos=(30, 3))
|
||||
self.Bind(wx.EVT_CHECKBOX, self.OnEnableLine, p.enable1)
|
||||
p.mon1 = wx.CheckBox(p, -1, '', pos=(330, 5), size=(15, 15))
|
||||
p.tue1 = wx.CheckBox(p, -1, '', pos=(346, 5), size=(15, 15))
|
||||
p.wed1 = wx.CheckBox(p, -1, '', pos=(362, 5), size=(15, 15))
|
||||
p.thu1 = wx.CheckBox(p, -1, '', pos=(378, 5), size=(15, 15))
|
||||
p.fri1 = wx.CheckBox(p, -1, '', pos=(394, 5), size=(15, 15))
|
||||
p.sat1 = wx.CheckBox(p, -1, '', pos=(410, 5), size=(15, 15))
|
||||
p.sun1 = wx.CheckBox(p, -1, '', pos=(426, 5), size=(15, 15))
|
||||
p.hour2 = wx.Choice(p, -1, choices=hourChoices, style=wx.BORDER_NONE, pos=(550,
|
||||
0), size=(50,
|
||||
26))
|
||||
p.hour2.SetStringSelection(hourChoices[0])
|
||||
p.l3 = wx.StaticText(p, -1, ':', pos=(601, 3))
|
||||
p.minute2 = wx.Choice(p, -1, choices=minuteChoices, style=wx.BORDER_NONE, pos=(610,
|
||||
0), size=(50,
|
||||
26))
|
||||
p.minute2.SetStringSelection(minuteChoices[0])
|
||||
p.preset2 = wx.Choice(p, -1, choices=self.preset_names.keys(), style=wx.BORDER_NONE, pos=(670,
|
||||
0), size=(100,
|
||||
26))
|
||||
p.preset2.SetStringSelection(self.preset_names.keys()[0])
|
||||
p.enable2 = wx.CheckBox(p, lineNumber | 128, 'Enable', pos=(480, 3))
|
||||
self.Bind(wx.EVT_CHECKBOX, self.OnEnableLine, p.enable2)
|
||||
p.mon2 = wx.CheckBox(p, -1, '', pos=(780, 5), size=(15, 15))
|
||||
p.tue2 = wx.CheckBox(p, -1, '', pos=(796, 5), size=(15, 15))
|
||||
p.wed2 = wx.CheckBox(p, -1, '', pos=(812, 5), size=(15, 15))
|
||||
p.thu2 = wx.CheckBox(p, -1, '', pos=(828, 5), size=(15, 15))
|
||||
p.fri2 = wx.CheckBox(p, -1, '', pos=(844, 5), size=(15, 15))
|
||||
p.sat2 = wx.CheckBox(p, -1, '', pos=(860, 5), size=(15, 15))
|
||||
p.sun2 = wx.CheckBox(p, -1, '', pos=(876, 5), size=(15, 15))
|
||||
if lineNumber == numberOfLines - 1 and self.pageOffset == 0:
|
||||
p.enable = wx.CheckBox(p, -1, getString('ent'), pos=(30, 70), size=(100,
|
||||
15))
|
||||
p.enable.SetValue(0)
|
||||
self.Bind(wx.EVT_CHECKBOX, self.OnEnable, p.enable)
|
||||
p.SetPosition((0, 30 + 26 * lineNumber))
|
||||
else:
|
||||
p.timeLabel = wx.StaticText(p, -1, 'Current time in unit:', pos=(30, 0), size=(150,
|
||||
22))
|
||||
p.currentTime = wx.StaticText(p, -1, 'Not set', pos=(208, 0), size=(70,
|
||||
22))
|
||||
p.timeLabel2 = wx.StaticText(p, -1, 'The unit time will be automatically aligned with the actual time when settings are applied.', pos=(30,
|
||||
16), size=(750,
|
||||
22))
|
||||
p.SetPosition((0, 100 + 26 * lineNumber))
|
||||
p.key = None
|
||||
self.lines[lineNumber] = p
|
||||
p.Show(True)
|
||||
if lineNumber == numberOfLines - 1:
|
||||
self.enable()
|
||||
if lineNumber < numberOfLines:
|
||||
self.enableLine(lineNumber)
|
||||
self.enableLine(lineNumber | 128)
|
||||
return p
|
||||
|
||||
def OnEnableLine(self, e):
|
||||
self.enableLine(e.GetId())
|
||||
return
|
||||
|
||||
def enableLine(self, id):
|
||||
lineNumber = id & 31
|
||||
p = self.lines[lineNumber]
|
||||
if id & 128 == 0:
|
||||
val = p.enable1.GetValue()
|
||||
p.hour1.Enable(val)
|
||||
p.minute1.Enable(val)
|
||||
p.preset1.Enable(val)
|
||||
p.mon1.Enable(val)
|
||||
p.tue1.Enable(val)
|
||||
p.wed1.Enable(val)
|
||||
p.thu1.Enable(val)
|
||||
p.fri1.Enable(val)
|
||||
p.sat1.Enable(val)
|
||||
p.sun1.Enable(val)
|
||||
if lineNumber > 0 and val and p.mon1.GetValue() == 0 and p.tue1.GetValue() == 0 and p.wed1.GetValue() == 0 and p.thu1.GetValue() == 0 and p.fri1.GetValue() == 0 and p.sat1.GetValue() == 0 and p.sun1.GetValue() == 0:
|
||||
p2 = self.lines[lineNumber - 1]
|
||||
if p.hour1.GetStringSelection() != '02':
|
||||
return
|
||||
if p.minute1.GetStringSelection() != '00':
|
||||
return
|
||||
p.hour1.SetStringSelection(p2.hour2.GetStringSelection())
|
||||
p.minute1.SetStringSelection(p2.minute2.GetStringSelection())
|
||||
p.mon1.SetValue(p2.mon2.GetValue())
|
||||
p.tue1.SetValue(p2.tue2.GetValue())
|
||||
p.wed1.SetValue(p2.wed2.GetValue())
|
||||
p.thu1.SetValue(p2.thu2.GetValue())
|
||||
p.fri1.SetValue(p2.fri2.GetValue())
|
||||
p.sat1.SetValue(p2.sat2.GetValue())
|
||||
p.sun1.SetValue(p2.sun2.GetValue())
|
||||
p.preset1.SetStringSelection(p2.preset2.GetStringSelection())
|
||||
else:
|
||||
val = p.enable2.GetValue()
|
||||
p.hour2.Enable(val)
|
||||
p.minute2.Enable(val)
|
||||
p.preset2.Enable(val)
|
||||
p.mon2.Enable(val)
|
||||
p.tue2.Enable(val)
|
||||
p.wed2.Enable(val)
|
||||
p.thu2.Enable(val)
|
||||
p.fri2.Enable(val)
|
||||
p.sat2.Enable(val)
|
||||
p.sun2.Enable(val)
|
||||
if lineNumber >= 0 and val and p.mon2.GetValue() == 0 and p.tue2.GetValue() == 0 and p.wed2.GetValue() == 0 and p.thu2.GetValue() == 0 and p.fri2.GetValue() == 0 and p.sat2.GetValue() == 0 and p.sun2.GetValue() == 0:
|
||||
if p.hour2.GetStringSelection() != '02':
|
||||
return
|
||||
if p.minute2.GetStringSelection() != '00':
|
||||
return
|
||||
p.hour2.SetStringSelection(p.hour1.GetStringSelection())
|
||||
p.minute2.SetStringSelection(p.minute1.GetStringSelection())
|
||||
p.mon2.SetValue(p.mon1.GetValue())
|
||||
p.tue2.SetValue(p.tue1.GetValue())
|
||||
p.wed2.SetValue(p.wed1.GetValue())
|
||||
p.thu2.SetValue(p.thu1.GetValue())
|
||||
p.fri2.SetValue(p.fri1.GetValue())
|
||||
p.sat2.SetValue(p.sat1.GetValue())
|
||||
p.sun2.SetValue(p.sun1.GetValue())
|
||||
p.preset2.SetStringSelection(p.preset1.GetStringSelection())
|
||||
return
|
||||
|
||||
def OnEnable(self, e):
|
||||
self.enable()
|
||||
return
|
||||
|
||||
def enable(self):
|
||||
return
|
||||
|
||||
def OnCopy(self, e):
|
||||
lineNumber = e.GetId() - 20
|
||||
for i in range(48):
|
||||
self.lines[lineNumber].timeSlot[i].SetValue(self.lines[lineNumber - 1].timeSlot[i].GetValue())
|
||||
|
||||
return
|
||||
|
||||
def OnClear(self, e):
|
||||
lineNumber = e.GetId() - 30
|
||||
for i in range(48):
|
||||
self.lines[lineNumber].timeSlot[i].SetValue(0)
|
||||
|
||||
return
|
||||
|
||||
def evaluateLine(self, line):
|
||||
try:
|
||||
if line.lineNumber < numberOfLines:
|
||||
val = {}
|
||||
hour = (int(line.hour1.GetStringSelection()) - 2) * 12
|
||||
minute = int(line.minute1.GetStringSelection()) / 5
|
||||
time = hour + minute
|
||||
enable = line.enable1.GetValue() << 7
|
||||
mon = line.mon1.GetValue() << 6
|
||||
tue = line.tue1.GetValue() << 5
|
||||
wed = line.wed1.GetValue() << 4
|
||||
thu = line.thu1.GetValue() << 3
|
||||
fri = line.fri1.GetValue() << 2
|
||||
sat = line.sat1.GetValue() << 1
|
||||
sun = line.sun1.GetValue() << 0
|
||||
try:
|
||||
preset = self.preset_names[line.preset1.GetStringSelection()]
|
||||
except:
|
||||
preset = 1
|
||||
else:
|
||||
if preset > 255:
|
||||
preset = 255
|
||||
if time > 255:
|
||||
time = 255
|
||||
val[0] = time
|
||||
val[1] = preset
|
||||
val[2] = enable | mon | tue | wed | thu | fri | sat | sun
|
||||
hour = (int(line.hour2.GetStringSelection()) - 2) * 12
|
||||
minute = int(line.minute2.GetStringSelection()) / 5
|
||||
time = hour + minute
|
||||
enable = line.enable2.GetValue() << 7
|
||||
mon = line.mon2.GetValue() << 6
|
||||
tue = line.tue2.GetValue() << 5
|
||||
wed = line.wed2.GetValue() << 4
|
||||
thu = line.thu2.GetValue() << 3
|
||||
fri = line.fri2.GetValue() << 2
|
||||
sat = line.sat2.GetValue() << 1
|
||||
sun = line.sun2.GetValue() << 0
|
||||
try:
|
||||
preset = self.preset_names[line.preset2.GetStringSelection()]
|
||||
except:
|
||||
preset = 0
|
||||
else:
|
||||
if preset > 255:
|
||||
preset = 255
|
||||
if time > 255:
|
||||
time = 255
|
||||
val[3] = time
|
||||
val[4] = preset
|
||||
val[5] = enable | mon | tue | wed | thu | fri | sat | sun
|
||||
flags = 0
|
||||
if line.lineNumber == 0 and self.pageOffset == 0:
|
||||
if self.lines[numberOfLines - 1].enable.GetValue():
|
||||
flags |= 32
|
||||
structID = line.lineNumber + self.pageOffset | flags
|
||||
else:
|
||||
import datetime
|
||||
nowString = datetime.datetime.now().strftime('%y-%m-%d-%H-%M-%S')
|
||||
print mytime.displayTime(), 'uct.tijd zetten op', nowString
|
||||
val = [_[1] for c in nowString.split('-')]
|
||||
structID = 31
|
||||
val[1] |= 128
|
||||
try:
|
||||
sendString = '' + chr(self.uiNumber)
|
||||
sendString += chr(structID)
|
||||
sendString += chr(val[0])
|
||||
sendString += chr(val[1])
|
||||
sendString += chr(val[2])
|
||||
sendString += chr(val[3])
|
||||
sendString += chr(val[4])
|
||||
sendString += chr(val[5])
|
||||
mys = 'uct.String: '
|
||||
for c in sendString:
|
||||
mys += hex(ord(c)) + ':'
|
||||
|
||||
print mys
|
||||
return sendString
|
||||
except:
|
||||
print mytime.displayTime(), 'uct.eL.failed to build string'
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
||||
# okay decompiling pycode/user_config_timer.pyc
|
||||
@@ -0,0 +1,942 @@
|
||||
# uncompyle6 version 3.9.3
|
||||
# Python bytecode version base 2.6 (62161)
|
||||
# Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49)
|
||||
# [GCC 14.2.0]
|
||||
# Embedded file name: user_config_vu.pyc
|
||||
# Compiled at: 2024-11-13 09:37:24
|
||||
import wx, os, data_model, traceback, one_unit, ConfigParser, protocol, sys, select_keys, select_units, d_protocol, mytime, string
|
||||
from user_config_helpers import *
|
||||
from user_config_leds import *
|
||||
vuLedFunctions = {0: 'Signal',
|
||||
1: '-6 dB',
|
||||
2: 'Limit',
|
||||
3: 'Peak Level',
|
||||
4: 'Peak Limit',
|
||||
5: 'Mute',
|
||||
6: '-12 dB',
|
||||
7: '-18 dB',
|
||||
8: '-24 dB',
|
||||
9: '-30 dB',
|
||||
10: '-3 dB',
|
||||
11: '+3 dB',
|
||||
12: '+6 dB',
|
||||
13: 'AES/EBU Signal',
|
||||
14: 'AES/EBU -6dB',
|
||||
15: 'AES/EBU Peak',
|
||||
16: 'AES/EBU CLIP',
|
||||
17: '0 dB',
|
||||
18: 'AES/EBU -12 dB',
|
||||
19: 'AES/EBU -24 dB',
|
||||
20: 'AES/EBU 0 dB',
|
||||
21: 'User 1',
|
||||
22: 'User 2',
|
||||
23: 'User 3',
|
||||
24: 'User 4',
|
||||
25: 'User 5',
|
||||
26: 'User 6',
|
||||
27: 'User 7',
|
||||
28: 'User 8',
|
||||
29: 'User 9',
|
||||
30: 'User 10',
|
||||
31: 'User 11'}
|
||||
|
||||
class vuMeterLeds(wx.Panel):
|
||||
|
||||
def __init__(self, parent, frame, uiNumber, panelName, mainVuPanel):
|
||||
self.frame = frame
|
||||
self.name = panelName
|
||||
self.mainVuPanel = mainVuPanel
|
||||
self.ledIndex = uiNumber
|
||||
uiNumber = 187
|
||||
self.uiNumber = uiNumber
|
||||
self.page = uiNumber
|
||||
self.parent = parent
|
||||
wx.Panel.__init__(self, parent, size=(964, 500))
|
||||
self.lines = {}
|
||||
self.initFinished = False
|
||||
self.Show(True)
|
||||
return
|
||||
|
||||
def initMe(self, force=False):
|
||||
if self.IsShown() == False and force == False:
|
||||
return
|
||||
if self.initFinished == True:
|
||||
return 0
|
||||
print mytime.displayTime(), 'ucv.initMe vuMeterLeds', self.name
|
||||
frame = self.frame
|
||||
uiNumber = self.uiNumber
|
||||
self.struct_id_choices = ['Selected']
|
||||
for strID in (3, 4, 5, 7, 8):
|
||||
self.struct_id_choices.append(protocol.get_strid_text(strID))
|
||||
|
||||
self.member_id_choices = [
|
||||
'Selected']
|
||||
for membID in (0, 1, 2, 3, 4, 5, 6, 7, 8, 14, 15, 24, 27):
|
||||
self.member_id_choices.append(protocol.get_member_text(membID))
|
||||
|
||||
self.channels = {127: 'All Inputs', 255: 'All Outputs'}
|
||||
for c in self.frame.frame.parent.unit_channels:
|
||||
if c < 128:
|
||||
s = 'Input ' + str(c + 1)
|
||||
else:
|
||||
s = 'Output ' + str(c - 127)
|
||||
self.channels[c] = s
|
||||
|
||||
self.strFunction = wx.StaticText(self, -1, 'Function', pos=(80, 20))
|
||||
self.strItem = wx.StaticText(self, -1, 'Process', pos=(220, 20))
|
||||
self.strSubItem = wx.StaticText(self, -1, 'Parameter', pos=(330, 20))
|
||||
self.strIndex = wx.StaticText(self, -1, 'Index', pos=(550, 20))
|
||||
self.strComparison = wx.StaticText(self, -1, 'Comparison', pos=(600, 20))
|
||||
self.strBlnkWhenChanged = wx.StaticText(self, -1, 'BwC HdS', pos=(820, 20))
|
||||
self.uiKeys = getKeys(frame, uiNumber, self.ledIndex)
|
||||
i = 0
|
||||
self.factoryItems = 0
|
||||
for uiIndex in self.uiKeys:
|
||||
(key, val) = self.uiKeys[uiIndex]
|
||||
print mytime.displayTime(), 'ucl.key:', key, val
|
||||
if key.channel != 1 or key.index < 128:
|
||||
continue
|
||||
self.createLine(i)
|
||||
self.lines[i].key = key
|
||||
self.lines[i].checkBox.Enable(False)
|
||||
self.lines[i].checkBox.SetLabel('Factory')
|
||||
self.lines[i].struct_id_choice.Enable(False)
|
||||
self.lines[i].member_id_choice.Enable(False)
|
||||
self.lines[i].index_choice.Enable(False)
|
||||
self.lines[i].keyComparisonChoice.Enable(False)
|
||||
self.lines[i].checkBox.SetValue(True)
|
||||
try:
|
||||
self.lines[i].struct_id_choice.SetStringSelection(protocol.get_strid_text(val[1] & 15))
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
self.lines[i].member_id_choice.SetStringSelection(protocol.get_member_text(0))
|
||||
except:
|
||||
pass
|
||||
|
||||
channel = val[3]
|
||||
if channel == 255:
|
||||
channel = 'All Outputs'
|
||||
elif channel == 127:
|
||||
channel = 'All Inputs'
|
||||
elif channel < 128:
|
||||
channel = 'Input ' + str(channel + 1)
|
||||
else:
|
||||
channel = 'Output ' + str(channel - 128 + 1)
|
||||
self.lines[i].channel_choice.SetStringSelection(channel)
|
||||
self.lines[i].index_choice.SetStringSelection(str((val[6] >> 4 & 15) + 1))
|
||||
ledFunction = val[4]
|
||||
self.lines[i].ledFunctionChoice.SetStringSelection(ledFunctions[ledFunction])
|
||||
self.lines[i].keyComparisonChoice.SetStringSelection(keyComparisonOptions[val[6] & 15])
|
||||
if ledFunction in (ledFunctionSignal, ledFunctionGainReduction, ledFunctionAutoIndicatePeakInput):
|
||||
self.lines[i].value.SetValue(str(val[5] - 128) + 'dBu')
|
||||
else:
|
||||
self.lines[i].value.SetValue(str(val[5]))
|
||||
self.enable(i)
|
||||
self.lines[i].channel_choice.Enable(False)
|
||||
self.lines[i].ledFunctionChoice.Enable(False)
|
||||
self.lines[i].struct_id_choice.Enable(False)
|
||||
self.lines[i].member_id_choice.Enable(False)
|
||||
self.lines[i].index_choice.Enable(False)
|
||||
self.lines[i].keyComparisonChoice.Enable(False)
|
||||
self.lines[i].value.Enable(False)
|
||||
i += 1
|
||||
self.factoryItems += 1
|
||||
|
||||
for uiIndex in self.uiKeys:
|
||||
(key, val) = self.uiKeys[uiIndex]
|
||||
if key.channel == 1 and key.index >= 128:
|
||||
continue
|
||||
self.createLine(i)
|
||||
self.lines[i].key = key
|
||||
self.lines[i].checkBox.SetValue(True)
|
||||
try:
|
||||
self.lines[i].struct_id_choice.SetStringSelection(protocol.get_strid_text(val[1] & 15))
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
self.lines[i].member_id_choice.SetStringSelection(protocol.get_member_text(0))
|
||||
except:
|
||||
pass
|
||||
|
||||
channel = val[3]
|
||||
if channel == 255:
|
||||
channel = 'All Outputs'
|
||||
elif channel == 127:
|
||||
channel = 'All Inputs'
|
||||
elif channel < 128:
|
||||
channel = 'Input ' + str(channel + 1)
|
||||
else:
|
||||
channel = 'Output ' + str(channel - 128 + 1)
|
||||
self.lines[i].channel_choice.SetStringSelection(channel)
|
||||
self.lines[i].index_choice.SetStringSelection(str((val[6] >> 4 & 15) + 1))
|
||||
ledFunction = val[4]
|
||||
self.lines[i].ledFunctionChoice.SetStringSelection(ledFunctions[ledFunction])
|
||||
self.lines[i].keyComparisonChoice.SetStringSelection(keyComparisonOptions[val[6] & 15])
|
||||
if ledFunction == ledFunctionSignal:
|
||||
self.lines[i].value.SetValue(str(val[5] - 128) + 'dBu')
|
||||
elif ledFunction in (ledFunctionGainReduction, ledFunctionAutoIndicatePeakInput):
|
||||
self.lines[i].value.SetValue(str(val[5] - 128) + 'dB')
|
||||
else:
|
||||
self.lines[i].value.SetValue(str(val[5]))
|
||||
if val[7] & 2 == 2:
|
||||
self.lines[i].blinkBox.SetValue(1)
|
||||
if val[7] & 1 == 1:
|
||||
self.lines[i].standbyBox.SetValue(1)
|
||||
self.enable(i)
|
||||
i += 1
|
||||
|
||||
if i - self.factoryItems < 8:
|
||||
self.createLine(i)
|
||||
print mytime.displayTime() + ' Created tab for', self.name
|
||||
self.Show(True)
|
||||
self.initFinished = True
|
||||
return
|
||||
|
||||
def createLine(self, i):
|
||||
p = wx.Panel(self, size=(964, 28))
|
||||
p.Show(False)
|
||||
p.checkBox = wx.CheckBox(p, 10 + i, ' User', pos=(10, 2), size=(70, 20))
|
||||
p.keyComparisonChoice = wx.Choice(p, 80 + i, choices=keyComparisonOptions.values(), style=wx.BORDER_NONE, pos=(600,
|
||||
0), size=(160,
|
||||
26))
|
||||
p.keyComparisonChoice.SetStringSelection(keyComparisonOptions.values()[0])
|
||||
p.ledFunctionChoice = wx.Choice(p, 30 + i, choices=ledFunctions.values(), style=wx.BORDER_NONE, pos=(80,
|
||||
0), size=(130,
|
||||
26))
|
||||
p.ledFunctionChoice.SetStringSelection(ledFunctions.values()[0])
|
||||
p.struct_id_choice = wx.Choice(p, 40 + i, choices=self.struct_id_choices, style=wx.BORDER_NONE, pos=(220,
|
||||
0), size=(100,
|
||||
26))
|
||||
p.struct_id_choice.SetStringSelection(self.struct_id_choices[0])
|
||||
p.member_id_choice = wx.Choice(p, 50 + i, choices=self.member_id_choices, style=wx.BORDER_NONE, pos=(330,
|
||||
0), size=(100,
|
||||
26))
|
||||
p.member_id_choice.SetStringSelection(self.member_id_choices[0])
|
||||
p.channel_choice = wx.Choice(p, 60 + i, choices=self.channels.values(), style=wx.BORDER_NONE, pos=(440,
|
||||
0), size=(100,
|
||||
26))
|
||||
p.channel_choice.SetStringSelection(self.channels.values()[0])
|
||||
p.index_choice = wx.Choice(p, 70 + i, choices=[_[1] for j in range(10)], style=wx.BORDER_NONE, pos=(550,
|
||||
0), size=(40,
|
||||
26))
|
||||
p.index_choice.SetStringSelection('1')
|
||||
p.value = wx.TextCtrl(p, 20 + i, '', pos=(770, 1), size=(40, 20))
|
||||
p.value.Show(False)
|
||||
p.additionalLabel = wx.StaticText(p, -1, '', pos=(220, 5))
|
||||
p.additionalLabel.Show(False)
|
||||
p.blinkBox = wx.CheckBox(p, 80 + i, '', pos=(830, 2), size=(20, 20))
|
||||
p.standbyBox = wx.CheckBox(p, 80 + i, '', pos=(860, 2), size=(20, 20))
|
||||
p.SetPosition((0, 40 + 28 * i))
|
||||
p.checkBox.SetValue(0)
|
||||
p.checkBox.Enable(True)
|
||||
p.key = None
|
||||
self.Bind(wx.EVT_CHECKBOX, self.OnEnabled, id=10 + i)
|
||||
self.Bind(wx.EVT_CHOICE, self.OnStructId, id=40 + i)
|
||||
self.Bind(wx.EVT_CHOICE, self.OnChangeledFunction, id=30 + i)
|
||||
self.lines[i] = p
|
||||
self.enable(i)
|
||||
p.Show(True)
|
||||
return
|
||||
|
||||
def enable(self, i):
|
||||
val = self.lines[i].checkBox.GetValue()
|
||||
self.showChoices(i, self.getledFunction(self.lines[i]), val)
|
||||
return
|
||||
|
||||
def showChoices(self, i, ledFunctionInt, enabled):
|
||||
self.lines[i].ledFunctionChoice.Enable(enabled)
|
||||
try:
|
||||
ledFunctionFields = ledSelectOptions[ledFunctionInt]
|
||||
except:
|
||||
ledFunctionFields = None
|
||||
|
||||
self.lines[i].struct_id_choice.Show(False)
|
||||
self.lines[i].member_id_choice.Show(False)
|
||||
self.lines[i].channel_choice.Show(False)
|
||||
self.lines[i].index_choice.Show(False)
|
||||
self.lines[i].keyComparisonChoice.Show(enabled)
|
||||
self.lines[i].struct_id_choice.Enable(enabled)
|
||||
self.lines[i].member_id_choice.Enable(enabled)
|
||||
self.lines[i].index_choice.Enable(enabled)
|
||||
self.lines[i].keyComparisonChoice.Show(enabled)
|
||||
self.lines[i].value.Show(False)
|
||||
if ledFunctionFields.find('s') >= 0:
|
||||
self.lines[i].struct_id_choice.Show(True)
|
||||
if self.lines[i].struct_id_choice.GetStringSelection() not in ('Selected',
|
||||
'All'):
|
||||
if ledFunctionFields.find('m') >= 0:
|
||||
self.lines[i].member_id_choice.Show(True)
|
||||
if ledFunctionFields.find('i') >= 0:
|
||||
self.lines[i].index_choice.Show(True)
|
||||
elif ledFunctionFields.find('m') >= 0:
|
||||
self.lines[i].member_id_choice.Show(True)
|
||||
if ledFunctionFields.find('i') >= 0:
|
||||
self.lines[i].index_choice.Show(True)
|
||||
if ledFunctionFields.find('v') >= 0:
|
||||
self.lines[i].value.Show(True)
|
||||
if ledFunctionFields == 'sm':
|
||||
self.lines[i].struct_id_choice.Show(True)
|
||||
self.lines[i].member_id_choice.Show(True)
|
||||
if ledAdditionalText[ledFunctionInt] == '':
|
||||
self.lines[i].additionalLabel.Show(False)
|
||||
else:
|
||||
self.lines[i].additionalLabel.SetLabel(ledAdditionalText[ledFunctionInt])
|
||||
self.lines[i].additionalLabel.Show(True)
|
||||
return
|
||||
|
||||
def OnEnabled(self, e):
|
||||
i = e.GetId() - 10
|
||||
if self.mainVuPanel.countLedFunctionKeys() > 32:
|
||||
print mytime.displayTime(), 'Maximum number of VU LED functions bereikt'
|
||||
self.lines[i].checkBox.SetValue(False)
|
||||
return
|
||||
self.enable(i)
|
||||
if i == len(self.lines) - 1 and self.lines[i].checkBox.GetValue() == True and i < 7 + self.factoryItems:
|
||||
self.createLine(i + 1)
|
||||
return
|
||||
|
||||
def OnChangeledFunction(self, e):
|
||||
i = e.GetId() - 30
|
||||
self.showChoices(i, self.getledFunction(self.lines[i]), 1)
|
||||
print mytime.displayTime() + ' on change key function', self.lines[i].ledFunctionChoice.GetStringSelection()
|
||||
return
|
||||
|
||||
def OnStructId(self, e):
|
||||
print mytime.displayTime() + ' OnStructid'
|
||||
i = e.GetId() - 40
|
||||
self.showChoices(i, self.getledFunction(self.lines[i]), True)
|
||||
return
|
||||
|
||||
def getledFunction(self, line):
|
||||
fName = line.ledFunctionChoice.GetStringSelection()
|
||||
for k in ledFunctions.keys():
|
||||
if ledFunctions[k] == fName:
|
||||
return k
|
||||
|
||||
return
|
||||
|
||||
def getKeyComparison(self, line):
|
||||
fName = line.keyComparisonChoice.GetStringSelection()
|
||||
for k in keyComparisonOptions.keys():
|
||||
if keyComparisonOptions[k] == fName:
|
||||
return k
|
||||
|
||||
return
|
||||
|
||||
def stripValue(self, v):
|
||||
for s in data_model.validFilenameChars + data_model.forbiddenFilenameChars:
|
||||
if s in string.digits:
|
||||
continue
|
||||
if s in ('-', '.'):
|
||||
continue
|
||||
if s == ',':
|
||||
v = v.replace(s, '.')
|
||||
continue
|
||||
v = v.replace(s, '')
|
||||
|
||||
try:
|
||||
return float(v)
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
return v
|
||||
|
||||
return
|
||||
|
||||
def evaluateLine(self, line):
|
||||
if line.checkBox.GetValue() == False:
|
||||
return
|
||||
else:
|
||||
ledFunction = self.getledFunction(line)
|
||||
channel = line.channel_choice.GetStringSelection()
|
||||
if channel == 'All Inputs':
|
||||
channel = 127
|
||||
elif channel == 'All Outputs':
|
||||
channel = 255
|
||||
elif channel.find('Input ') >= 0:
|
||||
channel = int(channel.replace('Input ', '')) - 1
|
||||
elif channel.find('Output ') >= 0:
|
||||
channel = int(channel.replace('Output ', '')) - 1 + 128
|
||||
keyComparison = self.getKeyComparison(line)
|
||||
if ledFunction in (ledFunctionSignal, ledFunctionGainReduction, ledFunctionAutoIndicatePeakInput):
|
||||
strID = 0
|
||||
if self.name.find('Analog') >= 0:
|
||||
strID = 1
|
||||
if self.name.find('AES/EBU') >= 0:
|
||||
strID = 2
|
||||
if self.name.find('Dante') >= 0:
|
||||
strID = 3
|
||||
index = ledFunction
|
||||
flags = 0
|
||||
try:
|
||||
value = int(self.stripValue(line.value.GetValue()))
|
||||
if value > 120:
|
||||
value = 120
|
||||
if value < -120:
|
||||
value = -120
|
||||
value += 128
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
value = 0
|
||||
|
||||
elif ledFunction == ledFunctionPresetNumber:
|
||||
strID = 0
|
||||
flags = 0
|
||||
try:
|
||||
value = int(self.stripValue(line.value.GetValue()))
|
||||
if value > 250:
|
||||
value = 250
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
value = 1
|
||||
|
||||
elif ledFunction == ledFunctionStandby:
|
||||
strID = 0
|
||||
flags = 0
|
||||
try:
|
||||
value = int(self.stripValue(line.value.GetValue()))
|
||||
if value > 250:
|
||||
value = 250
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
value = 1
|
||||
|
||||
elif ledFunction == ledFunctionWink:
|
||||
strID = 0
|
||||
flags = 0
|
||||
try:
|
||||
value = int(self.stripValue(line.value.GetValue()))
|
||||
if value > 250:
|
||||
value = 250
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
value = 1
|
||||
|
||||
elif ledFunction == ledFunctionPresetChanged:
|
||||
strID = 0
|
||||
flags = 0
|
||||
try:
|
||||
value = int(self.stripValue(line.value.GetValue()))
|
||||
if value > 250:
|
||||
value = 250
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
value = 1
|
||||
|
||||
elif ledFunction == ledFunctionShowValue:
|
||||
strID = protocol.get_strid_by_text(line.struct_id_choice.GetStringSelection())
|
||||
index = int(line.index_choice.GetStringSelection()) - 1
|
||||
keyComparison |= index << 4
|
||||
flags = 0
|
||||
try:
|
||||
value = int(self.stripValue(line.value.GetValue()))
|
||||
if value > 250:
|
||||
value = 250
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
value = 1
|
||||
|
||||
else:
|
||||
strID = 0
|
||||
channel = 0
|
||||
flags = 0
|
||||
try:
|
||||
value = int(line.value.GetValue().replace('dBu', ''))
|
||||
if value > 250:
|
||||
value = 250
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
value = 1
|
||||
|
||||
if line.standbyBox.GetValue() == 1:
|
||||
flags |= 1
|
||||
if line.blinkBox.GetValue() == 1:
|
||||
flags |= 2
|
||||
try:
|
||||
sendString = '' + chr(self.uiNumber)
|
||||
sendString += chr(strID)
|
||||
sendString += chr(self.ledIndex)
|
||||
sendString += chr(channel)
|
||||
sendString += chr(ledFunction)
|
||||
sendString += chr(value)
|
||||
sendString += chr(keyComparison)
|
||||
sendString += chr(flags)
|
||||
mys = 'String: '
|
||||
for c in sendString:
|
||||
mys += hex(ord(c)) + ':'
|
||||
|
||||
print mys
|
||||
return sendString
|
||||
except:
|
||||
print mytime.displayTime(), 'ucv.fpk.eL.failed to build string'
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
def countLedFunctionKeys(self):
|
||||
if self.initFinished == False:
|
||||
return 0
|
||||
else:
|
||||
self.numberOfLedFunctionKeys = 0
|
||||
lines = 0
|
||||
for line in self.lines.values():
|
||||
if line.checkBox.GetValue() == True:
|
||||
lines += 1
|
||||
|
||||
if lines == self.factoryItems:
|
||||
print self.name, self.factoryItems, 'factory keys'
|
||||
return self.factoryItems
|
||||
print self.name, lines - self.factoryItems, 'user keys'
|
||||
return lines - self.factoryItems
|
||||
return
|
||||
|
||||
|
||||
class vuMeter(wx.Panel):
|
||||
|
||||
def __init__(self, parent, frame, uiNumber, panelName, mainVuPanel):
|
||||
self.frame = frame
|
||||
self.name = panelName
|
||||
self.uiNumber = uiNumber
|
||||
self.mainVuPanel = mainVuPanel
|
||||
self.parent = parent
|
||||
wx.Panel.__init__(self, parent, size=(964, 260))
|
||||
self.lines = {}
|
||||
self.Show(True)
|
||||
self.initFinished = False
|
||||
return
|
||||
|
||||
def initMe(self, force=False):
|
||||
if self.IsShown() == False and force == False:
|
||||
return
|
||||
else:
|
||||
if self.initFinished == True:
|
||||
return 0
|
||||
print mytime.displayTime(), 'ucv.initMe vuMeter', self.name
|
||||
frame = self.frame
|
||||
uiNumber = self.uiNumber
|
||||
if os.name in mac_names:
|
||||
y = 5
|
||||
else:
|
||||
y = 12
|
||||
self.headerLabel = wx.StaticText(self, -1, 'Select the LED function for each LED in the VU meter:', pos=(10,
|
||||
11))
|
||||
self.uiKeys = getKeys(frame, 188, None, uiNumber)
|
||||
print self.uiKeys
|
||||
self.channels = {127: 'All Inputs', 255: 'All Outputs'}
|
||||
for c in self.frame.frame.parent.unit_channels:
|
||||
if c < 128:
|
||||
s = 'Input ' + str(c + 1)
|
||||
else:
|
||||
s = 'Output ' + str(c - 127)
|
||||
self.channels[c] = s
|
||||
|
||||
self.ledChannelList = self.channels
|
||||
self.createLine(0)
|
||||
self.createLine(1)
|
||||
self.lines[0].val = [1, 1, 1, 1, 1, 1, 1, 1]
|
||||
self.lines[1].val = [1, 1, 1, 1, 1, 1, 1, 1]
|
||||
for uiIndex in self.uiKeys:
|
||||
(key, val) = self.uiKeys[uiIndex]
|
||||
if key.channel != 1 or key.index < 128:
|
||||
continue
|
||||
self.lines[0].val = val
|
||||
self.lines[0].key = key
|
||||
self.setChannelChoices(0)
|
||||
self.setLedFunctions(0)
|
||||
if self.lines[1].key == None:
|
||||
self.lines[1].val = val
|
||||
self.setChannelChoices(1)
|
||||
self.setLedFunctions(1)
|
||||
|
||||
for uiIndex in self.uiKeys:
|
||||
(key, val) = self.uiKeys[uiIndex]
|
||||
if key.channel == 1 and key.index >= 128:
|
||||
continue
|
||||
self.lines[1].checkBox.SetValue(True)
|
||||
self.lines[1].val = val
|
||||
self.lines[1].key = key
|
||||
self.enable(1)
|
||||
self.setChannelChoices(1)
|
||||
self.setLedFunctions(1)
|
||||
|
||||
self.uiIndex = self.uiNumber
|
||||
self.uiNumber = 188
|
||||
self.Show(True)
|
||||
self.initFinished = True
|
||||
return
|
||||
|
||||
def setLedFunctions(self, lineNumber):
|
||||
val = self.lines[lineNumber].val
|
||||
ledFunctions = {}
|
||||
ledFunctions[0] = val[2] & 31
|
||||
ledFunctions[1] = (val[2] & 224) >> 5 | (val[4] & 3) << 3
|
||||
ledFunctions[2] = (val[4] & 124) >> 2
|
||||
ledFunctions[3] = (val[4] & 128) >> 7 | (val[5] & 15) << 1
|
||||
ledFunctions[4] = (val[5] & 240) >> 4 | (val[6] & 1) << 4
|
||||
ledFunctions[5] = (val[6] & 62) >> 1
|
||||
ledFunctions[6] = (val[6] & 192) >> 6 | (val[7] & 7) << 2
|
||||
ledFunctions[7] = (val[7] & 248) >> 3
|
||||
self.lines[lineNumber].ledFunctionEen.SetStringSelection(vuLedFunctions[ledFunctions[0]])
|
||||
self.lines[lineNumber].ledFunctionTwee.SetStringSelection(vuLedFunctions[ledFunctions[1]])
|
||||
self.lines[lineNumber].ledFunctionDrie.SetStringSelection(vuLedFunctions[ledFunctions[2]])
|
||||
self.lines[lineNumber].ledFunctionVier.SetStringSelection(vuLedFunctions[ledFunctions[3]])
|
||||
self.lines[lineNumber].ledFunctionVijf.SetStringSelection(vuLedFunctions[ledFunctions[4]])
|
||||
self.lines[lineNumber].ledFunctionZes.SetStringSelection(vuLedFunctions[ledFunctions[5]])
|
||||
self.lines[lineNumber].ledFunctionZeven.SetStringSelection(vuLedFunctions[ledFunctions[6]])
|
||||
self.lines[lineNumber].ledFunctionAcht.SetStringSelection(vuLedFunctions[ledFunctions[7]])
|
||||
return
|
||||
|
||||
def setChannelChoices(self, lineNumber):
|
||||
val = self.lines[lineNumber].val
|
||||
channel = val[3]
|
||||
if channel not in self.ledChannelList:
|
||||
return
|
||||
if channel == 255:
|
||||
channelString = 'All Outputs'
|
||||
elif channel == 127:
|
||||
channelString = 'All Inputs'
|
||||
elif channel < 128:
|
||||
channelString = 'Input ' + str(channel + 1)
|
||||
else:
|
||||
channelString = 'Output ' + str(channel - 128 + 1)
|
||||
structID = val[1]
|
||||
if structID & 128 == 128:
|
||||
print mytime.displayTime(), 'ucv.Increase channel from led four!'
|
||||
self.increaseChannelFromLedFour = True
|
||||
else:
|
||||
self.increaseChannelFromLedFour = False
|
||||
self.lines[lineNumber].ledChannelEen.SetStringSelection(channelString)
|
||||
self.lines[lineNumber].ledChannelTwee.SetStringSelection(channelString)
|
||||
self.lines[lineNumber].ledChannelDrie.SetStringSelection(channelString)
|
||||
self.lines[lineNumber].ledChannelVier.SetStringSelection(channelString)
|
||||
if channel not in (127, 255) and channel + 1 in self.ledChannelList and lineNumber == 1:
|
||||
self.lines[lineNumber].ledChannelVijf.Destroy()
|
||||
choices = [self.ledChannelList[channel], self.ledChannelList[channel + 1]]
|
||||
self.lines[lineNumber].ledChannelVijf = wx.Choice(self.lines[1], 51, choices=sorted(choices), style=wx.BORDER_NONE, pos=(10,
|
||||
150), size=(100,
|
||||
26))
|
||||
self.lines[lineNumber].ledChannelVijf.Enable(self.lines[lineNumber].checkBox.GetValue())
|
||||
elif lineNumber == 1:
|
||||
self.lines[lineNumber].ledChannelVijf.Destroy()
|
||||
self.lines[lineNumber].ledChannelVijf = wx.Choice(self.lines[1], 51, choices=sorted(self.ledChannelList.values()), style=wx.BORDER_NONE, pos=(10,
|
||||
150), size=(100,
|
||||
26))
|
||||
self.lines[lineNumber].ledChannelVijf.Enable(False)
|
||||
if self.increaseChannelFromLedFour == True and channel not in (127, 255) and channel + 1 in self.ledChannelList:
|
||||
channel += 1
|
||||
if channel < 128:
|
||||
channelString = 'Input ' + str(channel + 1)
|
||||
else:
|
||||
channelString = 'Output ' + str(channel - 128 + 1)
|
||||
self.lines[lineNumber].ledChannelVijf.SetStringSelection(channelString)
|
||||
self.lines[lineNumber].ledChannelZes.SetStringSelection(channelString)
|
||||
self.lines[lineNumber].ledChannelZeven.SetStringSelection(channelString)
|
||||
self.lines[lineNumber].ledChannelAcht.SetStringSelection(channelString)
|
||||
return
|
||||
|
||||
def createLine(self, i):
|
||||
if os.name in mac_names:
|
||||
y = 3
|
||||
else:
|
||||
y = 4
|
||||
if i == 0:
|
||||
x = 80
|
||||
else:
|
||||
x = 10
|
||||
p = wx.Panel(self, size=(450, 260))
|
||||
p.Show(False)
|
||||
p.checkBox = wx.CheckBox(p, 10 + i, ' Uncheck to remove', pos=(10, 0), size=(150,
|
||||
20))
|
||||
p.SetPosition((10 + 450 * i, 10))
|
||||
ledChannels = sorted(self.ledChannelList.values())
|
||||
ledFunctions = sorted(vuLedFunctions.values())
|
||||
print mytime.displayTime(), 'ucVU.vM.cL.1c', ledFunctions
|
||||
p.ledChannelEen = wx.Choice(p, 20 + i, choices=ledChannels, style=wx.BORDER_NONE, pos=(x, 30), size=(100,
|
||||
26))
|
||||
p.ledChannelTwee = wx.Choice(p, 50 + i, choices=ledChannels, style=wx.BORDER_NONE, pos=(x, 60), size=(100,
|
||||
26))
|
||||
p.ledChannelDrie = wx.Choice(p, 30 + i, choices=ledChannels, style=wx.BORDER_NONE, pos=(x, 90), size=(100,
|
||||
26))
|
||||
p.ledChannelVier = wx.Choice(p, 40 + i, choices=ledChannels, style=wx.BORDER_NONE, pos=(x, 120), size=(100,
|
||||
26))
|
||||
p.ledChannelVijf = wx.Choice(p, 50 + i, choices=ledChannels, style=wx.BORDER_NONE, pos=(x, 150), size=(100,
|
||||
26))
|
||||
p.ledChannelZes = wx.Choice(p, 60 + i, choices=ledChannels, style=wx.BORDER_NONE, pos=(x, 180), size=(100,
|
||||
26))
|
||||
p.ledChannelZeven = wx.Choice(p, 70 + i, choices=ledChannels, style=wx.BORDER_NONE, pos=(x, 210), size=(100,
|
||||
26))
|
||||
p.ledChannelAcht = wx.Choice(p, 80 + i, choices=ledChannels, style=wx.BORDER_NONE, pos=(x, 240), size=(100,
|
||||
26))
|
||||
p.ledFunctionEen = wx.Choice(p, 20 + i, choices=ledFunctions, style=wx.BORDER_NONE, pos=(110 + x, 30), size=(150,
|
||||
26))
|
||||
p.ledFunctionTwee = wx.Choice(p, 50 + i, choices=ledFunctions, style=wx.BORDER_NONE, pos=(110 + x, 60), size=(150,
|
||||
26))
|
||||
p.ledFunctionDrie = wx.Choice(p, 30 + i, choices=ledFunctions, style=wx.BORDER_NONE, pos=(110 + x, 90), size=(150,
|
||||
26))
|
||||
p.ledFunctionVier = wx.Choice(p, 40 + i, choices=ledFunctions, style=wx.BORDER_NONE, pos=(110 + x, 120), size=(150,
|
||||
26))
|
||||
p.ledFunctionVijf = wx.Choice(p, 50 + i, choices=ledFunctions, style=wx.BORDER_NONE, pos=(110 + x, 150), size=(150,
|
||||
26))
|
||||
p.ledFunctionZes = wx.Choice(p, 60 + i, choices=ledFunctions, style=wx.BORDER_NONE, pos=(110 + x, 180), size=(150,
|
||||
26))
|
||||
p.ledFunctionZeven = wx.Choice(p, 70 + i, choices=ledFunctions, style=wx.BORDER_NONE, pos=(110 + x, 210), size=(150,
|
||||
26))
|
||||
p.ledFunctionAcht = wx.Choice(p, 80 + i, choices=ledFunctions, style=wx.BORDER_NONE, pos=(110 + x, 240), size=(150,
|
||||
26))
|
||||
p.checkBox.SetValue(0)
|
||||
p.checkBox.Enable(True)
|
||||
if i == 0:
|
||||
p.checkBox.SetValue(1)
|
||||
p.checkBox.Show(False)
|
||||
channelString = 'Led nr '
|
||||
p.inputGainSourceLabel = wx.StaticText(p, -1, 'LED 1', pos=(0, 30 + y))
|
||||
p.inputGainSourceLabel2 = wx.StaticText(p, -1, 'LED 2', pos=(0, 60 + y))
|
||||
p.inputDSPSourceLabel = wx.StaticText(p, -1, 'LED 3', pos=(0, 90 + y))
|
||||
p.inputDelaySourceLabel = wx.StaticText(p, -1, 'LED 4', pos=(0, 120 + y))
|
||||
p.inputRoutingOutputSourceLabel = wx.StaticText(p, -1, 'LED 5', pos=(0, 150 + y))
|
||||
p.inputRoutingOutputSourceLabel2 = wx.StaticText(p, -1, 'LED 6', pos=(0, 180 + y))
|
||||
p.inputRoutingOutputSourceLabel2 = wx.StaticText(p, -1, 'LED 7', pos=(0, 210 + y))
|
||||
p.inputRoutingOutputSourceLabel2 = wx.StaticText(p, -1, 'LED 8', pos=(0, 240 + y))
|
||||
p.key = None
|
||||
p.lineNumber = i
|
||||
self.Bind(wx.EVT_CHECKBOX, self.OnEnabled, id=10 + i)
|
||||
self.Bind(wx.EVT_CHOICE, self.OnSelectChannelEen, id=20 + i)
|
||||
self.Bind(wx.EVT_CHOICE, self.OnSelectChannelTwee, id=50 + i)
|
||||
self.lines[i] = p
|
||||
self.enable(i)
|
||||
if i:
|
||||
p.Show(True)
|
||||
else:
|
||||
p.Show(False)
|
||||
return
|
||||
|
||||
def OnSelectChannelEen(self, e):
|
||||
i = e.GetId() - 20
|
||||
if i == 0:
|
||||
return
|
||||
channelString = self.lines[i].ledChannelEen.GetStringSelection()
|
||||
if channelString == 'All Inputs':
|
||||
channel = 127
|
||||
elif channelString == 'All Outputs':
|
||||
channel = 255
|
||||
elif channelString.find('Output') >= 0:
|
||||
channel = int(channelString.replace('Output', '').strip()) + 127
|
||||
elif channelString.find('Input') >= 0:
|
||||
channel = int(channelString.replace('Input', '').strip()) - 1
|
||||
self.lines[1].val[3] = channel
|
||||
self.setChannelChoices(1)
|
||||
return
|
||||
|
||||
def OnSelectChannelTwee(self, e):
|
||||
i = e.GetId() - 50
|
||||
if i == 0:
|
||||
return
|
||||
channelString = self.lines[i].ledChannelVijf.GetStringSelection()
|
||||
channelString2 = self.lines[i].ledChannelEen.GetStringSelection()
|
||||
if channelString == channelString2:
|
||||
self.lines[1].val[1] &= 127
|
||||
else:
|
||||
self.lines[1].val[1] |= 128
|
||||
self.setChannelChoices(1)
|
||||
return
|
||||
|
||||
def enable(self, i):
|
||||
val = self.lines[i].checkBox.GetValue()
|
||||
if i == 0:
|
||||
val = False
|
||||
self.lines[i].ledFunctionEen.Enable(val)
|
||||
self.lines[i].ledFunctionTwee.Enable(val)
|
||||
self.lines[i].ledFunctionDrie.Enable(val)
|
||||
self.lines[i].ledFunctionVier.Enable(val)
|
||||
self.lines[i].ledFunctionVijf.Enable(val)
|
||||
self.lines[i].ledFunctionZes.Enable(val)
|
||||
self.lines[i].ledFunctionZeven.Enable(val)
|
||||
self.lines[i].ledFunctionAcht.Enable(val)
|
||||
self.lines[i].ledChannelEen.Enable(val)
|
||||
self.lines[i].ledChannelTwee.Enable(False)
|
||||
self.lines[i].ledChannelDrie.Enable(False)
|
||||
self.lines[i].ledChannelVier.Enable(False)
|
||||
self.lines[i].ledChannelVijf.Enable(False)
|
||||
self.lines[i].ledChannelZes.Enable(False)
|
||||
self.lines[i].ledChannelZeven.Enable(False)
|
||||
self.lines[i].ledChannelAcht.Enable(False)
|
||||
return
|
||||
|
||||
def OnEnabled(self, e):
|
||||
print mytime.displayTime(), 'uca.OnEnabled'
|
||||
i = e.GetId() - 10
|
||||
if i == 0:
|
||||
return
|
||||
self.enable(i)
|
||||
t = self.lines[i]
|
||||
s = self.lines[0]
|
||||
t.ledFunctionEen.SetStringSelection(s.ledFunctionEen.GetStringSelection())
|
||||
t.ledFunctionTwee.SetStringSelection(s.ledFunctionTwee.GetStringSelection())
|
||||
t.ledFunctionDrie.SetStringSelection(s.ledFunctionDrie.GetStringSelection())
|
||||
t.ledFunctionVier.SetStringSelection(s.ledFunctionVier.GetStringSelection())
|
||||
t.ledFunctionVijf.SetStringSelection(s.ledFunctionVijf.GetStringSelection())
|
||||
t.ledFunctionZes.SetStringSelection(s.ledFunctionZes.GetStringSelection())
|
||||
return
|
||||
|
||||
def getSourceKey(self, str):
|
||||
for key in vuLedFunctions:
|
||||
if vuLedFunctions[key] == str:
|
||||
print mytime.displayTime(), 'uca.found key for', str, '->', key
|
||||
return key
|
||||
|
||||
print mytime.displayTime(), 'uca.did not find key for', str, '-> None'
|
||||
return 0
|
||||
|
||||
def evaluateLine(self, line):
|
||||
if line.lineNumber == 0:
|
||||
return
|
||||
else:
|
||||
if self.lines[1].checkBox.GetValue() == False:
|
||||
return
|
||||
ledFunctions = {}
|
||||
ledFunctions[0] = self.getSourceKey(line.ledFunctionEen.GetStringSelection())
|
||||
ledFunctions[1] = self.getSourceKey(line.ledFunctionTwee.GetStringSelection())
|
||||
ledFunctions[2] = self.getSourceKey(line.ledFunctionDrie.GetStringSelection())
|
||||
ledFunctions[3] = self.getSourceKey(line.ledFunctionVier.GetStringSelection())
|
||||
ledFunctions[4] = self.getSourceKey(line.ledFunctionVijf.GetStringSelection())
|
||||
ledFunctions[5] = self.getSourceKey(line.ledFunctionZes.GetStringSelection())
|
||||
ledFunctions[6] = self.getSourceKey(line.ledFunctionZeven.GetStringSelection())
|
||||
ledFunctions[7] = self.getSourceKey(line.ledFunctionAcht.GetStringSelection())
|
||||
ledValue = {}
|
||||
ledValue[0] = ledFunctions[0] | (ledFunctions[1] & 7) << 5
|
||||
ledValue[1] = (ledFunctions[1] & 24) >> 3 | (ledFunctions[2] & 31) << 2 | (ledFunctions[3] & 1) << 7
|
||||
ledValue[2] = (ledFunctions[3] & 30) >> 1 | (ledFunctions[4] & 15) << 4
|
||||
ledValue[3] = (ledFunctions[4] & 16) >> 4 | (ledFunctions[5] & 31) << 1 | (ledFunctions[6] & 3) << 6
|
||||
ledValue[4] = (ledFunctions[6] & 28) >> 2 | (ledFunctions[7] & 31) << 3
|
||||
structID = self.uiIndex
|
||||
channelString = line.ledChannelVijf.GetStringSelection()
|
||||
channelString2 = line.ledChannelEen.GetStringSelection()
|
||||
if channelString != channelString2:
|
||||
structID |= 128
|
||||
channel = line.val[3]
|
||||
try:
|
||||
sendString = '' + chr(self.uiNumber)
|
||||
sendString += chr(structID)
|
||||
sendString += chr(ledValue[0])
|
||||
sendString += chr(channel)
|
||||
sendString += chr(ledValue[1])
|
||||
sendString += chr(ledValue[2])
|
||||
sendString += chr(ledValue[3])
|
||||
sendString += chr(ledValue[4])
|
||||
mys = 'String: '
|
||||
for c in sendString:
|
||||
mys += hex(ord(c)) + ':'
|
||||
|
||||
print mytime.displayTime(), 'Built string for VU meter:', mys[:-1]
|
||||
return sendString
|
||||
except:
|
||||
print mytime.displayTime(), 'uca.ar.eL.failed to build string'
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
|
||||
class vuMeterSelectPanel(wx.Panel):
|
||||
|
||||
def __init__(self, parent, frame, uiNumber, panelName):
|
||||
wx.Panel.__init__(self, parent, size=(964, 500))
|
||||
self.parent = parent
|
||||
self.frame = frame
|
||||
self.name = panelName
|
||||
self.p = wx.Panel(self)
|
||||
self.p.SetSize((924, 500))
|
||||
self.p.SetPosition((0, 0))
|
||||
self.nb = wx.Choicebook(self.p, -1, pos=(0, 0))
|
||||
self.nb.Bind(wx.EVT_CHOICEBOOK_PAGE_CHANGED, self.onTabChange)
|
||||
self.nb.SetSize((914, 300))
|
||||
self.subPanels = {}
|
||||
self.numberOfActiveVUMeters = 0
|
||||
self.sortedListOfPanels = []
|
||||
if self.name == 'VU LED functions':
|
||||
for name in sorted(vuLedFunctions.values()):
|
||||
for i in range(32):
|
||||
if vuLedFunctions[i] == name:
|
||||
self.sortedListOfPanels.append(i)
|
||||
panelName = vuLedFunctions[i]
|
||||
self.subPanels[i] = vuMeterLeds(self.nb, frame, i, panelName, self)
|
||||
self.nb.AddPage(self.subPanels[i], panelName)
|
||||
|
||||
self.countLedFunctionKeys()
|
||||
else:
|
||||
invVuMeters = {}
|
||||
for k in self.frame.frame.vuMeters:
|
||||
invVuMeters[self.frame.frame.vuMeters[k]] = k
|
||||
|
||||
for vuMeterName in sorted(self.frame.frame.vuMeters.values()):
|
||||
i = invVuMeters[vuMeterName]
|
||||
uiKeys = getKeys(frame, 188, None, i)
|
||||
if len(uiKeys) == 0:
|
||||
continue
|
||||
self.sortedListOfPanels.append(i)
|
||||
self.numberOfActiveVUMeters += 1
|
||||
self.subPanels[i] = vuMeter(self.nb, frame, i, vuMeterName, self)
|
||||
self.nb.AddPage(self.subPanels[i], vuMeterName)
|
||||
|
||||
self.add = wx.Button(self.p, 5, 'Add', pos=(800, 330), size=(70, 20))
|
||||
self.Bind(wx.EVT_BUTTON, self.OnAdd, id=5)
|
||||
self.nb.Layout()
|
||||
self.initFinished = False
|
||||
self.Show(True)
|
||||
return
|
||||
|
||||
def initMe(self, force=False):
|
||||
if self.IsShown() == False and force == False:
|
||||
return
|
||||
if self.initFinished == True:
|
||||
return 0
|
||||
print mytime.displayTime(), 'ucv.initMe vuMeterSelectPanel'
|
||||
for i in self.sortedListOfPanels:
|
||||
p = self.subPanels[i]
|
||||
p.initMe(force)
|
||||
force = False
|
||||
|
||||
self.initFinished = True
|
||||
return
|
||||
|
||||
def OnAdd(self, e):
|
||||
i = self.numberOfActiveVUMeters
|
||||
self.subPanels[i] = vuMeter(self.nb, self.frame, i, self.frame.frame.vuMeters[i], self)
|
||||
self.nb.AddPage(self.subPanels[i], self.frame.frame.vuMeters[i])
|
||||
self.nb.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.onTabChange)
|
||||
self.numberOfActiveVUMeters += 1
|
||||
self.nb.ChangeSelection(i)
|
||||
self.subPanels[i].initMe(True)
|
||||
return
|
||||
|
||||
def countLedFunctionKeys(self):
|
||||
self.numberOfLedFunctionKeys = 0
|
||||
for subPanel in self.subPanels.values():
|
||||
self.numberOfLedFunctionKeys += subPanel.countLedFunctionKeys()
|
||||
|
||||
print mytime.displayTime(), 'number of led function keys:', self.numberOfLedFunctionKeys
|
||||
return self.numberOfLedFunctionKeys
|
||||
|
||||
def onTabChange(self, e):
|
||||
print mytime.displayTime(), 'uc.cp.OnTabChange', self.name
|
||||
pageNumber = e.Selection
|
||||
page = self.nb.GetPage(pageNumber)
|
||||
force = True
|
||||
try:
|
||||
page.initMe(force)
|
||||
force = False
|
||||
except:
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
|
||||
e.Skip()
|
||||
return
|
||||
|
||||
def evaluateLine(self, line):
|
||||
return self.ledFunctionPanel.evaluateLine
|
||||
|
||||
|
||||
|
||||
# okay decompiling pycode/user_config_vu.pyc
|
||||
@@ -0,0 +1,10 @@
|
||||
# Linux-Stub fuer pywin32 (nur die von der App genutzten Funktionen)
|
||||
import os
|
||||
def GetCurrentProcessId():
|
||||
return os.getpid()
|
||||
def OpenProcess(access, inherit, pid):
|
||||
return 0 # Dummy-Handle
|
||||
def GetLogicalDriveStrings():
|
||||
return '' # keine Windows-Laufwerksbuchstaben auf Linux
|
||||
def GetVersionEx():
|
||||
return (0, 0, 0, 2, '')
|
||||
@@ -0,0 +1,2 @@
|
||||
# Linux-Stub
|
||||
PROCESS_ALL_ACCESS = 2035711 # 0x1F0FFF
|
||||
@@ -0,0 +1,10 @@
|
||||
# Linux-Stub
|
||||
DRIVE_UNKNOWN = 0
|
||||
DRIVE_NO_ROOT_DIR = 1
|
||||
DRIVE_REMOVABLE = 2
|
||||
DRIVE_FIXED = 3
|
||||
DRIVE_REMOTE = 4
|
||||
DRIVE_CDROM = 5
|
||||
DRIVE_RAMDISK = 6
|
||||
def GetDriveType(path):
|
||||
return DRIVE_UNKNOWN
|
||||
@@ -0,0 +1,9 @@
|
||||
# Linux-Stub. Prozess-Prioritaet -> no-op (optional os.nice).
|
||||
IDLE_PRIORITY_CLASS = 64
|
||||
BELOW_NORMAL_PRIORITY_CLASS = 16384
|
||||
NORMAL_PRIORITY_CLASS = 32
|
||||
ABOVE_NORMAL_PRIORITY_CLASS = 32768
|
||||
HIGH_PRIORITY_CLASS = 128
|
||||
REALTIME_PRIORITY_CLASS = 256
|
||||
def SetPriorityClass(handle, cls):
|
||||
return None
|
||||
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
# Startet die native App aus ORIGINAL-macOS-Bytecode (echtes wxGTK 3.0, KEIN Wine)
|
||||
# mit X11 + Ethernet + optional seriell.
|
||||
# ./run.sh GUI + Ethernet-Amps (Host-Netz)
|
||||
# SERIAL_DEV=/dev/ttyUSB0 ./run.sh zusaetzlich seriellen Port
|
||||
# NET=bridge ./run.sh ohne Host-Netz (dann keine LAN-Amps)
|
||||
set -e
|
||||
IMAGE="va-remotecontrol:native-mac"
|
||||
SERIAL_DEV="${SERIAL_DEV:-/dev/ttyUSB0}"
|
||||
|
||||
xhost +local: >/dev/null 2>&1 || true
|
||||
|
||||
DEV=()
|
||||
[ -e "$SERIAL_DEV" ] && DEV+=(--device "$SERIAL_DEV") && echo "[run] $SERIAL_DEV durchgereicht"
|
||||
|
||||
if [ "${NET:-host}" = "host" ]; then
|
||||
NETARGS=(--network host) # LAN direkt (Amp-Broadcast/Discovery)
|
||||
else
|
||||
NETARGS=()
|
||||
echo "[run] ohne Host-Netz - LAN-Amps nicht erreichbar"
|
||||
fi
|
||||
|
||||
# --ipc=host: teilt IPC-Namespace -> X-MIT-SHM funktioniert (sonst BadShmSeg
|
||||
# unter XWayland/Wayland-Compositoren mit eigenem Container-IPC).
|
||||
docker run --rm -it \
|
||||
"${NETARGS[@]}" \
|
||||
--ipc=host \
|
||||
-e DISPLAY="$DISPLAY" \
|
||||
-e SERIAL_DEV="$SERIAL_DEV" \
|
||||
-e VA_SVG_WINPATH="${VA_SVG_WINPATH:-}" \
|
||||
-v /tmp/.X11-unix:/tmp/.X11-unix:rw \
|
||||
"${DEV[@]}" \
|
||||
--name va-native-mac \
|
||||
"$IMAGE"
|
||||
|
||||
xhost -local: >/dev/null 2>&1 || true
|
||||
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 121 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 896 B |
|
After Width: | Height: | Size: 977 B |
|
After Width: | Height: | Size: 772 B |
|
After Width: | Height: | Size: 813 B |
|
After Width: | Height: | Size: 168 B |
|
After Width: | Height: | Size: 337 B |
|
After Width: | Height: | Size: 921 B |
|
After Width: | Height: | Size: 911 B |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 238 B |
|
After Width: | Height: | Size: 623 B |
|
After Width: | Height: | Size: 809 B |
|
After Width: | Height: | Size: 607 B |
|
After Width: | Height: | Size: 173 B |
|
After Width: | Height: | Size: 885 B |
|
After Width: | Height: | Size: 768 B |
|
After Width: | Height: | Size: 753 B |
|
After Width: | Height: | Size: 737 B |
|
After Width: | Height: | Size: 428 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 947 B |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 934 B |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 921 B |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 947 B |