def add_routine(self, instance): file_dir = os.path.dirname(os.path.realpath(__file__)) file_dir = file_dir.replace('super_controller','extract_data_panel/alternatives/roach_configurations') fc_conf = BofFileChooserIconView(self.load_data, path=file_dir, filter=['*.pkl']) self.file_roch_popup = Popup(title='Choose Configuration', auto_dismiss=False, content=fc_conf, \ size_hint=(None, None), size=(400, 400)) fc_conf.set_popup(self.file_roch_popup) self.file_roch_popup.open()
def __init__(self, **kwargs): super(ROACH, self).__init__(kwargs=kwargs) self.config_manager = LoadSaveConfig(os.path.dirname(os.path.realpath(__file__)) + '/roach_configurations') big_one = BoxLayout(orientation='vertical') self.reg_array = {} self.reg_cont = 0 self.bram_array = {} self.bram_cont = 0 #self.snapshot_array = {} #self.snapshot_cont = 0 self.prog_dev = False self.bof_path = '' self.sources = [] self.function = [] # reg layout roach_connection_info = BoxLayout(orientation='horizontal', size_hint=(1,None), size=(1,30)) roach_register = BoxLayout(orientation='horizontal', size_hint=(1,None), size=(1,40)) ip_label = Label(text='IP :') port_label = Label(text='Port :') self.ip = TextInput(multiline=False) self.port = TextInput(multiline=False, Text='7417') roach_connection_info.add_widget(ip_label) roach_connection_info.add_widget(self.ip) roach_connection_info.add_widget(port_label) roach_connection_info.add_widget(self.port) clear_button = Button(text='clear', size_hint=(0.33,1)) save_button = Button(text='save', size_hint=(0.33,1)) clear_button.bind(on_press=self.clear_button) save_button.bind(on_press=self.button_save_all) self.program_button = ToggleButton(text='program', size_hint=(0.33,1)) buttons_layout = BoxLayout(orientation='horizontal', size_hint=(1,None), size=(1,30)) buttons_layout.add_widget(clear_button) buttons_layout.add_widget(save_button) buttons_layout.add_widget(self.program_button) new_reg_label = Label(text='Initial Values', size_hint=(0.6,None), height=40) new_reg = Button(text='new reg', size_hint=(0.4,None), height=40) new_reg.bind(on_press=self.add_registers) roach_register.add_widget(new_reg_label) roach_register.add_widget(new_reg) ##### Regiter container self.reg_container = GridLayout(cols=1, spacing=0, size_hint_y=None)#row_default_height=30) self.reg_container.bind(minimum_height=self.reg_container.setter('height')) scroll_root = ScrollView(size_hint=(1,1), size=(1, 125)) scroll_root.add_widget(self.reg_container) #### free_running_label_layout = BoxLayout(orientation='horizontal', size_hint=(1,None), size=(1,30)) add_free_running_label = Label(text="Free Running", size_hint=(0.45,1)) free_running_label_layout.add_widget(add_free_running_label) free_running = BoxLayout(orientation='horizontal', size_hint=(1,None), size=(1,30)) add_free_running_bram = Button(text = 'New BRAM', size_hint=(0.30,1)) add_free_running_reg = Button(text = 'New Reg', size_hint=(0.25,1)) add_free_running_snapshot = Button(text = 'SnapShot', size_hint=(0.25,1)) add_free_running_bram.bind(on_press=self.add_free_running) add_free_running_reg.bind(on_press=self.add_register_free_running) add_free_running_snapshot.bind(on_press=self.add_snapshot_free_running) free_running.add_widget(add_free_running_bram) free_running.add_widget(add_free_running_reg) free_running.add_widget(add_free_running_snapshot) #### free run container self.free_run_container = GridLayout(cols=1, spacing = 3,size_hint=(1,None), size=(1,30)) self.free_run_container.bind(minimum_height=self.free_run_container.setter('height')) scroll_root_free_run = ScrollView(size_hint=(1,1), size=(1,195), scroll_type=['bars']) scroll_root_free_run.add_widget(self.free_run_container) scroll_root_free_run.bar_width = 10 #### size_ = 30 name_config = Button(text='Name',size_hint=(0.25,None), height=size_) self.name_config_input = TextInput(size_hint=(0.5,None), height=size_) buton_bof_file = Button(text='Add bof',size_hint=(0.25,None), height=size_) print os.path.dirname(os.path.realpath(__file__)) + '/roach_configurations' name_config.bind(on_press=self.open_look_directory) fc = BofFileChooserIconView(self.set_bof_path) self.file_choose_popup = Popup(title='Choose Bof', auto_dismiss=False, content=fc,\ size_hint=(None, None), size=(400,400)) fc.set_popup(self.file_choose_popup) buton_bof_file.bind(on_press=self.file_choose_popup.open) name = BoxLayout(orientation='horizontal', size_hint=(1,None), size=(1,30)) name.add_widget(name_config) name.add_widget(self.name_config_input) name.add_widget(buton_bof_file) ## store or plot big_one.add_widget(name) big_one.add_widget(roach_connection_info) big_one.add_widget(buttons_layout) big_one.add_widget(roach_register) big_one.add_widget(scroll_root) big_one.add_widget(free_running_label_layout) big_one.add_widget(free_running) big_one.add_widget(scroll_root_free_run) padding_layout = BoxLayout() #big_one.add_widget(padding_layout) self.add_widget(big_one) self.do_extraction = None
def open_look_directory(self, instance): fc_conf = BofFileChooserIconView(self.load_data, path=os.path.dirname(os.path.realpath(__file__)) + '/roach_configurations' , filter=['*.pkl']) self.file_roch_popup = Popup(title='Choose Configuration', auto_dismiss=False, content=fc_conf,\ size_hint=(None, None), size=(400,400)) fc_conf.set_popup(self.file_roch_popup) self.file_roch_popup.open()
def copy_function(self, instance): content = BofFileChooserIconView(return_selection_path=self.copy_function_copy_file ) a_popup = Popup(title='Choose Bof', auto_dismiss=False, content=content, size_hint=(None, None), size=(400,400)) content.set_popup(a_popup) a_popup.open()