def auto_print_strip_reason(fpl): ''' Returns reason to print if strip should be auto-printed from FPL; None otherwise ''' if fpl.status() == FPL.CLOSED or fpl.strip_auto_printed \ or settings.auto_print_strips_IFR_only and fpl[FPL.FLIGHT_RULES] != 'IFR' \ or env.airport_data == None or env.linkedStrip(fpl) != None: return None present_time = now() ok_reason = None if settings.auto_print_strips_include_DEP: # check DEP time dep = fpl[FPL.TIME_OF_DEP] if dep != None and fpl[ FPL. ICAO_DEP] == env.airport_data.navpoint.code: # we know: fpl.status() != FPL.CLOSED if dep - settings.auto_print_strips_anticipation <= present_time <= dep: ok_reason = 'departure due ' + rel_datetime_str(dep) if ok_reason == None and settings.auto_print_strips_include_ARR: # check ARR time eta = fpl.ETA() if eta != None and fpl[ FPL.ICAO_ARR] == env.airport_data.navpoint.code and fpl.status( ) == FPL.OPEN: if eta - settings.auto_print_strips_anticipation <= present_time <= eta: ok_reason = 'arrival due ' + rel_datetime_str(eta) return ok_reason
def shortDescr_time(self): if self.status() == FPL.OPEN: eta = self.ETA() if eta != None: return 'ARR %s' % rel_datetime_str(eta, longFormat=True) tdep = self.details[FPL.TIME_OF_DEP] return 'DEP %s' % rel_datetime_str( tdep, longFormat=True) if tdep != None else '?'
def data(self, index, role): if role == Qt.DisplayRole: chat_line = self.messageOnRow(index.row()) col = index.column() if col == 0: return rel_datetime_str(chat_line.timeStamp(), seconds=True) if col == 1: return chat_line.sender() if col == 2: return chat_line.txtMsg()
def data(self, index, role): row = index.row() col = index.column() if role == Qt.DisplayRole: if row == 0: ## First row of a connection if col == 0: return rel_datetime_str(self.connectionTime(), seconds=True) elif col == 1 and self.initiator != None: return 'XFR' elif col == 2: if self.atc_pov: return 'ACFT log-on' if self.initiator == None else 'Received from %s' % self.initiator else: # ACFT point of view return 'Logged on' if self.initiator == None else '%s → %s' % (self.initiator, self.dataAuthority()) elif row == self.rowCount() - 1 and not self.isLive(): ## Last row of a terminated or transferred connection if col == 0: return rel_datetime_str(self.disconnectionTime(), seconds=True) elif col == 1 and self.transferred_to != None: return 'XFR' elif col == 2: return 'Terminated' if self.transferred_to == None else 'Transferred to %s' % self.transferred_to else: ## Regular message row imsg = row - 1 msg = self.messages[imsg] if col == 0: return rel_datetime_str(msg.timeStamp(), seconds=True) elif col == 1: prefix = '↓↑'[self.atc_pov] + ' ' if msg.isFromMe() else '' return prefix + CpdlcMessage.type2str(msg.type()) elif col == 2: return msg.contents() elif col == 3: if imsg in self.problems: return self.problems[imsg] elif imsg == self.msgCount() - 1 and self.expecting: return self.statusStr()
def data(self, index, role): col = index.column() notification = self.history[index.row()] if role == Qt.DisplayRole: if col == 0: return rel_datetime_str(notification.time, seconds=True) if col == 1: return notification.msg elif role == Qt.DecorationRole: if col == 0: try: pixmap = QPixmap( path.join(icons_directory, icon_files[notification.t])) return QIcon(pixmap) except KeyError: pass # No decoration for this notification type
def data(self, index, role): strip, timestamp = self.discarded_strips[index.row()] if role == Qt.DisplayRole: line1 = some(strip.callsign(), '?') toATC = strip.lookup(sent_to_detail) if toATC == None: line2 = 'Shelved ' if strip.lookup( shelved_detail) else 'Deleted ' else: line1 += ' >> ' + toATC line2 = 'Sent ' line2 += rel_datetime_str(timestamp) ## RETURN return '%s\n %s' % (line1, line2) elif role == Qt.DecorationRole: if strip.lookup(sent_to_detail) == None: # was deleted or shelved return self.shelved_icon if strip.lookup( shelved_detail) else self.deleted_icon else: # was handed over return self.handed_over_icon