def write_wp_pushed(self, event): # wxGlade: MissionEditorFrame.<event_handler> self.event_queue_lock.acquire() self.event_queue.put( MissionEditorEvent(me_event.MEE_WRITE_WPS, count=self.grid_mission.GetNumberRows() + 1)) #home point first: lat = float(self.label_home_lat_value.GetLabel()) lon = float(self.label_home_lon_value.GetLabel()) alt = float(self.label_home_alt_value.GetLabel()) self.event_queue.put( MissionEditorEvent(me_event.MEE_WRITE_WP_NUM, num=0, cmd_id=16, p1=0.0, p2=0.0, p3=0.0, p4=0.0, lat=lat, lon=lon, alt=alt, frame=0)) for i in range(0, self.grid_mission.GetNumberRows()): cmd_id = me_defines.cmd_reverse_lookup( self.grid_mission.GetCellValue(i, 0)) try: p1 = float(self.grid_mission.GetCellValue(i, ME_P1_COL)) p2 = float(self.grid_mission.GetCellValue(i, ME_P2_COL)) p3 = float(self.grid_mission.GetCellValue(i, ME_P3_COL)) p4 = float(self.grid_mission.GetCellValue(i, ME_P4_COL)) lat = float(self.grid_mission.GetCellValue(i, ME_LAT_COL)) lon = float(self.grid_mission.GetCellValue(i, ME_LON_COL)) alt = float(self.grid_mission.GetCellValue(i, ME_ALT_COL)) frame = float( me_defines.frame_enum_rev[self.grid_mission.GetCellValue( i, ME_FRAME_COL)]) except: #don't lock up the misseditor on missing input! pass #anything missing will just be zero self.event_queue.put( MissionEditorEvent(me_event.MEE_WRITE_WP_NUM, num=i + 1, cmd_id=cmd_id, p1=p1, p2=p2, p3=p3, p4=p4, lat=lat, lon=lon, alt=alt, frame=frame)) self.event_queue_lock.release() self.set_modified_state(False) event.Skip()
def write_wp_pushed(self, event): # wxGlade: MissionEditorFrame.<event_handler> self.event_queue_lock.acquire() self.event_queue.put(MissionEditorEvent(me_event.MEE_WRITE_WPS,count= self.grid_mission.GetNumberRows()+1)) #home point first: lat = float(self.label_home_lat_value.GetLabel()) lon = float(self.label_home_lon_value.GetLabel()) alt = float(self.label_home_alt_value.GetLabel()) self.event_queue.put(MissionEditorEvent(me_event.MEE_WRITE_WP_NUM, num=0,cmd_id=16,p1=0.0,p2=0.0,p3=0.0,p4=0.0, lat=lat,lon=lon,alt=alt,frame=0)) for i in range(0, self.grid_mission.GetNumberRows()): cmd_id = me_defines.cmd_reverse_lookup(self.grid_mission.GetCellValue(i,0)) p1 = float(self.grid_mission.GetCellValue(i,ME_P1_COL)) p2 = float(self.grid_mission.GetCellValue(i,ME_P2_COL)) p3 = float(self.grid_mission.GetCellValue(i,ME_P3_COL)) p4 = float(self.grid_mission.GetCellValue(i,ME_P4_COL)) lat = float(self.grid_mission.GetCellValue(i,ME_LAT_COL)) lon = float(self.grid_mission.GetCellValue(i,ME_LON_COL)) alt = float(self.grid_mission.GetCellValue(i,ME_ALT_COL)) frame = float(me_defines.frame_enum_rev[self.grid_mission.GetCellValue(i,ME_FRAME_COL)]) self.event_queue.put(MissionEditorEvent(me_event.MEE_WRITE_WP_NUM, num=i+1,cmd_id=cmd_id,p1=p1,p2=p2,p3=p3,p4=p4, lat=lat,lon=lon,alt=alt,frame=frame)) self.event_queue_lock.release() self.set_modified_state(False) event.Skip()