Files
maikandClaude Opus 4.8 a7c93fa266 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>
2026-08-20 19:57:01 +02:00

3712 lines
124 KiB
Python

# Source Generated with Decompyle++
# File: one_unit.pyc (Python 2.6)
import sys
import mytime
print mytime.displayTime(), 'ou.Python interpreter version:', sys.version_info
mac_names = 'posix'
import os
import wx
print mytime.displayTime(), 'ou.wxPython version: ' + str(wx.VERSION_STRING)
if os.name in mac_names:
app = wx.App(0)
else:
app = wx.PySimpleApp(0)
import ConfigParser
import os.path as os
import cPickle
import child_unit
import data_model
import threading
import platform
import traceback
import protocol
import dialog
import codecs
import base64
import StringIO
import cStringIO
import socket
import server
import shutil
import d_protocol
import zipfile
import future
import inspect
from definitions import *
if sys.maxint == 0x7FFFFFFFFFFFFFFFL:
_64b = True
enablePsyco = False
else:
_64b = False
enablePsyco = False
tab = '\t'
indent = ' '
dindent = indent + indent
if os.name in mac_names:
newline = '\n'
enablePsyco = False
else:
newline = '\r\n'
if enablePsyco:
import psyco
DEFAULT_GROUP_TYPES = {
'Carbon Copy': 'Carbon Copy',
'Advanced': 'Advanced',
'Relative': 'Relative',
'Mute': 'Mute',
'EQ Panel': '1_1_eq',
'Group EQ (MK2 Only)': '1_10_eq' }
DEFAULT_GROUP_LINKS = {
'EQ Panel': 'config',
'Group EQ (MK2 Only)': 'config' }
productList = {
'1_10_51': 'SBD44',
'1_10_37': 'XM24',
'1_10_16': '1800B',
'1_10_18': 'MTX88',
'1_10_30': 'PLP204',
'1_10_31': 'PLP428',
'1_10_66': 'HSE',
'1_11_16': '1800B Signature',
'1_11_30': 'PLP204SV',
'1_11_31': 'PLP428 Signature' }
def tryYield():
try:
app.Yield()
except:
pass
def lowPriority():
''' Set the priority of the process to below-normal.'''
while not hasattr(app, 'main_frame'):
mytime.sleep(0.01)
while not hasattr(app.main_frame, 'network_window'):
mytime.sleep(0.01)
while app.main_frame.network_window.painted == False:
mytime.sleep(0.01)
mytime.sleep(0.1)
try:
sys.getwindowsversion()
except AttributeError:
isWindows = False
isWindows = True
if isWindows:
import win32api
import win32process
import win32con
pid = win32api.GetCurrentProcessId()
handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, True, pid)
win32process.SetPriorityClass(handle, win32process.BELOW_NORMAL_PRIORITY_CLASS)
else:
os.nice(10)
def printFunctions(thisClass, spacing = ''):
methods = inspect.getmembers(thisClass, predicate = inspect.ismethod)
for method in methods:
print spacing + str(method)
def areYouSure(text):
res = wx.MessageBox(text, 'Please Confirm', wx.OK | wx.CANCEL)
if res == wx.OK:
return True
return False
def all_subclasses(cls):
return []([ s for c in cls.__subclasses__() for s in all_subclasses(c) ])
def printChildren(cls, spacing = ''):
print spacing + 'Class', cls.__name__
printFunctions(cls, spacing + ' ')
for d in cls.__dict__:
print mytime.displayTime(), ' ', d
classes = all_subclasses(cls)
for thisClass in classes:
printChildren(thisClass, spacing + ' ')
def getMacList(groupID):
if groupID not in app.groups:
return []
maclist = app.groups[groupID].keys()
res = []
for mac in maclist:
if mac.startswith('Group '):
try:
groupNumber = mac.replace('Group ', '')
for unitMac in getMacList(groupNumber):
if unitMac not in res:
res.append(unitMac)
continue
groupID not in app.groups
except:
traceback.print_exc(file = sys.stdout)
continue
continue
res.append(mac)
return res
def getLeadingMAC(groupID):
leading_mac = None
maclist = getMacList(groupID)
if len(maclist) == 0:
return None
for mac in maclist:
try:
if app.groups[groupID][mac][2] in (0, '0', 'Master', 'Reference'):
leading_mac = mac
except:
continue
continue
if leading_mac == None:
leading_mac = maclist[0]
if leading_mac[:5] == 'Group':
leading_mac = getLeadingMAC(leading_mac[5:].strip())
return leading_mac
def getModelNumber(mac):
if mac[:4] == 'DEMO':
return '_0'
if mac[:4] == 'VN::':
return '_0'
try:
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_MODEL_NUMBER, 0, 0)
model_number = app.server.peers.get(key, mac)
if model_number == None:
model_number = ''
else:
model_number = '_' + str(int(model_number))
except:
mac[:4] == 'VN::'
mac[:4] == 'DEMO'
traceback.print_exc(file = sys.stdout)
model_number = ''
return model_number
def getConfig(mac):
if mac[:4] == 'DEMO':
return 'OK'
try:
config = app.server.peers.units[mac].process.conn.full_config
except:
mac[:4] == 'DEMO'
config = None
return config
def getCurrentUser(mac):
if mac[:4] == 'DEMO':
current_user = protocol.uUser
if app.demo_developer_password == app.check_password:
current_user = protocol.uDeveloper
if app.demo_admin_password == app.check_password:
current_user = protocol.uAdmin
return current_user
userkey = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CURRENT_USER, 0, 0)
try:
current_user = int(app.server.peers.get(userkey, mac))
except:
mac[:4] == 'DEMO'
current_user = None
return current_user
def getLaunchKey(mac):
try:
current_user = getCurrentUser(mac)
model_number = getModelNumber(mac)
launchKey = None
ulstring = None
print 'ou.making launch key for', mac, 'user:', current_user
try:
if app.supported_units[app.main_frame.peers.units[mac].type] == 'factory':
launchKey = mac + '|' + 'factory'
return launchKey
except:
pass
if mac[:4] == 'VN::':
model_number = '0'
ulstring = '_u'
if current_user == protocol.uUser:
ulstring = '_u'
if current_user == protocol.uAdmin:
ulstring = '_a'
if current_user == protocol.uDeveloper:
ulstring = '_d'
if current_user == protocol.uFactory:
ulstring = '_d'
if current_user == protocol.uLocked:
ulstring = '_l'
ref = app.main_frame.peers.units[mac].type + model_number + ulstring
launchKey = mac + '|' + ref
print mytime.displayTime(), 'ou.testing launch key', launchKey
if os.path.exists(app.cwd + '/' + app.skin_path + '/' + ref + '/default.cfg'):
print mytime.displayTime(), 'ou.Found launch key', launchKey
return launchKey
if model_number != '_0':
ref = app.main_frame.peers.units[mac].type + '_0' + ulstring
launchKey = mac + '|' + ref
print mytime.displayTime(), 'ou.testing launch key', launchKey
if os.path.exists(app.cwd + '/' + app.skin_path + '/' + ref + '/default.cfg'):
print mytime.displayTime(), 'ou.Found launch key', launchKey
return launchKey
ref = app.main_frame.peers.units[mac].type + model_number + '_u'
launchKey = mac + '|' + ref
print mytime.displayTime(), 'ou.testing launch key', launchKey
if os.path.exists(app.cwd + '/' + app.skin_path + '/' + ref + '/default.cfg'):
print mytime.displayTime(), 'ou.Found launch key', launchKey
return launchKey
ref = app.main_frame.peers.units[mac].type + model_number
launchKey = mac + '|' + ref
print mytime.displayTime(), 'ou.testing launch key', launchKey
if os.path.exists(app.cwd + '/' + app.skin_path + '/' + ref + '/default.cfg'):
print mytime.displayTime(), 'ou.Found launch key', launchKey
return launchKey
if model_number != '':
ref = app.main_frame.peers.units[mac].type + ulstring
launchKey = mac + '|' + ref
print mytime.displayTime(), 'ou.testing launch key', launchKey
if os.path.exists(app.cwd + '/' + app.skin_path + '/' + ref + '/default.cfg'):
print mytime.displayTime(), 'ou.Found launch key', launchKey
return launchKey
if model_number != '_0':
ref = app.main_frame.peers.units[mac].type + '_0'
launchKey = mac + '|' + ref
print mytime.displayTime(), 'ou.testing launch key', launchKey
if os.path.exists(app.cwd + '/' + app.skin_path + '/' + ref + '/default.cfg'):
print mytime.displayTime(), 'ou.Found launch key', launchKey
return launchKey
ref = app.main_frame.peers.units[mac].type
launchKey = mac + '|' + ref
print mytime.displayTime(), 'ou.testing launch key', launchKey
if os.path.exists(app.cwd + '/' + app.skin_path + '/' + ref + '/default.cfg'):
print mytime.displayTime(), 'ou.Found launch key', launchKey
return launchKey
print mytime.displayTime(), 'ou.No launch key found!!!! defaulting to ', launchKey
return launchKey
except:
print mytime.displayTime(), 'ou.Failed to make launch key for', mac
traceback.print_exc(file = sys.stdout)
return ''
def raiseChildren(type = None):
children = app.main_frame.network_window.children.values()
clickTimeChildren = { }
for c in children:
try:
clickTimeChildren[c.clickTime] = c
except:
continue
continue
done = []
for t in sorted(clickTimeChildren.keys()):
c = clickTimeChildren[t]
try:
if c.windowReference.find(type) < 0:
continue
except:
pass
if c in done:
continue
try:
if c.isClosed == False:
print mytime.displayTime(), 'Raising', c.windowReference
c.shouldBeVisible = True
c.isVisible = False
c.raiseOrLower()
c.Show(True)
else:
print c.windowReference, 'is closed'
done.append(c)
except:
continue
continue
def restoreChildren(type = None):
children = app.main_frame.network_window.children.values()
clickTimeChildren = { }
for c in children:
try:
clickTimeChildren[c.clickTime] = c
except:
continue
continue
done = []
for t in sorted(clickTimeChildren.keys()):
c = clickTimeChildren[t]
try:
if c.windowReference.find(type) < 0:
continue
except:
pass
if c in done:
continue
try:
if c.isClosed == False and c.shouldBeVisible == True:
c.isVisible = False
c.raiseOrLower()
c.Show(True)
else:
print c.windowReference, 'is closed'
done.append(c)
except:
continue
continue
def moveChildren(delta):
children = app.main_frame.network_window.children.values()
clickTimeChildren = { }
for c in children:
try:
clickTimeChildren[c.clickTime] = c
except:
continue
continue
done = []
for t in sorted(clickTimeChildren.keys()):
c = clickTimeChildren[t]
if c in done:
continue
try:
if c.shouldBeVisible == True:
c.SetPosition(c.GetPosition() + delta)
c.isVisible = False
c.raiseOrLower()
c.Show(True)
done.append(c)
except:
continue
continue
def hideChildren(skip = None, type = None):
done = []
for c in app.main_frame.network_window.children.values():
try:
if skip != None and c.windowReference.find(skip) >= 0:
continue
if type != None and c.windowReference.find(type) < 0:
continue
except:
pass
if c in done:
continue
try:
c.shouldBeVisible = False
c.raiseOrLower()
done.append(c)
except:
continue
continue
def closeChildren(type = None, skip = None):
done = []
for key in app.main_frame.network_window.children.keys():
try:
c = app.main_frame.network_window.children[key]
except:
continue
try:
if c.windowReference.find(type) < 0:
continue
except:
pass
try:
if skip != None and c.windowReference.find(skip) >= 0:
continue
except:
pass
if c in done:
continue
try:
c.shouldBeVisible = False
c.close()
done.append(c)
except:
continue
continue
def executeLaunch(mac, keepOpen = None, preLaunching = False):
if app.use_graphical_nww == True:
if (app.hideChildrenOnLaunch == True or wx.GetKeyState(wx.WXK_SHIFT) == False or app.hideChildrenOnLaunch == False) and wx.GetKeyState(wx.WXK_SHIFT) == True:
hideChildren(skip = keepOpen)
else:
restoreChildren()
wx.CallAfter(launchLater, mac, preLaunching)
mytime.sleep(0.01)
def launchLater(mac, preLaunching = False):
current_user = getCurrentUser(mac)
if current_user == None:
print mytime.displayTime() + ' ou.eL. aborting, current user unknown'
offset = app.main_frame.network_window.getOffset(mac)
model_number = getModelNumber(mac)
launchKey = getLaunchKey(mac)
if launchKey in app.main_frame.network_window.children and app.main_frame.network_window.children[launchKey] == 'Launching':
print 'ou.lL.Duplicate launch, aborting with key', launchKey
return None
try:
app.main_frame.network_window.children[launchKey].Show(True)
print mytime.displayTime(), 'ou.lL.Restoring panel', launchKey
app.main_frame.network_window.children[launchKey].shouldBeVisible = True
app.main_frame.network_window.children[mac] = app.main_frame.network_window.children[launchKey]
app.main_frame.network_window.children[mac].clickTime = mytime.clock()
app.main_frame.network_window.children[mac].Raise()
app.main_frame.network_window.children[mac].isClosed = False
app.main_frame.network_window.children[mac].isVisible = True
if os.name not in mac_names:
app.main_frame.network_window.children[mac].Iconize(False)
wx.CallAfter(app.main_frame.network_window.children[launchKey].current_view.renderAll)
except:
app.main_frame.network_window.children[launchKey] == 'Launching'
app.main_frame.network_window.children[launchKey] = 'Launching'
fullType = app.main_frame.peers.units[mac].type
if fullType.count('_') == 2:
fullType += model_number
print mytime.displayTime(), 'ou.lL.Launching with Key:', launchKey, 'type:', fullType
app.main_frame.network_window.children[mac] = child_unit.Child_frame(app.main_frame, None, -1, '', False)
app.main_frame.network_window.children[mac].init_1(app.main_frame.peers.units[mac].type + model_number, offset, mac, launchKey = launchKey, preLaunching = preLaunching)
if app.use_graphical_nww == True:
app.main_frame.network_window.updateAllWindowLists()
def sortGroupPriority(values):
def helper(x):
if x[0] == 'G':
return (0, x)
return (1, x)
values.sort(key = helper)
return values
def deleteVirtualUnit(mac):
if app.softwareLock:
future.Future(0.1, self.deleteVirtualUnit, mac)
return None
app.softwareLock = True
print mytime.displayTime(), 'ou.dVU.Deleting', mac
config = app.groupconfig
try:
del app.main_frame.peers.units[mac]
except:
traceback.print_exc(file = sys.stdout)
try:
del app.server.peers.units[mac]
except:
traceback.print_exc(file = sys.stdout)
for group in app.groups:
groupMembers = app.groups[group]
try:
del groupMembers[mac]
config.set(group, 'members', groupMembers)
except:
continue
traceback.print_exc(file = sys.stdout)
continue
file = os.path.join(app.asys_config_path, 'grouping.cfg')
try:
groupconfigfile = open(file, 'wb')
config.write(groupconfigfile)
groupconfigfile.close()
except:
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()
app.softwareLock = False
return False
print mytime.displayTime(), 'cg.sg.Saved Group', file
app.softwareLock = False
def updateWindowList(parent):
if app.application_stopping == True:
return None
wx.CallAfter(laterUpdateWindowList, parent)
def laterUpdateWindowList(parent):
try:
windowMenu = parent.windowMenu
actualWindows = app.main_frame.network_window.children
for menuItemId in windowMenu.GetMenuItems().keys():
windowMenu.Destroy(menuItemId)
windowMenu.Append(7000, 'Main', 'Main Network Window')
windowMenu.Append(7001, 'Show All Units', 'Show all Unit Panels')
windowMenu.Append(7002, 'Show All Groups', 'Show all Group Panels')
windowMenu.Append(7005, 'Hide All Units', 'Hide all Unit Panels')
windowMenu.Append(7006, 'Hide All Groups', 'Hide all Group Panels')
windowMenu.Append(7003, 'Close All Units', 'Close all Unit Panels')
windowMenu.Append(7004, 'Close All Groups', 'Close all Group Panels')
parent.Bind(wx.EVT_MENU, parent.OnSelectWindow, id = 7000)
parent.Bind(wx.EVT_MENU, parent.OnSelectWindow, id = 7001)
parent.Bind(wx.EVT_MENU, parent.OnSelectWindow, id = 7002)
parent.Bind(wx.EVT_MENU, parent.OnSelectWindow, id = 7003)
parent.Bind(wx.EVT_MENU, parent.OnSelectWindow, id = 7004)
parent.Bind(wx.EVT_MENU, parent.OnSelectWindow, id = 7005)
parent.Bind(wx.EVT_MENU, parent.OnSelectWindow, id = 7006)
i = 1
listedItems = []
for key in sortGroupPriority(actualWindows.keys()):
c = actualWindows[key]
try:
mac = c.active_unit.MAC
list = True
for label in listedItems:
if label.find(mac) >= 0:
list = False
break
continue
if list == False:
continue
name = c.active_unit.name
IP = c.active_unit.IP
windowReference = c.windowReference
if windowReference.startswith('Unit'):
splitPos = windowReference.find('|')
if splitPos >= 0:
windowReference = windowReference[:splitPos]
menuLabel = windowReference + ' ' + name + ' (' + IP + ')'
elif windowReference.startswith('Group'):
splitPos = 6
group = windowReference[splitPos:].strip()
windowReference = windowReference + ': ' + app.group_names[group]
if app.group_enabled[group] == True:
menuLabel = windowReference
else:
menuLabel = windowReference + ' (Disabled)'
else:
print mytime.displayTime(), 'ng. I do not understand this window reference:', windowReference
menuLabel = windowReference
if c.isClosed == False:
windowMenu.Append(7700 + i, menuLabel, menuLabel)
listedItems.append(menuLabel)
parent.Bind(wx.EVT_MENU, parent.OnSelectWindow, id = 7700 + i)
i += 1
except:
continue
continue
except:
pass
def OnSelectWindow(parent, e):
id = e.GetId()
if id < 7700:
if id == 7000:
hideChildren()
if id == 7001:
raiseChildren(type = 'Unit')
if id == 7002:
raiseChildren(type = 'Group')
if id == 7005:
hideChildren(type = 'Unit')
if id == 7006:
hideChildren(type = 'Group')
if id == 7003:
closeChildren(type = 'Unit')
if id == 7004:
closeChildren(type = 'Group')
return None
label = parent.windowMenu.FindItemById(id).GetLabel()
switchToWindow(label)
parent.Raise()
def switchToWindow(label):
try:
if label.startswith('Unit:'):
label = label[6:]
mac = label[:label.find(' ')].strip()
if mac.find('|') > 0:
mac = mac[:mac.find('|')].strip()
if mac not in app.main_frame.peers.units:
return None
wx.CallAfter(launchLater, mac)
else:
windowReference = label[:label.find(':')]
try:
app.main_frame.network_window.children[windowReference].Show(True)
app.main_frame.network_window.children[windowReference].shouldBeVisible = True
app.main_frame.network_window.children[windowReference].isVisible = False
app.main_frame.network_window.children[windowReference].raiseOrLower()
except:
pass
except:
traceback.print_exc(file = sys.stdout)
def updateBootloaderDial(mac, msg, title = 'Progress', alwaysUpdate = True, statusInfo = infoStatusByText):
wx.CallAfter(immediateUpdateBootloaderDial, mac, msg, title, alwaysUpdate, statusInfo)
def immediateUpdateBootloaderDial(mac, msg, title = 'Progress', alwaysUpdate = True, statusInfo = infoStatusByText):
curframe = inspect.currentframe()
calframe = inspect.getouterframes(curframe, 2)
if mac not in app.bootloader_progress:
app.bootloader_progress[mac] = None
if mac not in app.bootloaderStatus:
app.bootloaderStatus[mac] = 0
app.bootloader_progress[mac] = msg
app.bootloaderStatus[mac] = statusInfo
if app.updatingBootloaderDial == True:
return None
app.updatingBootloaderDial = True
if msg == None:
app.updatingBootloaderDial = False
return None
try:
if (mytime.clock() - app.lastBootloaderDialUpdateTime > 1 or alwaysUpdate == True) and unicode(msg).strip() != app.bootloader_dial.infostring.strip():
app.lastBootloaderDialUpdateTime = mytime.clock()
app.bootloader_dial.Update(msg)
app.bootloader_dial.Show()
app.bootloader_dial.Raise()
except:
msg == None
app.updatingBootloaderDial == True
if app.application_stopping == True:
return None
try:
makeBootloaderDial(mac, msg, title)
app.bootloader_dial.Update(msg)
except:
traceback.print_exc(file = sys.stdout)
app.updatingBootloaderDial = False
class progressDialog(wx.Frame):
def __init__(self, parent, id, title, msg, OK_Only, OK_Enable, OK_Show, alwaysOnTop, mac):
if os.name in mac_names:
h = 100
else:
h = 120
style = wx.DEFAULT_FRAME_STYLE
if alwaysOnTop == True:
style |= wx.STAY_ON_TOP
wx.Frame.__init__(self, None, -1, title = title, size = (300, h), style = style)
self.parent = parent
p = wx.Panel(self)
self.msgText = wx.StaticText(p, -1, label = msg, pos = (10, 10))
self.infostring = msg
self.mac = mac
self.OKbutton = wx.Button(p, -1, 'OK', pos = (200, 45))
self.Bind(wx.EVT_BUTTON, self.onOK, self.OKbutton)
self.CenterOnScreen()
self.okEnabled = OK_Enable
self.showOK = OK_Show
if self.showOK == False:
self.OKbutton.Enable(False)
def onOK(self, e):
if self.okEnabled:
app.bootloader_progress[self.mac] = None
app.bootloaderStatus[self.mac] |= closedByUser
self.Destroy()
def Update(self, msg):
self.msgText.SetLabel(msg)
self.infostring = msg
def ShowOK(self, val):
self.OKbutton.Enable(val)
def EnableOK(self, val):
self.okEnabled = val
def makeBootloaderDial(mac, msg, title, alwaysOnTop = False):
if app.application_stopping == True:
return None
app.lastBootloaderDialUpdateTime = mytime.clock()
app.bootloader_dial = progressDialog(app.main_frame, -1, title, app.bootloader_progress[mac], OK_Only = True, OK_Enable = False, OK_Show = False, alwaysOnTop = alwaysOnTop, mac = mac)
pos = app.bootloader_dial.GetPosition()
size = app.bootloader_dial.GetSize()
app.bootloader_dial.SetPosition((pos[0], pos[1] - 200))
app.bootloader_dial.Show(True)
app.bootloader_dial.ShowOK(False)
app.bootloader_dial.Raise()
curframe = inspect.currentframe()
calframe = inspect.getouterframes(curframe, 2)
print mytime.displayTime() + ' ou.mbd.Started bootloader_dial for', app.bootloader_progress[mac], 'by', calframe[2][3], calframe[1][3]
def Walk(root, recurse = 0, pattern = '*', return_folders = 0):
import fnmatch
import os
import string
result = []
try:
names = os.listdir(root)
except os.error:
return result
if not pattern:
pass
pattern = '*'
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 (os.path.isfile(fullname) or return_folders) and os.path.isdir(fullname):
result.append(name)
continue
continue
continue
if recurse:
if os.path.isdir(fullname) and not os.path.islink(fullname):
result = result + Walk(fullname, recurse, pattern, return_folders)
not os.path.islink(fullname)
return result
DRIVE_TYPES = '\n0 Unknown\n1 No Root Directory\n2 Removable Disk\n3 Local Disk\n4 Network Drive\n5 Compact Disc\n6 RAM Disk\n'
def remove_install_remain_files(libDir):
try:
files = Walk(libDir, return_folders = True)
for file in files:
if file.endswith('.ffii') == True:
try:
os.remove(os.path.join(libDir, file))
print 'ou.rrf.2 Removed', os.path.join(libDir, file)
except:
pass
if file.startswith('tempzip_') == True:
try:
shutil.rmtree(file)
print 'ou.rrf.2 Removed', os.path.join(libDir, file)
except:
traceback.print_exc(file = sys.stdout)
continue
files = Walk(os.getcwd(), return_folders = True)
for file in files:
if file.endswith('.ffii') == True:
try:
os.remove(os.path.join(os.getcwd(), file))
print 'ou.rrf.2 Removed', os.path.join(os.getcwd(), file)
except:
pass
if file.startswith('tempzip_') == True:
try:
shutil.rmtree(file)
print 'ou.rrf.2 Removed', os.path.join(os.getcwd(), file)
except:
traceback.print_exc(file = sys.stdout)
continue
except:
traceback.print_exc(file = sys.stdout)
if os.name in mac_names or platform.version()[0] == '6':
return None
return None
class LAN_adapter:
def __init__(self, name):
self.name = name
self.IPv6 = None
self.IPv4 = None
self.subnet_mask = None
self.DHCP_enabled = 'Unknown'
self.MAC = None
self.description = 'None'
self.router = 'Unknown'
def check_interfaces(printInfo = False):
if printInfo:
print mytime.displayTime() + ' Network Hardware ports:'
if os.name in mac_names:
import subprocess
args = [
'networksetup',
'-listallhardwareports']
run = subprocess.Popen(args, stdout = subprocess.PIPE)
pfile = run.stdout
res = pfile.read()
pfile.close()
if printInfo:
try:
print res
except:
pass
lines = res.split(newline)
adapter = None
description = None
for line in lines:
if line.find('Hardware Port:') >= 0:
description = line[line.find(':') + 1:].strip()
if line.find('Device') >= 0:
name = line[line.find(':') + 1:].strip()
adapter = LAN_adapter(name)
app.LAN_adapters[name] = adapter
if adapter == None and name == None or description == None:
a = 2
continue
adapter.description = description
continue
if line.find('Ethernet Address') >= 0:
mac = line[line.find(':') + 1:].strip()
if adapter == None:
a = 2
continue
adapter.MAC = mac
continue
continue
for adapter in app.LAN_adapters:
if printInfo:
try:
print mytime.displayTime() + ' Getting info for', app.LAN_adapters[adapter].description
except:
pass
args = [
'networksetup',
'-getinfo',
app.LAN_adapters[adapter].description]
run = subprocess.Popen(args, stdout = subprocess.PIPE)
pfile = run.stdout
res = pfile.read()
pfile.close()
if printInfo:
try:
print res
except:
pass
lines = res.split(newline)
for line in lines:
if line.find('IP address') >= 0 and line.find('IPv6') < 0:
IPv4 = line[line.find(':') + 1:].strip()
app.LAN_adapters[adapter].IPv4 = IPv4
break
continue
else:
import subprocess
startupinfo = subprocess.STARTUPINFO()
try:
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
except:
pass
args = [
'ipconfig',
'/all']
run = subprocess.Popen(args, stdout = subprocess.PIPE, startupinfo = startupinfo)
pfile = run.stdout
res = pfile.read()
pfile.close()
if printInfo:
try:
print res
except:
pass
lines = res.split(newline)
adapter = None
for line in lines:
line = line.replace('(Preferred)', '')
if line.find('adapter') >= 0:
name = line[line.find('adapter') + 8:line.find(':')]
adapter = LAN_adapter(name)
app.LAN_adapters[name] = adapter
continue
if line.find('IPv4') >= 0:
IPv4 = line[line.find(':') + 2:].strip()
if adapter == None:
a = 2
continue
adapter.IPv4 = IPv4
continue
continue
def doVerifyPIN(parent, peers):
if peers.units[parent.MAC].link_status != 'available':
parent.pin_verified = False
app.pin_verified[parent.MAC] = False
parent.ask_for_pin = True
return None
if peers.units[parent.MAC].numericalFWVersion < peers.units[parent.MAC].minPINVersion:
parent.ask_for_pin = False
parent.pin_verified = True
app.pin_verified[parent.MAC] = True
if parent.pin_verified == True or parent.ask_for_pin == False:
return None
if parent.name in ('No Name', '', None):
return None
if parent.verifyingPIN:
return None
if parent.MAC[:4] in ('DEMO', 'GRP_', 'VN::'):
parent.ask_for_pin = False
parent.pin_verified = True
app.pin_verified[parent.MAC] = True
parent.verifyingPIN = False
return None
parent.verifyingPIN = True
pin = peers.get(data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_PIN, 0, 0), parent.MAC)
check_pin = peers.get(data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CHECK_PIN, 0, 0), parent.MAC)
if (pin == check_pin or pin != None) and pin == 0 or str(parent.name).strip() in ('Recovery Mode', 'Safe Mode'):
parent.ask_for_pin = False
parent.pin_verified = True
app.pin_verified[parent.MAC] = True
parent.verifyingPIN = False
return None
parent.verifyingPIN = False
if enablePsyco:
def set_psyco():
try:
psyco.bind(Main_frame)
psyco.bind(RemoteUnits)
import child_unit
psyco.bind(child_unit.Child_frame)
psyco.bind(protocol.UnitLink.process)
psyco.bind(d_protocol.Remote_Link)
psyco.bind(d_protocol.Protocol_Execute)
psyco.bind(d_protocol.parse_data_packet)
psyco.bind(d_protocol.Remote_Link)
psyco.bind(d_protocol.parse_packet)
psyco.bind(d_protocol.parse_data_packet)
psyco.bind(server.User_command)
psyco.bind(server.RemoteUnits)
psyco.bind(data_model.DataModel)
import network_customized
psyco.bind(network_customized.NetworkWindow)
import network_graphical
psyco.bind(network_graphical.NetworkWindow)
psyco.bind(network_customized.GroupPanel)
psyco.bind(network_graphical.GroupPanel)
psyco.bind(protocol.UnitLink)
psyco.bind(Main_frame)
psyco.bind(RemoteUnits)
psyco.bind(RemoteUnit)
psyco.bind(my_log)
psyco.bind(main_application)
print mytime.displayTime() + ' Psyco Initialized'
except:
traceback.print_exc(file = sys.stdout)
print mytime.displayTime() + ' Set Psyco Failed'
DEFAULT_PRESET_PATH = os.path.join(os.path.dirname(sys.argv[0]), 'presets')
DEFAULT_PRESET_PATH = os.path.abspath(DEFAULT_PRESET_PATH)
import os
import fnmatch
def PrintDisplayInfo():
if os.name in mac_names:
return None
import win32com.client as win32com
strComputer = '.'
objWMIService = win32com.client.Dispatch('WbemScripting.SWbemLocator')
objSWbemServices = objWMIService.ConnectServer(strComputer, 'root\\cimv2')
colItems = objSWbemServices.ExecQuery('Select * from Win32_DisplayConfiguration')
print mytime.displayTime() + ' Display Information:'
for objItem in colItems:
try:
print indent + objItem.Caption + ':'
except:
print mytime.displayTime() + ' Error printing display information:'
traceback.print_exc(file = sys.stdout)
continue
print dindent + 'Bits Per Pixel: ', objItem.BitsPerPel
try:
print dindent + 'Description: ', objItem.Description
print dindent + 'Device Name: ', objItem.DeviceName
except:
print mytime.displayTime() + ' Error printing display information:'
traceback.print_exc(file = sys.stdout)
print dindent + 'Display Frequency: ', objItem.DisplayFrequency
print dindent + 'Dither Type: ', objItem.DitherType
print dindent + 'Log Pixels: ', objItem.LogPixels
print dindent + 'Pixels Height: ', objItem.PelsHeight
print dindent + 'Pixels Width: ', objItem.PelsWidth
app.display_dpi = float(objItem.LogPixels)
print mytime.displayTime(), 'Set application display dpi to', app.display_dpi
print dindent
def listDirectory(directory, fileExtList):
'''get list of file info objects for files of particular extensions'''
fileList = os.listdir(directory)
fileList = [ os.path.join(directory, f) for f in fileList ]
fileList = _[2]
return sorted(fileList, reverse = True)
def locate(pattern, root = os.curdir):
'''Locate all files matching supplied filename pattern in and below
supplied root directory.'''
for path, dirs, files in os.walk(os.path.abspath(root)):
for filename in fnmatch.filter(files, pattern):
yield os.path.join(path, filename)
class RemoteUnits:
def __init__(self, parent):
self.units = { }
self.parent = parent
self.preLaunched = 10000
def add(self, unit):
if unit.type not in self.parent.supported_unit_ids and app.supportAnyUnit == False:
try:
key = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_MODEL_FIRMWARE, 0, 0)
model_firmware = app.server.peers.get(key, unit.MAC)
if model_firmware == None:
model_firmware = ''
else:
model_firmware = '_' + str(int(model_firmware))
except:
model_firmware = ''
try:
model_firmware = str(model_firmware)
except:
model_firmware = ''
if unit.type + model_firmware not in self.parent.supported_unit_ids:
found_unit = False
if self.parent.exclude_unsupported_model_number == False:
try:
model_firmware = ''
count = 0
while count < 100:
model_firmware = '_' + str(int(count))
if unit.type + model_firmware in self.parent.supported_unit_ids:
found_unit = True
break
count += 1
except:
pass
elif model_firmware in ('', '_0'):
if unit.MAC not in self.units.keys():
print mytime.displayTime() + ' found unit with unknown or default model number:', unit.MAC, unit.type, unit.link_status
found_unit = True
elif unit.MAC in self.units.keys():
print mytime.displayTime() + ' removing unit with unsupported model number (model number ' + model_firmware + '):', unit.MAC, unit.type, unit.link_status
del self.units[unit.MAC]
if found_unit == False:
return None
if self.parent.active_unit.MAC == 'no MAC' and self.parent.auto_unit_switch == True:
self.parent.active_unit = unit
if unit.MAC in self.units.keys():
self.units[unit.MAC].IP = unit.IP
self.units[unit.MAC].link_type = unit.link_type
self.units[unit.MAC].link_status = unit.link_status
self.units[unit.MAC].type = unit.type
self.units[unit.MAC].pkt = unit.pkt
if unit.name != 'No Name':
self.units[unit.MAC].name = unit.name
self.units[unit.MAC].Serial = unit.Serial
self.units[unit.MAC].HWVersion = unit.HWVersion
self.units[unit.MAC].FWVersion = unit.FWVersion
self.units[unit.MAC].PICVersion = unit.PICVersion
self.units[unit.MAC].ProductionDate = unit.ProductionDate
self.units[unit.MAC].originalSwID = unit.originalSwID
self.units[unit.MAC].Muted = unit.Muted
self.units[unit.MAC].BuildNumber = unit.BuildNumber
if self.parent.active_unit.MAC == unit.MAC:
self.units[unit.MAC].last_rx = self.parent.active_unit.last_rx
else:
self.units[unit.MAC] = unit
for group_id in app.groups.keys():
group_members = app.groups[group_id]
if unit.MAC in group_members.keys():
unit.group = group_id
continue
if False:
print mytime.displayTime(), 'ou.Prelaunching', unit.MAC, self.preLaunched
self.preLaunchUnit(unit.MAC)
try:
if self.parent.auto_unit_switch == True and self.parent.switching_skin == False and self.parent.remote_link.ResetValues == True and self.parent.remote_link.SyncIndicateActive == False and unit.MAC[:3] != 'DEM' and self.parent.active_unit.MAC != unit.MAC and unit.link_status == 'available':
self.last_connection_attempt = mytime.clock()
self.parent.active_unit = unit
except:
pass
def preLaunchUnit(self, mac, count = 0):
current_user = getCurrentUser(mac)
model_number = getModelNumber(mac)
config = getConfig(mac)
if self.preLaunched > 1:
return None
if app.init_finished == True and current_user != None and model_number != '' and config != None:
self.preLaunched += 1
executeLaunch(mac, preLaunching = True)
elif count < 50:
future.Future(0.3, self.preLaunchUnit, mac, count + 1)
def set_unit_link_status(self, unit, status):
if unit.MAC in self.units.keys():
self.units[unit.MAC].link_status = status
def get_unit_link_status(self, unit):
if unit.MAC in self.units.keys():
return self.units[unit.MAC].link_status
class RemoteUnit:
def __init__(self):
self.MAC = 'no MAC'
self.IP = 'no IP'
self.type = 'no type'
self.name = 'No Name'
self.pkt = None
self.link_status = 'new'
self.last_rx = 0
self.correct_vars = 0
self.link_type = None
self.HWVersion = ''
self.originalSwID = ''
self.FWVersion = ''
self.BuildNumber = 0
self.preset_names = { }
self.PICVersion = ''
self.Serial = ''
self.ProductionDate = ''
self.originalSwID = ''
self.discover_time = mytime.clock()
self.Muted = str(False)
class ProgressScreen(wx.Dialog):
def __init__(self, parent, id, title, message):
try:
self.window = wx.ProgressDialog(title, message, style = wx.STAY_ON_TOP | wx.CAPTION | wx.DEFAULT_DIALOG_STYLE | wx.BORDER_NONE)
self.window.Show(False)
self.frame_height = 2 * wx.SystemSettings.GetMetric(wx.SYS_CAPTION_Y) + wx.SystemSettings.GetMetric(wx.SYS_BORDER_Y) + 100
if os.name in mac_names:
self.frame_height = 150
self.window.SetSize((400, self.frame_height))
except:
print mytime.displayTime() + ' Creation of progress screen failed!'
return None
try:
self.window.SetPosition(app.progress_position)
except:
try:
self.window.SetPosition((app.main_frame.GetPosition()[0] + app.main_frame.GetSize()[0] / 2 - 150, app.main_frame.GetPosition()[1] + app.main_frame.GetSize()[1] / 2 - 60))
except:
self.window.CenterOnScreen()
if message == None:
message = ''
self.message = message
self.val = 0
self.window.Raise()
self.title = title
def GetPosition(self, pos):
self.window.SetPosition(pos)
def GetSize(self):
return self.window.GetSize()
def GetPosition(self):
return self.window.GetPosition()
def SetSize(self, size):
self.window.SetSize(size)
def Show(self, show = True):
self.window.Show(show)
if show == True:
self.window.Raise()
def IsShown(self):
if app.application_stopping == True:
self.Destroy()
return False
try:
return self.window.IsShown()
except:
app.application_stopping == True
return 'Error'
def Update(self, val):
try:
app.progress_position = self.window.GetPosition()
except:
pass
try:
if self.message[:4] == 'Done':
text = self.message
elif val == 99:
text = self.message + ' (100%)'
else:
text = self.message + ' (' + str(val) + '%)'
active = self.window.Update(val, text)[0]
self.window.Raise()
except:
traceback.print_exc(file = sys.stdout)
return None
self.val = val
if active == True:
return None
self.window.Destroy()
def Destroy(self):
try:
app.progress_position = self.window.GetPosition()
except:
pass
try:
self.window.Destroy()
except:
pass
def SetFocus(self):
self.window.SetFocus()
self.window.Raise()
def SetText(self, text):
try:
self.window.Update(self.val, text)
self.message = text
except:
pass
if text[:4] == 'Done':
print 'ou.adding Close button'
self.addCloseButton('Close')
self.Update(99)
self.window.Raise()
def GetText(self):
return self.message
def addCloseButton(self, text, action = None):
try:
if action == None:
self.action = text
else:
self.action = action
self.OK_button = wx.Button(self.window, 1, text, pos = (300, 80), size = (80, 20))
self.OK_button.Enable(True)
self.OK_button.Show(True)
self.window.Bind(wx.EVT_BUTTON, self.OnButton, id = 1)
self.window.Raise()
except:
traceback.print_exc()
def OnButton(self, evt):
if self.action == 'Close':
try:
self.window.Destroy()
except:
pass
try:
self.Destroy()
except:
pass
def get_cpu_load():
pass
class Main_frame(wx.Frame):
def __init__(self, parent, *args):
mystyle = wx.MINIMIZE_BOX | wx.CAPTION | wx.CLOSE_BOX | wx.CLIP_CHILDREN | wx.SYSTEM_MENU
wx.Frame.__init__(self, style = mystyle, *args)
self.init_done = False
self.parent = parent
def addKnownUnits(self):
for group_id in app.groups.keys():
members = app.groups[group_id]
for mac in members.keys():
try:
unit = self.peers.units[mac]
except:
unit = None
if unit == None:
unit = RemoteUnit()
unit.MAC = mac
unit.type = members[mac][1]
unit.link_type = '0'
unit.name = members[mac][0]
unit.link_status = 'disconnected'
unit.IP = 'Offline'
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 = unit.link_type
d_unit.link_status = unit.link_status
d_unit.Serial = '0'
d_unit.IP = unit.IP
d_unit.HWVersion = '0'
d_unit.FWVersion = '0'
d_unit.PICVersion = '0'
d_unit.ProductionDate = '0'
d_unit.Muted = 'False'
d_unit.BuildNumber = '99999999'
d_unit.name = unit.name
if d_unit.MAC.startswith('VN::'):
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.Muted = 'False'
d_unit.BuildNumber = '99999999'
d_unit.name = unit.name
app.server.peers.add(d_unit)
try:
app.server.peers.units[unit.MAC].numericalFWVersion = 1e+10
except:
pass
self.peers.add(unit)
def init_1(self):
self.lock = threading.Lock()
self.model = data_model.DataModel(self)
self.Bind(wx.EVT_CLOSE, self.OnClose)
self.GL = GlobalVariables()
self.peers = RemoteUnits(self)
self.active_unit = RemoteUnit()
self.changing_view = False
app.check_pin = { }
app.hideChildrenOnLaunch = True
self.player = None
self.MAC = 'Main'
self.launchKey = 'Main'
self.child_positions = { }
self.auto_unit_switch = False
self.cpu_check_counter = 0
self.program_title = ''
self.switching_skin = False
self.main_config = ConfigParser.ConfigParser()
self.main_config.read(os.path.join(app.cwd, 'main.cfg'))
self.factory_config = ConfigParser.ConfigParser()
try:
if os.name in mac_names:
self.factory_config.read(os.path.expanduser('~') + '/alldspFactoryOptions.cfg')
else:
self.factory_config.read('C:/alldspFactoryOptions.cfg')
except:
pass
self.loading_factory_presets = False
try:
app.demoMode = eval(self.main_config.get('ROOT', 'demoMode'))
except:
app.demoMode = False
try:
app.autoPassword = self.main_config.get('ROOT', 'autoPassword')
except:
app.autoPassword = ''
try:
emulate = self.main_config.get('ROOT', 'emulate')
self.main_config = ConfigParser.ConfigParser()
self.main_config.read(app.cwd + '/customers/' + emulate + '/main.cfg')
self.emulate_path = app.cwd + '/customers/' + emulate + '/'
except:
self.emulate_path = None
try:
self.exclude_unsupported_model_number = eval(self.main_config.get('ROOT', 'exclude_unsupported_model_number'))
except:
self.exclude_unsupported_model_number = False
app.supported_unit_ids = self.supported_unit_ids
app.supportAnyUnit = False
try:
if app.mijnpc == True and self.main_config.get('ROOT', 'supportAnyUnit') == 'jazeker':
print mytime.displayTime(), '############################################################################## support any unit #############################################'
app.supportAnyUnit = True
except:
None if app.testpc == True else None if showDefaultTypes == True else []
if app.supportAnyUnit == False:
for id in app.supported_unit_ids:
if id.count('_') > 2:
id = id[:id.rfind('_')]
app.short_unit_ids.append(id)
self.about_text = ''
self.vars_to_store = { }
self.child_width = 0
self.lock_on_exit = False
self.child_pos = (0, 0)
self.link_mute = False
show_factory_mode = False
self.is_child_window = False
self.auto_progress_disabled = False
self.menu_based_on_user = None
show_development_mode = False
try:
app.always_show_full_graphics = eval(self.main_config.get('ROOT', 'always_show_full_graphics'))
except:
app.always_show_full_graphics = False
if app.master_password == None:
try:
app.master_password = self.main_config.get('ROOT', 'default_password')
except:
pass
if app.master_password != None and len(app.master_password) > 0 and app.i_am_child == False:
key = data_model.Key(0, 0, 0, 0)
while app.application_stopping == False:
dial = dialog.Dialog(self, -1, 'Enter Password', 'Enter Password', textkey = key, default_text = '', IsPassword = True, Set = False)
dial.ShowModal()
res = dial.response
if res != 'OK':
app.application_stopping = True
return None
pw = dial.textfield.GetValue()
dial.Destroy()
break
continue
None if pw != app.master_password and pw != '8734ibdsfi' else res != 'OK'
if app.build_number == 0:
self.build_number = self.main_config.get('ROOT', 'build_number')
else:
self.build_number = app.build_number
self.enable_advanced_grouping = True
try:
self.support_wrong_skin = self.main_config.get('ROOT', 'support_wrong_skin')
except:
self.support_wrong_skin = False
self.master_network_window = False
try:
self.master_network_window = self.main_config.get('ROOT', 'use_master_network_window')
if self.master_network_window == 'yes':
self.master_network_window = True
self.auto_unit_switch = False
else:
self.master_network_window = False
self.auto_unit_switch = True
except:
self.master_network_window = True
self.auto_unit_switch = False
try:
self.child_width = int(self.main_config.get('ROOT', 'child_width'))
except:
pass
self.child_offset_x = self.child_width
self.child_offset_y = 0
try:
self.child_offset_x = int(self.main_config.get('ROOT', 'child_offset_x'))
except:
pass
try:
self.child_offset_y = int(self.main_config.get('ROOT', 'child_offset_y'))
except:
pass
try:
app.hideChildrenOnLaunch = eval(self.main_config.get('ROOT', 'hideChildrenOnLaunch'))
except:
pass
try:
app.image_replace_list = eval(self.main_config.get('ROOT', 'image_replace_list'))
except:
app.image_replace_list = { }
app.close_at_fw_update = False
try:
app.close_at_fw_update = self.main_config.get('ROOT', 'close_at_fw_update')
if app.close_at_fw_update == 'True' or app.close_at_fw_update == 'yes':
app.close_at_fw_update = True
except:
pass
try:
app.demo_user_password = self.main_config.get('ROOT', 'demo_user_password')
except:
app.demo_user_password = 'Demo'
app.demo_user_password = app.demo_user_password[:8]
try:
app.demo_locked_password = self.main_config.get('ROOT', 'demo_locked_password')
except:
app.demo_locked_password = 'Locked'
app.demo_locked_password = app.demo_locked_password[:8]
try:
app.demo_admin_password = self.main_config.get('ROOT', 'demo_admin_password')
except:
app.demo_admin_password = 'Admin'
app.demo_admin_password = app.demo_admin_password[:8]
try:
app.demo_developer_password = self.main_config.get('ROOT', 'demo_developer_password')
except:
app.demo_developer_password = 'Developer'
app.demo_developer_password = app.demo_developer_password[:8]
try:
app.usb_update_supported_list = eval(self.main_config.get('ROOT', 'usb_update_supported_list'))
except:
app.usb_update_supported_list = []
try:
show_development_mode = self.main_config.get('ROOT', 'show_development_mode')
if show_development_mode == 'True' or show_development_mode == 'yes':
show_development_mode = True
except:
show_development_mode = False
try:
show_factory_mode = self.main_config.get('ROOT', 'show_factory_mode')
if show_factory_mode == 'True' or show_factory_mode == 'yes':
show_factory_mode = True
except:
show_factory_mode = False
try:
link = self.main_config.get('ROOT', 'link_mute')
if link == 'True' or link == 'yes':
self.link_mute = True
except:
pass
self.auto_factory_load = False
try:
self.auto_factory_load = self.main_config.get('ROOT', 'auto_factory_load')
if self.auto_factory_load == 'True' or self.auto_factory_load == 'yes':
self.auto_factory_load = True
except:
pass
try:
keyword = self.main_config.get('ROOT', 'keyword')
except:
keyword = ''
try:
development_mode = self.main_config.get('ROOT', 'development_mode')
if development_mode == 'yes':
app.development_mode = True
except:
app.development_mode = False
try:
about_text = self.main_config.get('ROOT', 'about_text')
except:
about_text = 'AllControl DSP control software. Copyright ALLDSP GmbH & Co. KG.'
self.about_text = '\tApplication Version: ' + app.Version + newline + '\tBuild: ' + str(self.build_number) + newline + newline + about_text
app.display_dpi = 96
print mytime.displayTime(), 'Application Version: ' + app.Version + '.' + str(self.build_number) + newline
self.hardware_menu_text = 'Hardware'
self.full_access = False
if self.support_wrong_skin == 'yes':
self.support_wrong_skin = True
if os.path.exists(os.path.normpath(app.cwd + '/FactoryKJHIUHI.bhjk')) == True:
print mytime.displayTime() + ' Factory Mode!!!!'
app.factory_mode = True
else:
app.factory_mode = False
if os.path.exists(os.path.normpath(app.cwd + '/BootloaderKJHIUHI.bhjk')) == True:
print mytime.displayTime() + ' Bootloader Mode!!!!'
app.bootloader_dial = dialog.Dialog(self, -1, 'Bootloader Mode', 'Idle', OK_Only = True)
app.bootloader_dial.Show()
app.bootloader_mode = True
app.enable_bootloader = True
else:
app.bootloader_mode = False
self.supported_units = { }
self.config = ConfigParser.ConfigParser()
self.loading_preset = False
self.show_sync_status = False
self.skin_path = app.skin_path
self.remote_link = protocol.UnitLink(self)
self.bitmaps_to_load = []
for unit_id in self.supported_unit_ids:
if unit_id.count('_') > 3:
print mytime.displayTime() + ' Supported Unit ID List Error!!!', unit_id
continue
try:
unitName = self.main_config.get('ROOT', unit_id)
except:
if unit_id in productList.keys():
self.supported_units[unit_id] = 'factory'
continue
self.bitmaps_to_load.append(unit_id)
self.bitmaps_to_load.append(unit_id + '_u')
self.bitmaps_to_load.append(unit_id + '_d')
self.bitmaps_to_load.append(unit_id + '_f')
self.bitmaps_to_load.append(unit_id + '_a')
if unit_id in self.supported_units:
continue
if app.supportAnyUnit == True:
self.supported_units[unit_id] = str(unit_id)
continue
self.supported_units[unit_id] = self.main_config.get('ROOT', unit_id)
self.supported_units[unit_id + '_u'] = self.main_config.get('ROOT', unit_id)
self.supported_units[unit_id + '_d'] = self.main_config.get('ROOT', unit_id)
self.supported_units[unit_id + '_f'] = self.main_config.get('ROOT', unit_id)
self.supported_units[unit_id + '_a'] = self.main_config.get('ROOT', unit_id)
self.supported_units[unit_id + '_l'] = self.main_config.get('ROOT', unit_id)
if show_development_mode == True:
unit = RemoteUnit()
unit.name = self.supported_units[unit_id] + ' Development'
unit.type = unit_id + '_d'
self.supported_unit_ids.append(unit.type)
if unit.type == '0_0_0':
unit.MAC = 'Choose unit....'
else:
unit.MAC = ''.join(('DEMO', str(unit_id), 'Dev'))
unit.IP = 'DEMO'
unit.link_status = 'DEMO'
self.peers.add(unit)
d_unit = d_protocol.RemoteUnit()
d_unit.MAC = unit.MAC
app.server.peers.add(d_unit)
app.server.peers.units[unit.MAC].numericalFWVersion = 1e+10
self.model.set_unit_name(unit.name, unit.MAC)
if show_factory_mode == True:
unit = RemoteUnit()
unit.name = self.supported_units[unit_id] + ' Factory'
unit.type = unit_id + '_f'
self.supported_unit_ids.append(unit.type)
if unit.type == '0_0_0':
unit.MAC = 'Choose unit....'
else:
unit.MAC = ''.join(('DEMO', str(unit_id), 'Fac'))
unit.IP = 'DEMO'
unit.link_status = 'DEMO'
self.peers.add(unit)
d_unit = d_protocol.RemoteUnit()
d_unit.MAC = unit.MAC
app.server.peers.add(d_unit)
app.server.peers.units[unit.MAC].numericalFWVersion = 1e+10
self.model.set_unit_name(unit.name, unit.MAC)
unit = RemoteUnit()
unit.name = self.supported_units[unit_id]
unit.type = unit_id
if unit.type == '0_0_0':
unit.MAC = 'Choose unit....'
else:
unit.MAC = ''.join(('DEMO', str(unit_id)))
unit.IP = 'DEMO'
unit.link_status = 'DEMO'
self.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
app.server.peers.add(d_unit)
app.server.peers.units[unit.MAC].numericalFWVersion = 1e+10
self.model.set_unit_name(unit.name, unit.MAC)
app.supported_units = self.supported_units
self.addKnownUnits()
self.unit_channels = []
self.default_skin = self.main_config.get('ROOT', 'default_skin')
accessrights = 0
current_user = 0
if self.active_unit.MAC[:4] in ('DEMO', 'GRPdeactivated'):
full_access = True
accessrights = 0
current_user = protocol.uUser
if self.is_child_window == False:
dial = dialog.Dialog(self, -1, 'No Units Found', 'No units found. The software will start in demo mode.')
dial.ShowModal()
if dial.response != 'OK':
app.application_stopping = True
return None
dial.Destroy()
for mac in self.peers.units.keys():
if self.peers.units[mac].type == self.default_skin:
self.active_unit = self.peers.units[mac]
break
continue
dial.response != 'OK'
else:
accesskey = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_ACCESS_RIGHTS, 0, 0)
retry = 0
while retry < 30:
try:
accessrights = int(self.model.get(accesskey))
except:
None if self.master_network_window == True else self.active_unit == None
accessrights = 0
if accessrights != 0 and accessrights != None:
break
retry += 1
mytime.sleep(0.1)
userkey = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_CURRENT_USER, 0, 0)
retry = 0
while retry < 30:
try:
current_user = int(self.model.get(userkey))
except:
current_user = 0
if current_user != 0 and current_user != None:
break
retry += 1
mytime.sleep(0.1)
self.restart_child_frame = False
import child_unit
self.child_frame = child_unit.Child_frame(self, None, -1, '', False)
self.child_frame.init_1(self.active_unit.type, (0, 0), self.active_unit.MAC)
self.network_window_timer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.on_network_window_timer, self.network_window_timer)
self.network_window_timer.Start(500)
app.init_finished = True
app.Yield()
print mytime.displayTime(), 'ou.init app finished 2'
def init_2(self):
pass
def on_network_window_timer(self, e):
self.network_window_timer.Stop()
if self.master_network_window == True:
self.network_window.Update()
elif self.restart_child_frame == True:
self.restart_child_frame = False
try:
self.child_frame.Destroy()
except:
pass
import child_unit
self.child_frame = child_unit.Child_frame(self, None, -1, '', False)
self.child_frame.init_1(self.active_unit.type, (0, 0), self.active_unit.MAC)
if mytime.clock() < 15:
self.network_window_timer.Start(100)
else:
self.network_window_timer.Start(1000)
def OnUpdate(self, e):
if self.active_unit.link_status == 'available':
dial = dialog.Dialog(self, -1, 'Firmware Update', 'The firmware of this unit will be updated. The update process can have multiple ' + 'steps; please do not power off the unit or disconnect the network until it is finished. Should the process fail, try again. ' + 'Please make sure to make a backup of your settings before you continue. All presets in the unit will be erased! Continue?', Wrap = 300)
dial.ShowModal()
response = dial.response
dial.Destroy()
if response != 'OK':
return None
self.remote_link.StartMainUpdate(self.active_unit.MAC, ignore_version = True)
mytime.sleep(2)
if app.close_at_fw_update == True:
app.application_stopping = True
else:
dial = dialog.Dialog(self, -1, 'Firmware Update', 'This unit is not connected. Please start the update process again later.', Wrap = 300)
dial.ShowModal()
dial.Destroy()
def OnShowLog(self, e):
if os.name not in mac_names:
wildcard = 'Log (*.dfl)|*.dfl|'
mydir = app.asys_config_path
dlg = wx.FileDialog(self, message = 'Choose a file', defaultDir = mydir, defaultFile = '', wildcard = wildcard, style = wx.OPEN | wx.CHANGE_DIR)
if dlg.ShowModal() == wx.ID_OK:
try:
path = dlg.GetPath()
logfile = open(path, 'rb')
string = logfile.read()
logfile.close()
try:
string = base64.b64decode(string)
except:
pass
outfile = open(path + '_d', 'wb')
outfile.write(string)
outfile.close()
except:
string = 'Log Error!!'
dlg.Destroy()
else:
print mytime.displayTime() + ' Only works on Windows.'
def OnOpenGroup(self, e):
print mytime.displayTime() + ' Open Group'
wildcard = 'Group (*.group)|*.group'
dlg = wx.FileDialog(self, message = 'Choose a group file', defaultDir = app.library_path, defaultFile = '', wildcard = wildcard, style = wx.OPEN | wx.CHANGE_DIR)
answer = dlg.ShowModal()
if answer == wx.ID_OK:
path = dlg.GetPath()
self.addGroup(group_type = 'openGroup', path = path)
dlg.Destroy()
def OnAddGroup(self, e):
group_type = app.default_group_type
self.addGroup(group_type)
def OnRedefineHardware(self, e):
print mytime.displayTime(), 'ou.OnRedefineHardware', app.unitAliases
choices = []
for mac in app.ignoredUnits:
if app.ignoredUnits[mac].type in app.unitAliases:
choices.append(mac + ': ' + app.unitAliases[app.ignoredUnits[mac].type][0])
print mytime.displayTime() + ' Select MAC from', choices
dial = wx.SingleChoiceDialog(None, 'Available Units:', 'Select Unit', choices)
dial.ShowModal()
mac = dial.GetStringSelection()
dial.Destroy()
if mac not in choices:
return None
mac = mac[:mac.find(': ')]
if mac in app.ignoredUnits:
print app.ignoredUnits[mac].type
print app.unitAliases[app.ignoredUnits[mac].type][1]
print app.main_config.get('ROOT', app.unitAliases[app.ignoredUnits[mac].type][1][0])
choices = [ app.main_config.get('ROOT', type) for type in app.unitAliases[app.ignoredUnits[mac].type][1] ]
print mytime.displayTime() + ' Select type from', choices
dial = wx.SingleChoiceDialog(None, 'Select new product definition:', 'Select Product', choices)
dial.ShowModal()
newTypeName = dial.GetStringSelection()
dial.Destroy()
for type, name in app.main_config.items('ROOT'):
print type, name
if name == newTypeName:
print mytime.displayTime(), 'Setting', mac, 'from', app.ignoredUnits[mac].type, 'to', type
if app.warning1Shown == False:
dlgMessage = 'Click OK to redefine ' + mac + ' (' + app.unitAliases[app.ignoredUnits[mac].type][0] + ') as a ' + newTypeName + '. Continue?'
dlgTitle = 'Redefine Hardware'
res = wx.MessageBox(dlgMessage, dlgTitle, wx.OK | wx.CANCEL)
if res != wx.OK:
return None
app.warning1Shown = True
app.unitConfig.set(mac, 'typeString', type)
del app.ignoredUnits[mac]
break
continue
elif mac in app.server.peers.units:
print app.server.peers.units[mac].type
print app.unitConfig.get(mac, 'oemTypeString')
print app.unitAliases[app.unitConfig.get(mac, 'oemTypeString')][1]
print mytime.displayTime(), 'Setting', mac, 'from', app.unitConfig.get(mac, 'typeString'), 'to', app.unitConfig.get(mac, 'oemTypeString')
if app.warning2Shown == False:
dlgMessage = 'Click OK to restore ' + mac + ' (' + app.main_config.get('ROOT', app.unitConfig.get(mac, 'typeString')) + ') as a ' + app.unitAliases[app.unitConfig.get(mac, 'oemTypeString')][0] + '. Continue?'
dlgTitle = 'Redefine Hardware'
res = wx.MessageBox(dlgMessage, dlgTitle, wx.OK | wx.CANCEL)
if res != wx.OK:
return None
app.warning2Shown = True
app.unitConfig.set(mac, 'typeString', app.unitConfig.get(mac, 'oemTypeString'))
app.ignoredUnits[mac] = app.server.peers.units[mac]
if app.warning3Shown == False:
dlgMessage = 'Click OK to close and restart the software for the changes to take effect, or Cancel to proceed redefining further units without restarting.'
dlgTitle = 'Redefine Hardware'
res = wx.MessageBox(dlgMessage, dlgTitle, wx.OK | wx.CANCEL)
if res == wx.OK:
self.close()
return None
app.warning3Shown = True
continue
res == wx.OK
mac not in choices
def addGroup(self, group_type, path = None):
group_id = 0
while str(group_id) in app.groups.keys():
group_id += 1
if path == None:
key = data_model.Key(0, 0, 0, 0)
txtGroup = 'Group'
txtlcGroup = 'group'
name = None
dial = wx.TextEntryDialog(None, 'Enter the name of the new ' + txtlcGroup + ':', 'New ' + txtGroup, '')
if dial.ShowModal() == wx.ID_OK:
name = dial.GetValue()
dial.Destroy()
if name == None:
return None
if len(name) < 1:
name = str(group_id)
try:
name = name.encode('utf-8')
except:
name = ''.join(c for c in name if c in data_model.validFilenameChars)
else:
txtlcGroup = 'group'
txtGroup = 'Group'
try:
loadedConfig = ConfigParser.ConfigParser()
loadedConfig.read(path)
loadedID = loadedConfig.sections()[0]
print mytime.displayTime() + ' Found group ID', loadedID
name = loadedConfig.get(loadedID, 'name')
except:
print mytime.displayTime() + ' Open group failed (1)'
traceback.print_exc(file = sys.stdout)
dial = dialog.Dialog(self, -1, 'Open ' + txtGroup, 'This is not a valid ' + txtlcGroup + ' file (1).', OK_Only = True)
dial.ShowModal()
dial.Destroy()
return None
while name in app.group_names.values():
dial = dialog.Dialog(self, -1, 'New ' + txtGroup, 'This name is already in use. Please choose another ' + txtlcGroup + ' name.', OK_Only = True)
dial.ShowModal()
dial.Destroy()
name = None
dial = wx.TextEntryDialog(None, 'Enter the name of the new ' + txtlcGroup + ':', 'New ' + txtGroup, '')
if dial.ShowModal() == wx.ID_OK:
name = dial.GetValue()
dial.Destroy()
if name == None:
return None
continue
name == None
group_id = str(group_id)
if path == None:
enabled = True
links = []
functions = []
exceptions = []
members = { }
description = ''
else:
try:
enabled = loadedConfig.get(loadedID, 'enabled')
if enabled == 'yes':
enabled = True
else:
enabled = False
links = loadedConfig.get(loadedID, 'links')
functions = eval(loadedConfig.get(loadedID, 'functions'))
exceptions = eval(loadedConfig.get(loadedID, 'exceptions'))
members = eval(loadedConfig.get(loadedID, 'members'))
description = loadedConfig.get(loadedID, 'description')
group_type = loadedConfig.get(loadedID, 'type')
except:
print mytime.displayTime() + ' Open group failed (2)'
traceback.print_exc(file = sys.stdout)
dial = dialog.Dialog(self, -1, 'Open ' + txtGroup, 'This is not a valid ' + txtlcGroup + ' file (2).', OK_Only = True)
dial.ShowModal()
dial.Destroy()
return None
if group_type in app.fixed_group_links:
links = app.fixed_group_links[group_type]
app.groups[group_id] = members
app.group_names[group_id] = name
app.group_enabled[group_id] = enabled
app.group_links[group_id] = links
app.group_functions[group_id] = functions
app.group_exceptions[group_id] = exceptions
app.group_type[group_id] = group_type
print mytime.displayTime(), 'ou.Added group', name, group_type, app.group_links[group_id]
app.groupconfig.add_section(group_id)
app.groupconfig.set(group_id, 'members', members)
app.groupconfig.set(group_id, 'type', group_type)
app.groupconfig.set(group_id, 'name', name)
app.groupconfig.set(group_id, 'links', links)
app.groupconfig.set(group_id, 'functions', functions)
app.groupconfig.set(group_id, 'exceptions', exceptions)
app.groupconfig.set(group_id, 'description', description)
None(app.groupconfig.set, group_id, 'enabled' if enabled else 'no')
try:
groupconfigfile = open(os.path.join(app.asys_config_path, 'grouping.cfg'), 'wb')
app.groupconfig.write(groupconfigfile)
groupconfigfile.close()
except:
print mytime.displayTime() + ' Failed to open or write', os.path.join(app.asys_config_path, 'grouping.cfg')
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. (1)', OK_Only = True)
dial.ShowModal()
dial.Destroy()
return None
def CreateAboutText(self, log = False):
additional_text = ''
if log == False:
about_text = additional_text + newline + 'Application Information:' + newline + self.about_text
else:
about_text = newline + additional_text + newline
return about_text
def OnAbout(self, event):
self.about_dial = dialog.Dialog(self, -1, 'About', self.CreateAboutText(), OK_Only = True, Wrap = 500)
self.about_dial.ShowModal()
self.about_dial.Destroy()
del self.about_dial
def OnSetSoftwarePassword(self, event):
key = data_model.Key(0, 0, 0, 0)
if app.master_password != None and len(app.master_password) > 0:
dial = dialog.Dialog(self, -1, 'Enter Password', 'Enter Old Software Password', textkey = key, default_text = '', IsPassword = True, Set = False)
dial.ShowModal()
pw = dial.textfield.GetValue()
dial.Destroy()
if pw.strip() != app.master_password.strip():
dial = dialog.Dialog(self, -1, 'Enter Password', 'Invalid Password!')
dial.ShowModal()
dial.Destroy()
return None
text = 'Change'
else:
text = 'Set'
dial = dialog.Dialog(self, -1, text + ' Password', 'Enter New Password (leave blank to disable the Software Password):', textkey = key, default_text = '', IsPassword = True, Set = False)
dial.ShowModal()
pw = dial.textfield.GetValue()
if dial.response != 'OK':
dial.Destroy()
return None
dial.Destroy()
try:
if app.mijnpc == False:
ref = base64.b64decode(app.main_config.get('ROOT', 'productKey'))
print mytime.displayTime(), 'ou.ossp.fm', ref
if pw == ref:
app.factoryMode = True
self.updateFactoryMenu()
return None
else:
app.factoryMode = True
self.updateFactoryMenu()
return None
except:
pw == ref
print mytime.displayTime(), 'ou.OSSP. no product key set in config'
traceback.print_exc(file = sys.stdout)
dial = dialog.Dialog(self, -1, text + ' Password', 'Confirm New Password (leave blank to disable the Software Password):', textkey = key, default_text = '', IsPassword = True, Set = False)
dial.ShowModal()
if dial.response != 'OK':
dial.Destroy()
return None
dial.Destroy()
def updateFactoryMenu(self):
if (app.factoryMode or app.mijnpc) and len(app.unitAliases) > 0:
nww = self.network_window
nww.tools.AppendSeparator()
nww.tools.Append(219, 'Redefine Hardware', 'Change Hardware Type')
nww.Bind(wx.EVT_MENU, self.OnRedefineHardware, id = 219)
def OnClose(self, event):
self.close()
def close(self):
self.network_window.Show(False)
for c in self.network_window.children:
try:
c.Show(False)
except:
continue
continue
print mytime.displayTime() + ' Closing Main Application'
app.application_stopping = True
app.about_text = self.CreateAboutText(log = True)
mytime.sleep(0.1)
try:
app.bootloader_dial.Close()
app.bootloader_dial.Destroy()
except:
pass
self.Destroy()
print mytime.displayTime() + ' Main Application Closed'
class GlobalVariables:
'''Class that holds Global Variables'''
def __init__(self):
self.next_skin = None
self.current_skin = None
self.loaded_skin = None
self.last_tested_skin = None
if os.name == 'nt':
def setpriority(priority = 3):
try:
import win32api
import win32process
import win32con
priorityclasses = [
win32process.IDLE_PRIORITY_CLASS,
win32process.BELOW_NORMAL_PRIORITY_CLASS,
win32process.NORMAL_PRIORITY_CLASS,
win32process.ABOVE_NORMAL_PRIORITY_CLASS,
win32process.HIGH_PRIORITY_CLASS,
win32process.REALTIME_PRIORITY_CLASS]
pid = win32api.GetCurrentProcessId()
print mytime.displayTime() + ' Setting priority of process', pid, 'to', priority
handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, True, pid)
win32process.SetPriorityClass(handle, priorityclasses[priority])
except:
print mytime.displayTime() + ' Set Priority failed'
traceback.print_exc(file = sys.stdout)
else:
def setpriority(priority = 3):
pass
def start_tetris():
TetrisGame = TetrisGame
import tetris.TetrisGame
frame = TetrisGame(None)
frame.Show(True)
class my_log(wx.Frame):
def __init__(self, parent, *args):
wx.Frame.__init__(self, size = (300, 200), *args)
self.stopping = False
self.parent = parent
panel = wx.Panel(self)
self.client_area = wx.Display().GetClientArea()
panel.SetBackgroundColour('WHITE')
box = wx.BoxSizer(wx.VERTICAL)
hbox2 = wx.BoxSizer(wx.HORIZONTAL)
vbox3 = wx.BoxSizer(wx.VERTICAL)
hbox2.Add(vbox3, 0, wx.LEFT, 10)
self.logwindow = wx.TextCtrl(panel, id = -1, value = '', pos = wx.DefaultPosition, size = (self.client_area[2] - 10, self.client_area[3]), style = wx.TE_MULTILINE | wx.SUNKEN_BORDER)
self.logwindow.AppendText('ALLDSP ALLCONTROL Console' + '\n')
hbox2.Add(self.logwindow, 0, wx.TOP | wx.BOTTOM, 10)
box.Add(hbox2)
panel.SetSizer(box)
panel.Layout()
self.SetSize((self.client_area[2], self.client_area[3]))
self.log = cStringIO.StringIO()
self.Show(True)
self.Maximize()
self.Bind(wx.EVT_CLOSE, self.OnClose)
def OnClose(self, e):
if app.application_stopping == True:
self.Destroy()
def console(self, text):
try:
self.logwindow.SetInsertionPointEnd()
self.logwindow.WriteText(text)
except:
pass
def write(self, txt):
self.log.write(txt)
if app.IsMainLoopRunning() and not (app.application_stopping):
self.console(txt)
def read(self):
return self.log.read()
def getvalue(self):
return self.log.getvalue()
def initGroups():
if os.path.exists(os.path.join(app.asys_config_path, 'grouping.cfg')):
try:
app.groupconfig.read(os.path.join(app.asys_config_path, 'grouping.cfg'))
for group_id in app.groupconfig.sections():
if group_id == 'all_units':
continue
members = eval(app.groupconfig.get(group_id, 'members'))
name = app.groupconfig.get(group_id, 'name')
app.groups[group_id] = members
app.group_names[group_id] = name
app.group_enabled[group_id] = app.groupconfig.get(group_id, 'enabled')
if app.group_enabled[group_id] == 'yes':
app.group_enabled[group_id] = True
else:
app.group_enabled[group_id] = False
Key = data_model.Key
app.group_links[group_id] = eval(app.groupconfig.get(group_id, 'links'))
app.group_functions[group_id] = eval(app.groupconfig.get(group_id, 'functions'))
app.group_exceptions[group_id] = eval(app.groupconfig.get(group_id, 'exceptions'))
app.group_type[group_id] = app.groupconfig.get(group_id, 'type')
if app.group_type[group_id] in app.fixed_group_links:
app.group_links[group_id] = app.fixed_group_links[app.group_type[group_id]]
app.groupconfig.set(group_id, 'links', app.group_links[group_id])
print mytime.displayTime(), 'ou.opened group', name, app.group_type[group_id], app.group_links[group_id]
except:
traceback.print_exc(file = sys.stdout)
app.groupconfig = ConfigParser.ConfigParser()
app.groups = { }
app.group_names = { }
app.group_enabled = { }
app.group_links = { }
app.group_functions = { }
app.group_exceptions = { }
app.group_type = { }
def safeName(s):
res = ''
try:
for c in s:
if c in data_model.validFilenameChars:
res += c
continue
except:
pass
return res
def getString(stringID):
if stringID in app.languageName:
return app.languageName[stringID]
language = safeName(app.language)
try:
return app.strings[language].get('ROOT', stringID)
except:
stringID in app.languageName
try:
return app.strings['English'].get('ROOT', stringID)
except:
return 'None'
def readConfig(config, path):
try:
config.readfp(codecs.open(path, 'r', 'UTF-8'))
return True
except:
print mytime.displayTime(), 'ou.rc.Failed to open config file', path
traceback.print_exc(file = sys.stdout)
return False
def set_frame_display(frame, display_index):
display = wx.Display(display_index)
(x, y, w, h) = display.GetGeometry()
frame.SetPosition((x, y))
def setHighDPIAware(val):
try:
import ctypes
ctypes.windll.shcore.SetProcessDpiAwareness(val)
except:
pass
def get_config_vars(configPath):
config = ConfigParser.ConfigParser()
config.read(configPath)
res = []
sections = config.sections()
struct_id = None
member_id = None
num = None
for var in sections:
if var == 'DEFAULT':
continue
try:
struct_id = config.getint(var, 'struct_id')
member_id = config.getint(var, 'member_id')
num = config.getint(var, 'num')
except:
continue
if struct_id in (protocol.STRUCT_ID_INTERNAL, protocol.STRUCT_ID_COMMAND, protocol.STRUCT_ID_VU, protocol.STRUCT_ID_GR, protocol.STRUCT_ID_RAW_VU):
continue
if member_id in (protocol.MEMBER_ID_VU_IN, protocol.MEMBER_ID_VU_OUT, protocol.MEMBER_ID_GR_IN, protocol.MEMBER_ID_GR_OUT, protocol.MEMBER_ID_COMMAND, protocol.MEMBER_ID_CHECK_PASSWORD, protocol.MEMBER_ID_HARDWARE_STATUS_FLAGS, protocol.MEMBER_ID_AMP_READINGS, protocol.MEMBER_ID_AMP_READINGS_2):
continue
try:
channels = [ int(s, 0) for s in config.get(var, 'channels').split(',') ]
except:
channels = []
channels.append(int(config.get(var, 'channel'), 0))
for channel in channels:
key = data_model.Key(struct_id, member_id, channel, num)
if key not in res:
res.append(key)
continue
try:
FIR_taps = eval(config.get('DEFAULT', 'FIR_taps'))
except:
FIR_taps = None
try:
FIR_gain = eval(config.get('DEFAULT', 'FIR_gain'))
except:
FIR_gain = True
if FIR_taps != None:
for channel in FIR_taps.keys():
if FIR_taps[channel] > 0:
for tap in range(FIR_taps[channel]):
key = data_model.Key(protocol.STRUCT_ID_FIR, protocol.MEMBER_ID_FIR, channel, tap)
if key not in res:
res.append(key)
continue
if FIR_gain == True:
gainkey = data_model.Key(protocol.STRUCT_ID_FIR, protocol.MEMBER_ID_GAIN, channel, 0)
if gainkey not in res:
res.append(gainkey)
FIR_gain == True
return res
class main_application(wx.Frame):
def __init__(self, arguments):
self.arguments = arguments
app.application_stopping = False
app.load = 100
app.img_cache = { }
app.bitmaplib = { }
app.logfile = ''
app.enable_vu_demo = False
if enablePsyco:
set_psyco()
def MacReopenApp(self):
try:
self.main_frame.network_window.restore_from_dock()
except:
pass
def start(self):
self.loading_factory_presets = False
app.init_finished = False
app.bootloader_progress = { }
app.bootloaderStatus = { }
arguments = self.arguments
self.i_am_master = False
app.unitLogs = { }
app.enable_support_request = False
app.link_ok = False
app.LAN_adapters = { }
app.softwareLock = False
app.always_allow_update = { }
app.global_bootloader_progress = None
app.i_am_child = False
app.verbose = False
app.get_list_by_type = { }
app.copied_channel = None
app.my_ip_list = []
app.subnet_mask_list = { }
app.copied_data = None
app.printCompletion = None
app.mute_channels_by_type = { }
app.min_by_type = { }
app.testResult = []
app.max_by_type = { }
app.config_by_type = { }
app.interfaceUpdate = { }
app.minPresetLockVersion = { }
app.minPINVersion = { }
app.minFIRgainVersion = { }
app.updatingBootloaderDial = False
app.lastBootloaderDialUpdateTime = 0
app.minBuildNumberVersion = { }
app.minModelFirmwareVersion = { }
app.image_filename = { }
app.lastModelFirmwareString = { }
app.pin_verified = { }
app.default_group_type = 'Carbon Copy'
app.image_filesize = { }
app.image_sector_size = { }
app.image_slot_size = { }
app.image_start_address = { }
app.update_image_start_address = { }
app.children = { }
app.customization_options = { }
app.rta_on = False
app.supported_unit_ids = []
app.FFT_len = 4096
app.MK2 = { }
app.rta_new_data = False
app.available_audio_devices = { }
app.audio_input_device = None
app.rta_time_avg = 3
app.rta_smoothing = 0.33
app.rta_one_shot = False
app.EmergencyRecoveryMode = False
app.rta_auto_mute = False
app.rta_auto_scale = True
app.rta_show_peq = True
app.rta_running = False
app.rta_data = { }
app.rta_data[0] = list((1, 'Last Measurement', True, True, 'light grey', [], 0, 20000))
app.rta_data[1] = list((1, 'Weighted Result', True, True, (255, 255, 255), [], 0, 20000))
app.rta_scale = None
app.last_rta_measurement_saved = False
app.bootloader_ok = False
app.executable = arguments[0]
app.cwd = os.path.abspath(os.path.dirname(app.executable))
app.mijnpc = os.path.exists(os.path.normpath(app.cwd + '/dfsjhafkjhdoijo.cfg'))
app.testpc = os.path.exists(os.path.normpath(app.cwd + '/hggiskfhusmfki.cfg'))
app.type_replacements = { }
app.main_config = ConfigParser.ConfigParser()
app.main_config.read(os.path.join(app.cwd, 'main.cfg'))
try:
app.type_replacements = eval(app.main_config.get('ROOT', 'type_replacements'))
except:
pass
try:
app.printCompletion = eval(app.main_config.get('ROOT', 'printCompletion'))
except:
pass
self.emulate_path = None
try:
emulate = app.main_config.get('ROOT', 'emulate')
print mytime.displayTime() + ' Emulating', emulate
app.main_config = ConfigParser.ConfigParser()
app.main_config.read(app.cwd + '/customers/' + emulate + '/main.cfg')
emulate_path = app.cwd + '/customers/' + emulate + '/'
self.emulate_path = emulate_path
try:
if len(app.type_replacements) == 0:
app.type_replacements = eval(app.main_config.get('ROOT', 'type_replacements'))
except:
pass
try:
shutil.rmtree(app.cwd + '/local')
try:
shutil.copytree(emulate_path + '/local', app.cwd + '/local')
except:
raise
except:
try:
shutil.copytree(app.cwd + '/customers/default/local', app.cwd + '/local')
except:
print 'Kon local niet kopieren van default'
traceback.print_exc(file = sys.stdout)
try:
shutil.rmtree(app.cwd + '/nww')
shutil.copytree(emulate_path + '/nww', app.cwd + '/nww')
except:
shutil.copytree(app.cwd + '/customers/default/nww', app.cwd + '/nww')
try:
shutil.copy(emulate_path + 'keyfile.py', app.cwd)
except:
pass
try:
shutil.copy(emulate_path + 'subtypes.cfg', app.cwd)
except:
pass
try:
shutil.copy(emulate_path + 'versions.cfg', app.cwd)
except:
shutil.copy('customers/default/versions.cfg', app.cwd)
try:
shutil.copy(emulate_path + 'logo.png', app.cwd)
except:
pass
try:
os.remove('img.cache')
except:
pass
try:
os.remove('img.cache.zip')
except:
pass
try:
shutil.copy(emulate_path + 'img.cache', app.cwd)
except:
pass
except:
pass
try:
try:
rta_enabled = eval(app.main_config.get('ROOT', 'rta_enabled'))
except:
rta_enabled = True
import platform
if sys.platform != 'darwin':
if (int(platform.version()[0]) < 6 or int(platform.version()[0]) == 6) and int(platform.version()[2]) < 1:
rta_enabled = False
if sys.platform == 'darwin':
rta_enabled = False
if rta_enabled == True:
import record
app.getfft = record.getfft
app.resample_fft = record.resample_fft
app.reset_rta_avg = record.reset_rta_avg
except:
traceback.print_exc(file = sys.stdout)
rta_enabled = False
app.rta_enabled = rta_enabled
app.global_img_cache_enabled = False
app.enableRightClickButtonConfiguration = True
try:
app.enableRightClickButtonConfiguration = eval(app.main_config.get('ROOT', 'enableRightClickButtonConfiguration'))
except:
pass
if not os.path.exists('img.cache') and app.global_img_cache_enabled:
try:
filename = 'img.cache.zip'
zfile = zipfile.ZipFile(filename, 'r')
zfile.extractall()
zfile.close()
print mytime.clock(), 'Unpacked img.cache'
except:
print mytime.clock(), 'Failed to unpack img.cache'
if app.global_img_cache_enabled:
try:
filename = '/img.cache'
f = open('img.cache', 'rb')
app.bitmaplib = cPickle.load(f)
f.close()
print mytime.displayTime(), 'Loaded App Image Cache'
except:
print mytime.displayTime(), 'Loading App Image Cache Failed'
try:
brand = app.main_config.get('ROOT', 'brand')
except:
brand = 'AllDSP'
try:
app.save_log_as_txt = app.main_config.get('ROOT', 'save_log_as_txt')
except:
app.save_log_as_txt = 'no'
app.acceptedInterfaceVersions = [
'3.9.1']
try:
daemon = eval(app.main_config.get('ROOT', 'daemon'))
except:
daemon = False
try:
additional_type_replacements = eval(app.main_config.get('ROOT', 'type_replacements'))
for tr in additional_type_replacements:
app.type_replacements[tr] = additional_type_replacements[tr]
except:
pass
app.daemon = daemon
app.test = 1
app.short_unit_ids = []
app.bootloader_last_rx = 0
app.enable_bootloader = False
app.bootloader_mode = False
app.updating_all = False
app.bitmap_cache = { }
app.member_scale = { }
app.member_offset = { }
app.mac_lookup = { }
sp = wx.StandardPaths.Get()
app.asys_config_path = os.path.normpath(sp.GetUserConfigDir() + '/' + brand)
print mytime.displayTime() + ' Application Data Folder:', app.asys_config_path
if os.path.exists(app.asys_config_path) == False:
try:
os.mkdir(app.asys_config_path)
except:
print mytime.displayTime() + ' Failed to create application data folder'
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. (2)', OK_Only = True)
dial.ShowModal()
dial.Destroy()
if app.mijnpc:
print mytime.displayTime() + ' #######################Access Mode &74 Enabled###########################'
app.asys_config_path = app.cwd
app.logfilename = os.path.join(app.asys_config_path, 'srvstd.dfl')
app.lock = threading.Lock()
import gettext
gettext.install('app')
wx.InitAllImageHandlers()
app.library_path = app.cwd + '/factory/'
app.preset_path = DEFAULT_PRESET_PATH
app.music_folder = DEFAULT_PRESET_PATH
app.custom_scale = { }
app.master_password = None
app.demo_password = None
try:
app.autoPassword = app.main_config.get('ROOT', 'autoPassword')
except:
app.autoPassword = ''
app.check_password = app.autoPassword
app.auto_load_dff = { }
app.seriesHeaders = []
try:
app.seriesHeaders = eval(app.main_config.get('ROOT', 'seriesHeaders'))
except:
pass
dirName = os.path.join(os.path.dirname(app.executable))
dirName = os.path.abspath(dirName)
app.bitmap_dir = os.path.join(dirName, 'bitmaps')
try:
show_console = app.main_config.get('ROOT', 'show_console')
if show_console == 'vsjdfhljabsdnc':
show_console = True
else:
show_console = False
except:
show_console = False
if (app.mijnpc == True or app.testpc == True) and os.name in mac_names:
show_console = True
row = 200
column = 300
sys.stdout.write('\x1b[8;{rows};{cols}t'.format(rows = row, cols = column))
n = os.system('clear')
print '\x1b[3;0;0t'
mytime.sleep(0.01)
if app.mijnpc == False and app.testpc == False:
if app.save_log_as_txt == 'jazeker':
path = None
wildcard = 'Log (*.txt)|*.txt|All files (*.*)|*.*'
dlg = wx.FileDialog(None, message = 'Save Log', defaultDir = '', defaultFile = 'srvstd.txt', wildcard = wildcard, style = wx.SAVE | wx.CHANGE_DIR)
if dlg.ShowModal() == wx.ID_OK:
path = dlg.GetPath()
if path:
try:
app.logfile = open(path, 'wb')
except:
pass
dlg.Destroy()
elif show_console:
app.logfile = my_log(self, None, -1, '')
else:
app.logfile = cStringIO.StringIO()
print mytime.displayTime() + ' Log Created'
last_stdout = sys.stdout
sys.stdout = app.logfile
last_stderr = None
print mytime.displayTime() + ' Redirected stdout'
try:
print mytime.displayTime() + ' Application config path:', app.asys_config_path
except:
print mytime.displayTime() + ' Failed to log application config path'
app.build_number = 0
sysconfig = ConfigParser.ConfigParser()
app.knownIP = { }
app.oluUnits = { }
if os.path.exists(os.path.join(app.asys_config_path, 'asys.cfg')):
try:
sysconfig.read(os.path.join(app.asys_config_path, 'asys.cfg'))
except:
try:
encoded_file = open(os.path.join(app.asys_config_path, 'asys.cfg'), 'rb')
encoded_string = encoded_file.read()
encoded_file.close()
decoded_string = base64.b64decode(encoded_string)
decoded_string = base64.b64decode(decoded_string)
decoded_config = StringIO.StringIO(decoded_string)
sysconfig.readfp(decoded_config)
except:
traceback.print_exc(file = sys.stdout)
try:
if 'Directories' not in sysconfig.sections():
sysconfig.add_section('Directories')
except:
sysconfig = ConfigParser.ConfigParser()
sysconfig.add_section('Directories')
sysconfig.set('Directories', 'libpath', app.library_path)
sysconfig.set('Directories', 'presetpath', app.preset_path)
sysconfig.set('Directories', 'musicpath', app.music_folder)
try:
app.library_path = sysconfig.get('Directories', 'libpath')
app.preset_path = sysconfig.get('Directories', 'presetpath')
app.music_folder = sysconfig.get('Directories', 'musicpath')
app.library_path = base64.b64decode(app.library_path).decode('utf-8')
app.preset_path = base64.b64decode(app.preset_path).decode('utf-8')
app.music_folder = base64.b64decode(app.music_folder).decode('utf-8')
except:
print mytime.displayTime() + ' Exception reading system config.'
try:
app.build_number = int(sysconfig.get('Directories', 'build_number'))
app.build_number += 1
except:
app.build_number = 0
try:
app.master_password = sysconfig.get('Directories', 'mpw')
if app.master_password == 'None':
app.master_password = None
except:
app.master_password = None
try:
app.knownIP = sysconfig.get('Directories', 'knownIP')
app.knownIP = eval(base64.b64decode(app.knownIP).decode('utf-8'))
except:
pass
try:
app.oluUnits = eval(sysconfig.get('Directories', 'oluUnits'))
except:
pass
for mac in app.knownIP.keys():
try:
if app.knownIP[mac]['history'] >= 10:
print mytime.displayTime(), 'ou.removed old known IP', app.knownIP[mac]['IP']
del app.knownIP[mac]
except:
continue
continue
else:
sysconfig.add_section('Directories')
sysconfig.set('Directories', 'libpath', app.library_path)
sysconfig.set('Directories', 'presetpath', app.preset_path)
sysconfig.set('Directories', 'musicpath', app.music_folder)
app.client_area = wx.Display().GetClientArea()
count = wx.Display_GetCount()
app.display = { }
app.displayScale = { }
for index in range(count):
try:
d = wx.Display(index)
ca = d.GetClientArea()
vm = d.GetCurrentMode()
app.displayScale[index] = float(vm.GetWidth()) / float(ca[2])
app.display[index] = d
except:
continue
print mytime.displayTime(), 'ou.failed to read display information for display', index
traceback.print_exc(file = sys.stdout)
app.displayScale[index] = 1
continue
try:
app.nwwSize = eval(sysconfig.get('Directories', 'nwwSize'))
app.nwwPosition = eval(sysconfig.get('Directories', 'nwwPosition'))
except:
app.nwwSize = (app.client_area[2], app.client_area[3])
app.nwwPosition = (app.client_area[0], app.client_area[1])
if app.nwwSize[0] < 300:
app.nwwSize = (300, app.nwwSize[1])
if app.nwwSize[1] < 200:
app.nwwSize = (app.nwwSize[0], 200)
if app.nwwPosition[0] + app.nwwSize[0] > app.client_area[2] + 100:
app.nwwPosition = (app.client_area[2] - app.nwwSize[0], app.nwwPosition[1])
if app.nwwPosition[0] < app.client_area[0] - 100:
app.nwwPosition = (app.client_area[0], app.nwwPosition[1])
if app.nwwPosition[1] + app.nwwSize[1] > app.client_area[3] + 100:
app.nwwPosition = (app.nwwPosition[0], app.client_area[3] - app.nwwSize[1])
if app.nwwPosition[1] < app.client_area[1] - 100:
app.nwwPosition = (app.nwwPosition[0], app.client_area[1])
try:
app.nwwMaximized = eval(sysconfig.get('Directories', 'nwwMaximized'))
except:
app.nwwMaximized = False
try:
app.highDPI = eval(sysconfig.get('Directories', 'highDPI'))
except:
app.highDPI = False
if os.name not in mac_names:
setHighDPIAware(app.highDPI)
app.unitConfig = ConfigParser.ConfigParser()
try:
app.unitConfig.read(os.path.join(app.asys_config_path, 'unitConfig.cfg'))
except:
pass
app.supportLanguages = True
try:
app.supportLanguages = eval(app.main_config.get('ROOT', 'supportLanguages'))
except:
pass
app.language = 'English'
app.strings = { }
app.languageName = { }
for fname in os.listdir(app.cwd + '/local'):
if fname.endswith('.cfg'):
try:
c = ConfigParser.ConfigParser()
if readConfig(c, app.cwd + '/local/' + fname) == True:
language = safeName(c.get('ROOT', 'language'))
app.strings[language] = c
app.languageName[language] = c.get('ROOT', 'language')
except:
print mytime.displayTime(), 'Language file failed:', fname
traceback.print_exc(file = sys.stdout)
continue
if app.supportLanguages == True:
try:
app.language = sysconfig.get('Directories', 'language')
print mytime.displayTime(), 'language from config:', language
except:
pass
app.factoryMode = False
app.warning1Shown = False
app.warning2Shown = False
app.warning3Shown = False
app.unitAliases = { }
try:
app.unitAliases = eval(app.main_config.get('ROOT', 'unitAliases'))
except:
pass
app.ignoredUnits = { }
try:
app.skin_path = app.main_config.get('ROOT', 'skin_path')
except:
app.skin_path = 'skins'
try:
app.EmergencyRecoveryMode = eval(app.main_config.get('ROOT', 'ForceUpdate'))
except:
pass
try:
app.group_membership_filter = eval(app.main_config.get('ROOT', 'group_membership_filter'))
except:
app.group_membership_filter = { }
try:
app.group_types = eval(app.main_config.get('ROOT', 'group_types'))
except:
app.group_types = DEFAULT_GROUP_TYPES
try:
app.showConnectionTest = eval(app.main_config.get('ROOT', 'showConnectionTest'))
except:
app.showConnectionTest = False
if app.mijnpc == True:
app.showConnectionTest = True
app.runConnectionTest = False
try:
app.group_relative = eval(app.main_config.get('ROOT', 'group_relative'))
except:
app.group_relative = { }
for groupType in app.group_types:
if groupType == 'Relative':
app.group_relative[groupType] = True
continue
app.group_relative[groupType] = False
app.group_links = { }
try:
app.fixed_group_links = eval(app.main_config.get('ROOT', 'group_links'))
except:
app.fixed_group_links = DEFAULT_GROUP_LINKS
for group_type in app.fixed_group_links:
if group_type not in app.group_types:
continue
if app.fixed_group_links[group_type] == 'config':
try:
configPath = app.cwd + '/' + app.skin_path + '/' + app.group_types[group_type] + '/default.cfg'
app.fixed_group_links[group_type] = get_config_vars(configPath)
except:
print mytime.displayTime(), 'ou.group skin niet in pakket!!', group_type
app.fixed_group_links[group_type] = { }
continue
app.default_group_type = 'Carbon Copy'
try:
app.default_group_type = app.main_config.get('ROOT', 'default_group_type')
except:
pass
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(0.1)
d = None
try:
s.connect(('127.0.0.1', 50684))
print mytime.displayTime() + ' Found Network Server'
mytime.sleep(0.01)
s.send('get_info\n')
print 'ja get info sent'
res = s.recv(4096)
print 'response:'
print str(res)
s.close()
if res == os.getcwd():
dial = wx.MessageDialog(None, 'Another instance of this application is already running on this machine.', 'Error', wx.OK | wx.ICON_ERROR)
dial.ShowModal()
dial.Destroy()
print mytime.displayTime() + ' Application already running, exiting...'
app.application_stopping = True
app.Exit()
return None
d = server.Daemon()
except:
d = server.Daemon()
app.server = d
app.groups = { }
app.group_names = { }
app.group_enabled = { }
app.group_functions = { }
app.group_exceptions = { }
app.group_type = { }
app.groupconfig = ConfigParser.ConfigParser()
initGroups()
app.pic_versions = { }
app.fw_versions = { }
app.fw_version = '0'
app.pic_version = '0'
app.Version = '0'
versionconfig = ConfigParser.ConfigParser()
try:
versionfile = os.path.normpath(app.cwd + '/versions.cfg')
versionconfig.read(versionfile)
except:
pass
try:
app.pic_versions = eval(versionconfig.get('ROOT', 'ifl'))
except:
pass
try:
app.fw_versions = eval(versionconfig.get('ROOT', 'fwl'))
except:
pass
try:
app.fw_version = versionconfig.get('ROOT', 'fw')
except:
pass
try:
app.pic_version = versionconfig.get('ROOT', 'if')
except:
pass
try:
app.Version = versionconfig.get('ROOT', 'app')
except:
pass
app.bgName = None
try:
app.bgName = base64.b64decode(sysconfig.get('Directories', 'background'))
if not os.path.exists(app.bgName):
app.bgName = None
except:
app.bgName = None
if app.bgName == None:
bgName = app.cwd + '/nww/defaultBackground.png'
if os.path.exists(bgName):
app.bgName = bgName
try:
check_interfaces()
except:
traceback.print_exc(file = sys.stdout)
app.sys_version = platform.version()
try:
import datetime
print mytime.displayTime() + ' ou.Date:', str(datetime.datetime.now())
except:
pass
remove_install_remain_files(app.library_path)
try:
self.main_frame = Main_frame(self, None, -1, '')
app.main_frame = self.main_frame
if daemon == False:
self.main_frame.server = d
self.main_frame.init_1()
if app.application_stopping == False:
print mytime.displayTime() + ' Starting Main Loop'
tryYield()
app.MainLoop()
print mytime.displayTime() + ' ou.Main Loop Stopped'
except:
if app.mijnpc == False and app.testpc == False:
sys.stdout = app.logfile
traceback.print_exc(file = sys.stdout)
if app.mijnpc == False and app.testpc == False:
sys.stdout = app.logfile
try:
try:
app.library_path = base64.b64encode(app.library_path.encode('utf-8'))
except:
app.library_path = base64.b64encode('')
try:
app.preset_path = base64.b64encode(app.preset_path.encode('utf-8'))
except:
app.preset_path = base64.b64encode('')
try:
app.music_folder = base64.b64encode(app.music_folder.encode('utf-8'))
except:
app.music_folder = base64.b64encode('')
sysconfig.set('Directories', 'libpath', app.library_path)
sysconfig.set('Directories', 'presetpath', app.preset_path)
sysconfig.set('Directories', 'musicpath', app.music_folder)
if app.master_password != None:
sysconfig.set('Directories', 'mpw', app.master_password)
if app.build_number > 0:
sysconfig.set('Directories', 'build_number', app.build_number)
for unit in app.knownIP.values():
unit['history'] += 1
for mac in app.server.peers.units:
if mac[:4] in ('DEMO', 'GRP_', 'VN::'):
continue
unit = app.server.peers.units[mac]
app.knownIP[unit.MAC] = {
'IP': unit.IP,
'name': unit.name,
'type': unit.type,
'history': 0 }
sysconfig.set('Directories', 'knownIP', base64.b64encode(str(app.knownIP).encode('utf-8')))
print mytime.displayTime(), 'Saved known IP addresses:', app.knownIP
sysconfig.set('Directories', 'background', base64.b64encode(str(app.bgName).encode('utf-8')))
sysconfig.set('Directories', 'nwwSize', str(app.nwwSize))
sysconfig.set('Directories', 'nwwMaximized', str(app.nwwMaximized))
sysconfig.set('Directories', 'nwwPosition', str(app.nwwPosition))
sysconfig.set('Directories', 'language', str(app.language))
sysconfig.set('Directories', 'highDPI', str(app.highDPI))
sysconfig.set('Directories', 'oluUnits', str(app.oluUnits).encode('utf-8'))
decoded_config = StringIO.StringIO()
sysconfig.write(decoded_config)
decoded_string = decoded_config.getvalue()
decoded_config.close()
encoded_string = base64.b64encode(decoded_string)
encoded_string = base64.b64encode(encoded_string)
configfile = open(os.path.join(app.asys_config_path, 'asys.cfg'), 'wb')
configfile.write(encoded_string)
configfile.close()
except:
print mytime.displayTime() + ' Failed to open or write', os.path.join(app.asys_config_path, 'asys.cfg')
traceback.print_exc(file = sys.stdout)
try:
f = open(os.path.join(app.asys_config_path, 'unitConfig.cfg'), 'wb')
app.unitConfig.write(f)
f.close()
except:
print mytime.displayTime(), 'Failed to write unit config'
traceback.print_exc(file = sys.stdout)
app.application_stopping = True
try:
app.bootloader_dial.Destroy()
except:
pass
exit_counter = 0
while len(threading.enumerate()) > 1 and exit_counter < 5:
mytime.sleep(1)
exit_counter += 1
exit_counter = 0
threadlist = threading.enumerate()
while len(threadlist) > 1 and exit_counter < 5:
threadlist = threading.enumerate()
exit_counter += 1
mytime.sleep(1)
for thread in threadlist:
if thread.getName() == 'Support':
mytime.sleep(0.01)
continue
if len(threading.enumerate()) > 1:
print mytime.displayTime() + ' Not all threads quit in time:'
print threading.enumerate()
print mytime.displayTime() + ' Quitting anyway'
elif self.i_am_master == True:
print mytime.displayTime() + ' All threads exited normally, quitting'
tempdir = os.path.normpath(app.cwd + '/temp')
try:
shutil.rmtree(tempdir)
except:
pass
print mytime.displayTime(), 'Main Application Exit'
mytime.sleep(0.1)
if app.mijnpc == True:
if self.emulate_path != None and app.global_img_cache_enabled:
import hashlib
print mytime.displayTime(), 'Saving Image Cache'
filename = self.emulate_path + '/img.cache'
f = open(filename, 'wb')
cPickle.dump(app.bitmaplib, f, cPickle.HIGHEST_PROTOCOL)
f.close()
import zlib
zfile = zipfile.ZipFile(filename + '.zip', 'w')
zfile.write(filename, 'img.cache', compress_type = zipfile.ZIP_DEFLATED)
zfile.close()
elif app.testpc == False:
if last_stderr != None:
sys.stderr = last_stderr
sys.stdout = last_stdout
string = app.logfile.getvalue()
app.logfile.close()
string = base64.b64encode(string)
print mytime.displayTime() + ' Writing Log:', app.logfilename
try:
logfile = open(app.logfilename, 'wb')
logfile.write(string)
logfile.close()
except:
app.Exit()
app.Exit()