Skip to content

Set waypoint times by editing the Time (UTC) cell in the table view - #3315

Open
joernu76 wants to merge 1 commit into
developfrom
editable-waypoint-time
Open

joernu76 wants to merge 1 commit into
developfrom
editable-waypoint-time

Conversation

@joernu76

@joernu76 joernu76 commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

The takeoff time could only be set in the Performance Settings dock, which few users found. The Time (UTC) column of the table view (shown with "Show Performance") is now editable with a date/time editor with calendar popup. Setting the time of a waypoint sets the takeoff time so that this waypoint is reached at the given time; all other times follow from the aircraft model. The takeoff time field is removed from the dock and replaced by a hint.

  • All times are handled in UTC. QDateTimes are built directly in UTC instead of via local time, which gave invalid values for times in a daylight saving gap of the local zone (the editor opened at 1999-12-31 and shifted the flight there).
  • Time (UTC), leg time and cumulative time are rounded to full seconds instead of truncated, so an entered 12:00:00 no longer shows 11:59:59.
  • The top view redraws on time changes (solar angle lines).
  • WaypointsTableModel.load_settings passes a copy of DEFAULT_PERFORMANCE: load_settings_qsettings updates its defaults in place, so all models shared, and modified, the module-level default dict.
  • The take off time step is removed from the performance tutorial and its texts; docs/usage.rst describes the editable time.

Purpose of PR?:

Fixes #3316

Does this PR introduce a breaking change?
No

@joernu76
joernu76 requested a review from ReimarBauer November 10, 2026 20:21

@ReimarBauer ReimarBauer left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @joernu76

my standard code-review high by claude shows hints for some unwanted options the changes create. Please have a look into these

Likely real bugs:

  1. Leaving the Time (UTC) editor without a change still shifts the flight (flighttrack.py:984). The editor shows whole seconds and writes that value back. Example: a waypoint at 13:00:00.6 shows 13:00:01; committing it moves takeoff to 11:59:59.4. The other waypoints can then show times one second off. Fix: skip setData when the value is unchanged.
  2. Times saved by earlier versions are still in local time (flighttrack.py:786). The fix only applies to newly edited times. A takeoff time saved by the old dock widget was stored in local time and keeps showing as UTC, or wrong around daylight saving changes, until the user edits a cell. Fix: convert the loaded takeoff_time to UTC once, in load_settings.
  3. Only an editor that sends UTC gets a correct time (flighttrack.py:660). setData uses value.toPyDateTime() without toUTC(). Any caller passing a time in local spec gets it taken as UTC. value.toUTC().toPyDateTime() works for every spec.
  4. The solar-angle time can no longer be set with performance off (performance_settings.py:91). Removing the dock's takeoff field means the takeoff time can only be set with Show Performance ticked. The top view's solar-angle lines still depend on it, so a user can't change their time without switching performance on.

Performance and side effects:

  1. Extra redraws (mpl_pathinteractor.py:1331). The top view now listens to TIME_UTC, which update_distances emits on every change. So every edit in the table redraws the top view twice, and inserting or removing rows also redraws in the middle of the operation.
  2. MSColab sees a change that isn't one (flighttrack.py:669). A time edit emits dataChanged, which MSColab treats as a flight track change. Working locally, the FTML file is written twice; online, right after a load, the unchanged content may be sent to the server.
  3. Full recalculation for a time shift (flighttrack.py:670). A time edit reruns the whole performance model for every leg, although shifting each waypoint's time by the takeoff difference would be enough.

Small:

  1. The new hint label in ui_performance_dockwidget.ui has no wordWrap, so it makes the dock several hundred pixels wide.
  2. test_edit_time_in_local_dst_gap calls time.tzset(), which exists only on Unix. Skip the test where it's missing.

@joernu76

Copy link
Copy Markdown
Member Author

I have to talk with my Claude Code Review high then...

The takeoff time could only be set in the Performance Settings dock,
which few users found, and the times were only shown with "Show
Performance". Now the Time (UTC) column of the table view is always
shown and editable with a date/time editor with calendar popup. Setting
the time of a waypoint sets the takeoff time so that this waypoint is
reached at the given time; all other times follow from the aircraft
model. The takeoff time field and the Show Performance switch are
removed from the dock, a hint points to the table instead. Read-only
cells of the table (distances, times and fuel computed from the
performance, the data of the linear view) use the palette's disabled
text colour.

Times:
- All times are handled in UTC. QDateTimes are built directly in UTC
  instead of via local time, which gave invalid values for times in a
  daylight saving gap of the local zone (the editor opened at
  1999-12-31 and shifted the flight there). A takeoff time stored by
  earlier versions with local time spec is reinterpreted as UTC by its
  fields, not converted.
- Time (UTC), leg time and cumulative time are rounded to full seconds
  instead of truncated, so an entered 12:00:00 no longer shows 11:59:59.
  Committing the editor unchanged does not shift the flight by the
  rounding difference.

Change signals of the flight track model:
The model emitted dataChanged from update_distances in addition to
setData, also inside row insertion and removal, so every edit redrew
the views and requested the vertical and linear sections twice, and
time edits reached MSColab. Now:
- dataChanged once per change of the flight plan, its range covers all
  changed columns of the row; the derived data is updated before.
- rowsInserted/rowsRemoved/modelReset for structural changes, without
  an additional dataChanged; invert_direction and replace_waypoints
  reset the model and mark it modified.
- the new performanceDataChanged when only times, fuel or weight change
  (new takeoff time, new performance settings).
- An unchanged location, name or comment emits nothing, unparsable
  input is rejected (setData returns False).
Views dispatch on the changed columns: the linear view requests a new
section only for a changed path, the top view redraws for position,
name and altitude, and for times only when it shows solar angles. The
side view redraws its x-axis (times, ceiling altitude) also after an
altitude change, as the times and the aircraft weight depend on it.
The table view repaints on performanceDataChanged. MSColab and the
roundtrip buttons listen to the flight plan signals only; the
connections of the table view and of MSColab move with the flight
track (connect/disconnect_waypoints_model).

Performance settings:
- Performance is always computed and shown; the stored "visible"
  switch of earlier versions is dropped.
- The default takeoff and empty weight are those of the dummy aircraft
  (90000 lb and 55000 lb) instead of 0, which showed negative fuel.
- WaypointsTableModel.load_settings passes a copy of
  DEFAULT_PERFORMANCE: load_settings_qsettings updates its defaults in
  place, so all models shared, and modified, the module-level dict.
- The dock's weight spin boxes have no keyboard tracking, so a typed
  value is applied once, not on every keystroke; a loaded aircraft is
  applied once, not for each changed weight.

Docs and tutorials: the takeoff time and Show Performance steps are
removed from the performance tutorial and its texts; docs/usage.rst
describes the editable time.

Tests count the signals and the costly view updates (WMS requests, top
view and side view x-axis redraws) per change, check that every table
cell with a new text is repainted and that the plots get the current
waypoints, also after the views moved to another flight track. The
test fixtures reset the QSettings file after every test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@joernu76
joernu76 force-pushed the editable-waypoint-time branch from 31a2210 to db8b672 Compare November 11, 2026 14:07
@joernu76

Copy link
Copy Markdown
Member Author

OK; the code was not very well thought out to begin with. I asked for a clean rewrite and check of updates, etc. Tests are much more comprehensive and I believe that we fixed several minor bugs on the way.

@joernu76
joernu76 requested a review from ReimarBauer November 11, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Changing the take-off time

2 participants