@@ -97,6 +97,17 @@ def delete_rendered_object(self):
9797
9898 # --- Module specific attributes ---
9999
100+ def copy_tooltip_coords_as_strtr_to_clipboard (self ):
101+ coords = self .tooltip_coordinates
102+ if coords is not None :
103+ tooltip_str_transform = ' ' .join ([
104+ f'T{ ax } ' + si_format (cc , format_str = '{value}{prefix}m' )
105+ for ax , cc in zip (['x' , 'y' , 'z' ], coords )
106+ ])
107+
108+ clipboard = self .parent_viewer .app .clipboard ()
109+ clipboard .setText (tooltip_str_transform )
110+
100111 def _on_editor_parsed (self , param_name , edited_value ):
101112 self .set_user_param (param_name , edited_value )
102113 self .parent_viewer .update_rendered_view ()
@@ -118,13 +129,21 @@ def _init_status_bar_widget(self):
118129
119130 # Tooltip global coordinates widget
120131 space_conv = self .parent_viewer .ATLAS_SPACE_CONVENTION
121- self .statusbar_label = pyqtw . QLabel (' Tooltip global coords: ' )
122- self .statusbar_x_coord_label = pyqtw . QLabel (f"{ space_conv [0 ][:4 ]} . (x): 0 m" )
132+ self .statusbar_label = ClickableLabel (' Tooltip global coords: ' )
133+ self .statusbar_x_coord_label = ClickableLabel (f"{ space_conv [0 ][:4 ]} . (x): 0 m" )
123134 self .statusbar_x_coord_label .setStyleSheet (f'border: 0; color: { self .parent_viewer .x_RED } ;' )
124- self .statusbar_y_coord_label = pyqtw . QLabel (f"{ space_conv [1 ][:4 ]} . (y): 0 m" )
135+ self .statusbar_y_coord_label = ClickableLabel (f"{ space_conv [1 ][:4 ]} . (y): 0 m" )
125136 self .statusbar_y_coord_label .setStyleSheet (f'border: 0; color: { self .parent_viewer .y_GREEN } ;' )
126- self .statusbar_z_coord_label = pyqtw . QLabel (f"{ space_conv [2 ][:4 ]} . (z): 0 m" )
137+ self .statusbar_z_coord_label = ClickableLabel (f"{ space_conv [2 ][:4 ]} . (z): 0 m" )
127138 self .statusbar_z_coord_label .setStyleSheet (f'border: 0; color: { self .parent_viewer .z_BLUE } ;' )
139+
140+ # Connect mouse click events
141+ self .statusbar_label .clicked .connect (self .copy_tooltip_coords_as_strtr_to_clipboard )
142+ self .statusbar_x_coord_label .clicked .connect (self .copy_tooltip_coords_as_strtr_to_clipboard )
143+ self .statusbar_y_coord_label .clicked .connect (self .copy_tooltip_coords_as_strtr_to_clipboard )
144+ self .statusbar_z_coord_label .clicked .connect (self .copy_tooltip_coords_as_strtr_to_clipboard )
145+
146+ # Add widgets to toolbar
128147 self .parent_viewer .statusBar ().addPermanentWidget (self .statusbar_label )
129148 self .parent_viewer .statusBar ().addPermanentWidget (self .statusbar_x_coord_label )
130149 self .parent_viewer .statusBar ().addPermanentWidget (self .statusbar_y_coord_label )
0 commit comments