本文整理汇总了Python中ninja_ide.tools.json_manager.parse函数的典型用法代码示例。如果您正苦于以下问题:Python parse函数的具体用法?Python parse怎么用?Python parse使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: run
def run(self):
try:
#Check for IDE Updates
ninja_version = urllib.request.urlopen(resources.UPDATES_URL)
ide = json_manager.parse(ninja_version)
except:
ide = {}
logger.info('no connection available')
self.versionReceived.emit(ide.get('version', '0'), ide.get('downloads', ''))
开发者ID:Salmista-94,项目名称:Ninja_PyQt5,代码行数:9,代码来源:updates.py
示例2: execute_thread
def execute_thread(self):
try:
descriptor_languages = urllib2.urlopen(resources.LANGUAGES_URL)
languages = json_manager.parse(descriptor_languages)
languages = [[name, languages[name]] for name in languages]
local_languages = self.get_local_languages()
languages = [languages[i] for i in range(len(languages)) if \
os.path.basename(languages[i][1]) not in local_languages]
self._languages = languages
except urllib2.URLError:
self._languages = []
开发者ID:beefsack,项目名称:ninja-ide,代码行数:11,代码来源:language_manager.py
示例3: execute_thread
def execute_thread(self):
try:
descriptor_schemes = urllib2.urlopen(resources.SCHEMES_URL)
schemes = json_manager.parse(descriptor_schemes)
schemes = [[name, schemes[name]] for name in schemes]
local_schemes = self.get_local_schemes()
schemes = [schemes[i] for i in range(len(schemes)) if \
os.path.basename(schemes[i][1]) not in local_schemes]
self._schemes = schemes
except urllib2.URLError:
self._schemes = []
开发者ID:alekibango,项目名称:ninja-ide,代码行数:11,代码来源:themes_manager.py
示例4: execute_thread
def execute_thread(self):
try:
descriptor_schemes = urlopen(resources.SCHEMES_URL)
schemes = json_manager.parse(descriptor_schemes)
schemes = [(d['name'], d['download']) for d in schemes]
local_schemes = self.get_local_schemes()
schemes = [schemes[i] for i in range(len(schemes)) if
os.path.basename(schemes[i][1]) not in local_schemes]
self._schemes = schemes
except URLError:
self._schemes = []
开发者ID:Bengt,项目名称:ninja-ide,代码行数:11,代码来源:themes_manager.py
示例5: check_version
def check_version(self):
try:
# Check for IDE Updates
logger.info("Checking for updates")
ninja_version = urlopen(
resources.UPDATES_URL).read().decode('utf8')
ide = json_manager.parse(ninja_version)
except:
ide = {}
logger.info('no connection available')
# Emit a singal with info
self.versionReceived.emit(
ide.get('version', ''),
ide.get('downloads', ''))
# Finish
self.finished.emit()
开发者ID:ninja-ide,项目名称:ninja-ide,代码行数:16,代码来源:updates.py
示例6: run
def run(self):
try:
#Check for IDE Updates
ninja_version = urllib.urlopen(resources.UPDATES_URL)
self.ide = json_manager.parse(ninja_version)
# available = ninja_ide.core.available_plugins()
# local_plugins = ninja_ide.core.local_plugins()
# updates = []
# for lp in local_plugins:
# if lp in available:
# ava = available.pop(lp)
# if float(ava[1]) > float(local_plugins[lp][1]):
# updates += [[lp, ava[0], ava[1], ava[2]]]
# self.plugins = updates
except:
logger.info('no connection available')
开发者ID:alekibango,项目名称:ninja-ide,代码行数:17,代码来源:updates.py
示例7: start_ide
def start_ide(app, filenames, projects_path, extra_plugins, linenos):
"""Load all the settings necessary before loading the UI, and start IDE."""
QCoreApplication.setOrganizationName('NINJA-IDE')
QCoreApplication.setOrganizationDomain('NINJA-IDE')
QCoreApplication.setApplicationName('NINJA-IDE')
app.setWindowIcon(QIcon(":img/icon"))
# Check if there is another session of ninja-ide opened
# and in that case send the filenames and projects to that session
running = ipc.is_running()
start_server = not running[0]
if running[0] and (filenames or projects_path):
sended = ipc.send_data(running[1], filenames, projects_path, linenos)
running[1].close()
if sended:
sys.exit()
else:
running[1].close()
# Create and display the splash screen
splash_pix = QPixmap(":img/splash")
splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)
splash.setMask(splash_pix.mask())
splash.show()
app.processEvents()
# Set the cursor to unblinking
if not settings.IS_WINDOWS:
app.setCursorFlashTime(0)
#Set the codec for strings (QString)
QTextCodec.setCodecForCStrings(QTextCodec.codecForName('utf-8'))
#Translator
qsettings = ide.IDE.ninja_settings()
data_qsettings = ide.IDE.data_settings()
language = QLocale.system().name()
lang = qsettings.value('preferences/interface/language',
defaultValue=language, type='QString') + '.qm'
lang_path = file_manager.create_path(resources.LANGS, lang)
if file_manager.file_exists(lang_path):
settings.LANGUAGE = lang_path
translator = QTranslator()
if settings.LANGUAGE:
translator.load(settings.LANGUAGE)
app.installTranslator(translator)
qtTranslator = QTranslator()
qtTranslator.load("qt_" + language,
QLibraryInfo.location(QLibraryInfo.TranslationsPath))
app.installTranslator(qtTranslator)
#Loading Syntax
splash.showMessage("Loading Syntax", Qt.AlignRight | Qt.AlignTop, Qt.black)
json_manager.load_syntax()
#Read Settings
splash.showMessage("Loading Settings", Qt.AlignRight | Qt.AlignTop,
Qt.black)
settings.load_settings()
#Set Stylesheet
style_applied = False
if settings.NINJA_SKIN not in ('Default', 'Classic Theme'):
file_name = ("%s.qss" % settings.NINJA_SKIN)
qss_file = file_manager.create_path(resources.NINJA_THEME_DOWNLOAD,
file_name)
if file_manager.file_exists(qss_file):
with open(qss_file) as f:
qss = f.read()
app.setStyleSheet(qss)
style_applied = True
if not style_applied:
if settings.NINJA_SKIN == 'Default':
with open(resources.NINJA_THEME) as f:
qss = f.read()
else:
with open(resources.NINJA_THEME_CLASSIC) as f:
qss = f.read()
app.setStyleSheet(qss)
#Loading Schemes
splash.showMessage("Loading Schemes",
Qt.AlignRight | Qt.AlignTop, Qt.black)
scheme = qsettings.value('preferences/editor/scheme', "default",
type='QString')
if scheme != 'default':
scheme = file_manager.create_path(resources.EDITOR_SKINS,
scheme + '.color')
if file_manager.file_exists(scheme):
resources.CUSTOM_SCHEME = json_manager.parse(open(scheme))
#Loading Shortcuts
resources.load_shortcuts()
#Loading GUI
splash.showMessage("Loading GUI", Qt.AlignRight | Qt.AlignTop, Qt.black)
ninjaide = ide.IDE(start_server)
#Showing GUI
ninjaide.show()
#.........这里部分代码省略.........
开发者ID:Hmaal,项目名称:ninja-ide,代码行数:101,代码来源:__init__.py
示例8: start
def start(filenames=None, projects_path=None,
extra_plugins=None, linenos=None):
app = QApplication(sys.argv)
QCoreApplication.setOrganizationName('NINJA-IDE')
QCoreApplication.setOrganizationDomain('NINJA-IDE')
QCoreApplication.setApplicationName('NINJA-IDE')
app.setWindowIcon(QIcon(resources.IMAGES['icon']))
# Check if there is another session of ninja-ide opened
# and in that case send the filenames and projects to that session
running = ipc.is_running()
start_server = not running[0]
if running[0] and (filenames or projects_path):
sended = ipc.send_data(running[1], filenames, projects_path, linenos)
running[1].close()
if sended:
sys.exit()
else:
running[1].close()
# Create and display the splash screen
splash_pix = QPixmap(resources.IMAGES['splash'])
splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)
splash.setMask(splash_pix.mask())
splash.show()
app.processEvents()
# Set the cursor to unblinking
global cursor_flash_time
cursor_flash_time = app.cursorFlashTime()
app.setCursorFlashTime(0)
#Set the codec for strings (QString)
QTextCodec.setCodecForCStrings(QTextCodec.codecForName('utf-8'))
#Translator
qsettings = QSettings()
language = QLocale.system().name()
lang = qsettings.value('preferences/interface/language', language) + '.qm'
lang_path = file_manager.create_path(resources.LANGS, lang)
if file_manager.file_exists(lang_path):
settings.LANGUAGE = lang_path
elif file_manager.file_exists(file_manager.create_path(
resources.LANGS_DOWNLOAD, lang)):
settings.LANGUAGE = file_manager.create_path(
resources.LANGS_DOWNLOAD, lang)
translator = QTranslator()
if settings.LANGUAGE:
translator.load(settings.LANGUAGE)
app.installTranslator(translator)
#Loading Syntax
splash.showMessage("Loading Syntax", Qt.AlignRight | Qt.AlignTop, Qt.black)
json_manager.load_syntax()
#Read Settings
splash.showMessage("Loading Settings", Qt.AlignRight | Qt.AlignTop,
Qt.black)
settings.load_settings()
#Set Stylesheet
style_applied = False
if settings.NINJA_SKIN not in ('Default', 'Classic Theme'):
file_name = ("%s.qss" % settings.NINJA_SKIN)
qss_file = file_manager.create_path(resources.NINJA_THEME_DOWNLOAD,
file_name)
if file_manager.file_exists(qss_file):
with open(qss_file) as f:
qss = f.read()
app.setStyleSheet(qss)
style_applied = True
if not style_applied:
if settings.NINJA_SKIN == 'Default':
with open(resources.NINJA_THEME) as f:
qss = f.read()
else:
with open(resources.NINJA__THEME_CLASSIC) as f:
qss = f.read()
app.setStyleSheet(qss)
#Loading Schemes
splash.showMessage("Loading Schemes",
Qt.AlignRight | Qt.AlignTop, Qt.black)
scheme = qsettings.value('preferences/editor/scheme', "default")
if scheme != 'default':
scheme = file_manager.create_path(resources.EDITOR_SKINS,
scheme + '.color')
if file_manager.file_exists(scheme):
resources.CUSTOM_SCHEME = json_manager.parse(open(scheme))
#Loading Shortcuts
resources.load_shortcuts()
#Loading GUI
splash.showMessage("Loading GUI", Qt.AlignRight | Qt.AlignTop, Qt.black)
ide = IDE(start_server)
#Showing GUI
ide.show()
#Loading Session Files
#.........这里部分代码省略.........
开发者ID:marchon,项目名称:ninja-ide,代码行数:101,代码来源:ide.py
示例9: start_ide
def start_ide(app, filenames, projects_path, extra_plugins, linenos):
"""Load all the settings necessary before loading the UI, and start IDE."""
QCoreApplication.setOrganizationName("NINJA-IDE")
QCoreApplication.setOrganizationDomain("NINJA-IDE")
QCoreApplication.setApplicationName("NINJA-IDE")
app.setWindowIcon(QIcon(resources.IMAGES["icon"]))
# Check if there is another session of ninja-ide opened
# and in that case send the filenames and projects to that session
running = ipc.is_running()
start_server = not running[0]
if running[0] and (filenames or projects_path):
sended = ipc.send_data(running[1], filenames, projects_path, linenos)
running[1].close()
if sended:
sys.exit()
else:
running[1].close()
# Create and display the splash screen
splash_pix = QPixmap(resources.IMAGES["splash"])
splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)
splash.setMask(splash_pix.mask())
splash.show()
app.processEvents()
# Set the cursor to unblinking
if not settings.IS_WINDOWS:
app.setCursorFlashTime(0)
# Set the codec for strings (QString)
QTextCodec.setCodecForCStrings(QTextCodec.codecForName("utf-8"))
# Translator
qsettings = QSettings(resources.SETTINGS_PATH, QSettings.IniFormat)
language = QLocale.system().name()
lang = qsettings.value("preferences/interface/language", defaultValue=language, type="QString") + ".qm"
lang_path = file_manager.create_path(resources.LANGS, lang)
if file_manager.file_exists(lang_path):
settings.LANGUAGE = lang_path
translator = QTranslator()
if settings.LANGUAGE:
translator.load(settings.LANGUAGE)
app.installTranslator(translator)
qtTranslator = QTranslator()
qtTranslator.load("qt_" + language, QLibraryInfo.location(QLibraryInfo.TranslationsPath))
app.installTranslator(qtTranslator)
# Loading Syntax
splash.showMessage("Loading Syntax", Qt.AlignRight | Qt.AlignTop, Qt.black)
json_manager.load_syntax()
# Read Settings
splash.showMessage("Loading Settings", Qt.AlignRight | Qt.AlignTop, Qt.black)
settings.load_settings()
# Set Stylesheet
style_applied = False
if settings.NINJA_SKIN not in ("Default", "Classic Theme"):
file_name = "%s.qss" % settings.NINJA_SKIN
qss_file = file_manager.create_path(resources.NINJA_THEME_DOWNLOAD, file_name)
if file_manager.file_exists(qss_file):
with open(qss_file) as f:
qss = f.read()
app.setStyleSheet(qss)
style_applied = True
if not style_applied:
if settings.NINJA_SKIN == "Default":
with open(resources.NINJA_THEME) as f:
qss = f.read()
else:
with open(resources.NINJA_THEME_CLASSIC) as f:
qss = f.read()
app.setStyleSheet(qss)
# Loading Schemes
splash.showMessage("Loading Schemes", Qt.AlignRight | Qt.AlignTop, Qt.black)
scheme = qsettings.value("preferences/editor/scheme", "default", type="QString")
if scheme != "default":
scheme = file_manager.create_path(resources.EDITOR_SKINS, scheme + ".color")
if file_manager.file_exists(scheme):
resources.CUSTOM_SCHEME = json_manager.parse(open(scheme))
# Loading Shortcuts
resources.load_shortcuts()
# Loading GUI
splash.showMessage("Loading GUI", Qt.AlignRight | Qt.AlignTop, Qt.black)
ninjaide = ide.IDE(start_server)
# Showing GUI
ninjaide.show()
# Loading Session Files
splash.showMessage("Loading Files and Projects", Qt.AlignRight | Qt.AlignTop, Qt.black)
# First check if we need to load last session files
if qsettings.value("preferences/general/loadFiles", True, type=bool):
# Files in Main Tab
main_files = qsettings.value("openFiles/mainTab", [])
#.........这里部分代码省略.........
开发者ID:rolandgeider,项目名称:ninja-ide,代码行数:101,代码来源:__init__.py
示例10: start
def start(listener, filenames=None, projects_path=None, extra_plugins=None):
app = QApplication(sys.argv)
QCoreApplication.setOrganizationName('NINJA-IDE')
QCoreApplication.setOrganizationDomain('NINJA-IDE')
QCoreApplication.setApplicationName('NINJA-IDE')
app.setWindowIcon(QIcon(resources.IMAGES['icon']))
# Create and display the splash screen
splash_pix = QPixmap(resources.IMAGES['splash'])
splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)
splash.setMask(splash_pix.mask())
splash.show()
app.processEvents()
# Set the cursor to unblinking
app.setCursorFlashTime(0)
#Set the codec for strings (QString)
QTextCodec.setCodecForCStrings(QTextCodec.codecForName('utf-8'))
#Translator
qsettings = QSettings()
language = QLocale.system().language()
lang = unicode(qsettings.value(
'preferences/interface/language', language).toString()) + '.qm'
lang_path = file_manager.create_path(resources.LANGS, unicode(lang))
if file_manager.file_exists(lang_path):
settings.LANGUAGE = lang_path
elif file_manager.file_exists(file_manager.create_path(
resources.LANGS_DOWNLOAD, unicode(lang))):
settings.LANGUAGE = file_manager.create_path(
resources.LANGS_DOWNLOAD, unicode(lang))
translator = QTranslator()
if settings.LANGUAGE:
translator.load(settings.LANGUAGE)
app.installTranslator(translator)
#Loading Syntax
splash.showMessage("Loading Syntax", Qt.AlignRight | Qt.AlignTop, Qt.black)
json_manager.load_syntax()
#Read Settings
splash.showMessage("Loading Settings", Qt.AlignRight | Qt.AlignTop,
Qt.black)
settings.load_settings()
#Loading Themes
splash.showMessage("Loading Themes", Qt.AlignRight | Qt.AlignTop, Qt.black)
scheme = unicode(qsettings.value('preferences/editor/scheme',
"default").toString())
if scheme != 'default':
scheme = file_manager.create_path(resources.EDITOR_SKINS,
scheme + '.color')
if file_manager.file_exists(scheme):
resources.CUSTOM_SCHEME = json_manager.parse(open(scheme))
#Loading Shortcuts
resources.load_shortcuts()
#Loading GUI
splash.showMessage("Loading GUI", Qt.AlignRight | Qt.AlignTop, Qt.black)
ide = IDE()
#Showing GUI
ide.show()
#Connect listener signals
ide.connect(listener, SIGNAL("fileOpenRequested(QString)"),
ide.open_file)
ide.connect(listener, SIGNAL("projectOpenRequested(QString)"),
ide.open_project)
#Loading Session Files
splash.showMessage("Loading Files and Projects",
Qt.AlignRight | Qt.AlignTop, Qt.black)
#Files in Main Tab
mainFiles = qsettings.value('openFiles/mainTab', []).toList()
tempFiles = []
for file_ in mainFiles:
fileData = file_.toList()
tempFiles.append((unicode(fileData[0].toString()),
fileData[1].toInt()[0]))
mainFiles = tempFiles
#Files in Secondary Tab
secondaryFiles = qsettings.value('openFiles/secondaryTab', []).toList()
tempFiles = []
for file_ in secondaryFiles:
fileData = file_.toList()
tempFiles.append((unicode(fileData[0].toString()),
fileData[1].toInt()[0]))
secondaryFiles = tempFiles
#Projects
projects = qsettings.value('openFiles/projects', []).toList()
projects = [unicode(project.toString()) for project in projects]
#Include files received from console args
if filenames:
mainFiles += [(f, 0) for f in filenames]
#Include projects received from console args
if projects_path:
projects += projects_path
ide.load_session_files_projects(mainFiles, secondaryFiles, projects)
#Load external plugins
#.........这里部分代码省略.........
开发者ID:Fieldbyte,项目名称:ninja-ide,代码行数:101,代码来源:ide.py
示例11: start
def start(filenames=None, projects_path=None, extra_plugins=None, linenos=None):
app = QApplication(sys.argv)
QCoreApplication.setOrganizationName("NINJA-IDE")
QCoreApplication.setOrganizationDomain("NINJA-IDE")
QCoreApplication.setApplicationName("NINJA-IDE")
app.setWindowIcon(QIcon(resources.IMAGES["icon"]))
# Check if there is another session of ninja-ide opened
# and in that case send the filenames and projects to that session
running = ipc.is_running()
start_server = not running[0]
if running[0] and (filenames or projects_path):
sended = ipc.send_data(running[1], filenames, projects_path, linenos)
running[1].close()
if sended:
sys.exit()
else:
running[1].close()
# Create and display the splash screen
splash_pix = QPixmap(resources.IMAGES["splash"])
splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)
splash.setMask(splash_pix.mask())
splash.show()
app.processEvents()
# Set the cursor to unblinking
global cursor_flash_time
cursor_flash_time = app.cursorFlashTime()
app.setCursorFlashTime(0)
# Set the codec for strings (QString)
QTextCodec.setCodecForCStrings(QTextCodec.codecForName("utf-8"))
# Translator
qsettings = QSettings()
language = QLocale.system().language()
lang = unicode(qsettings.value("preferences/interface/language", language).toString()) + ".qm"
lang_path = file_manager.create_path(resources.LANGS, unicode(lang))
if file_manager.file_exists(lang_path):
settings.LANGUAGE = lang_path
elif file_manager.file_exists(file_manager.create_path(resources.LANGS_DOWNLOAD, unicode(lang))):
settings.LANGUAGE = file_manager.create_path(resources.LANGS_DOWNLOAD, unicode(lang))
translator = QTranslator()
if settings.LANGUAGE:
translator.load(settings.LANGUAGE)
app.installTranslator(translator)
# Loading Syntax
splash.showMessage("Loading Syntax", Qt.AlignRight | Qt.AlignTop, Qt.black)
json_manager.load_syntax()
# Read Settings
splash.showMessage("Loading Settings", Qt.AlignRight | Qt.AlignTop, Qt.black)
settings.load_settings()
# Set Stylesheet
if settings.USE_STYLESHEET:
with open(resources.NINJA_THEME) as f:
qss = f.read()
app.setStyleSheet(qss)
# Loading Themes
splash.showMessage("Loading Themes", Qt.AlignRight | Qt.AlignTop, Qt.black)
scheme = unicode(qsettings.value("preferences/editor/scheme", "default").toString())
if scheme != "default":
scheme = file_manager.create_path(resources.EDITOR_SKINS, scheme + ".color")
if file_manager.file_exists(scheme):
resources.CUSTOM_SCHEME = json_manager.parse(open(scheme))
# Loading Shortcuts
resources.load_shortcuts()
# Loading GUI
splash.showMessage("Loading GUI", Qt.AlignRight | Qt.AlignTop, Qt.black)
ide = IDE(start_server)
# Showing GUI
ide.show()
# Loading Session Files
splash.showMessage("Loading Files and Projects", Qt.AlignRight | Qt.AlignTop, Qt.black)
# Files in Main Tab
mainFiles = qsettings.value("openFiles/mainTab", []).toList()
tempFiles = []
for file_ in mainFiles:
fileData = file_.toList()
tempFiles.append((unicode(fileData[0].toString()), fileData[1].toInt()[0]))
mainFiles = tempFiles
# Files in Secondary Tab
secondaryFiles = qsettings.value("openFiles/secondaryTab", []).toList()
tempFiles = []
for file_ in secondaryFiles:
fileData = file_.toList()
tempFiles.append((unicode(fileData[0].toString()), fileData[1].toInt()[0]))
secondaryFiles = tempFiles
# Current File
current_file = unicode(qsettings.value("openFiles/currentFile", "").toString())
# Projects
projects = qsettings.value("openFiles/projects", []).toList()
projects = [unicode(project.toString()) for project in projects]
#.........这里部分代码省略.........
开发者ID:mauricioacrueda,项目名称:ninja-ide,代码行数:101,代码来源:ide.py
注:本文中的ninja_ide.tools.json_manager.parse函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论