當前位置: 首頁>>代碼示例>>Python>>正文


Python Tools.closeSerialMonitors方法代碼示例

本文整理匯總了Python中libs.Tools.closeSerialMonitors方法的典型用法代碼示例。如果您正苦於以下問題:Python Tools.closeSerialMonitors方法的具體用法?Python Tools.closeSerialMonitors怎麽用?Python Tools.closeSerialMonitors使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在libs.Tools的用法示例。


在下文中一共展示了Tools.closeSerialMonitors方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: uploadSketchProject

# 需要導入模塊: from libs import Tools [as 別名]
# 或者: from libs.Tools import closeSerialMonitors [as 別名]
    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()
開發者ID:dattasaurabh82,項目名稱:Deviot,代碼行數:49,代碼來源:PlatformioCLI.py


注:本文中的libs.Tools.closeSerialMonitors方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。