コード例 #1
0
ファイル: 刘怡君.py プロジェクト: bq-bq/GraduationDesign
 def app_info_callback(data):
     if 'error' in data:
         window.hide_spinner_modal()
         window.error_toast(data['error'])
     else:
         if 'user' in data and data['user'] == '': user_info[0] = ''
         refresh_UI(data)
コード例 #2
0
ファイル: 刘怡君.py プロジェクト: bq-bq/GraduationDesign
def refresh_UI(new_app_info):
    global app_info, current_activity, data_hub, user_info
    user, session_code, app, app_secret = user_info
    window.set_user_name(user)
    window.user_info = ''
    if app in ('me', 'ui', 'elt') and user != '':
        window.user_info = JSON.stringify({
            'user': user,
            'session_code': session_code,
            'app': app,
            'app_secret': app_secret
        })
    document["login"].hidden = (user == '')
    document["logout"].hidden = (user != '')

    for activity in app_info['activities']:
        document['nav-' + activity['id']].unbind('click')
    document["main-nav"].clear()
    app_info.update(new_app_info)
    for activity in app_info['activities']:
        a = html.A(activity['name'], **{
            'id': 'nav-' + activity['id'],
            'class': 'nav-link'
        })
        li = html.LI(a, **{'class': 'nav-item'})
        document["main-nav"] <= li
        a.bind('click', lambda ev: show_activity(ev.target.id))
    document["main"].clear()
    client = user_info[0]
    data_hub = DataHub(client if app_info['app'] == 'db' else '', True)
    for i, activity in enumerate(app_info['activities']):
        page = html.DIV(**{'id': 'page-' + activity['id']})
        document["main"] <= page
        if activity['ui_json'] == '':
            pass
        else:
            make_ui(JSON.parse(activity['ui_json']), page, data_hub)
        page.style.display = 'none'
    if len(app_info['activities']) > 0:
        current_activity = None
        show_activity('nav-' + app_info['activities'][0]['id'])
        data_hub.onevent('', '', '')
    else:
        window.hide_spinner_modal()
コード例 #3
0
ファイル: 刘怡君.py プロジェクト: bq-bq/GraduationDesign
 def next_ev():
     self.event_queue = self.event_queue[1:]
     if len(self.event_queue) > 0:
         self._onevent()
     else:
         if self.main_hub: window.hide_spinner_modal()