本文整理汇总了Python中ninja_ide.core.file_manager.file_exists函数的典型用法代码示例。如果您正苦于以下问题:Python file_exists函数的具体用法?Python file_exists怎么用?Python file_exists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了file_exists函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: save_properties
def save_properties(self):
if self.projectData.name.text().strip() == '':
QMessageBox.critical(self, self.tr("Properties Invalid"),
self.tr("The Project must have a name."))
return
tempName = self._item.name
self._item.name = self.projectData.name.text()
self._item.description = self.projectData.description.toPlainText()
self._item.license = self.projectData.cboLicense.currentText()
self._item.mainFile = self.projectExecution.path.text()
self._item.url = self.projectData.url.text()
self._item.projectType = self.projectData.txtType.text()
# FIXME
self._item.pythonPath = self.projectExecution.txtPythonPath.text()
self._item.PYTHONPATH = self.projectExecution.PYTHONPATH.toPlainText()
self._item.additional_builtins = filter(
lambda e: e, # remove empty names
self.projectExecution.additional_builtins.text().split(' '))
self._item.preExecScript = self.projectExecution.txtPreExec.text()
self._item.postExecScript = self.projectExecution.txtPostExec.text()
self._item.programParams = self.projectExecution.txtParams.text()
self._item.venv = self.projectExecution.txtVenvPath.text()
extensions = self.projectData.txtExtensions.text().split(', ')
self._item.extensions = tuple(extensions)
self._item.indentation = self.projectData.spinIndentation.value()
self._item.useTabs = self.projectData.checkUseTabs.isChecked()
related = self.projectMetadata.txt_projects.toPlainText()
related = [path for path in related.split('\n') if path != '']
self._item.related_projects = related
#save project properties
project = {}
project['name'] = self._item.name
project['description'] = self._item.description
project['url'] = self._item.url
project['license'] = self._item.license
project['mainFile'] = self._item.mainFile
project['project-type'] = self._item.projectType
project['supported-extensions'] = self._item.extensions
project['indentation'] = self._item.indentation
project['use-tabs'] = self._item.useTabs
project['pythonPath'] = self._item.pythonPath # FIXME
project['PYTHONPATH'] = self._item.PYTHONPATH
project['additional_builtins'] = self._item.additional_builtins
project['preExecScript'] = self._item.preExecScript
project['postExecScript'] = self._item.postExecScript
project['venv'] = self._item.venv
project['programParams'] = self._item.programParams
project['relatedProjects'] = self._item.related_projects
if tempName != self._item.name and \
file_manager.file_exists(self._item.path, tempName + '.nja'):
file_manager.delete_file(self._item.path, tempName + '.nja')
json_manager.create_ninja_project(
self._item.path, self._item.name, project)
self._item.setText(0, self._item.name)
self._item.setToolTip(0, self._item.name)
if self._item.extensions != settings.SUPPORTED_EXTENSIONS:
self._item._parent._refresh_project(self._item)
self._item.update_paths()
self.close()
开发者ID:YatharthROCK,项目名称:ninja-ide,代码行数:60,代码来源:project_properties_widget.py
示例2: open_files
def open_files(self, files, mainTab=True, notIDEStart=True):
if mainTab:
self.actualTab = self._tabMain
else:
self.actualTab = self._tabSecondary
for fileData in files:
if file_manager.file_exists(unicode(fileData[0])):
self.open_file(unicode(fileData[0]), fileData[1], notIDEStart)
self.actualTab = self._tabMain
开发者ID:Fieldbyte,项目名称:ninja-ide,代码行数:9,代码来源:main_container.py
示例3: open_files
def open_files(self, files, mainTab=True, notIDEStart=True):
if mainTab:
self.actualTab = self._tabMain
else:
self.actualTab = self._tabSecondary
if files:
self._tabSecondary.show()
for fileData in files:
if file_manager.file_exists(unicode(fileData[0])):
self.open_file(unicode(fileData[0]), fileData[1], notStart=notIDEStart, positionIsLineNumber=True)
self.actualTab = self._tabMain
开发者ID:mauricioacrueda,项目名称:ninja-ide,代码行数:12,代码来源:main_container.py
示例4: save_properties
def save_properties(self):
if unicode(self.projectData.name.text()).strip() == '':
QMessageBox.critical(self, self.tr("Properties Invalid"),
self.tr("The Project must have a name."))
return
tempName = self._item.name
self._item.name = unicode(self.projectData.name.text())
self._item.description = unicode(
self.projectData.description.toPlainText())
self._item.license = unicode(self.projectData.cboLicense.currentText())
self._item.mainFile = unicode(self.projectExecution.path.text())
self._item.url = unicode(self.projectData.url.text())
self._item.projectType = unicode(self.projectData.txtType.text())
self._item.pythonPath = unicode(
self.projectExecution.txtPythonPath.text()) # FIXME
self._item.PYTHONPATH = unicode(
self.projectExecution.PYTHONPATH.toPlainText())
self._item.preExecScript = unicode(
self.projectExecution.txtPreExec.text())
self._item.postExecScript = unicode(
self.projectExecution.txtPostExec.text())
self._item.programParams = unicode(
self.projectExecution.txtParams.text())
self._item.venv = unicode(self.projectExecution.txtVenvPath.text())
extensions = unicode(self.projectData.txtExtensions.text()).split(', ')
self._item.extensions = tuple(extensions)
#save project properties
project = {}
project['name'] = self._item.name
project['description'] = self._item.description
project['url'] = self._item.url
project['license'] = self._item.license
project['mainFile'] = self._item.mainFile
project['project-type'] = self._item.projectType
project['supported-extensions'] = self._item.extensions
project['pythonPath'] = self._item.pythonPath # FIXME
project['PYTHONPATH'] = self._item.PYTHONPATH
project['preExecScript'] = self._item.preExecScript
project['postExecScript'] = self._item.postExecScript
project['venv'] = self._item.venv
project['programParams'] = self._item.programParams
if tempName != self._item.name and \
file_manager.file_exists(self._item.path, tempName + '.nja'):
file_manager.delete_file(self._item.path, tempName + '.nja')
json_manager.create_ninja_project(
self._item.path, self._item.name, project)
self._item.setText(0, self._item.name)
self._item.setToolTip(0, self._item.name)
if self._item.extensions != settings.SUPPORTED_EXTENSIONS:
self._item._parent._refresh_project(self._item)
self.close()
开发者ID:cjdp25,项目名称:ninja-ide,代码行数:52,代码来源:project_properties_widget.py
示例5: open_files
def open_files(self, files, mainTab=True, notIDEStart=True):
if mainTab:
self.actualTab = self._tabMain
else:
self.actualTab = self._tabSecondary
if files:
self._tabSecondary.show()
self.splitted = True
for fileData in files:
if file_manager.file_exists(fileData[0]):
self.open_file(fileData[0], fileData[1], notStart=notIDEStart)
self.actualTab = self._tabMain
开发者ID:sbellem,项目名称:ninja-ide,代码行数:13,代码来源:main_container.py
示例6: _navigate_bookmarks
def _navigate_bookmarks(self, val):
"""Navigate between the bookmarks."""
bookList = list(settings.BOOKMARKS.keys())
bookList.sort()
if not bookList:
return
if self.__bookmarksFile not in bookList:
self.__bookmarksFile = bookList[0]
index = bookList.index(self.__bookmarksFile)
bookms = settings.BOOKMARKS.get(self.__bookmarksFile, [])
lineNumber = 0
#val == True: forward
if val:
if (len(bookms) - 1) > self.__bookmarksPos:
self.__bookmarksPos += 1
lineNumber = bookms[self.__bookmarksPos]
elif len(bookms) > 0:
if index < (len(bookList) - 1):
self.__bookmarksFile = bookList[index + 1]
else:
self.__bookmarksFile = bookList[0]
self.__bookmarksPos = 0
bookms = settings.BOOKMARKS[self.__bookmarksFile]
lineNumber = bookms[0]
else:
if self.__bookmarksPos > 0:
self.__bookmarksPos -= 1
lineNumber = bookms[self.__bookmarksPos]
elif len(bookms) > 0:
self.__bookmarksFile = bookList[index - 1]
bookms = settings.BOOKMARKS[self.__bookmarksFile]
self.__bookmarksPos = len(bookms) - 1
lineNumber = bookms[self.__bookmarksPos]
if file_manager.file_exists(self.__bookmarksFile):
self.ide.mainContainer.open_file(self.__bookmarksFile,
lineNumber, None, True)
else:
settings.BOOKMARKS.pop(self.__bookmarksFile)
开发者ID:SlashRoot,项目名称:ninja-ide,代码行数:38,代码来源:actions.py
示例7: _navigate_breakpoints
def _navigate_breakpoints(self, val):
"""Navigate between the breakpoints."""
breakList = settings.BREAKPOINTS.keys()
breakList.sort()
if not breakList:
return
if self.__breakpointsFile not in breakList:
self.__breakpointsFile = breakList[0]
index = breakList.index(self.__breakpointsFile)
breaks = settings.BREAKPOINTS.get(self.__breakpointsFile, [])
lineNumber = 0
#val == True: forward
if val:
if (len(breaks) - 1) > self.__breakpointsPos:
self.__breakpointsPos += 1
lineNumber = breaks[self.__breakpointsPos]
elif len(breaks) > 0:
if index < (len(breakList) - 1):
self.__breakpointsFile = breakList[index + 1]
else:
self.__breakpointsFile = breakList[0]
self.__breakpointsPos = 0
breaks = settings.BREAKPOINTS[self.__breakpointsFile]
lineNumber = breaks[0]
else:
if self.__breakpointsPos > 0:
self.__breakpointsPos -= 1
lineNumber = breaks[self.__breakpointsPos]
elif len(breaks) > 0:
self.__breakpointsFile = breakList[index - 1]
breaks = settings.BREAKPOINTS[self.__breakpointsFile]
self.__breakpointsPos = len(breaks) - 1
lineNumber = breaks[self.__breakpointsPos]
if file_manager.file_exists(self.__breakpointsFile):
self.ide.mainContainer.open_file(self.__breakpointsFile,
lineNumber, None, True)
else:
settings.BREAKPOINTS.pop(self.__breakpointsFile)
开发者ID:alekibango,项目名称:ninja-ide,代码行数:38,代码来源:actions.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
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
示例10: 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.core.file_manager.file_exists函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论