예제 #1
0
파일: ml.py 프로젝트: millercommamatt/fp
def Create_interaction(test=False, profile=None, **kwargs):
    'Main program to start the moving lines and set up all the map and interactions'

    warnings.simplefilter(action="ignore", category=FutureWarning)

    goto_cwd()
    ui = Create_gui()
    ui.tb.set_message('Creating basemap')
    profile = Get_basemap_profile()
    m = mi.build_basemap(ax=ui.ax1, profile=profile)
    if profile:
        sla, slo = profile['Start_lat'], profile['Start_lon']
    else:
        sla, slo = None, None
    line = init_plot(m, start_lat=sla, start_lon=slo, color='red')

    flabels = 'labels.txt'
    faero = 'aeronet_locations.txt'
    try:
        ui.tb.set_message('putting labels and aeronet')
        mi.plot_map_labels(m, flabels)
        mi.plot_map_labels(m, faero, marker='*', skip_lines=2, color='y')
    except:
        print 'Label files not found!'
    get_datestr(ui)
    ui.tb.set_message('making the Excel connection')
    wb = ex.dict_position(datestr=ui.datestr,
                          color=line.get_color(),
                          profile=profile,
                          version=__version__,
                          platform_file=platform_filename,
                          **kwargs)
    ui.tb.set_message('Building the interactivity on the map')
    lines = mi.LineBuilder(line, m=m, ex=wb, tb=ui.tb, blit=True)
    ui.tb.set_message('Saving temporary excel file')
    savetmp(ui, wb)

    build_buttons(ui, lines)
    lines.get_bg(redraw=True)
    bind_move_window(ui, lines)
    ui.tb.set_message('Ready for interaction')

    def stopandquit():
        'simple function to handle the stop and quit'
        lines.ex.wb.close()
        ui.root.quit()
        ui.root.destroy()

    ui.root.protocol('WM_DELETE_WINDOW', stopandquit)
    if not test:
        ui.root.mainloop()
    return lines, ui
예제 #2
0
파일: ml.py 프로젝트: samuelleblanc/fp
def Create_interaction(test=False,profile=None,**kwargs):
    'Main program to start the moving lines and set up all the map and interactions'
    
    warnings.simplefilter(action = "ignore", category = FutureWarning)
    
    goto_cwd()
    ui = Create_gui()
    ui.tb.set_message('Creating basemap')
    profile = Get_basemap_profile()
    m = mi.build_basemap(ax=ui.ax1,profile=profile)
    if profile:
        sla,slo = profile['Start_lat'],profile['Start_lon']
    else:
        sla,slo = None,None
    line = init_plot(m,start_lat=sla,start_lon=slo,color='red')

    flabels = 'labels.txt'
    faero = 'aeronet_locations.txt'
    try:
        ui.tb.set_message('putting labels and aeronet')
        mi.plot_map_labels(m,flabels)
        mi.plot_map_labels(m,faero,marker='*',skip_lines=2,color='y')
    except:
        print 'Label files not found!'
    get_datestr(ui)
    ui.tb.set_message('making the Excel connection')
    wb = ex.dict_position(datestr=ui.datestr,color=line.get_color(),profile=profile,
         version=__version__,platform_file=platform_filename,**kwargs)
    ui.tb.set_message('Building the interactivity on the map')
    lines = mi.LineBuilder(line,m=m,ex=wb,tb=ui.tb,blit=True)
    ui.tb.set_message('Saving temporary excel file')
    savetmp(ui,wb)
    
    build_buttons(ui,lines)
    lines.get_bg(redraw=True)
    bind_move_window(ui,lines)
    ui.tb.set_message('Ready for interaction')
    def stopandquit():
        'simple function to handle the stop and quit'
        lines.ex.wb.close()
        ui.root.quit()
        ui.root.destroy()

    ui.root.protocol('WM_DELETE_WINDOW',stopandquit)
    if not test:
        ui.root.mainloop()
    return lines,ui
def Create_interaction(test=False,**kwargs):
    ui = Create_gui()

    m = mi.build_basemap(ax=ui.ax1)
    line = init_plot(m,color='red')

    flabels = 'labels.txt'
    faero = 'aeronet_locations.txt'
    try:
        mi.plot_map_labels(m,flabels)
        mi.plot_map_labels(m,faero,marker='*',skip_lines=2,color='y')
    except:
        print 'Label files not found!'
        
    get_datestr(ui)
    wb = ex.dict_position(datestr=ui.datestr,color=line.get_color(),**kwargs)
    lines = mi.LineBuilder(line,m=m,ex=wb,tb=ui.tb)
    savetmp(ui,wb)
    
    build_buttons(ui,lines)    
    if not test:
        ui.root.mainloop()
    return lines,ui
def Create_interaction(test=False, **kwargs):
    ui = Create_gui()

    m = mi.build_basemap(ax=ui.ax1)
    line = init_plot(m, color='red')

    flabels = 'labels.txt'
    faero = 'aeronet_locations.txt'
    try:
        mi.plot_map_labels(m, flabels)
        mi.plot_map_labels(m, faero, marker='*', skip_lines=2, color='y')
    except:
        print 'Label files not found!'

    get_datestr(ui)
    wb = ex.dict_position(datestr=ui.datestr, color=line.get_color(), **kwargs)
    lines = mi.LineBuilder(line, m=m, ex=wb, tb=ui.tb)
    savetmp(ui, wb)

    build_buttons(ui, lines)
    if not test:
        ui.root.mainloop()
    return lines, ui