Skip to content

Commit 8bb7b8d

Browse files
committed
Codestyle fixes.
1 parent 9d6eb46 commit 8bb7b8d

File tree

5 files changed

+26
-24
lines changed

5 files changed

+26
-24
lines changed

glue_wwt/viewer/jupyter_viewer.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -90,20 +90,22 @@ def __init__(self, viewer_state, available_layers):
9090
self.widget_constellation_boundaries = LinkedDropdown(self.state, 'constellation_boundaries',
9191
label="Boundaries:")
9292
self.widget_constellation_boundary_color = linked_color_picker(self.state, 'constellation_boundary_color',
93-
description="Boundary")
93+
description="Boundary")
9494
dlink((self.widget_constellation_boundaries, 'value'), (self.widget_constellation_boundary_color, 'disabled'),
9595
lambda value: value != "All")
9696
self.widget_constellation_selection_color = linked_color_picker(self.state, 'constellation_selection_color',
97-
description="Selection")
97+
description="Selection")
9898
dlink((self.widget_constellation_boundaries, 'value'), (self.widget_constellation_selection_color, 'disabled'),
9999
lambda value: value == "None")
100100

101101
self.widget_constellation_figures = linked_checkbox(self.state, 'constellation_figures', description="Figures")
102102
self.widget_constellation_figure_color = linked_color_picker(self.state, 'constellation_figure_color',
103-
description="Figure")
103+
description="Figure")
104104
set_enabled_from_checkbox(self.widget_constellation_figure_color, self.widget_constellation_figures)
105-
self.widget_constellation_labels = linked_checkbox(self.state, 'constellation_labels', description="Labels")
106-
self.widget_constellation_pictures = linked_checkbox(self.state, 'constellation_pictures', description="Pictures")
105+
self.widget_constellation_labels = linked_checkbox(self.state, 'constellation_labels',
106+
description="Labels")
107+
self.widget_constellation_pictures = linked_checkbox(self.state, 'constellation_pictures',
108+
description="Pictures")
107109

108110
constellations_hbox_layout = Layout(gap="10px", justify_content="space-between")
109111
constellations_vbox_layout = Layout(height="fit-content", gap="2px", padding="5px", flex_direction="column")
@@ -150,26 +152,24 @@ def __init__(self, viewer_state, available_layers):
150152
self.widget_min_time = NaiveDatetimePicker(description="Min Time:")
151153
link((self.state, 'min_time'), (self.widget_min_time, 'value'),
152154
lambda time: self._datetime64_to_utc_datetime(time),
153-
lambda value: datetime64(value)
154-
)
155+
lambda value: datetime64(value))
155156
self.widget_max_time = NaiveDatetimePicker(description="Max Time:")
156157
link((self.state, 'max_time'), (self.widget_max_time, 'value'),
157158
lambda time: self._datetime64_to_utc_datetime(time),
158-
lambda value: datetime64(value)
159-
)
159+
lambda value: datetime64(value))
160160

161161
self.other_settings = VBox(children=[
162162
GridBox(children=[self.widget_ecliptic_label, self.widget_ecliptic,
163163
self.widget_ecliptic_color, self.widget_precession_chart_label,
164-
self.widget_precession_chart, self.widget_precession_chart_color],
164+
self.widget_precession_chart,
165+
self.widget_precession_chart_color],
165166
layout=Layout(grid_template_columns="60% 20% 20%", width="100%",
166167
grid_gap="2px 10px")),
167168
VBox(children=[self.widget_play_time, self.widget_clock_rate,
168169
self.widget_current_time_label, self.widget_current_time,
169170
self.widget_min_time, self.widget_max_time])
170171
])
171172

172-
173173
self.settings = Accordion(children=[self.general_settings, self.grid_settings,
174174
self.constellation_settings, self.other_settings],
175175
layout=Layout(width="350px"))
@@ -232,7 +232,7 @@ def __init__(self, layer_state):
232232
self.state = layer_state
233233
self.color_widgets = Color(state=self.state)
234234
self.size_widgets = Size(state=self.state)
235-
235+
236236
self.widget_time_series = linked_checkbox(self.state, 'time_series', description="Time series")
237237
self.widget_time_att = LinkedDropdown(self.state, 'time_att', 'Time att')
238238
self.widget_time_decay_value = linked_float_text(self.state, 'time_decay_value',

glue_wwt/viewer/options_widget.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ def _setup_widget_dependencies(self):
5454
set_enabled_from_checkbox(self.ui.color_precession_chart_color, self.ui.bool_precession_chart)
5555

5656
enabled_if_combosel_in(self.ui.color_constellation_boundary_color,
57-
self.ui.combosel_constellation_boundaries,
58-
['All'])
57+
self.ui.combosel_constellation_boundaries,
58+
['All'])
5959
enabled_if_combosel_in(self.ui.color_constellation_selection_color,
60-
self.ui.combosel_constellation_boundaries,
61-
['All', 'Selection only'])
60+
self.ui.combosel_constellation_boundaries,
61+
['All', 'Selection only'])
6262

6363
def _update_visible_options(self, *args, **kwargs):
6464

@@ -96,7 +96,8 @@ def _update_visible_options(self, *args, **kwargs):
9696
self.ui.label_lat_att.setText('Latitude')
9797

9898
def _update_slider_fraction(self, *args):
99-
fraction = (self._viewer_state.current_time - self._viewer_state.min_time) / (self._viewer_state.max_time - self._viewer_state.min_time)
99+
fraction = (self._viewer_state.current_time - self._viewer_state.min_time) / \
100+
(self._viewer_state.max_time - self._viewer_state.min_time)
100101
slider_min = self.ui.slider_current_time.minimum()
101102
slider_max = self.ui.slider_current_time.maximum()
102103
value = round(slider_min + fraction * (slider_max - slider_min))
@@ -107,7 +108,7 @@ def _on_current_time_update(self, time):
107108
self._update_slider_fraction()
108109
try:
109110
self.ui.label_current_time.setText(f"Current Time: {time.astype('datetime64[ms]')}")
110-
except:
111+
except Exception:
111112
pass
112113

113114
def _on_slider_changed(self, *args):
@@ -118,7 +119,8 @@ def _on_slider_changed(self, *args):
118119
slider_min = self.ui.slider_current_time.minimum()
119120
slider_max = self.ui.slider_current_time.maximum()
120121
fraction = (value - slider_min) / (slider_max - slider_min)
121-
self._viewer_state.current_time = self._viewer_state.min_time + fraction * (self._viewer_state.max_time - self._viewer_state.min_time)
122+
self._viewer_state.current_time = self._viewer_state.min_time + \
123+
fraction * (self._viewer_state.max_time - self._viewer_state.min_time)
122124

123125
def _update_time_bounds(self, *args):
124126
min_time = self._viewer_state.min_time
@@ -130,4 +132,3 @@ def _update_time_bounds(self, *args):
130132

131133
self._viewer_state.min_time = min_time
132134
self._viewer_state.max_time = max_time
133-

glue_wwt/viewer/table_layer.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,11 @@ def _update_presentation(self, force=False, **kwargs):
251251

252252
if self.state.time_series and self.state.time_att is not None:
253253
try:
254-
# Providing datetime objects as the time values offers noticeably better performance than either datetime strings or astropy Time objects
254+
# Providing datetime objects as the time values offers noticeably better performance
255+
# than either datetime strings or astropy Time objects.
255256
# This is likely due to the time attribute value validation in pywwt
256-
time_values = [datetime.fromisoformat(datetime_as_string(t, unit='s', timezone='UTC')) for t in self.layer[self.state.time_att]]
257+
time_values = [datetime.fromisoformat(datetime_as_string(t, unit='s', timezone='UTC'))
258+
for t in self.layer[self.state.time_att]]
257259
except IncompatibleAttribute:
258260
self.disable_invalid_attributes(self.state.time_att)
259261
return

glue_wwt/viewer/time_dialog.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import os
2-
from datetime import datetime
2+
from datetime import datetime
33

44
from qtpy.QtCore import QDate, QTime
55
from qtpy.QtWidgets import QDialog

glue_wwt/viewer/viewer_state.py

-1
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,3 @@ def _on_current_time_update(self, time):
159159
elif time > self.max_time:
160160
self.current_time = self.max_time
161161
self.play_time = False
162-

0 commit comments

Comments
 (0)