Skip to content
Snippets Groups Projects
Commit 5905f2df authored by Alexandros Asonitis's avatar Alexandros Asonitis
Browse files

implemented move to next sample button and changed the default file name

parent 4918036a
Branches
No related tags found
No related merge requests found
......@@ -201,13 +201,13 @@ def initialize_tkinter(sample_series,field,DUT):
root.attributes("-topmost", True)#window stays above all other applications
file_path = filedialog.asksaveasfilename(defaultextension=".txt", filetypes=[("Text files","*.txt")],title = "save results path",initialfile = f'{DUT.value}_Memristor.txt')
file_path = filedialog.asksaveasfilename(defaultextension=".txt", filetypes=[("Text files","*.txt")],title = "save results path",initialfile = f'{sample_series.value}_{field.value}_{DUT.value}.txt')
#check if the file path is correct(.txt)
while file_path.endswith(".txt") == False:
#open again filedialog with error message box
tk.messagebox.showerror(message='invalid filename!')
file_path = filedialog.asksaveasfilename(defaultextension=".txt", filetypes=[("Text files","*.txt")],title = "save results path",initialfile = f'{DUT.value}_Memristor.txt')
file_path = filedialog.asksaveasfilename(defaultextension=".txt", filetypes=[("Text files","*.txt")],title = "save results path",initialfile = f'{sample_series.value}_{field.value}_{DUT.value}.txt')
#the first time open the file in write mode!(replaces the old file)
#write sample series
......
......@@ -7,7 +7,8 @@ from keyboard import add_hotkey,remove_hotkey
#additional variables
first = True #first measurement
file_path = None
first_sampling = True #indicates first sampling for set and reset buttons because we cannot add two at each button
#first_sampling = True #indicates first sampling for set and reset buttons because we cannot add two at each button
#we dont need this variable anymore
# the three naming fields
......@@ -32,7 +33,11 @@ DUT = widgets.Text(
style = {'description_width': 'initial'},
)
all_text_boxes = widgets.VBox([sample_series,field,DUT])
#start new measurement button(new sample)
new=widgets.Button(description='next sample')
horizontal = widgets.HBox([sample_series,new])
all_text_boxes = widgets.VBox([horizontal,field,DUT])
display(all_text_boxes)
print()
......@@ -68,6 +73,7 @@ reset=widgets.Button(description='RESET')
full=widgets.Button(description='full sweep')
number = widgets.BoundedIntText(value=1,min=1,max=sys.maxsize,step=1,description='full sweeps:',disabled=False) #number of measuremts for the full sweep
#parameter boxes
Vset=widgets.BoundedFloatText(
value=1,
......@@ -80,8 +86,8 @@ Vset=widgets.BoundedFloatText(
#parameter buttons
CC_vset=widgets.BoundedFloatText(
value=1e-3,
min=-1,
max=1,
min=-0.1,
max=0.1,
step=0.1,
description= 'Comp(A):',
)
......@@ -98,8 +104,8 @@ Vreset=widgets.BoundedFloatText(
#parameter buttons
CC_vreset=widgets.BoundedFloatText(
value=1e-3,
min=-1,
max=1,
min=-0.1,
max=0.1,
step=0.1,
description='Comp(A):',
)
......@@ -119,7 +125,7 @@ display(all,output)
#help lists for changing state of the buttons
information = [sample_series,field,DUT]
buttons = [set,reset,full]
buttons = [set,reset,full,new]
parameters = [Vset,CC_vset,Vreset,CC_vreset,step,integration_time,number,sampling]
......@@ -144,7 +150,7 @@ device.user_function('R','OHM','V2/I2')
""" the above is what happens when the programm starts all the rest have to be written into button trigger functions"""
def on_set_button_clicked(b):
global first,file_path,first_sampling
global first,file_path
with output:
#disable buttons
change_state(buttons)
......@@ -188,7 +194,7 @@ def on_set_button_clicked(b):
change_state(parameters)
def on_reset_button_clicked(b):
global first,file_path,first_sampling
global first,file_path
with output:
change_state(buttons)
change_state(parameters)
......@@ -349,9 +355,29 @@ def on_full_button_clicked(b):
change_state(buttons)
change_state(parameters)
#move to next sample
def on_new_sample_button_clicked(b):
global first
with output:
#the if is to ensure that is not pressed many times
if first == False:
#just in case the user presses anything
change_state(buttons)
change_state(parameters)
first = True
change_state(information)
sample_series.value=''
field.value=''
DUT.value=''
#enable again
change_state(buttons)
change_state(parameters)
#link buttons with functions
set.on_click(on_set_button_clicked)
reset.on_click(on_reset_button_clicked)
full.on_click(on_full_button_clicked)
new.on_click(on_new_sample_button_clicked)
......@@ -9,12 +9,12 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "8287cc7caa5c4e0bba415d30c515ab24",
"model_id": "01745b3b609c4947950664f8367c3a69",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(Text(value='', description='sample series:', placeholder='Enter text here:', style=TextStyle(de…"
"VBox(children=(HBox(children=(Text(value='', description='sample series:', placeholder='Enter text here:', sty…"
]
},
"metadata": {},
......@@ -30,7 +30,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "2edd00f2c1634820be364e7a1246c8b9",
"model_id": "fabd996a68dc45a4b512f6692c6c8e9c",
"version_major": 2,
"version_minor": 0
},
......@@ -51,7 +51,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "4c21d99441f245178c017b98dbb9502e",
"model_id": "adacc460f13f403b9281b5e7173d902c",
"version_major": 2,
"version_minor": 0
},
......@@ -65,7 +65,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "ca6c20cca5b5431f911770de4dfacad4",
"model_id": "9b3cbee7a41e400fbf4e5a29c0ac2b91",
"version_major": 2,
"version_minor": 0
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment