示例#1
0
    def uploadSketchProject(self):
        '''
        Upload the sketch to the select board to the select COM port
        it returns an error if any com port is selected
        '''
        id_port = self.Preferences.get('id_port', '')
        current_ports = listSerialPorts()

        if(id_port not in current_ports and id_port != 'none'):
            id_port = False

        # check port selected
        if(not id_port):
            current_time = time.strftime('%H:%M:%S')
            self.message_queue.put('none_port_select_{0}', current_time)
            self.execute = False

        if(not self.execute):
            self.message_queue.stopPrint()
            return

        # Stop serial monitor
        Tools.closeSerialMonitors(self.Preferences)

        # Compiling code
        choosen_env = self.buildSketchProject()
        if(not choosen_env):
            return

        if(self.Commands.error_running):
            self.message_queue.stopPrint()
            return

        up_port = '--upload-port %s' % id_port
        if(id_port == 'none'):
            up_port = ''

        command = ['run', '-t upload %s -e %s' %
                   (up_port, choosen_env)]

        self.Commands.runCommand(command)
        if(not self.Commands.error_running):
            autorun = self.Preferences.get('autorun_monitor', False)
            if(autorun):
                Tools.toggleSerialMonitor()
                self.Preferences.set('autorun_monitor', False)
        self.message_queue.stopPrint()
示例#2
0
    def uploadSketchProject(self):
        '''
        Upload the sketch to the select board to the select COM port
        it returns an error if any com port is selected
        '''
        id_port = self.Preferences.get('id_port', '')
        current_ports = listSerialPorts()

        if (id_port not in current_ports and id_port != 'none'):
            id_port = False

        # check port selected
        if (not id_port):
            current_time = time.strftime('%H:%M:%S')
            self.message_queue.put('none_port_select_{0}', current_time)
            self.execute = False

        if (not self.execute):
            self.message_queue.stopPrint()
            return

        # Stop serial monitor
        Tools.closeSerialMonitors(self.Preferences)

        # Compiling code
        choosen_env = self.buildSketchProject()
        if (not choosen_env):
            return

        if (self.Commands.error_running):
            self.message_queue.stopPrint()
            return

        up_port = '--upload-port %s' % id_port
        if (id_port == 'none'):
            up_port = ''

        command = ['run', '-t upload %s -e %s' % (up_port, choosen_env)]

        self.Commands.runCommand(command)
        if (not self.Commands.error_running):
            autorun = self.Preferences.get('autorun_monitor', False)
            if (autorun):
                Tools.toggleSerialMonitor()
                self.Preferences.set('autorun_monitor', False)
        self.message_queue.stopPrint()
示例#3
0
 def run(self):
     Tools.toggleSerialMonitor(self.window)
示例#4
0
 def run(self):
     Tools.toggleSerialMonitor(self.window)