本文整理汇总了Python中libs.Tools.getPythonVersion方法的典型用法代码示例。如果您正苦于以下问题:Python Tools.getPythonVersion方法的具体用法?Python Tools.getPythonVersion怎么用?Python Tools.getPythonVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libs.Tools
的用法示例。
在下文中一共展示了Tools.getPythonVersion方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: checkInitFile
# 需要导入模块: from libs import Tools [as 别名]
# 或者: from libs.Tools import getPythonVersion [as 别名]
def checkInitFile(self):
"""
Check each platformio.ini file and loads the environments already
initialized.
"""
protected = self.Preferences.get('protected', False)
if(not protected):
return
# Empy menu if it's not a IoT file
if(not self.is_iot):
if(Tools.getPythonVersion() > 2):
self.Menu.createEnvironmentMenu(empty=True)
return
ini_path = Paths.getFullIniPath(self.dir)
# show non native data
if(not self.is_native):
self.Preferences.set('native', False)
self.Preferences.set('ini_path', self.dir)
self.Menu.createEnvironmentMenu()
return
else:
self.Preferences.set('native', True)
self.Preferences.set('ini_path', self.dir)
# get data from platformio.ini file
ini_list = []
with open(ini_path, 'r') as file:
pattern = compile(r'\[(\w+)\W(\w+)\]')
for line in file:
if pattern.findall(line):
if('#' not in line):
line = match(r"\[\w+:(\w+)\]", line).group(1)
ini_list.append(line)
# save preferences, update menu data
type = 'board_id' if not self.is_native else 'found_ini'
self.Preferences.set(type, ini_list)
self.Menu.createEnvironmentMenu()
示例2:
# 需要导入模块: from libs import Tools [as 别名]
# 或者: from libs.Tools import getPythonVersion [as 别名]
from .Commands import CommandsPy
from .Messages import MessageQueue
from .I18n import I18n
except:
import libs.Paths as Paths
import libs.Tools as Tools
from libs import Messages
from libs import __version__ as version
from libs.JSONFile import JSONFile
from libs.Preferences import Preferences
from libs.Progress import ThreadProgress
from libs.Commands import CommandsPy
from libs.Messages import MessageQueue
from libs.I18n import I18n
if(Tools.getPythonVersion() < 3):
from urllib import urlencode
from urllib2 import Request
from urllib2 import urlopen
else:
from urllib.parse import urlencode
from urllib.request import Request
from urllib.request import urlopen
_ = I18n().translate
class Libraries:
"""
Handle the library API from platformIO
More info: http://docs.platformio.org/en/latest/librarymanager/index.html
示例3: MessageQueue
# 需要导入模块: from libs import Tools [as 别名]
# 或者: from libs.Tools import getPythonVersion [as 别名]
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import threading
import sublime
import time
try:
from . import Tools
from .I18n import I18n
except:
from libs import Tools
from libs.I18n import I18n
python_version = Tools.getPythonVersion()
if python_version < 3:
import Queue as queue
else:
import queue
_ = I18n().translate
class MessageQueue(object):
"""
Print messages in the user console,
placed in the message queue
"""
示例4: SerialListener
# 需要导入模块: from libs import Tools [as 别名]
# 或者: from libs.Tools import getPythonVersion [as 别名]
import glob
import threading
try:
from . import Tools
from . import pyserial
from . import Messages
from .Preferences import Preferences
except:
from libs import Tools
from libs import pyserial
from libs import Messages
from libs.Preferences import Preferences
if Tools.getOsName() == 'windows':
if Tools.getPythonVersion() < 3:
import _winreg as winreg
else:
import winreg
@Tools.singleton
class SerialListener(object):
"""
Constantly checks if a port has been connected or disconnected
"""
def __init__(self, func=None):
self.func = func
self.serial_list = []
self.is_alive = False