Skip to content

Commit

Permalink
Inside viewer: adding tooltips.
Browse files Browse the repository at this point in the history
  • Loading branch information
unhyperbolic committed Nov 25, 2023
1 parent 2286237 commit 8914cf5
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 9 deletions.
3 changes: 3 additions & 0 deletions python/raytracing/geodesics_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from tkinter import ttk

from .gui_utilities import UniformDictController, ScrollableFrame
from .tooltip import ToolTip
from .geodesics import geodesic_index_to_color, LengthSpectrumError
from ..geometric_structure.geodesic.exceptions import WordAppearsToBeParabolic
from ..SnapPy import word_as_list # type: ignore
Expand Down Expand Up @@ -164,6 +165,8 @@ def populate_geodesics_frame(self):
text='View',
takefocus=0,
command=lambda i=geodesic.index: self.view_geodesic(i))
ToolTip(btn,
msg="Move camera onto geodesic looking down the geodesic")
btn.grid(row=row, column=self.view_column)

row += 1
Expand Down
52 changes: 43 additions & 9 deletions python/raytracing/inside_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from .raytracing_view import *
from .geodesics_window import GeodesicsWindow
from .hyperboloid_utilities import unit_3_vector_and_distance_to_O13_hyperbolic_translation
from .tooltip import ToolTip
from .zoom_slider import Slider, ZoomSlider
from .eyeball import eyeball_type_none, eyeball_type_paper_plane, eyeball_type_eyeball

Expand Down Expand Up @@ -207,6 +208,8 @@ def create_cusps_frame(self, parent):
command=(
lambda which_cusp=i:
self.set_camera_cusp_view(which_cusp)))
ToolTip(cusp_button,
msg="Move camera into cusp neighborhood and look out")
cusp_button.grid(row=row, column=3)
row += 1

Expand Down Expand Up @@ -310,11 +313,15 @@ def create_fillings_frame(self, parent):
orb_button = ttk.Button(
subframe, text="Make orbifold", takefocus=0,
command=self.make_orbifold)
ToolTip(orb_button,
msg="Make filling coefficients integers")
orb_button.grid(row=0, column=2)

mfd_button = ttk.Button(
subframe, text="Make manifold", takefocus=0,
command=self.make_manifold)
ToolTip(mfd_button,
msg="Make filling coefficients co-prime integers")
mfd_button.grid(row=0, column=3)

return frame
Expand All @@ -331,12 +338,22 @@ def create_eyeball_frame(self, parent):
view_label.grid(row=row, column=0)

radio_buttons = []
for i, text in enumerate(["Material", "Ideal", "Hyperideal"]):
for i, text, tooltip in [
(0,
"Material",
"Camera rays leave from the same point"),
(1,
"Ideal",
"Camera rays leave orthogonally from a horosphere"),
(2,
"Hyperideal",
"Camera rays leave orthogonally from a (hyperbolic) plane")]:
button = ttk.Radiobutton(frame,
value=i,
text=text,
takefocus=0)
button.grid(row=row, column=i + 1, padx=8, sticky=tkinter.NW)
ToolTip(button, msg=tooltip)
radio_buttons.append(button)

self.perspective_type_controller = UniformDictController(
Expand All @@ -349,17 +366,28 @@ def create_eyeball_frame(self, parent):

self_type_label = ttk.Label(frame, text="Camera body")
self_type_label.grid(row=row, column=0)

ToolTip(self_type_label,
msg="What shows your position and orientation in the manifold")

radio_buttons = []
for i, (eyeball_type, text) in enumerate([
(eyeball_type_none, "None"),
(eyeball_type_paper_plane, "Paper plane"),
(eyeball_type_eyeball, "Eyeball")]):
for i, (eyeball_type, text, tooltip) in enumerate([
(eyeball_type_none,
"None",
""),
(eyeball_type_paper_plane,
"Paper plane",
"Paper plane shows your position and orientation in the manifold"),
(eyeball_type_eyeball,
"Eyeball",
"Eyeball shows your position and orientation in the manifold")]):
button = ttk.Radiobutton(frame,
value=eyeball_type,
text=text,
takefocus=0)
button.grid(row=row, column=1 + i, padx=8, sticky=tkinter.NW)
if tooltip:
ToolTip(button, msg=tooltip)
radio_buttons.append(button)
self.self_type_controller = UniformDictController(
self.widget.ui_parameter_dict,
Expand All @@ -385,15 +413,19 @@ def create_eyeball_frame(self, parent):
misc_frame = ttk.Frame(frame)
misc_frame.grid(row=row, column=1, columnspan=3)

UniformDictController.create_checkbox(
freeze_checkbox = UniformDictController.create_checkbox(
misc_frame,
self.widget.ui_parameter_dict,
key='freezeEyeball',
text='Freeze camera body',
row=row,
column=0,
update_function=self.widget.redraw_if_initialized,
gridargs = {'padx' : 8})
gridargs = {'padx' : 8}).checkbox
ToolTip(freeze_checkbox,
msg=("Keep paper plane/eyeball at the same position "
"and attitude even when you are moving through the "
"manifold"))

UniformDictController.create_checkbox(
misc_frame,
Expand All @@ -418,7 +450,7 @@ def create_skeleton_frame(self, parent):

row = 0

UniformDictController.create_horizontal_scale(
scale = UniformDictController.create_horizontal_scale(
frame,
self.widget.ui_parameter_dict,
key='edgeThickness',
Expand All @@ -427,7 +459,9 @@ def create_skeleton_frame(self, parent):
left_end=0.0,
right_end=0.35,
update_function=self.widget.redraw_if_initialized,
format_string='%.3f')
format_string='%.3f').scale
ToolTip(scale,
msg=("Partially show faces of the tetrahedra."))
row += 1

self.insphereScaleController = (
Expand Down

0 comments on commit 8914cf5

Please sign in to comment.