def viewLoadError(self, alias, name, errorTxt): msg = 'Error during view {0} load. Name: {1}, error:{2}' msg = msg.format(alias, name, errorTxt) LOG_ERROR(msg) item = None if name in self.__nameToLoadingItem: item = self.__nameToLoadingItem.pop(name) self.onViewLoadError(name, msg, item) if item is not None: settings = item.pyEntity.settings if constants.IS_DEVELOPMENT and settings.url != NO_IMPL_URL: g_entitiesFactories.addSettings(ViewSettings(NO_IMPL_ALIAS, View, NO_IMPL_URL, settings.type, None, ScopeTemplates.DEFAULT_SCOPE)) LOG_WARNING('Try to load noImpl swf...') self.__doLoadView(NO_IMPL_ALIAS, item.name)
def viewLoadError(self, token, name, errorTxt): msg = 'Error during view {0} load. Token: {1}, error:{2}' msg = msg.format(name, token, errorTxt) LOG_ERROR(msg) item = None if token in self.__tokens: item = self.__tokens.pop(token) self.onViewLoadError(token, msg, item) if item is not None: settings = item.pyEntity.settings if constants.IS_DEVELOPMENT and settings.url != NO_IMPL_URL: g_entitiesFactories.addSettings(ViewSettings(NO_IMPL_ALIAS, View, NO_IMPL_URL, settings.type, None, ScopeTemplates.DEFAULT)) LOG_WARNING('Try to load noImpl swf...') self.__loadViewForToken(NO_IMPL_ALIAS, item.name, token)
if loginView.loginManager.wgcAvailable: loginView.loginManager.tryWgcLogin() elif loginView.loginManager.getPreference('remember_user'): password = '******' * loginView.loginManager.getPreference( 'password_length') login = loginView.loginManager.getPreference('login') loginView.onLogin(login, password, loginView._servers.selectedServer['data'], '@' not in login) g_entitiesFactories.addSettings( GroupedViewSettings('SkinnerLoading', SkinnerLoading, 'LoginQueueWindow.swf', WindowLayer.TOP_WINDOW, '', None, ScopeTemplates.DEFAULT_SCOPE, canClose=False)) def CRC32_from_file(filename, localPath): return binascii.crc32(str( ResMgr.openSection(filename).asBinary)) & 0xFFFFFFFF & hash(localPath) @empty_async @process def skinCRC32All(callback): global texReplaced, vehicleSkins
files = glob.iglob('{}/*/{}/*.swf'.format(mods_dir, as_path)) for m in files: m = '%s%s' % (_WOT_ROOT, m.replace('\\', '/').replace('//', '/')) # debug('[XFW] getMods: ' + m) name = os.path.basename(os.path.dirname(os.path.dirname(m))) if not m.lower().endswith('_ui.swf') and not m.lower().endswith('_view.swf'): xfw_mods_info.update(name, {'swf_file_name':m}) return xfw_mods_info.info except: err(traceback.format_exc()) return None g_entitiesFactories.addSettings(ViewSettings( CONST.XFW_VIEW_ALIAS, _XfwInjectorView, PATH.XFW_SWF_URL, ViewTypes.WINDOW, None, ScopeTemplates.GLOBAL_SCOPE)) g_entitiesFactories.addSettings(ViewSettings( CONST.XFW_COMPONENT_ALIAS, _XfwComponent, None, ViewTypes.COMPONENT, None, ScopeTemplates.DEFAULT_SCOPE))
def _start(self): g_entitiesFactories.addSettings( ViewSettings(CONSTANTS.VIEW_ALIAS, Flash_UI, CONSTANTS.FILE_NAME, ViewTypes.WINDOW, None, ScopeTemplates.GLOBAL_SCOPE))
def py_getCustomConfig(self): return {'title': 'Test_Window', 'width': 600, 'height': 400} def _populate(self): super(TestWindow, self)._populate() def onWindowClose(self): self.destroy() _alias = 'TestWindow' _url = 'TestWindow3.swf' _type = ViewTypes.WINDOW _event = None _scope = ScopeTemplates.VIEW_SCOPE _settings = ViewSettings(_alias, TestWindow, _url, _type, _event, _scope) g_entitiesFactories.addSettings(_settings) def onhandleKeyEvent(event): key = getBigworldNameFromKey(event.key) if key == 'KEY_F10': g_appLoader.getDefLobbyApp().loadView(ViewLoadParams(_alias, None)) return None from gui import InputHandler InputHandler.g_instance.onKeyDown += onhandleKeyEvent #mod_TestWindow3.py
def processPopulate(self): if self._isDAAPIInited(): if g_AccMngr.isLobby: self.flashObject.as_populateLobby() else: self.flashObject.as_populateLogin() def py_log(self, text): print("[AccountsManagerLoginButton]: %s" % text) def py_openAccMngr(self): g_appLoader.getDefLobbyApp().loadView("AccountsManager") def py_getTranslate(self): return {"tooltip_l10n": "Account manager"} g_AccMngr = AccountsManagerButtonController() g_entitiesFactories.addSettings( ViewSettings( "AccountsManagerLoginButton", AccountsManagerLoginButton, "AccountsManager/AccountsManagerLoginButton.swf", ViewTypes.WINDOW, None, ScopeTemplates.GLOBAL_SCOPE, ) )
from config import g_config import anchor_properties import cm_handler import season_buttons_component from gui.Scaleform.framework import ScopeTemplates, ViewSettings, ViewTypes, g_entitiesFactories from .main_view import CamoSelectorMainView __all__ = ['CamoSelectorMainView'] # noinspection PyArgumentList g_entitiesFactories.addSettings( ViewSettings('CamoSelectorMainView', CamoSelectorMainView, 'customizationMainView.swf', ViewTypes.LOBBY_SUB, None, ScopeTemplates.LOBBY_SUB_SCOPE))
""" xvm (c) sirmax 2013-2014 """ import BigWorld import BattleReplay from gui.WindowsManager import g_windowsManager from ConnectionManager import connectionManager from gui.Scaleform.framework import g_entitiesFactories, ViewSettings, ViewTypes, ScopeTemplates from gui.Scaleform.framework.entities.View import View from logger import * _alias = 'xvm' _url = '../../../xvm/mods/xvm.swf' _viewType = ViewTypes.SERVICE_LAYOUT _scopeTemplate = ScopeTemplates.GLOBAL_SCOPE _settings = ViewSettings(_alias, View, _url, _viewType, None, _scopeTemplate) g_entitiesFactories.addSettings(_settings) def AppStarted(event): #debug('AppStarted') app = g_windowsManager.window if app is not None: if BattleReplay.g_replayCtrl.autoStartBattleReplay() or connectionManager.isConnected(): app.loadView(_alias) else: BigWorld.callback(0, lambda: app.loadView(_alias))
self.api.cleanConfig() self.as_setStaticDataS(genModApiStaticVO(self.api.userSettings)) self.as_setDataS(self.api.getTemplatesForUI()) self.as_updateHotKeysS() def as_setStaticDataS(self, data): if self._isDAAPIInited(): self.flashObject.as_setStaticData(data) def as_setDataS(self, data): if self._isDAAPIInited(): self.flashObject.as_setData(data) def as_updateHotKeysS(self): if self._isDAAPIInited(): data = self.api.getAllHotKeys() self.flashObject.as_updateHotKeys(data) def closeView(self): self.api.configSave() self.destroy() def onFocusIn(self, *args): if self._isDAAPIInited(): return False g_entitiesFactories.addSettings( ViewSettings(VIEW_ALIAS, ModsSettingsApiWindow, VIEW_SWF, ViewTypes.WINDOW, None, ScopeTemplates.GLOBAL_SCOPE))
def onTryClosing(self): return True def onOkClicked(self): '''Called from ActionScript by DAAPI when user clicks ok button.''' logger.info("PYTHON: onOkClicked() called") def onCancelClicked(self): '''Called from ActionScript by DAAPI when user clicks cancel button.''' logger.info("PYTHON: onCancelClicked() called") g_entitiesFactories.addSettings( ViewSettings( SettingsUIWindow.NAME, SettingsUIWindow, 'tessu_mod/SettingsUI.swf', ViewTypes.WINDOW, None, ScopeTemplates.DEFAULT_SCOPE ) ) # HACK: get the settings ui window open somehow def onhandleKeyEvent(event): key = getBigworldNameFromKey(event.key) if key == "KEY_F10": g_appLoader.getApp().loadView(SettingsUIWindow.NAME, SettingsUIWindow.NAME) return None InputHandler.g_instance.onKeyDown += onhandleKeyEvent # HACK: get GUI debug messages to appear to python.log log_handlers = {
from messenger.gui.Scaleform.data.contacts_cm_handlers import PlayerContactsCMHandler from xfw import * from xfw_actionscript.python import * from xvm_main.python.logger import * from xvm_main.python.xvm import l10n import contacts import view ##################################################################### # initialization g_entitiesFactories.addSettings( ViewSettings(VIEW.XVM_EDIT_CONTACT_DATA_ALIAS, view.XvmEditContactDataView, None, WindowLayer.UNDEFINED, None, ScopeTemplates.DEFAULT_SCOPE)) ##################################################################### # handlers @registerEvent(ContactsListPopover, '_populate') def ContactsListPopover_populate(self): #log('ContactsListPopover_populate') contacts.initialize() @overrideClassMethod(ContactConverter, 'makeVO') def ContactConverter_makeVO(base, cls, contact, useBigIcons=False): #log('ContactConverter_makeVO')
def init(): g_entitiesFactories.addSettings(SELECTOR_VIEW_SETTINGS)
g_AccMngr.flash = self super(AccountsManagerLoginButton, self)._populate() self.processPopulate() def _dispose(self): super(AccountsManagerLoginButton, self)._dispose() def processPopulate(self): if self._isDAAPIInited(): if g_AccMngr.isLobby: self.flashObject.as_populateLobby() else: self.flashObject.as_populateLogin() def py_log(self, text): print('[AccountsManagerLoginButton]: %s' % text) def py_openAccMngr(self): g_appLoader.getDefLobbyApp().loadView('AccountsManager') def py_getTranslate(self): return {'tooltip_l10n': 'Account manager'} g_AccMngr = AccountsManagerButtonController() g_entitiesFactories.addSettings( ViewSettings('AccountsManagerLoginButton', AccountsManagerLoginButton, 'AccountsManager/AccountsManagerLoginButton.swf', ViewTypes.WINDOW, None, ScopeTemplates.GLOBAL_SCOPE))
def _start(self): # noinspection PyArgumentList g_entitiesFactories.addSettings( ViewSettings(CONSTANTS.VIEW_ALIAS, Flash_UI, CONSTANTS.FILE_NAME, WindowLayer.WINDOW, None, ScopeTemplates.GLOBAL_SCOPE))
from gui.Scaleform.framework import ViewTypes, ScopeTemplates, g_entitiesFactories, ViewSettings from gui.Scaleform.framework.entities.View import View from gui.Scaleform.framework.entities.abstract.AbstractViewMeta import AbstractViewMeta from gui.app_loader import g_appLoader from gui.shared import events, g_eventBus class AccountsManagerLoginButton(View, AbstractViewMeta): def py_log(self, text): print('[AccountsManagerLoginButton]: %s' % text) def _populate(self): super(AccountsManagerLoginButton, self)._populate() def _dispose(self): super(AccountsManagerLoginButton, self)._dispose() def py_openAccMngr(self): g_appLoader.getApp().loadView('AccountsManager', 'AccountsManager') def py_getTranslate(self): return { 'tooltip_l10n' : 'Менеджер аккаунтов' } _btnAlias = 'AccountsManagerLoginButton' _aManagerLoginButtonSettings = ViewSettings(_btnAlias, AccountsManagerLoginButton, 'AccountsManager/AccountsManagerLoginButton.swf', ViewTypes.WINDOW, None, ScopeTemplates.GLOBAL_SCOPE) g_entitiesFactories.addSettings(_aManagerLoginButtonSettings) g_eventBus.addListener(events.AppLifeCycleEvent.INITIALIZED, lambda *args : g_appLoader.getDefLobbyApp().loadView(_btnAlias))
self.destroy() def onTryClosing(self): return True def onOkClicked(self): '''Called from ActionScript by DAAPI when user clicks ok button.''' logger.info("PYTHON: onOkClicked() called") def onCancelClicked(self): '''Called from ActionScript by DAAPI when user clicks cancel button.''' logger.info("PYTHON: onCancelClicked() called") g_entitiesFactories.addSettings( ViewSettings(SettingsUIWindow.NAME, SettingsUIWindow, 'tessu_mod/SettingsUI.swf', ViewTypes.WINDOW, None, ScopeTemplates.DEFAULT_SCOPE)) # HACK: get the settings ui window open somehow def onhandleKeyEvent(event): key = getBigworldNameFromKey(event.key) if key == "KEY_F10": g_appLoader.getApp().loadView(SettingsUIWindow.NAME, SettingsUIWindow.NAME) return None InputHandler.g_instance.onKeyDown += onhandleKeyEvent # HACK: get GUI debug messages to appear to python.log
def init(): global g_soundInfo g_soundInfo = _readSoundInfo() g_entitiesFactories.addSettings(VIEW_SETTINGS) g_eventBus.addListener(events.AppLifeCycleEvent.INITIALIZED, g_control.onAppInitialized)
def as_createS(self, linkage, config): if self._isDAAPIInited(): self.flashObject.as_create(linkage, config) def as_updateS(self, linkage, data): if self._isDAAPIInited(): self.flashObject.as_update(linkage, data) def as_deleteS(self, linkage): if self._isDAAPIInited(): self.flashObject.as_delete(linkage) # noinspection PyArgumentList g_entitiesFactories.addSettings(ViewSettings( 'PY_PlayersPanelAPI_UI', PlayersPanelUI, 'PlayersPanelAPI.swf', WindowLayer.WINDOW, None, ScopeTemplates.GLOBAL_SCOPE)) g_events = Events() g_cache = Cache() LABEL_CONFIG = { 'isHtml': True, 'left': { 'x': 0, 'y': 0, 'height': 24, 'width': 100, 'align': 'left'}, 'right': { 'x': 0, 'y': 0,
from xfw import * from xvm_main.python.logger import * from xvm_main.python.xvm import l10n import contacts import view ##################################################################### # initialization g_entitiesFactories.addSettings(ViewSettings( VIEW.XVM_EDIT_CONTACT_DATA_ALIAS, view.XvmEditContactDataView, None, ViewTypes.COMPONENT, None, ScopeTemplates.DEFAULT_SCOPE)) ##################################################################### # handlers @registerEvent(ContactsListPopover, '_populate') def ContactsListPopover_populate(self): #log('ContactsListPopover_populate') contacts.initialize() @overrideClassMethod(ContactConverter, 'makeVO') def ContactConverter_makeVO(base, cls, contact, useBigIcons = False):
if hasattr(player, 'databaseID'): playerID = player.databaseID else: playerID = player.arena.vehicles[player.playerVehicleID]['accountDBID'] if playerID != q['id']: q['id'] = playerID break BigWorld.wh_data.write_accounts() BigWorld.wh_data.renew_accounts() BigWorld.wh_data = UserAccounts() _aManagerAlias = 'AccountsManager' _aManagerSettings = ViewSettings(_aManagerAlias, AccountsManager, 'AccountsManager.swf', ViewTypes.WINDOW, 'showAccountsManager', ScopeTemplates.DEFAULT_SCOPE) g_entitiesFactories.addSettings(_aManagerSettings) _aManagerSubAlias = 'AccountsManagerSubwindow' _aManagerSubSettings = ViewSettings(_aManagerSubAlias, AccountsManagerSubwindow, 'AccountsManagerWindow.swf', ViewTypes.WINDOW, 'showAccountsManagerSubwindow', ScopeTemplates.DEFAULT_SCOPE) g_entitiesFactories.addSettings(_aManagerSubSettings) def inject_handle_key_event(event): is_down, key, mods, is_repeat = game.convertKeyEvent(event) if mods == Keys.MODIFIER_CTRL and key == Keys.KEY_B and is_down: loadWindow(_aManagerAlias) # noinspection PyProtectedMember hooked_update_all = Hangar._Hangar__updateAll
from messenger.gui.Scaleform.data.contacts_cm_handlers import PlayerContactsCMHandler from xfw import * from xfw_actionscript.python import * from xvm_main.python.logger import * from xvm_main.python.xvm import l10n import contacts import view ##################################################################### # initialization g_entitiesFactories.addSettings( ViewSettings(VIEW.XVM_EDIT_CONTACT_DATA_ALIAS, view.XvmEditContactDataView, None, ViewTypes.COMPONENT, None, ScopeTemplates.DEFAULT_SCOPE)) ##################################################################### # handlers @registerEvent(ContactsListPopover, '_populate') def ContactsListPopover_populate(self): #log('ContactsListPopover_populate') contacts.initialize() @overrideClassMethod(ContactConverter, 'makeVO') def ContactConverter_makeVO(base, cls, contact, useBigIcons=False): #log('ContactConverter_makeVO')
from gui.Scaleform.framework import g_entitiesFactories, ViewSettings, GroupedViewSettings, ViewTypes, ScopeTemplates from gui.modsListApi.modslist_constants import MODS_LIST_API_BUTTON_ALIAS, MODS_LIST_API_POPOVER_ALIAS from gui.modsListApi.views.buttonView import ModsListButtonView from gui.modsListApi.views.popoverView import ModsListPopoverView def getViewSettings(): buttonSettings = ViewSettings(MODS_LIST_API_BUTTON_ALIAS, ModsListButtonView, 'modsListButton.swf', ViewTypes.WINDOW, None, ScopeTemplates.GLOBAL_SCOPE) popoverSettings = GroupedViewSettings( MODS_LIST_API_POPOVER_ALIAS, ModsListPopoverView, 'modsListPopover.swf', ViewTypes.WINDOW, MODS_LIST_API_POPOVER_ALIAS, MODS_LIST_API_POPOVER_ALIAS, ScopeTemplates.DEFAULT_SCOPE) return buttonSettings, popoverSettings for item in getViewSettings(): g_entitiesFactories.addSettings(item)
).containerManager.getViewByKey(ViewKey(VIEW_ALIAS.LOGIN)) if loginView and loginView.loginManager.getPreference( 'remember_user'): password = '******' * loginView.loginManager.getPreference( 'password_length') login = loginView.loginManager.getPreference('login') loginView.onLogin(login, password, loginView._servers.selectedServer['data'], '@' not in login) g_entitiesFactories.addSettings( GroupedViewSettings('RemodEnablerLoading', RemodEnablerLoading, 'LoginQueueWindow.swf', ViewTypes.TOP_WINDOW, '', None, ScopeTemplates.DEFAULT_SCOPE, canClose=False)) def CRC32_from_file(filename, localPath): buf = str(ResMgr.openSection(filename).asBinary) buf = binascii.crc32(buf) & 0xFFFFFFFF & localPath.__hash__() return buf @async @process def skinCRC32All(callback):