temperature-logger-interface/main.kv

181 lines
6.3 KiB
Plaintext

<StatusWidget@BoxLayout>:
orientation: 'horizontal'
<YesNoModalView@Popup>:
id: clear_modal_view
process_callback:
title: 'Clear graph?'
BoxLayout:
orientation: 'vertical'
Label:
id: default_content
text: 'Continuing will clear the graph and turn off logging to file.'
BoxLayout:
orientation: 'horizontal'
size_hint_y: 0.1
Button:
id: cancel_button
text: 'Cancel'
on_press: clear_modal_view.process(0)
Button:
id: confirm_button
text: 'Delete data'
on_press: clear_modal_view.process(1)
<StatusBar@BoxLayout>:
orientation: 'horizontal'
pos_hint: { 'x' : 0.01 }
Image:
id: status_image
size_hint_x: 0.05
source: './images/ok.png'
Label:
id: status_text
size_hint_x: 0.1
Label:
id: status_message
size_hint_x: 0.80
<OutputFileDialog>:
textinput: text_input
BoxLayout:
orientation: 'vertical'
Label:
text: "Select a folder & file name for the output. A csv & png file will be saved."
size_hint_y: 0.1
FileChooserListView:
id: filechooser
on_selection: text_input.text = self.selection and self.selection[0] or ''
BoxLayout:
size_hint_y: 0.1
orientation: 'horizontal'
Label:
text: 'File name:'
size_hint_x: 0.2
TextInput:
id: text_input
BoxLayout:
size_hint_y: 0.1
orientation: 'horizontal'
Button:
text: 'Cancel'
on_press: root.cancel()
Button:
text: 'Set Output File'
on_press: root.set_output(filechooser.path, text_input.text)
<SelectReferenceProfileDialog>:
BoxLayout:
orientation: 'vertical'
Label:
text: 'Select a reference temperature profile (csv)'
size_hint_y: 0.1
FileChooserListView:
id: filechooser
filters: ['*.csv']
BoxLayout:
size_hint_y: 0.1
orientation: 'horizontal'
Button:
text: 'Cancel'
on_press: root.cancel()
Button:
text: 'Set reference profile'
on_press: root.set_output(file = filechooser.selection)
<MainWindow>:
label_wid: "Temperature Monitor"
current_temperature: current_temperature
serial_chooser_button: serial_chooser_button
on_dataSources: serial_chooser_button.values = self.dataSources
on_lastTemperature: current_temperature.on_temperature_change(self.lastTemperature)
on_lastStatus: status_bar.update_status(self.lastStatus)
on_lastData: mainplot.update_data(self.lastData)
raw_data_output_file: ''
image_output_file: ''
on_raw_data_output_file: mainplot.raw_data_output_file = self.raw_data_output_file
on_image_output_file: mainplot.image_output_file = self.image_output_file
reference_profile_file: ''
on_reference_profile_file: mainplot.reference_profile_file = self.reference_profile_file
BoxLayout:
orientation: 'vertical'
BoxLayout:
size_hint_y: 0.1
id: 'top_menu'
pos_hint: {'top':1}
orientation: 'horizontal'
MainMenuButton:
id: main_menu_button
size_hint_x: 0.2
source: "./images/menu_button.png"
on_press: root.main_menu()
MyLabel:
id: current_temperature
text: "Current Temperature: n/a"
StatusWidget:
id: startstop_widget
state: 'running'
on_state: setattr(startstop_button, 'text', self.change_state_labels[self.state])
on_state: root.set_state(self.state)
Button:
id: startstop_button
text: 'Pause Data'
on_press: startstop_widget.change_state()
Button:
id: clear_button
text: 'Clear Graph'
on_press: root.initiate_clear_dialog()
SerialPortButton:
id: serial_chooser_button
on_serial_port_changed: root.serial_port_changed(self.text)
BoxLayout:
orientation: 'horizontal'
size_hint_y: 0.1
BoxLayout:
orientation: 'vertical'
BoxLayout:
orientation: 'horizontal'
Label:
text: 'Output file'
size_hint_x: 0.3
Button:
id: output_button
text: 'Choose output file'
on_press: root.choose_output_file()
Label:
id: output_file_selected
text: 'No file chosen'
BoxLayout:
orientation: 'vertical'
BoxLayout:
orientation: 'horizontal'
Label:
text: 'Reference Profile'
Button:
id: reference_profile_select
text: 'Choose Profile'
on_press: root.select_reference_profile()
size_hint_x: 0.5
Button:
id: reference_profile_edit
text: 'Edit'
size_hint_x: 0.2
Button:
id: reference_profile_clear
text: 'Clear'
size_hint_x: 0.2
Label:
id: reference_profile_selected
text: 'No profile selected'
PlotWidget:
id: mainplot
reference_profile_file: ''
on_image_output_file: self.update_image_output_file()
on_raw_data_output_file: self.update_raw_data_output_file()
on_reference_profile_file: root.reference_profile_file = self.reference_profile_file
size_hint_y: 0.8
StatusBar:
size_hint_y: 0.1
id: status_bar
MainWindow: