本文整理汇总了Python中PyQt4.QtGui.QSplashScreen.setMask方法的典型用法代码示例。如果您正苦于以下问题:Python QSplashScreen.setMask方法的具体用法?Python QSplashScreen.setMask怎么用?Python QSplashScreen.setMask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QSplashScreen
的用法示例。
在下文中一共展示了QSplashScreen.setMask方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start
# 需要导入模块: from PyQt4.QtGui import QSplashScreen [as 别名]
# 或者: from PyQt4.QtGui.QSplashScreen import setMask [as 别名]
def start():
app = QApplication(sys.argv)
# 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()
loader.load_syntax()
ide = IDE()
#Settings
settings = QSettings('NINJA-IDE','Kunai')
if (settings.value('Preferences/General/activate_plugins', 2)==2):
set_plugin_access(ide)
core.load_plugins(ide)
ide.show()
for projectFolder in settings.value('Open_Files/projects',[]).toStringList():
ide.main.open_project_folder(str(projectFolder))
for openFile in settings.value('Open_Files/tab1', []).toStringList():
ide.main.open_document(str(openFile))
for openFile2 in settings.value('Open_Files/tab2', []).toStringList():
ide.main.split_tab(True)
ide.main.open_document(str(openFile2))
splash.finish(ide)
sys.exit(app.exec_())
示例2: __init__
# 需要导入模块: from PyQt4.QtGui import QSplashScreen [as 别名]
# 或者: from PyQt4.QtGui.QSplashScreen import setMask [as 别名]
class SplashScreen:
def __init__(self, image_resource=":/images/splash_wait.png", text=None):
pixmap = QPixmap(image_resource)
self.splash = QSplashScreen(pixmap)
self.splash.setMask(QRegion(pixmap.mask()));
self.splash.setPixmap(pixmap);
flags = self.splash.windowFlags()
flags |= Qt.WindowStaysOnTopHint
self.splash.setWindowFlags(flags)
self._text = None
if text is not None:
self.setText(text)
def show(self):
self.splash.show()
def hide(self):
self.splash.hide()
def setText(self, text):
self._text = text
self.splash.showMessage(text, Qt.AlignBottom | Qt.AlignHCenter);
def getText(self):
return self._text
示例3: main
# 需要导入模块: from PyQt4.QtGui import QSplashScreen [as 别名]
# 或者: from PyQt4.QtGui.QSplashScreen import setMask [as 别名]
def main():
splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)
splash.setMask(splash_pix.mask())
splash.show()
app.processEvents()
# app.setStyle('Plastique')
frame = MainWindow()
frame.showMaximized()
splash.finish(frame)
frame.init()
app.exec_()
示例4: start_eas
# 需要导入模块: from PyQt4.QtGui import QSplashScreen [as 别名]
# 或者: from PyQt4.QtGui.QSplashScreen import setMask [as 别名]
def start_eas(host, client, app):
multisite_client = MultisiteClient(host, client)
# Add splash screen
pixmap = QPixmap(":/images/splash_start.png")
splash = QSplashScreen(pixmap)
splash.setMask(QRegion(pixmap.mask()))
splash.setPixmap(pixmap)
splash.show()
app.splash = splash
splash.showMessage(tr("Loading application"), Qt.AlignBottom | Qt.AlignRight)
app.processEvents()
# Load the main window
from console_edenwall import MainWindow
window = MainWindow(app, multisite_client)
window.show()
splash.finish(window)
示例5: SplashScreen
# 需要导入模块: from PyQt4.QtGui import QSplashScreen [as 别名]
# 或者: from PyQt4.QtGui.QSplashScreen import setMask [as 别名]
class SplashScreen(object):
"""Displays a splash screen until the main window is ready"""
def __init__(self):
splash_pix = QPixmap(':/splash.png')
self.splash = QSplashScreen(splash_pix,
Qt.WindowStaysOnTopHint)
self.splash.setMask(splash_pix.mask())
def show(self):
"""Displays the splash screen"""
self.splash.show()
self.splash.showMessage('Loading...',
Qt.AlignBottom | Qt.AlignHCenter,
Qt.white)
# ensure at least its visible one second
time.sleep(1)
def finish(self, window):
"""Hides and destroy the splash screen, ensure the """
self.splash.finish(window)
示例6: showSplash
# 需要导入模块: from PyQt4.QtGui import QSplashScreen [as 别名]
# 或者: from PyQt4.QtGui.QSplashScreen import setMask [as 别名]
def showSplash(app):
# splash pixmap
logo = QPixmap(RES + ICONS + SPLASH)
splash = QSplashScreen(logo, Qt.WindowStaysOnTopHint)
splash.setWindowFlags(Qt.WindowStaysOnTopHint)
# alpha mask
splash.show()
splash.setMask(logo.mask())
# status message
labelAlignment = Qt.Alignment(Qt.AlignBottom | Qt.AlignCenter | Qt.AlignAbsolute)
newline = '<br/>'
family = FONTS_DICT['splash'][0]
size = str(FONTS_DICT['splash'][2])
font = "<font style='font-family: " + family + "; font-size: " + size + "pt; color: white;'>"
info = newline * 10 + font + 'Loading...<br/>' + __name__ + ' ' + __version__ + '</font'
splash.showMessage(info, labelAlignment) #NB: html tags completely break alignment and color settings
# checking for mouse click
app.processEvents()
return splash
示例7: start_ide
# 需要导入模块: from PyQt4.QtGui import QSplashScreen [as 别名]
# 或者: from PyQt4.QtGui.QSplashScreen import setMask [as 别名]
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()
#.........这里部分代码省略.........
示例8: start
# 需要导入模块: from PyQt4.QtGui import QSplashScreen [as 别名]
# 或者: from PyQt4.QtGui.QSplashScreen import setMask [as 别名]
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
#.........这里部分代码省略.........
示例9: resource_path
# 需要导入模块: from PyQt4.QtGui import QSplashScreen [as 别名]
# 或者: from PyQt4.QtGui.QSplashScreen import setMask [as 别名]
from PyQt4.QtCore import Qt
import sys
import os.path
"""
This script imports the minimum modules necessary to display a splash
screen before importing and displaying the downloader application.
"""
def resource_path(relative):
local = getattr(sys, '_MEIPASS', '.')
return os.path.join(local, relative)
# Create and display the splash screen
app = QApplication([])
splash_pix = QPixmap(resource_path('icons\splash_loading.png'))
splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)
splash.setMask(splash_pix.mask())
splash.show()
app.processEvents()
# Import and display the application
from mileage_gui import mileageGui
myapp = mileageGui()
myapp.show()
# Close the splash screen
splash.finish(myapp)
app.exec_()
示例10: start_ide
# 需要导入模块: from PyQt4.QtGui import QSplashScreen [as 别名]
# 或者: from PyQt4.QtGui.QSplashScreen import setMask [as 别名]
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", [])
#.........这里部分代码省略.........
示例11: start
# 需要导入模块: from PyQt4.QtGui import QSplashScreen [as 别名]
# 或者: from PyQt4.QtGui.QSplashScreen import setMask [as 别名]
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
#.........这里部分代码省略.........
示例12: start
# 需要导入模块: from PyQt4.QtGui import QSplashScreen [as 别名]
# 或者: from PyQt4.QtGui.QSplashScreen import setMask [as 别名]
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]
#.........这里部分代码省略.........
示例13: run_edis
# 需要导入模块: from PyQt4.QtGui import QSplashScreen [as 别名]
# 或者: from PyQt4.QtGui.QSplashScreen import setMask [as 别名]
def run_edis(app):
""" Se carga la interfáz """
DEBUG("Running Edis...")
qsettings = QSettings(paths.CONFIGURACION, QSettings.IniFormat)
# Ícono
app.setWindowIcon(QIcon(":image/edis"))
# Lenguaje
local = QLocale.system().name()
DEBUG("Loading language...")
language = settings.get_setting('general/language')
if language:
edis_translator = QTranslator()
edis_translator.load(os.path.join(paths.PATH,
"extras", "i18n", language))
app.installTranslator(edis_translator)
# Qt translator
qtranslator = QTranslator()
qtranslator.load("qt_" + local, QLibraryInfo.location(
QLibraryInfo.TranslationsPath))
app.installTranslator(qtranslator)
pixmap = QPixmap(":image/splash")
# Splash screen
show_splash = False
if settings.get_setting('general/show-splash'):
DEBUG("Showing splash...")
splash = QSplashScreen(pixmap, Qt.WindowStaysOnTopHint)
splash.setMask(pixmap.mask())
splash.show()
app.processEvents()
show_splash = True
# Style Sheet
style = settings.get_setting('window/style-sheet')
path_style = None
style_sheet = None
if style == 'Edark':
path_style = os.path.join(paths.PATH, 'extras', 'theme', 'edark.qss')
elif style != 'Default':
path_style = os.path.join(paths.EDIS, style + '.qss')
if path_style is not None:
with open(path_style, mode='r') as f:
style_sheet = f.read()
app.setStyleSheet(style_sheet)
# Fuente en Tooltips
QToolTip.setFont(QFont(settings.DEFAULT_FONT, 9))
# GUI
if show_splash:
alignment = Qt.AlignBottom | Qt.AlignLeft
splash.showMessage("Loading UI...", alignment, Qt.white)
DEBUG("Loading GUI...")
edis = Edis()
edis.show()
# Archivos de última sesión
files, recents_files, projects = [], [], []
projects = qsettings.value('general/projects')
#FIXME:
if projects is None:
projects = []
if settings.get_setting('general/load-files'):
DEBUG("Loading files and projects...")
if show_splash:
splash.showMessage("Loading files...", alignment, Qt.white)
files = qsettings.value('general/files')
if files is None:
files = []
# Archivos recientes
recents_files = qsettings.value('general/recents-files')
if recents_files is None:
recents_files = []
# Archivos desde línea de comandos
files += cmd_parser.parse()
edis.load_files_and_projects(files, recents_files, projects)
if show_splash:
splash.finish(edis)
DEBUG("Edis is Ready!")
sys.exit(app.exec_())
示例14: start
# 需要导入模块: from PyQt4.QtGui import QSplashScreen [as 别名]
# 或者: from PyQt4.QtGui.QSplashScreen import setMask [as 别名]
def start():
app = QApplication(sys.argv)
QCoreApplication.setOrganizationName('NINJA-IDE')
QCoreApplication.setOrganizationDomain('ninja-ide.org.ar')
QCoreApplication.setApplicationName('Kunai')
# 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()
loader.load_syntax()
#Loading GUI
splash.showMessage("Loading GUI", Qt.AlignRight | Qt.AlignBottom, Qt.white)
settings = QSettings()
if not settings.value('preferences/skins/default', True).toBool():
selectedSkin = settings.value('preferences/skins/selectedSkin', '').toString()
skins = loader.load_gui_skins()
css = skins.get(str(selectedSkin), '')
app.setStyleSheet(css)
schemeColor = str(settings.value('preferences/editor/scheme', 'default').toString())
if schemeColor != 'default':
resources.custom_scheme = loader.load_editor_skins().get(schemeColor, {})
#Editor Configuration
EditorGeneric.codeCompletion = settings.value('preferences/editor/codeCompletion', True).toBool()
EditorGeneric.indent = settings.value('preferences/editor/indent', 4).toInt()[0]
EditorGeneric.findErrors = settings.value('preferences/editor/errors', False).toBool()
EditorGeneric.checkStyle = settings.value('preferences/editor/checkStyle', True).toBool()
EditorGeneric.highlightVariables = settings.value('preferences/editor/highlightWord', True).toBool()
if not settings.value('preferences/editor/parentheses', True).toBool():
del EditorGeneric.braces_strings['(']
if not settings.value('preferences/editor/brackets', True).toBool():
del EditorGeneric.braces_strings['[']
if not settings.value('preferences/editor/keys', True).toBool():
del EditorGeneric.braces_strings['{']
if not settings.value('preferences/editor/simpleQuotes', True).toBool():
del EditorGeneric.braces_strings["'"]
if not settings.value('preferences/editor/doubleQuotes', True).toBool():
del EditorGeneric.braces_strings['"']
ide = IDE()
if settings.value('preferences/interface/centralRotate', False).toBool():
ide.main._splitter_central_rotate()
if settings.value('preferences/interface/panelsRotate', False).toBool():
ide.main._splitter_main_rotate()
if settings.value('preferences/interface/centralOrientation', False).toBool():
ide.main._splitter_central_orientation()
#Settings
splash.showMessage("Loading Settings", Qt.AlignRight | Qt.AlignBottom, Qt.white)
resources.python_path = str(settings.value('preferences/general/pythonPath', 'python').toString())
if (settings.value('preferences/general/activatePlugins', Qt.Checked) == Qt.Checked):
set_plugin_access(ide)
ninja_ide.core.load_plugins(ide)
resources.workspace = str(settings.value('preferences/general/workspace', '').toString())
supportedExtensions = settings.value('preferences/general/extensions', []).toList()
if supportedExtensions:
tempExtensions = []
for se in supportedExtensions:
tempExtensions.append(str(se.toString()))
manage_files.supported_extensions = tuple(tempExtensions)
#Load Font preference
font = str(settings.value('preferences/editor/font', "Monospace, 11").toString())
EditorGeneric.font_family = font.split(', ')[0]
EditorGeneric.font_size = int(font.split(', ')[1])
ide.show()
splash.showMessage("Loading Projects", Qt.AlignRight | Qt.AlignBottom, Qt.white)
for projectFolder in settings.value('openFiles/projects', []).toStringList():
if os.path.isdir(projectFolder):
ide.main.open_project_folder(str(projectFolder), False)
if (settings.value('preferences/general/loadFiles', Qt.Checked) == Qt.Checked):
for openFile in settings.value('openFiles/tab1', []).toList():
if len(openFile.toList()) > 0:
fileList = openFile.toList()
fileName = str(fileList[0].toString())
projectPath = str(fileList[1].toString())
if len(projectPath) == 0:
projectPath = None
cursorPosition = fileList[2].toInt()[0]
if os.path.isfile(fileName):
ide.main.open_document(fileName, projectPath)
ide.main._central.obtain_editor().set_cursor_position(cursorPosition)
for openFile2 in settings.value('openFiles/tab2', []).toList():
#ide.main.split_tab(True)
if len(openFile2.toList()) > 0:
ide.main._central._tabs2.show()
ide.main._central._mainTabSelected = False
fileList = openFile2.toList()
fileName = fileList[0].toString()
projectPath = fileList[1].toString()
cursorPosition = fileList[2].toInt()[0]
if os.path.isfile(fileName):
ide.main.open_document(str(fileName), str(projectPath))
ide.main._central.obtain_editor().set_cursor_position(cursorPosition)
#.........这里部分代码省略.........