コード例 #1
0
 def load_file(self, filename, associate_filename=True):
     infile = open(filename, 'r')
     flights = []
     for line in infile:
         if line:
             flights.append(flight.from_line(line[:-1],
                                             context=self.context()))
     # Don't add until all flight creations are successful, so
     # error handling will work properly
     for new_flight in flights:
         self.add(new_flight)
     infile.close()
     if associate_filename:
         self.filename = filename
コード例 #2
0
 def AddFlight(self, entry):
     self.schedule.add(flight.from_line(entry, self.schedule.context()))
     self.Refresh()
コード例 #3
0
 def to_flight(self):
     return flight.from_line(self._line)