def _response(self, user, choice): '''Handle response from a user.''' if callable(self.menuselect): params = { 'userid': user.userid, 'choice': choice, 'popup': self, 'previous': user.get_previous_popup(), } params.update(self.menuselect_args) params.update(self._menuselect_special) try: submenu = self.menuselect(params) except Exception: # print the exception as normal, but pretend nothing happened dbgmsg(1, 'Popuplib2: Called menuselect function raised:') sys.excepthook(*sys.exc_info()) sys.exc_clear() submenu = None if submenu is not None: try: user.queue[0] = submenu._get_userpopup(user) return False except AttributeError: dbgmsg(0, 'Popuplib2: got non-popup return value from callback function') dbgmsg_repr(0, submenu) return True
def get_game_data(module): global game_data data = load_game_data(module) # GJ HAX: gamename = str(es.ServerVar('eventscripts_gamedir')).replace('\\', '/').rpartition('/')[2].lower() dbgmsg(1, 'spmenu: game name is %s'%repr(gamename)) if gamename not in data: dbgmsg(1, 'spmenu: game not found, going default') gamename = 'default' this_game = data[gamename] game_data = { 'type': this_game['type'], 'refresh': this_game.as_int('refresh') if this_game['type'] == 'radio' else 0, } dbgmsg_repr(2, game_data) return game_data
def get_game_data(module): global game_data data = load_game_data(module) # GJ HAX: gamename = str(es.ServerVar('eventscripts_gamedir')).replace( '\\', '/').rpartition('/')[2].lower() dbgmsg(1, 'spmenu: game name is %s' % repr(gamename)) if gamename not in data: dbgmsg(1, 'spmenu: game not found, going default') gamename = 'default' this_game = data[gamename] game_data = { 'type': this_game['type'], 'refresh': this_game.as_int('refresh') if this_game['type'] == 'radio' else 0, } dbgmsg_repr(2, game_data) return game_data
def __del__(self): ''' No references to this popup. ''' dbgmsg(1, 'Popuplib2: Deleting popup') dbgmsg_repr(2, self)