Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions docs/source/dev_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@ the web interface works correctly.
The tests exercise the remote control features of PiFinder, changing **the state of the PiFinder** and
therefore should **not be run** against a PiFinder you are actively using for observing.

... tip

Note that the whole test suite runs approximately 20 min.

Running Website Tests locally
_______________________________

Expand All @@ -360,7 +364,8 @@ Note that when running the tests on Safari, you need to enable "Allow Remote Aut
does not support the "headless" mode, so you will see the browser window when running the tests and you cannot use other windows while the tests are running.

If you want to run the tests against a real PiFinder, set the ``PIFINDER_HOMEPAGE`` environment variable to the URL of your PiFinder instance or
pass the URL directly as a command line paramters with ``--url``. The PiFinder instance needs to be in the same WiFi as your machine, so that it is reachable via the network.
pass the URL directly as a command line parameter with ``--url``. The PiFinder instance needs to be in the same WiFi as your machine, so that it is
reachable via the network.

Running Website Tests remotely
________________________________
Expand Down Expand Up @@ -397,7 +402,6 @@ You can also run individual tests with PyTest directly, use ``SELENIUM_GRID_URL=

Note that due to the tests depending on the response times of the PiFinder web server and the Selenium Grid server, there may be occasional timeouts or failures.
If you encounter such issues, simply re-run the tests. We need to strike a balance between test speed and reliability, and this may require some tuning in the future.
Note that the tests run approximately 10 minutes.

Setting up Selenium Grid
___________________________
Expand Down
14 changes: 9 additions & 5 deletions python/PiFinder/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from PiFinder.multiproclogging import MultiprocLogging

from flask import Flask, request, jsonify, send_file, redirect, session, make_response
from urllib.parse import quote
from flask_babel import Babel, gettext # type: ignore[import-untyped]
from werkzeug.routing import IntegerConverter
from waitress import serve as waitress_serve
Expand Down Expand Up @@ -52,9 +53,8 @@ def auth_wrapper(*args, **kwargs):
if "authenticated" in session and session["authenticated"]:
return func(*args, **kwargs)

# Store the original URL for redirect after login
session["origin_url"] = request.url
return redirect("/login")
# Pass the original URL via ?next= so Safari preserves it across redirects
return redirect(f"/login?next={quote(request.url, safe='')}")

auth_wrapper.__name__ = func.__name__
return auth_wrapper
Expand Down Expand Up @@ -253,7 +253,10 @@ def home():
def login():
if request.method == "POST":
password = request.form.get("password")
origin_url = session.get("origin_url", "/")
# Read from hidden form field (set by GET handler); fall back to session
origin_url = request.form.get("origin_url") or session.get(
"origin_url", "/"
)
if sys_utils.verify_password("pifinder", password):
session["authenticated"] = True
session.pop("origin_url", None)
Expand All @@ -265,7 +268,8 @@ def login():
error_message=gettext("Invalid Password"),
)
else:
origin_url = session.get("origin_url", "/")
# Prefer ?next= URL param (set by auth_required); fall back to session
origin_url = request.args.get("next", session.get("origin_url", "/"))
return app.jinja_env.get_template("login.html").render(
title=gettext("Login"), origin_url=origin_url
)
Expand Down
3 changes: 3 additions & 0 deletions python/PiFinder/ui/menu_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,9 @@ def key_long_left(self):
self.help_images = None
self.update()

if self.marking_menu_stack:
self.exit_marking_menu()

self.stack[-1].inactive()
self.stack = self.stack[:1]
self.stack[0].active()
Expand Down
10 changes: 5 additions & 5 deletions python/PiFinder/ui/menu_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1058,23 +1058,23 @@ def _(key: str) -> Any:
"post_callback": callbacks.restart_pifinder,
"items": [
{
"name": _("Off"),
"name": _("Off"), # TRANSLATORS: IMU sensitivity setting
"value": 100,
},
{
"name": _("Very Low"),
"name": _("Very Low"), # TRANSLATORS: IMU sensitivity setting
"value": 3,
},
{
"name": _("Low"),
"name": _("Low"), # TRANSLATORS: IMU sensitivity setting
"value": 2,
},
{
"name": _("Medium"),
"name": _("Medium"), # TRANSLATORS: IMU sensitivity setting
"value": 1,
},
{
"name": _("High"),
"name": _("High"), # TRANSLATORS: IMU sensitivity setting
"value": 0.5,
},
],
Expand Down
8 changes: 4 additions & 4 deletions python/PiFinder/ui/object_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,10 +584,10 @@ def update(self, force=True):

# Add explanation about what CR means
explanation_lines = [
_("CR measures object"),
_("visibility based on"),
_("sky brightness,"),
_("telescope, and EP."),
_("CR measures object"), # TRANSLATORS: Contrast reserve explanation line 1
_("visibility based on"), # TRANSLATORS: Contrast reserve explanation line 2
_("sky brightness,"), # TRANSLATORS: Contrast reserve explanation line 3
_("telescope, and EP."), # TRANSLATORS: Contrast reserve explanation (EP = entrance pupil) line 4
]

for line in explanation_lines:
Expand Down
4 changes: 2 additions & 2 deletions python/PiFinder/ui/object_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def __init__(self, *args, **kwargs) -> None:
and self.item_definition.get("value") == "CM"
):
marking_menu_down = MarkingMenuOption(
label=_("Refresh"), callback=self.mm_refresh_comets
label=_("Refresh"), callback=self.mm_refresh_comets # TRANSLATORS: Marking menu option to refresh comet catalog
)

self.marking_menu = MarkingMenu(
Expand Down Expand Up @@ -846,7 +846,7 @@ def mm_refresh_comets(self, marking_menu, menu_item):
"""Force refresh of comet data from the internet"""
catalog = self.catalogs.get_catalog_by_code("CM")
if catalog and hasattr(catalog, "refresh"):
self.message(_("Refreshing..."), 1)
self.message(_("Refreshing..."), 1) # TRANSLATORS: Status message when refreshing comet catalog
catalog.refresh()
# Clear the UI object list and refresh to show status
self.refresh_object_list(force_update=True)
Expand Down
4 changes: 2 additions & 2 deletions python/PiFinder/ui/sqm.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ def __init__(self, *args, **kwargs):
# Marking menu definition
self.marking_menu = MarkingMenu(
left=MarkingMenuOption(
label=_("CAL"),
label=_("CAL"), # TRANSLATORS: Marking menu option to launch SQM calibration wizard
callback=self._launch_calibration,
),
down=MarkingMenuOption(
label=_("CORRECT"),
label=_("CORRECT"), # TRANSLATORS: Marking menu option to launch SQM correction sweep tool
callback=self._launch_sqm_sweep,
),
right=MarkingMenuOption(),
Expand Down
Binary file modified python/locale/de/LC_MESSAGES/messages.mo
Binary file not shown.
Loading
Loading