def createNewTraffic(self, spawn_coords, spawn_hdg): dialog = CreateTrafficDialog(spawn_coords, spawn_hdg, parent=self.gui) dialog.exec() if dialog.result() > 0: params = dialog.acftInitParams() params.XPDR_mode = new_traffic_XPDR_mode acft = ControlledAircraft(dialog.acftCallsign(), dialog.acftType(), params, None) acft.spawned = False acft.frozen = dialog.startFrozen() acft.tickOnce() self.aircraft_list.append(acft) if dialog.createStrip(): strip = Strip() strip.writeDetail(FPL.CALLSIGN, acft.identifier) strip.writeDetail(FPL.ACFT_TYPE, acft.aircraft_type) strip.writeDetail(FPL.WTC, wake_turb_cat(acft.aircraft_type)) strip.linkAircraft(acft) signals.receiveStrip.emit(strip) selection.selectAircraft(acft)
def new_strip_dialog(parent_widget, rack, linkToSelection=False): ''' Returns the created strip if operation not aborted ''' new_strip = Strip() new_strip.writeDetail(rack_detail, rack) if linkToSelection: new_strip.linkAircraft(selection.acft) if settings.strip_autofill_on_ACFT_link: new_strip.fillFromXPDR() new_strip.linkFPL(selection.fpl) dialog = StripDetailSheetDialog(parent_widget, new_strip) dialog.exec() if dialog.result() > 0: # not rejected new_strip.writeDetail(rack_detail, dialog.selectedRack()) env.strips.addStrip(new_strip) selection.selectStrip(new_strip) return new_strip else: return None