Skip to content

Commit 1248670

Browse files
committed
Adding precision value. this refs #337
1 parent c45b647 commit 1248670

File tree

3 files changed

+112
-309
lines changed

3 files changed

+112
-309
lines changed

notebooks/__code/metadata_overlapping_images/metadata_selector_handler.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,13 @@ def update_final_result(self):
100100
else:
101101
result = self.ui.linear_operation_value_before.text()
102102

103-
self.ui.final_result_label.setText(result)
103+
rounding_precision = self.ui.precision_spinBox.value()
104+
try:
105+
result = round(float(result), rounding_precision)
106+
except ValueError:
107+
pass
108+
109+
self.ui.final_result_label.setText(str(result))
104110

105111
def ok_clicked(self):
106112
QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
@@ -172,3 +178,6 @@ def result_of_checking_operation(ui=None):
172178
return False
173179
else:
174180
return True
181+
182+
def precision_spinbox_changed(self, new_value=None):
183+
self.update_final_result()

notebooks/metadata_overlapping_images.ipynb

Lines changed: 7 additions & 308 deletions
Original file line numberDiff line numberDiff line change
@@ -38,221 +38,14 @@
3838
},
3939
{
4040
"cell_type": "code",
41-
"execution_count": 1,
41+
"execution_count": null,
4242
"metadata": {
4343
"run_control": {
4444
"frozen": false,
4545
"read_only": false
4646
}
4747
},
48-
"outputs": [
49-
{
50-
"data": {
51-
"text/html": [
52-
"\n",
53-
"<style type=\"text/css\">\n",
54-
".jupyter-widgets select option {font-family: \"Lucida Console\", Monaco, monospace;}\n",
55-
".jupyter-widgets select {width: 98%;}\n",
56-
"div.output_subarea {padding: 0px;}\n",
57-
"div.output_subarea > div {margin: 0.4em;}\n",
58-
"</style>\n"
59-
],
60-
"text/plain": [
61-
"<IPython.core.display.HTML object>"
62-
]
63-
},
64-
"metadata": {},
65-
"output_type": "display_data"
66-
},
67-
{
68-
"data": {
69-
"text/html": [
70-
"\n",
71-
"<style type=\"text/css\">\n",
72-
".jupyter-widgets select option {font-family: \"Lucida Console\", Monaco, monospace;}\n",
73-
"div.output_subarea {padding: 0px;}\n",
74-
"div.output_subarea > div {margin: 0.4em;}\n",
75-
"</style>\n"
76-
],
77-
"text/plain": [
78-
"<IPython.core.display.HTML object>"
79-
]
80-
},
81-
"metadata": {},
82-
"output_type": "display_data"
83-
},
84-
{
85-
"data": {
86-
"text/html": [
87-
"\n",
88-
" <style>\n",
89-
" .result_label {\n",
90-
" font-style: bold;\n",
91-
" color: red;\n",
92-
" font-size: 18px;\n",
93-
" }\n",
94-
" </style>\n",
95-
" "
96-
],
97-
"text/plain": [
98-
"<IPython.core.display.HTML object>"
99-
]
100-
},
101-
"metadata": {},
102-
"output_type": "display_data"
103-
},
104-
{
105-
"data": {
106-
"text/html": [
107-
"<span style=\"font-size: 15px; color:blue\">working dir set to -> /Users/j35</span>"
108-
],
109-
"text/plain": [
110-
"<IPython.core.display.HTML object>"
111-
]
112-
},
113-
"metadata": {},
114-
"output_type": "display_data"
115-
},
116-
{
117-
"data": {
118-
"text/html": [
119-
"<style>\n",
120-
"\n",
121-
"/* The following CSS has been adapted from\n",
122-
" http://nbviewer.ipython.org/github/ketch/teaching-numerics-with-notebooks/blob/master/Styling_notebooks.ipynb\n",
123-
" by Aron Ahmadia and David Ketcheson and has been reused under CC BY 4.0\n",
124-
" */\n",
125-
"\n",
126-
"/* main background */\n",
127-
"#site {\n",
128-
" background: #888;\n",
129-
" color: #red;\n",
130-
"}\n",
131-
"\n",
132-
"div.container {\n",
133-
" width: 100% ! important;\n",
134-
"}\n",
135-
"\n",
136-
"div.cell { /* set cell width to about 80 chars */\n",
137-
" width: 95%;\n",
138-
"}\n",
139-
"\n",
140-
"div #notebook { /* centre the content */\n",
141-
"/* background: #fff; /* white background for content */\n",
142-
" background: blue;\n",
143-
" width: 100%;\n",
144-
" margin: auto;\n",
145-
" padding-left: 1em;\n",
146-
" padding-right: 1em;\n",
147-
" background-image: url(\"tile_background.jpg\");\n",
148-
"}\n",
149-
"\n",
150-
"#notebook li { /* More space between bullet points */\n",
151-
" margin-top:0.4em;\n",
152-
"}\n",
153-
"\n",
154-
"/* change background color of running cells */\n",
155-
"div.cell.code_cell.running {\n",
156-
"/* background-color: rgba(164,188,194,.75); */\n",
157-
" background-color: green;\n",
158-
" border-width: 8px\n",
159-
" border-style: solid\n",
160-
" border-color: #111;\n",
161-
"}\n",
162-
"\n",
163-
"/* Put a solid color box around each cell and its output, visually linking them together */\n",
164-
"div.cell.code_cell {\n",
165-
" background-color: rgba(164,188,194,.25); /* Continuum L Gray with alpha 0.25 */\n",
166-
" border-radius: 10px; /* rounded borders */\n",
167-
" padding: 1em;\n",
168-
" margin-top: 1em;\n",
169-
"}\n",
170-
"\n",
171-
"div.text_cell_render{\n",
172-
"\tfont-family: Georgia, Times, 'Times New Roman', serif;\n",
173-
" line-height: 110%;\n",
174-
" font-size: 105%;\n",
175-
" width: 95%;\n",
176-
" margin-left: auto;\n",
177-
" margin-right: auto;\n",
178-
"}\n",
179-
"\n",
180-
"\n",
181-
"/* Formatting for header cells */\n",
182-
".text_cell_render h1 {\n",
183-
"\tfont-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;\n",
184-
" font-weight: 400;\n",
185-
" font-size: 30pt;\n",
186-
" line-height: 100%;\n",
187-
" color: rgb(37,55,70); /* Continuum Blue*/\n",
188-
" margin-bottom: 0.1em;\n",
189-
" margin-top: 0.1em;\n",
190-
" display: block;\n",
191-
"}\n",
192-
".text_cell_render h2 {\n",
193-
"\tfont-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;\n",
194-
" font-weight: 700;\n",
195-
" font-size: 22pt;\n",
196-
" line-height: 100%;\n",
197-
" color: rgb(37,55,70);\n",
198-
" margin-bottom: 0.1em;\n",
199-
" margin-top: 0.1em;\n",
200-
" display: block;\n",
201-
"}\n",
202-
"\n",
203-
".text_cell_render h3 {\n",
204-
"\tfont-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;\n",
205-
" margin-top:12px;\n",
206-
" margin-bottom: 3px;\n",
207-
" font-style: italic;\n",
208-
" color: rgb(37, 55, 70);\n",
209-
"}\n",
210-
"\n",
211-
".text_cell_render h4 {\n",
212-
"\tfont-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;\n",
213-
"}\n",
214-
"\n",
215-
".text_cell_render h5 {\n",
216-
"\tfont-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;\n",
217-
" font-weight: 300;\n",
218-
" font-size: 14pt;\n",
219-
" font-style: italic;\n",
220-
" margin-bottom: .1em;\n",
221-
" margin-top: 0.1em;\n",
222-
" display: block;\n",
223-
"}\n",
224-
"\n",
225-
".text_cell_render h6 {\n",
226-
"\tfont-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;\n",
227-
" font-weight: 300;\n",
228-
" font-size: 10pt;\n",
229-
" margin-bottom: 1px;\n",
230-
" margin-top: 1px;\n",
231-
"}\n",
232-
"\n",
233-
".CodeMirror{\n",
234-
" font-family: \"PT Mono\", fixed;\n",
235-
" font-size: 100%;\n",
236-
"}\n",
237-
"\n",
238-
"#notebook_panel { /* main background */\n",
239-
" background-image: url(\"tile_background.jpg\");\n",
240-
"}\n",
241-
"\n",
242-
"\n",
243-
"\n",
244-
"\n",
245-
"</style>\n"
246-
],
247-
"text/plain": [
248-
"<IPython.core.display.HTML object>"
249-
]
250-
},
251-
"execution_count": 1,
252-
"metadata": {},
253-
"output_type": "execute_result"
254-
}
255-
],
48+
"outputs": [],
25649
"source": [
25750
"from __code.ipywe.myfileselector import FileSelection\n",
25851
"from __code.metadata_overlapping_images.metadata_overlapping_images import MetadataOverlappingImagesUi\n",
@@ -277,81 +70,14 @@
27770
},
27871
{
27972
"cell_type": "code",
280-
"execution_count": 2,
73+
"execution_count": null,
28174
"metadata": {
28275
"run_control": {
28376
"frozen": false,
28477
"read_only": false
28578
}
28679
},
287-
"outputs": [
288-
{
289-
"name": "stdout",
290-
"output_type": "stream",
291-
"text": [
292-
"metadata_text: N/A for metadata_index: 1\n",
293-
"metadata_text: N/A for metadata_index: 1\n",
294-
"metadata_text: N/A for metadata_index: 1\n",
295-
"metadata_text: N/A for metadata_index: 1\n",
296-
"metadata_text: N/A for metadata_index: 1\n",
297-
"metadata_text: N/A for metadata_index: 1\n",
298-
"metadata_text: N/A for metadata_index: 1\n",
299-
"metadata_text: N/A for metadata_index: 1\n",
300-
"metadata_text: N/A for metadata_index: 1\n",
301-
"metadata_text: N/A for metadata_index: 1\n",
302-
"metadata_text: N/A for metadata_index: 1\n",
303-
"metadata_text: N/A for metadata_index: 1\n",
304-
"metadata_text: N/A for metadata_index: 1\n",
305-
"metadata_text: N/A for metadata_index: 1\n",
306-
"metadata_text: N/A for metadata_index: 1\n",
307-
"metadata_text: N/A for metadata_index: 1\n",
308-
"metadata_text: N/A for metadata_index: 1\n",
309-
"metadata_text: N/A for metadata_index: 1\n",
310-
"metadata_text: N/A for metadata_index: 1\n",
311-
"metadata_text: N/A for metadata_index: 1\n",
312-
"metadata_text: N/A for metadata_index: 1\n",
313-
"metadata_text: N/A for metadata_index: 1\n",
314-
"metadata_text: N/A for metadata_index: 1\n",
315-
"metadata_text: N/A for metadata_index: 1\n",
316-
"metadata_text: N/A for metadata_index: 1\n",
317-
"metadata_text: N/A for metadata_index: 1\n",
318-
"metadata_text: N/A for metadata_index: 1\n",
319-
"metadata_text: N/A for metadata_index: 1\n",
320-
"metadata_text: -25.0 for metadata_index: 3\n",
321-
"metadata_text: -25.0 for metadata_index: 3\n",
322-
"metadata_text: -25.0 for metadata_index: 3\n",
323-
"metadata_text: -25.0 for metadata_index: 3\n",
324-
"metadata_text: -25.0 for metadata_index: 3\n",
325-
"metadata_text: -25.0 for metadata_index: 3\n",
326-
"metadata_text: -25.0 for metadata_index: 3\n",
327-
"metadata_text: -25.0 for metadata_index: 3\n",
328-
"metadata_text: -25.0 for metadata_index: 3\n",
329-
"metadata_text: -25.0 for metadata_index: 3\n",
330-
"metadata_text: -25.0 for metadata_index: 3\n",
331-
"metadata_text: -25.0 for metadata_index: 3\n",
332-
"metadata_text: -25.0 for metadata_index: 3\n",
333-
"metadata_text: -25.0 for metadata_index: 3\n",
334-
"metadata_text: -25.0 for metadata_index: 3\n",
335-
"metadata_text: -25.0 for metadata_index: 3\n",
336-
"metadata_text: -25.0 for metadata_index: 3\n",
337-
"metadata_text: -25.0 for metadata_index: 3\n",
338-
"metadata_text: -25.0 for metadata_index: 3\n",
339-
"metadata_text: -25.0 for metadata_index: 3\n",
340-
"metadata_text: -25.0 for metadata_index: 3\n",
341-
"metadata_text: -25.0 for metadata_index: 3\n",
342-
"metadata_text: -25.0 for metadata_index: 3\n",
343-
"metadata_text: -25.0 for metadata_index: 3\n",
344-
"metadata_text: -25.0 for metadata_index: 3\n",
345-
"metadata_text: -25.0 for metadata_index: 3\n",
346-
"metadata_text: -25.0 for metadata_index: 3\n",
347-
"metadata_text: -25.0 for metadata_index: 3\n",
348-
"metadata_text: -25.0 for metadata_index: 3\n",
349-
"metadata_text: -25.0 for metadata_index: 3\n",
350-
"metadata_text: -25.0 for metadata_index: 3\n",
351-
"metadata_text: -25.0 for metadata_index: 3\n"
352-
]
353-
}
354-
],
80+
"outputs": [],
35581
"source": [
35682
"%gui qt"
35783
]
@@ -370,7 +96,7 @@
37096
},
37197
{
37298
"cell_type": "code",
373-
"execution_count": 3,
99+
"execution_count": null,
374100
"metadata": {
375101
"run_control": {
376102
"frozen": false,
@@ -397,41 +123,14 @@
397123
},
398124
{
399125
"cell_type": "code",
400-
"execution_count": 4,
126+
"execution_count": null,
401127
"metadata": {
402128
"run_control": {
403129
"frozen": false,
404130
"read_only": false
405131
}
406132
},
407-
"outputs": [
408-
{
409-
"data": {
410-
"text/html": [
411-
"<span style=\"font-size: 20px; color:blue\">Check UI that popped up (maybe hidden behind this browser!)</span>"
412-
],
413-
"text/plain": [
414-
"<IPython.core.display.HTML object>"
415-
]
416-
},
417-
"metadata": {},
418-
"output_type": "display_data"
419-
},
420-
{
421-
"data": {
422-
"application/vnd.jupyter.widget-view+json": {
423-
"model_id": "9d830e1e07144d2ea7ee565e4a70858d",
424-
"version_major": 2,
425-
"version_minor": 0
426-
},
427-
"text/plain": [
428-
"Output()"
429-
]
430-
},
431-
"metadata": {},
432-
"output_type": "display_data"
433-
}
434-
],
133+
"outputs": [],
435134
"source": [
436135
"# o_profile = MetadataOverlappingImagesUi(working_dir=system.System.get_working_dir(),\n",
437136
"# data_dict=o_selection.data_dict['sample'],\n",

0 commit comments

Comments
 (0)