Skip to content

Commit

Permalink
Merge pull request #354 from Carifio24/expose-text-constellations
Browse files Browse the repository at this point in the history
Expose grid text and additional constellation settings
  • Loading branch information
pkgw authored Jun 30, 2023
2 parents c5c063a + c1a5a52 commit 3665ecb
Show file tree
Hide file tree
Showing 13 changed files with 83 additions and 17 deletions.
34 changes: 21 additions & 13 deletions pywwt/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,9 +604,9 @@ def instruments(self):
False, help="Whether to show an altitude-azimuth grid " "(`bool`)"
).tag(wwt="showAltAzGrid", wwt_reset=True)

# alt_az_text = Bool(False,
# help='Whether to show labels for the altitude-azimuth grid\'s text '
# '(`bool`)').tag(wwt='showAltAzGridText', wwt_reset=True)
alt_az_text = Bool(
False, help='Whether to show labels for the altitude-azimuth grid\'s text ' '(`bool`)'
).tag(wwt='showAltAzGridText', wwt_reset=True)

background = Unicode(
"Hydrogen Alpha Full Sky Map",
Expand Down Expand Up @@ -645,14 +645,14 @@ def instruments(self):
"(`bool`)",
).tag(wwt="showConstellationSelection", wwt_reset=True)

# constellation_pictures = Bool(False,
# help='Whether to show pictures of the constellations\' '
# 'mythological representations '
# '(`bool`)').tag(wwt='showConstellationPictures', wwt_reset=True)
constellation_pictures = Bool(
False, help='Whether to show pictures of the constellations\' '
'mythological representations ' '(`bool`)'
).tag(wwt='showConstellationPictures', wwt_reset=True)

# constellation_labels = Bool(False,
# help='Whether to show labelss for constellations '
# '(`bool`)').tag(wwt='showConstellationLabels', wwt_reset=True)
constellation_labels = Bool(
False, help='Whether to show labels for constellations ' '(`bool`)'
).tag(wwt='showConstellationLabels', wwt_reset=True)

crosshairs = Bool(
False, help="Whether to show crosshairs at the center of " "the field (`bool`)"
Expand All @@ -670,6 +670,10 @@ def instruments(self):
False, help="Whether to show a grid relative to the " "ecliptic plane (`bool`)"
).tag(wwt="showEclipticGrid", wwt_reset=True)

ecliptic_text = Bool(
False, help="Whether to show labels for the ecliptic grid " "(`bool`)"
).tag(wwt="showEclipticGridText", wwt_reset=True)

foreground = Unicode(
"Digitized Sky Survey (Color)",
help="The layer to show in the foreground (`str`)",
Expand All @@ -689,14 +693,18 @@ def instruments(self):
False, help="Whether to show a grid relative to the " "galactic plane (`bool`)"
).tag(wwt="showGalacticGrid", wwt_reset=True)

# galactic_text = Bool(False,
# help='Whether to show labels for the galactic grid\'s text '
# '(`bool`)').tag(wwt='showGalacticGridText', wwt_reset=True)
galactic_text = Bool(
False, help='Whether to show labels for the galactic grid\'s text ' '(`bool`)'
).tag(wwt='showGalacticGridText', wwt_reset=True)

grid = Bool(False, help="Whether to show the equatorial grid " "(`bool`)").tag(
wwt="showGrid", wwt_reset=True
)

grid_text = Bool(
False, help="Whether to show labels for the equatorial grid " "(`bool`)"
).tag(wwt="showEquatorialGridText", wwt_reset=True)

local_horizon_mode = Bool(
False,
help="Whether the view should be that of "
Expand Down
Binary file added pywwt/tests/data/refimg_qt_full_step7/a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pywwt/tests/data/refimg_qt_full_step7/b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pywwt/tests/data/refimg_qt_full_step7/c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pywwt/tests/data/refimg_qt_full_step7/d.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pywwt/tests/data/refimg_qt_full_step8/a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pywwt/tests/data/refimg_qt_full_step8/b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pywwt/tests/data/refimg_qt_full_step8/c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pywwt/tests/data/refimg_qt_full_step8/d.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pywwt/tests/data/refimg_qt_full_step8/e.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pywwt/tests/data/refimg_qt_full_step8/f.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions pywwt/tests/test_qt_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,50 @@ def test_full(tmpdir, wwt_qt_client_isolated):
if msg:
failures.append(msg)

# Step 7

wwt.clear_annotations()
wwt.grid = False
wwt.constellation_labels = True
wwt.constellation_figures = True
wwt.constellation_pictures = True
wwt.constellation_boundaries = True
wwt.constellation_boundary_color = "pink"
wwt.constellation_selection_color = "blue"
wwt.constellation_figure_color = "teal"

wwt.center_on_coordinates(wwt.get_center(), fov=60 * u.deg)

# The constellation images take some time to load
wait_for_test(wwt, 10 * WAIT_TIME, for_render=True)

msg = assert_widget_image(tmpdir, wwt, 'qt_full_step7.png', fail_now=False)
if msg:
failures.append(msg)

# Step 8

wwt.constellation_labels = False
wwt.constellation_figures = False
wwt.constellation_pictures = False
wwt.constellation_boundaries = False
wwt.grid = True
wwt.grid_text = True
wwt.alt_az_grid = True
wwt.alt_az_text = True
wwt.ecliptic_grid = True
wwt.ecliptic_text = True
wwt.galactic_grid = True
wwt.galactic_text = True

wwt.center_on_coordinates(wwt.get_center(), fov=20 * u.deg)

wait_for_test(wwt, WAIT_TIME, for_render=True)

msg = assert_widget_image(tmpdir, wwt, 'qt_full_step8.png', fail_now=False)
if msg:
failures.append(msg)

# Summarize

if failures:
Expand Down
22 changes: 18 additions & 4 deletions pywwt/tests/test_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
from astropy.coordinates import SkyCoord

DEGREES_TO_HOURS = 1. / 15.
STARDARD_WWT_SETTINGS = ['actualPlanetScale', 'showAltAzGrid', 'showConstellationBoundries', 'constellationBoundryColor',
'constellationFigureColor', 'showConstellationFigures', 'showConstellationSelection',
STARDARD_WWT_SETTINGS = ['actualPlanetScale', 'showAltAzGrid', 'showaltAzGridText', 'showConstellationBoundries',
'constellationBoundryColor', 'constellationFigureColor', 'showConstellationFigures',
'showConstellationSelection', 'showConstellationLabels', 'showConstellationPictures',
'constellationSelectionColor', 'showCrosshairs', 'crosshairsColor', 'showEcliptic',
'showEclipticGrid', 'showGalacticGrid', 'galacticMode', 'showGrid', 'localHorizonMode',
'locationAltitude', 'locationLat', 'locationLng']
'showEclipticGrid', 'showEclipticGridText', 'showGalacticGrid', 'showGalacticGridText',
'galacticMode', 'showGrid', 'showEquatorialGridText', 'localHorizonMode', 'locationAltitude',
'locationLat', 'locationLng']


class MockWWTWidget(BaseWWTWidget):
Expand Down Expand Up @@ -81,38 +83,50 @@ def test_widget_settings_serialization():
widget = MockWWTWidget()
widget.actual_planet_scale = True
widget.alt_az_grid = False
widget.alt_az_text = False
widget.constellation_boundaries = True
widget.constellation_boundary_color = 'red'
widget.constellation_figure_color = '#24680b'
widget.constellation_figures = False
widget.constellation_selection = True
widget.constellation_selection_color = 'c' # cyan
widget.constellation_labels = False
widget.constellation_pictures = False
widget.crosshairs = True
widget.crosshairs_color = (128./255., 64./255., 16./255.)
widget.ecliptic = False
widget.ecliptic_grid = True
widget.ecliptic_text = False
widget.galactic_grid = False
widget.galactic_text = False
widget.galactic_mode = True
widget.grid = False
widget.grid_text = False
widget.local_horizon_mode = True
widget.location_altitude = 7*u.m
widget.location_latitude = 12*u.deg
widget.location_longitude = -18*u.deg
expected_settings = {'actualPlanetScale': True,
'showAltAzGrid': False,
'showAltAzGridText': False,
'showConstellationBoundries': True,
'constellationBoundryColor': '#ff0000',
'constellationFigureColor': '#24680b',
'showConstellationFigures': False,
'showConstellationSelection': True,
'constellationSelectionColor': '#00bfbf',
'showConstellationLabels': False,
'showConstellationPictures': False,
'showCrosshairs': True,
'crosshairsColor': '#804010',
'showEcliptic': False,
'showEclipticGrid': True,
'showEclipticGridText': False,
'showGalacticGrid': False,
'showGalacticGridText': False,
'galacticMode': True,
'showGrid': False,
'showEquatorialGridText': False,
'localHorizonMode': True,
'locationAltitude': 7,
'locationLat': 12.,
Expand Down

0 comments on commit 3665ecb

Please sign in to comment.