def showSelectMap(self):
     g_appLoader.getApp().loadView(
         ViewLoadParams(PREBATTLE_ALIASES.TRAINING_SETTINGS_WINDOW_PY,
                        PREBATTLE_ALIASES.TRAINING_SETTINGS_WINDOW_PY), {
                            'isCreateRequest': True,
                            'isObserverMod': True
                        })
Exemplo n.º 2
0
    def getMods(self):
        #log(xfw_mods_info.info)
        # debug('[XFW] getMods')
        try:
            app = g_appLoader.getApp(swf.appNS)
            if app is None:
                return None

            as_path = None
            if app.appNS == APP_NAME_SPACE.SF_LOBBY:
                as_path = 'as_lobby'
            elif app.appNS == APP_NAME_SPACE.SF_BATTLE:
                as_path = 'as_battle'
            else:
                return None

            mods_dir = PATH.XFW_MODS_DIR
            if not os.path.isdir(mods_dir):
                return None

            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
Exemplo n.º 3
0
def getCmpConfiguratorMainView():
    """
    Provides reference on vehicle configurator view.
    :return:
    """
    cmpConfiguratorMain = g_appLoader.getApp().containerManager.getView(
        ViewTypes.LOBBY_SUB, {
            POP_UP_CRITERIA.VIEW_ALIAS:
            VIEW_ALIAS.VEHICLE_COMPARE_MAIN_CONFIGURATOR
        })
    raise cmpConfiguratorMain is not None or AssertionError
    return cmpConfiguratorMain
Exemplo n.º 4
0
 def _appInitialized(event):
     debug('[XFW] _appInitialized: {}'.format(event.ns))
     try:
         app = g_appLoader.getApp(event.ns)
         if app is not None:
             global g_xfwview
             g_xfwview = None
             global xfwInitialized, appNS
             xfwInitialized = False
             appNS = event.ns
             xfw_mods_info.clear_swfs()
             if event.ns == APP_NAME_SPACE.SF_LOBBY:
                 #BigWorld.callback(0, lambda: app.loadView(CONST.XFW_VIEW_ALIAS))
                 app.loadView(CONST.XFW_VIEW_ALIAS)
             elif event.ns == APP_NAME_SPACE.SF_BATTLE:
                 app.loadView(CONST.XFW_VIEW_ALIAS)
     except:
         err(traceback.format_exc())
Exemplo n.º 5
0
def xvm_formatDate(formatDate):
    dt = datetime.datetime.now()
    weekday = (dt.weekday() - BigWorld.wg_firstDayOfWeek() + 7) % 7
    app = g_appLoader.getApp()
    d = {}

    def getValue(value, isUpper, isLower):
        if value == 'a':
            return app.utilsManager.getWeekDayNames(False, isUpper, isLower)[weekday]
        elif value == 'A':
            return app.utilsManager.getWeekDayNames(True, isUpper, isLower)[weekday]
        elif value == 'b':
            return app.utilsManager.getMonthsNames(False, isUpper, isLower)[dt.month-1]
        elif value == 'B':
            return app.utilsManager.getMonthsNames(True, isUpper, isLower)[dt.month-1]
        elif value == 'p':
            if app.utilsManager.isTwelveHoursFormat():
                return 'AM' if dt.hour < 12 else 'PM'
            else:
                return ''
        
    def processDirective(value, formatDate):
        directive = '%'+value
        if directive in formatDate:
            isUpper = False
            isLower = False
            if len(value) > 1:
                if value[1] == 'u':
                    isUpper = True
                else:
                    isLower = True
            s = getValue(value[0], isUpper, isLower)
            d[value] = s
            formatDate = formatDate.replace('%{}'.format(value), '{%s}' % value)
        return formatDate

    formatDate = formatDate.decode('utf8').encode(_defaultlocale)
    for directive in _DIRECTIVES:
        formatDate = processDirective(directive, formatDate)
    t = dt.strftime(formatDate).decode(_defaultlocale)
    return t.format(**d)
Exemplo n.º 6
0
def _getLobby():
    return g_appLoader.getApp(_SPACE.SF_LOBBY)
 def __get__(self, obj, objType=None):
     return g_appLoader.getApp(self._space)
Exemplo n.º 8
0
def toggleHangarUI(visible):
    lobby = g_appLoader.getApp()
    hangar = lobby.containerManager.getView(ViewTypes.LOBBY_SUB)
    hangar.flashObject.visible = visible
Exemplo n.º 9
0
def on_key_event(event):
    key = getBigworldNameFromKey(event.key)
    if key == 'KEY_F10':
        app = g_appLoader.getApp().loadView(
            ViewLoadParams(_window_alias, _window_alias))
Exemplo n.º 10
0
def toggleHangarUI(visible):
    lobby = g_appLoader.getApp()
    hangar = lobby.containerManager.getView(ViewTypes.LOBBY_SUB)
    hangar.flashObject.visible = visible
    lobby.graphicsOptimizationManager.switchOptimizationEnabled(visible)
Exemplo n.º 11
0
 def onModsListCallback(self):
     g_appLoader.getApp().loadView(
         ViewLoadParams(OBSERVER_ALIAS, OBSERVER_ALIAS), {})