Example #1
0
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
Example #2
0
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(**kwargs):
    #fig,ax = plt.subplots()
    m = mi.build_basemap()
    plt.gca().set_title('line segments')
    lat0, lon0 = mi.pll('22 58.783S'), mi.pll('14 38.717E')
    x0, y0 = m(lon0, lat0)
    line, = m.plot([x0], [y0], 'ro-')
    text = ('Press s to stop interaction\\n'
            'Press i to restart interaction\\n')
    #plt.text(1.0,0.1,text)
    wb = ex.dict_position(**kwargs)
    lines = mi.LineBuilder(line, m=m, ex=wb)
    print 'after line builder'
    plt.show()
    print 'after show'
    plt.gcf().canvas._tkcanvas.master.geometry("900x1000")
    print 'after canvas'
    g = gui.gui(lines)
    g.make_gui()
    print 'after gui'
    return lines
def Create_interaction(**kwargs):
    #fig,ax = plt.subplots()
    m = mi.build_basemap()
    plt.gca().set_title('line segments')
    lat0,lon0 = mi.pll('22 58.783S'), mi.pll('14 38.717E')
    x0,y0 = m(lon0,lat0)
    line, = m.plot([x0],[y0],'ro-')
    text = ('Press s to stop interaction\\n'
            'Press i to restart interaction\\n')
    #plt.text(1.0,0.1,text)
    wb = ex.dict_position(**kwargs)
    lines = mi.LineBuilder(line,m=m,ex=wb)
    print 'after line builder'
    plt.show()
    print 'after show'
    plt.gcf().canvas._tkcanvas.master.geometry("900x1000")
    print 'after canvas'
    g = gui.gui(lines)
    g.make_gui()
    print 'after gui'
    return lines
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
Example #7
0
    def gui_newflight(self):
        'Program to call and create a new excel spreadsheet'
        import tkSimpleDialog,tkMessageBox
        import excel_interface as ex
        import Tkinter as tk
        if self.newflight_off:
	     tkMessageBox.showwarning('Sorry','Feature not yet implemented')
             return
        
        newname = tkSimpleDialog.askstring('New flight path',
                                           'New flight path name:')
        if not newname:
            print 'Cancelled'
            return
        self.flight_num = self.flight_num+1
        self.colors.append(self.colorcycle[self.flight_num])
        self.flightselect_arr.append(tk.Radiobutton(self.root,text=newname,
	                                            fg=self.colorcycle[self.flight_num],
                                                    variable=self.iactive,
                                                    value=self.flight_num,
                                                    indicatoron=0,
                                                    command=self.gui_changeflight,bg='white'))
        self.flightselect_arr[self.flight_num].pack(in_=self.frame_select,side=tk.TOP,
                                                    padx=4,pady=2,fill=tk.BOTH)
        print 'adding flight path to date: %s' %self.line.ex.datestr
        self.line.ex_arr.append(ex.dict_position(datestr=self.line.ex.datestr,
                                                 name=newname,
                                                 newsheetonly=True,
                                                 sheet_num=self.flight_num,
                                                 color=self.colorcycle[self.flight_num],
                                                 lon0=self.line.ex.lon[0],lat0=self.line.ex.lat[0],
                                                 UTC_start=self.line.ex.utc[0],
                                                 UTC_conversion=self.line.ex.UTC_conversion,
                                                 alt0=self.line.ex.alt[0],version=self.line.ex.__version__,campaign=self.line.ex.campaign))
        self.line.newline()
        self.iactive.set(self.flight_num)
        self.gui_changeflight()