-
Notifications
You must be signed in to change notification settings - Fork 0
/
image.kv
136 lines (133 loc) · 4.57 KB
/
image.kv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#:kivy 1.1.0
#:import Win kivy.core.window.Window
#:import FileBrowser kivy.garden.filebrowser
#:import plt matplotlib.pyplot
<MainWidget>:
canvas:
Color:
rgba: 250/255, 240/255, 230/255,1
# change default background of app from gray to some white-ish
Rectangle:
source: 'blank.png'
size: self.size
BoxLayout:
size: Win.size
id: mainbox
orientation: 'vertical'
BoxLayout:
height: '36dp'
spacing: '8dp'
size_hint_y: None
Button:
text: 'Load File'
width: '128dp'
height: '36dp'
size_hint: (None, None)
on_release: root.popup.open() # after we stop pressing button it will call show_load from MainWidget class
Spinner:
id: cmap_spinner
text: 'rainbow'
width: '128dp'
height: '36dp'
size_hint: (None, None)
sync_height: True
#values: ('rainbow', 'viridis', 'plasma', 'inferno', 'magma', 'jet', 'gray') # simpler list of cmaps
values: tuple(m for m in plt.cm.datad if not m.endswith("_r"))
# probably overkill, spinner with all available colormaps for matplotlib
Button:
text: 'Settings'
width: '128dp'
height: '36dp'
size_hint: (None, None)
on_release: app.open_settings()
BoxLayout:
height: '36dp'
spacing: '8dp'
cols: 2
size_hint_y: None
Label:
text: 'azimuth: {:.2f}'.format(azimuth_slider.value)
color: 0,0,0,1
size_hint_x: .3
SpecSlider:
id: azimuth_slider
min: -90
max: 90
step: 1
orientation: 'horizontal'
disabled: True # slider are disabled before loading file, just to prevent calling events
GridLayout:
cols: 2
Image:
size_hint_x: .85
size_hint_y: 1
id: surf_image
source: 'blank.png'
BoxLayout:
orientation: 'vertical'
size_hint_x: .15
Label:
text: 'elevation: {:.2f}'.format(elevation_slider.value)
color: 0,0,0,1
size_hint_y: .1
SpecSlider:
id: elevation_slider
size_hint_y: .9
min: -180
max: 180
step: 1
orientation: 'vertical'
disabled: True
<LoadDialog>:
title: 'Load File'
size_hint: 1, 1
pos: root.pos
FileBrowser:
#widget to select file
select_string: 'Select'
on_submit: root.load(self.selection[0]) # called when two-click on file
on_canceled: root.dismiss()
on_success: root.load(self.selection[0]) # called when pressed select button
<WrongFileDialog>:
title: 'Wrong File'
size_hint: None, None
size: Win.width / 2, Win.height / 2
auto_dismiss: False
BoxLayout:
orientation: 'vertical'
Label:
halign: 'center'
valign: 'middle'
text_size: self.width, None # otherwise text can display outside of popup
text: 'Unsupported file type. Supported file types are: matlab mat files and image files. Please choose again.'
Button:
text: 'Ok'
size_hint: None, None
height: '36dp'
width: '128dp'
pos_hint: {'center_x': 0.5}
on_release: root.reload() # call reload method of class
<SelectMatVariable>:
title: 'Select Variable'
auto_dismiss: False
size_hint: None, None
size: Win.width / 2, Win.height / 2
BoxLayout:
orientation: 'vertical'
spacing: 3*self.height/5
Spinner:
id: mat_spinner
size_hint: None, None
pos_hint: {'center_x': 0.5}
height: '36dp'
width: '128dp'
text: root.values[0]
values: root.values
sync_height: True # values from which we selected have the same height as spinner
Button:
text: 'Ok'
height: '36dp'
width: '128dp'
pos_hint: {'center_x': 0.5}
size_hint: None, None
on_release: root.dismiss() # just call normal method of popup class