def on_done(self, index): if index == -1: return sel_path = self.path_list[index] if arduino.isArduinoFolder(sel_path): real_path = sel_path if sys.platform == 'darwin': real_path = os.path.join(sel_path, 'Contents/Resources/JAVA') (ver_text, ver) = arduino.genVersion(real_path) text = '%s: %s\n%s: %s' % ('%(Arduino)s', sel_path, '%(Version)s', ver_text) msg = text % cur_lang.getDisplayTextDict() sublime.message_dialog(msg) if ver < 10: text = '%(Version_Not_Supported)s' msg = text % cur_lang.getDisplayTextDict() sublime.message_dialog(msg) else: pre_arduino_root = Settings.get('Arduino_root') if sel_path != pre_arduino_root: Settings.set('Arduino_root', sel_path) Settings.set('full_compilation', True) sublime.save_settings(Setting_File) cur_menu.fullUpdate() else: (self.level, self.path_list) = utils.enterNext(index, self.level, self.top_path_list, sel_path, False) file_list = utils.getFileList(self.path_list) self.window.show_quick_panel(file_list, self.on_done)
def on_activated(self, view): file_name = view.file_name() view_name = view.name() if file_name == None and not view_name: if not view.id() in self.new_view_list: return global opened_serial_list global serial_listen state = False state = utils.isSketch(file_name) pre_state = Settings.get('show_Arduino_menu') pre_serial_menu_state = Settings.get('show_serial_menu') serial_menu_state = False if 'Serial Monitor' in view.name(): serial_port = view.name().split('-')[1].strip() if serial_port in opened_serial_list: serial_menu_state = True view.window().run_command('serial_send') if state != pre_state: Settings.set('show_Arduino_menu', state) sublime.save_settings(Setting_File) cur_menu.update() if serial_menu_state != pre_serial_menu_state: Settings.set('show_serial_menu', serial_menu_state) sublime.save_settings(Setting_File) cur_menu.update() if state: arduino_root = Settings.get('Arduino_root') if arduino.isArduinoFolder(arduino_root): showInfoText(view) sublime.run_command('serial_listener') else: text = 'Please select Arduino folder' view.set_status('Arduino', text) serial_listen = False else: view.erase_status('Arduino') serial_listen = False