def _build_file_controls(self): self.file_controls_box = static_box(self, "File Controls") self.file_name_textbox = text_ctrl(self, "", min_size=(400, 21)) self.load_new_file_button = button(self, "Load New File", tooltip="Load a new experiment data file to memory", callback=self.load_new_file) self.comments_label = static_text(self, "Comments:") self.comments_textbox = text_ctrl(self, "", min_size=(400, 100), style=wx.TE_MULTILINE|wx.TE_WORDWRAP) self.file_controls_grid_sizer = AddMultipleSplat(wx.FlexGridSizer(4, 1, 0, 0), (self.file_name_textbox, 0, wx.EXPAND, 0), (self.load_new_file_button, 1, 0, 0), (self.comments_label, 0, 0, 0), (self.comments_textbox, 0, 0, 0), ) self.file_controls_grid_sizer.AddGrowableCol(0) self.file_controls_sizer = AddMultipleSplat(wx.StaticBoxSizer(self.file_controls_box, wx.HORIZONTAL), (self.file_controls_grid_sizer, 1, wx.EXPAND, 0), )
def __init__(self): # Misc Controls: self.playback_controls_box = static_box(self, "Playback Controls") self.playback_speed_label = static_text(self, 'Playback Speed (Hz): ') self.playback_speed_textbox = text_ctrl(self, '50', min_size=(60, -1), callback=self.update_data) self.skip_frames_checkbox = check_box(self, 'SkipFrames?', value=1, tooltip='When checked, this skips frames to honor the playback speed', callback=self.update_data) self.frame_number_label = static_text(self, 'Frame Number:') self.frame_number_textbox = text_ctrl(self, '0', min_size=(60, -1), callback=self.update_data) # Playback buttons: self.skip_to_start_button = button(self, '|<', min_size=(35, -1), tooltip='Skip to the first frame', callback=partial(self.set_frame_number, 0)) self.rewind_button = button(self, '<|', min_size=(35, -1), tooltip='Rewind', callback=partial(self.play, reverse=True)) self.jump_back_button = button(self, '-'+str(SKIP_VALUE), min_size=(15*(len(str(SKIP_VALUE))+1), -1), tooltip='Jump back {0} frames'.format(SKIP_VALUE), callback=partial(self.offset_frame_num, -SKIP_VALUE), ) self.step_back_button = button(self, '<', min_size=(40, -1), tooltip='Go back one frame', callback=partial(self.offset_frame_num, -1)) self.stop_button = button(self, '||', min_size=(25, -1), tooltip='Stop', callback=self.stop) self.step_forward_button = button(self, '>', min_size=(40, -1), tooltip='Go forward one frame', callback=partial(self.offset_frame_num, 1)) self.jump_forward_button = button(self, '+'+str(SKIP_VALUE), min_size=(15*(len(str(SKIP_VALUE))+1), -1), tooltip='Jump forward {0} frames'.format(SKIP_VALUE), callback=partial(self.offset_frame_num, 10)) self.play_button = button(self, '|>', min_size=(35, -1), tooltip='Go back one frame', callback=partial(self.play, reverse=False)) self.skip_to_end_button = button(self, '>|', min_size=(35, -1), tooltip='Go back one frame', callback=self.skip_to_end) # Sizers self.playback_speed_sizer = AddMultiple(HSizer(), (0, 0, 0), (75, 20), self.playback_speed_label, self.playback_speed_textbox, self.skip_frames_checkbox ) self.play_controls_sizer = AddMultiple(HSizer(), (0, 0, 0), (45, 20), self.skip_to_start_button, self.rewind_button, self.jump_back_button, self.step_back_button, self.stop_button, self.step_forward_button, self.jump_forward_button, self.play_button, self.skip_to_end_button ) self.frame_num_sizer = AddMultiple(HSizer(), (0, 0, 0), (43, 20), self.frame_number_label, (44, 20), self.frame_number_textbox ) _pcs = wx.StaticBoxSizer(self.playback_controls_box, wx.VERTICAL) self.playback_controls_sizer = AddMultiple(_pcs, (1, wx.EXPAND, 0), self.playback_speed_sizer, self.play_controls_sizer, self.frame_num_sizer )