Skip to content

Commit 4a79794

Browse files
committed
expose axes limits in profile viewer options
1 parent 9f7746b commit 4a79794

5 files changed

Lines changed: 44 additions & 1 deletion

File tree

glue_jupyter/common/state_widgets/viewer_profile.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import ipyvuetify as v
2+
import ipywidgets as widgets
23
import traitlets
34
from ...state_traitlets_helpers import GlueState
45
from ...vuetify_helpers import link_glue_choices
6+
from ...widgets import AxesLimits
57

68
__all__ = ['ProfileViewerStateWidget']
79

@@ -20,6 +22,8 @@ class ProfileViewerStateWidget(v.VuetifyTemplate):
2022
function_items = traitlets.List().tag(sync=True)
2123
function_selected = traitlets.Int(allow_none=True).tag(sync=True)
2224

25+
axes_limits_widget = traitlets.Any().tag(sync=True, **widgets.widget_serialization)
26+
2327
def __init__(self, viewer_state):
2428
super().__init__()
2529

@@ -28,3 +32,5 @@ def __init__(self, viewer_state):
2832
link_glue_choices(self, viewer_state, 'reference_data')
2933
link_glue_choices(self, viewer_state, 'x_att')
3034
link_glue_choices(self, viewer_state, 'function')
35+
36+
self.axes_limits_widget = AxesLimits(viewer_state)

glue_jupyter/common/state_widgets/viewer_profile.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
<v-select :items="function_items" label="function" v-model="function_selected"/>
1111
</div>
1212

13+
<div>
14+
<jupyter-widget :widget="axes_limits_widget"></jupyter-widget>
15+
</div>
16+
1317
<div class="d-inline-flex flex-wrap">
1418
<v-btn-toggle dense multiple :value="modeSet" @change="modeSetChange" style="margin-right: 8px">
1519

glue_jupyter/widgets/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
from .axes_limits import AxesLimits
12
from .color import Color
23
from .size import Size
34
from .linked_dropdown import LinkedDropdown
45

5-
__all__ = ['Color', 'Size', 'LinkedDropdown']
6+
__all__ = ['AxesLimits', 'Color', 'Size', 'LinkedDropdown']
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import ipyvuetify as v
2+
from ..state_traitlets_helpers import GlueState
3+
4+
__all__ = ['AxesLimits']
5+
6+
7+
class AxesLimits(v.VuetifyTemplate):
8+
template_file = (__file__, 'axes_limits.vue')
9+
10+
glue_state = GlueState().tag(sync=True)
11+
12+
def __init__(self, viewer_state):
13+
super().__init__()
14+
self.glue_state = viewer_state
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<template>
2+
<v-row>
3+
<v-col cols=6>
4+
<glue-float-field label="xmin" :value.sync="glue_state.x_min" />
5+
</v-col cols=6>
6+
<v-col>
7+
<glue-float-field label="xmax" :value.sync="glue_state.x_max" />
8+
</v-col>
9+
</v-row>
10+
<v-row>
11+
<v-col cols=6>
12+
<glue-float-field label="ymin" :value.sync="glue_state.y_min" />
13+
</v-col>
14+
<v-col cols=6>
15+
<glue-float-field label="ymax" :value.sync="glue_state.y_max" />
16+
</v-col>
17+
</v-row>
18+
</template>

0 commit comments

Comments
 (0)