Пример #1
0
def launchShell(workflowClass, testFunc = None, windowTitle="ilastikShell", workflowKwargs=None):
    """
    Start the ilastik shell GUI with the given workflow type.
    Note: A QApplication must already exist, and you must call this function from its event loop.
    
    workflowClass - the type of workflow to instantiate for the shell.    
    """
    if workflowKwargs is None:
        workflowKwargs = dict()

    # Splash Screen
    splashImage = QPixmap("../ilastik-splash.png")
    splashScreen = QSplashScreen(splashImage)
    splashScreen.show()
    
    # Create workflow
    workflow = workflowClass(**workflowKwargs)
    
    # Create the shell and populate it
    shell = IlastikShell(workflow=workflow, sideSplitterSizePolicy=SideSplitterSizePolicy.Manual)
    shell.setWindowTitle(windowTitle)
    shell.setImageNameListSlot( workflow.imageNameListSlot )
    
    # Start the shell GUI.
    shell.show()

    # Hide the splash screen
    splashScreen.finish(shell)

    # Run a test (if given)
    if testFunc:
        QTimer.singleShot(0, functools.partial(testFunc, shell, workflow) )
Пример #2
0
	def __init__(self, pixmap, waitTime=0, textColor=Qt.black, *args, **kwargs):
		"""
		Initializes the class.

		:param pixmap: Current pixmap path.
		:type pixmap: unicode
		:param waitTime: wait time.
		:type waitTime: int
		:param \*args: Arguments.
		:type \*args: \*
		:param \*\*kwargs: Keywords arguments.
		:type \*\*kwargs: \*\*
		"""

		LOGGER.debug("> Initializing '{0}()' class.".format(self.__class__.__name__))

		QSplashScreen.__init__(self, pixmap, *args, **kwargs)

		self.setWindowFlags(self.windowFlags() | Qt.WindowStaysOnTopHint)

		# --- Setting class attributes. ---
		self.__waitTime = None
		self.waitTime = waitTime
		self.__textColor = None
		self.textColor = textColor
Пример #3
0
    def showMessage( self, msg ):
        """ Show the message in the bottom part of the splashscreen """

        QSplashScreen.showMessage( self, msg,
                                   self.labelAlignment, QColor( Qt.black ) )
        QApplication.processEvents()
        return
Пример #4
0
 def __init__(self,qgisPrefix):
     p = qgisPrefix + "//data//icimod.png"
     pic = QPixmap(p)
     self.labelAlignment = Qt.Alignment(Qt.AlignBottom | Qt.AlignRight | Qt.AlignAbsolute)
     QSplashScreen.__init__(self, pic)
     self.show()
     QApplication.flush()
Пример #5
0
    def __init__(self, parent=None):
        from radiance import __version__
        self.__version = __version__
        self.parent = parent
        
        pixmap = QPixmap(QString(':/Radiance/splashscreen.png'))
        flags = Qt.WindowStaysOnTopHint
        QSplashScreen.__init__(self, pixmap, flags)
        self.setMask(pixmap.mask())
        
        # Custom progress bar stylesheet
        progressbar_stylesheet = """
        QProgressBar:horizontal {
            border: 1px solid black;
            background: white;
            padding: 1px;
        }
        QProgressBar::chunk:horizontal {
            background-color: qlineargradient(spread: pad, x1: 1, y1: 0.5, x2: 0, y2: 0.5, stop: 0 black, stop: 1 white);
        }
        """
        
        # Place progress bar to bottom of splash screen.
        progressbar = QProgressBar(self)
        progressbar.setRange(0, 0)
        progressbar.setGeometry(10, self.height() - 20, self.width() - 20, 10)
        progressbar.setTextVisible(False)
        progressbar.setStyleSheet(progressbar_stylesheet)
        self.progressbar = progressbar

        self.show()
Пример #6
0
def showSplashScreen():
    splash_path = os.path.join(
        os.path.split(ilastik.__file__)[0], 'ilastik-splash.png')
    splashImage = QPixmap(splash_path)
    global splashScreen
    splashScreen = QSplashScreen(splashImage)
    splashScreen.show()
Пример #7
0
    def showMessage(self, msg):
        """ Show the message in the bottom part of the splashscreen """

        QSplashScreen.showMessage(self, msg, self.labelAlignment,
                                  QColor(Qt.black))
        QApplication.processEvents()
        return
Пример #8
0
def show_splash():
    """Show the splash screen"""
    splashImage = QPixmap( "images/splash.png" )
    splashScreen = QSplashScreen( splashImage )
    splashScreen.showMessage( "Loading . . . " )
    splashScreen.show()
    return splashScreen
Пример #9
0
def show():
    
    message = "{0}  {1} ".format(appinfo.appname, appinfo.version)
    pixmap = QPixmap(os.path.join(__path__[0], 'splash.png'))
    if QApplication.desktop().screenGeometry().height() < 640:
        fontsize = 23
        pixmap = pixmap.scaledToHeight(240, Qt.SmoothTransformation)
    else:
        fontsize = 40

    splash = QSplashScreen(pixmap, Qt.SplashScreen)

    font = splash.font()
    font.setPixelSize(fontsize)
    font.setWeight(QFont.Bold)
    splash.setFont(font)

    splash.showMessage(message, Qt.AlignRight | Qt.AlignTop, Qt.white)
    splash.show()
    splash.repaint()
    
    def hide():
        splash.deleteLater()
        app.appStarted.disconnect(hide)

    app.appStarted.connect(hide)
Пример #10
0
def launchShell(workflowClass=None, *testFuncs):
    """
    Start the ilastik shell GUI with the given workflow type.
    Note: A QApplication must already exist, and you must call this function from its event loop.
    
    workflowClass - the type of workflow to instantiate for the shell.    
    """
    # Splash Screen
    splashImage = QPixmap("../ilastik-splash.png")
    splashScreen = QSplashScreen(splashImage)
    splashScreen.show()

    # Create the shell and populate it
    global shell
    shell = IlastikShell(workflowClass=workflowClass, sideSplitterSizePolicy=SideSplitterSizePolicy.Manual)

    assert QApplication.instance().thread() == shell.thread()

    # Start the shell GUI.
    shell.show()

    # Hide the splash screen
    splashScreen.finish(shell)

    # Run a test (if given)
    for testFunc in testFuncs:
        QTimer.singleShot(0, functools.partial(testFunc, shell))
Пример #11
0
 def showMessage(self, msg):
     """
     Public method to show a message in the bottom part of the splashscreen.
     
     @param msg message to be shown (string or QString)
     """
     QSplashScreen.showMessage(self, msg, self.labelAlignment, QColor(Qt.white))
     QApplication.processEvents()
Пример #12
0
 def __init__(self):
     """Launch GUI"""
     #translator = DFF_Translator()
     self.app = QApplication(sys.argv)
     #app.installTranslator(translator)
     pixmap = QPixmap(":splash.png")
     self.splash = QSplashScreen(pixmap, Qt.WindowStaysOnTopHint)
     self.splash.setMask(pixmap.mask())
Пример #13
0
 def __init__(self):
     """
     Constructor
     """
     ericPic = QPixmap(os.path.join(getConfig("ericPixDir"), "ericSplash.png"))
     self.labelAlignment = Qt.Alignment(Qt.AlignBottom | Qt.AlignRight | Qt.AlignAbsolute)
     QSplashScreen.__init__(self, ericPic)
     self.show()
     QApplication.flush()
Пример #14
0
def splash(path):
    u"Create and display the splash screen. Credits: Eli Bendersky ([email protected])"
    splash_pix = QPixmap(path)
    splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)
    ##splash.setAttribute(Qt.WA_TranslucentBackground)
    # XXX: Doesn't work currently: https://bugreports.qt.nokia.com//browse/QTBUG-12820
    # See also http://developer.qt.nokia.com/wiki/QSplashScreen_replacement_for_semitransparent_images
    splash.show()
    return splash
Пример #15
0
    def setPixmap(self, pixmap):
        self.setAttribute(Qt.WA_TranslucentBackground,
                          pixmap.hasAlpha() and \
                          is_transparency_supported())

        self.__pixmap = pixmap

        QSplashScreen.setPixmap(self, pixmap)
        if pixmap.hasAlpha() and not is_transparency_supported():
            self.setMask(pixmap.createHeuristicMask())
Пример #16
0
    def setPixmap(self, pixmap):
        self.setAttribute(Qt.WA_TranslucentBackground,
                          pixmap.hasAlpha() and \
                          is_transparency_supported())

        self.__pixmap = pixmap

        QSplashScreen.setPixmap(self, pixmap)
        if pixmap.hasAlpha() and not is_transparency_supported():
            self.setMask(pixmap.createHeuristicMask())
Пример #17
0
    def __init__( self ):

        self.labelAlignment = \
            Qt.Alignment( Qt.AlignBottom | Qt.AlignRight | Qt.AlignAbsolute )

        QSplashScreen.__init__( self, PixmapCache().getPixmap( 'splash.png' ) )

        self.show()
        QApplication.flush()
        return
Пример #18
0
 def __init__(self):
     """
     Constructor
     """
     img_path = os.path.join(os.getcwd(), 'gui', 'images', 'splash.png')
     pixmap = QPixmap(img_path)
     self.labelAlignment = Qt.Alignment(Qt.AlignBottom | Qt.AlignRight | Qt.AlignAbsolute)
     QSplashScreen.__init__(self, pixmap)
     self.show()
     QApplication.flush()
Пример #19
0
 def showMessage(self, message, alignment=Qt.AlignLeft, color=Qt.black):
     """
     Show the `message` with `color` and `alignment`.
     """
     # Need to store all this arguments for drawContents (no access
     # methods)
     self.__alignment = alignment
     self.__color = color
     self.__message = message
     QSplashScreen.showMessage(self, message, alignment, color)
     QApplication.instance().processEvents()
Пример #20
0
 def showMessage(self, message, alignment=Qt.AlignLeft, color=Qt.black):
     """
     Show the `message` with `color` and `alignment`.
     """
     # Need to store all this arguments for drawContents (no access
     # methods)
     self.__alignment = alignment
     self.__color = color
     self.__message = message
     QSplashScreen.showMessage(self, message, alignment, color)
     QApplication.instance().processEvents()
Пример #21
0
    def __init__(self):

        self.labelAlignment = \
            Qt.Alignment( Qt.AlignBottom | Qt.AlignRight | Qt.AlignAbsolute )

        QSplashScreen.__init__(self, None,
                               PixmapCache().getPixmap('splash.png'))

        self.show()
        QApplication.flush()
        return
Пример #22
0
def main():
    app = QApplication(sys.argv)
    start = time() 
    splash = QSplashScreen(QPixmap("images/login.png"))
    splash.show()
    while time() - start < 1:
        sleep(0.001)
        app.processEvents()
    win = MainWindow()
    splash.finish(win)
    win.show()
    app.exec_()
Пример #23
0
Файл: main.py Проект: eteq/glue
def get_splash():
    """Instantiate a splash screen"""
    from PyQt4.QtGui import QSplashScreen, QPixmap
    from PyQt4.QtCore import Qt
    import os

    pth = os.path.join(os.path.dirname(__file__), 'logo.png')
    pm = QPixmap(pth)
    splash = QSplashScreen(pm, Qt.WindowStaysOnTopHint)
    splash.show()

    return splash
Пример #24
0
    def show_splash_screen(self):
        """
        Show splash screen
        """
        file = QFile(':herculeum.qss')
        file.open(QFile.ReadOnly)
        styleSheet = str(file.readAll().data(), 'ascii')
        self.qt_app.setStyleSheet(styleSheet)

        pixmap = QPixmap(':splash.png')
        self.splash_screen = QSplashScreen(pixmap)
        self.splash_screen.show()
Пример #25
0
def main():
   """ Starts the Main Window Interface  """
   app = QApplication(sys.argv)
   app.setWindowIcon(QIcon(os.path.join(RESOURCE_PATH, "manager.ico"))) 

   start       = time.time()                               # Start timer for splash screen                                   
   splashImage = os.path.join(RESOURCE_PATH, "splash.jpg") # Define splash image 
   pixmap      = QPixmap(splashImage)                      # Create a pixmap object
   splash      = QSplashScreen(pixmap)                     # Create a splash screen object
   # This "splash.setMask()" is usefull if the splashscreen is not a regular 
   # ractangle. This is also the reason we created a separate object of type 
   # pixmap.
   # splash.setMask(pixmap.mask())                         # Accomodate odd shapes  
   splash.show()                                           # Show splash screen
   splash.showMessage((u'%s, Version %s Starting...' %(ME, VERSION)), Qt.AlignLeft | Qt.AlignBottom, Qt.black)
   # make sure Qt really display the splash screen 
   while time.time() - start < 3: # \
      time.sleep(0.001)           #  > Timer for splash screen.
      app.processEvents()         # /
   mainWin = MainWindow()         # Create object of type "MainWindow"
   splash.finish(mainWin)         # kill the splashscreen   

   mainWin.setGeometry(100, 100, 1000, 700) # Initial window position and size
   mainWin.setWindowTitle(ME)               # Initial Window title
   mainWin.show()                           # Abracadabra "POOF!"
   sys.exit(app.exec_())                    # Handles all clean exits 
Пример #26
0
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_())
Пример #27
0
class QtUserInterface():
    """
    Class for Qt User Interface

    .. versionadded:: 0.9
    """
    def __init__(self, application):
        """
        Default constructor
        """
        super().__init__()

        self.application = application
        self.splash_screen = None

        self.qt_app = QApplication([])
        self.qt_app.setOverrideCursor(QCursor(Qt.BlankCursor))

    def show_splash_screen(self):
        """
        Show splash screen
        """
        file = QFile(':herculeum.qss')
        file.open(QFile.ReadOnly)
        styleSheet = str(file.readAll().data(), 'ascii')
        self.qt_app.setStyleSheet(styleSheet)

        pixmap = QPixmap(':splash.png')
        self.splash_screen = QSplashScreen(pixmap)
        self.splash_screen.show()

    def show_main_window(self):
        """
        Show main window
        """
        main_window = MainWindow(self.application,
                                 self.application.surface_manager,
                                 self.qt_app,
                                 None,
                                 Qt.FramelessWindowHint,
                                 StartGameController(self.application.level_generator_factory,
                                                     self.application.creature_generator,
                                                     self.application.item_generator,
                                                     self.application.config.start_level))

        self.splash_screen.finish(main_window)
        main_window.show_new_game()

        self.qt_app.exec_()
Пример #28
0
    def __init__(self, parent=None, pixmap=None, textRect=None, **kwargs):
        QSplashScreen.__init__(self, parent, **kwargs)
        self.__textRect = textRect
        self.__message = ""
        self.__color = Qt.black
        self.__alignment = Qt.AlignLeft

        if pixmap is None:
            pixmap = QPixmap()

        self.setPixmap(pixmap)

        self.setAutoFillBackground(False)
        # Also set FramelesWindowHint (if not already set)
        self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint)
Пример #29
0
    def __init__(self, parent=None, pixmap=None, textRect=None, **kwargs):
        QSplashScreen.__init__(self, parent, **kwargs)
        self.__textRect = textRect
        self.__message = ""
        self.__color = Qt.black
        self.__alignment = Qt.AlignLeft

        if pixmap is None:
            pixmap = QPixmap()

        self.setPixmap(pixmap)

        self.setAutoFillBackground(False)
        # Also set FramelesWindowHint (if not already set)
        self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint)
Пример #30
0
    def __init__( self ):

        self.labelAlignment = \
            Qt.Alignment( Qt.AlignBottom | Qt.AlignRight | Qt.AlignAbsolute )

        splashPixmap = PixmapCache().getPixmap( 'splash.png' )
        painter = QPainter( splashPixmap )
        font = QFont( "Arial" )
        font.setPointSize( 12 )
        painter.setFont( font )
        painter.drawText( QPoint( 20, 130 ), "CODIMENSION v" + str( cdmverspec.__version__ ) )
        QSplashScreen.__init__( self, None, splashPixmap )

        self.show()
        QApplication.flush()
        return
Пример #31
0
class QtUserInterface():
    """
    Class for Qt User Interface

    .. versionadded:: 0.9
    """
    def __init__(self, application):
        """
        Default constructor
        """
        super().__init__()

        self.application = application
        self.splash_screen = None

        self.qt_app = QApplication([])
        # self.qt_app.setOverrideCursor(QCursor(Qt.BlankCursor))

    def show_splash_screen(self):
        """
        Show splash screen
        """
        file = QFile(':herculeum.qss')
        file.open(QFile.ReadOnly)
        styleSheet = str(file.readAll().data(), 'ascii')
        self.qt_app.setStyleSheet(styleSheet)

        pixmap = QPixmap(':splash.png')
        self.splash_screen = QSplashScreen(pixmap)
        self.splash_screen.show()

    def show_main_window(self):
        """
        Show main window
        """
        main_window = MainWindow(
            self.application, self.application.surface_manager, self.qt_app,
            None, Qt.FramelessWindowHint,
            StartGameController(self.application.level_generator_factory,
                                self.application.creature_generator,
                                self.application.item_generator,
                                self.application.config.start_level))

        self.splash_screen.finish(main_window)
        main_window.show_new_game()

        self.qt_app.exec_()
Пример #32
0
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_())
Пример #33
0
 def event(self, event):
     if event.type() == event.Paint:
         pixmap = self.__pixmap
         painter = QPainter(self)
         if not pixmap.isNull():
             painter.drawPixmap(0, 0, pixmap)
         self.drawContents(painter)
         return True
     return QSplashScreen.event(self, event)
Пример #34
0
def main():
    """
    Main runtine to run software.
    """
    workpath = os.path.dirname(os.path.join(os.getcwd(), __file__))
    # print workpath
    workpath = workpath.split("\\")
    workpath.append("icon")
    iconDir = "\\".join(workpath)
    # print iconDir
    app = QApplication(sys.argv)
    splash = QSplashScreen(QPixmap(os.path.join(iconDir, "tm.png")))
    splash.show()
    app.processEvents()
    sleep(1)
    TMWindows = TMMainWidget()
    splash.finish(TMWindows)
    sys.exit(app.exec_())
Пример #35
0
 def event(self, event):
     if event.type() == event.Paint:
         pixmap = self.__pixmap
         painter = QPainter(self)
         if not pixmap.isNull():
             painter.drawPixmap(0, 0, pixmap)
         self.drawContents(painter)
         return True
     return QSplashScreen.event(self, event)
Пример #36
0
    def processSplashScreen(self):
        """ Processes the splash screen, Prints a loading picture before entering the application
        """

        self.splashMessage = translate("Application", "Starting Graphical Network Simulator...")
        self.splashSleepTime = 1
        self.splashPath = ':/images/logo_gns3_splash.png'

        pixmap = QPixmap(self.splashPath)
        self.splash = QSplashScreen(pixmap, Qt.WindowStaysOnTopHint)
        self.splash.show()
        self.splash.showMessage(self.splashMessage, Qt.AlignRight | Qt.AlignTop, Qt.black)

        # make sure Qt really display the splash screen and message
        self.processEvents(QEventLoop.AllEvents, 500)
        time.sleep(self.splashSleepTime)
        self.splash.finish(self.__mainWindow)
        return
Пример #37
0
def run_pygobstones():
    app = QtGui.QApplication(sys.argv)

    #Get the locale settings
    locale = unicode(QtCore.QLocale.system().name())

    # This is to make Qt use locale configuration; i.e. Standard Buttons
    # in your system's language.
    qtTranslator=QtCore.QTranslator()
    qtTranslator.load("qt_" + locale,
                        QtCore.QLibraryInfo.location(
                        QtCore.QLibraryInfo.TranslationsPath)
                        )
    app.installTranslator(qtTranslator)

    path = os.path.join(root_path(), 'commons')

    f = QtGui.QFontDatabase.addApplicationFont(os.path.join(path, 'ubuntu.ttf'))
    font = QtGui.QFont('Ubuntu Titling')
    font.setBold(True)
    font.setPixelSize(16)
    app.setFont(font)

    start = time()
    
    if 'huayra' in platform.uname():
        img = QPixmap(os.path.join(path, 'gobstones_huayra.png'))
    else:
        img = QPixmap(os.path.join(path, 'gobstones.png'))

    splash = QSplashScreen(img)
    splash.show()

    while time() - start < 1:
        app.processEvents()
    
    w = MainWindow()
    icon = QtGui.QIcon(os.path.join(path, 'logo.png'))
    w.setWindowIcon(icon)
    splash.finish(w)
    w.showMaximized()
    sys.exit(app.exec_())
Пример #38
0
 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)
Пример #39
0
	def showMessage(self, message, textAlignement=Qt.AlignLeft, textColor=None, waitTime=None):
		"""
		Reimplements the :meth:`QSplashScreen.showMessage` method.

		:param message: Message to display on the splashscreen.
		:type message: unicode
		:param textAlignement: Text message alignment.
		:type textAlignement: object
		:param textColor: Text message color.
		:type textColor: object
		:param waitTime: Wait time.
		:type waitTime: int
		"""

		QSplashScreen.showMessage(self, message, textAlignement, self.__textColor if textColor is None else textColor)

		# Force QSplashscreen refresh.
		QApplication.processEvents()

		foundations.core.wait(self.__waitTime if waitTime is None else waitTime)
Пример #40
0
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        self.dirty = False

        self.setObjectName("MainWindow")
        self.resize(800, 600)
        self.setWindowTitle("GA")  # TODO
        # TODO        app_icon = get_icon('OpenFisca22.png')
        #        self.setWindowIcon(app_icon)
        self.setLocale(QLocale(QLocale.French, QLocale.France))
        self.setDockOptions(QMainWindow.AllowNestedDocks
                            | QMainWindow.AllowTabbedDocks
                            | QMainWindow.AnimatedDocks)

        self.centralwidget = QWidget(self)
        self.gridLayout = QGridLayout(self.centralwidget)
        self.setCentralWidget(self.centralwidget)
        self.centralwidget.hide()

        self.statusbar = QStatusBar(self)
        self.statusbar.setObjectName("statusbar")
        self.setStatusBar(self.statusbar)

        # Showing splash screen
        pixmap = QPixmap(':/images/splash.png', 'png')
        self.splash = QSplashScreen(pixmap)
        font = self.splash.font()
        font.setPixelSize(10)
        self.splash.setFont(font)
        self.splash.show()
        self.splash.showMessage(
            "Initialisation...",
            Qt.AlignBottom | Qt.AlignCenter | Qt.AlignAbsolute,
            QColor(Qt.black))
        #        if CONF.get('main', 'current_version', '') != __version__:
        #            CONF.set('main', 'current_version', __version__)
        # Execute here the actions to be performed only once after
        # each update (there is nothing there for now, but it could
        # be useful some day...

        self.start()
Пример #41
0
    def show_splash_screen(self):
        """
        Show splash screen
        """
        file = QFile(':herculeum.qss')
        file.open(QFile.ReadOnly)
        styleSheet = str(file.readAll().data(), 'ascii')
        self.qt_app.setStyleSheet(styleSheet)

        pixmap = QPixmap(':splash.png')
        self.splash_screen = QSplashScreen(pixmap)
        self.splash_screen.show()
Пример #42
0
def main():
    print 'Starting Central Access Reader...'

    import sys
    import os

    from PyQt4.QtGui import QApplication, QPixmap, QSplashScreen
    app = QApplication(sys.argv)

    # Create a splash screen
    from forms import resource_rc
    pixmap = QPixmap(':/icons/icons/CAR Splash.png')
    splash = QSplashScreen(pixmap)
    splash.show()
    app.processEvents()

    # Check to see if my folders in my paths exist. If they don't, make them
    from misc import program_path, app_data_path, temp_path

    if not os.path.exists(os.path.dirname(program_path('test.txt'))):
        os.makedirs(os.path.dirname(program_path('test.txt')))
    if not os.path.exists(os.path.dirname(app_data_path('test.txt'))):
        os.makedirs(os.path.dirname(app_data_path('test.txt')))
    if not os.path.exists(os.path.dirname(temp_path('test.txt'))):
        os.makedirs(os.path.dirname(temp_path('test.txt')))

    from gui.main_window import MainWindow

    window = MainWindow(app)
    window.show()
    splash.finish(window)
    sys.exit(app.exec_())
Пример #43
0
def main():
    app = QApplication(sys.argv)
    # Show SplashScreen
    splash_pixmap = QPixmap(':/cover.png')
    splash_screen = QSplashScreen(splash_pixmap, Qt.WindowStaysOnTopHint)
    splash_screen.show()

    app.processEvents()
    # Runtime imports
    import Valves_Main
    import time
    app.processEvents()
    app.setOrganizationName('Gatituz PK')
    app.setOrganizationDomain('http://gatituzmes-server.duckdns.org/')
    app.setApplicationName('VAL 518')
    app.processEvents()
    window = Valves_Main.MainWindowStart()
    app.setWindowIcon(QIcon(":/logo.png"))
    app.processEvents()

    app.processEvents()
    time.sleep(2)
    app.processEvents()
    time.sleep(1)
    app.processEvents()
    time.sleep(1)
    window.showMaximized()
    splash_screen.close()

    # Execute app
    app.exec_()
Пример #44
0
def showSplashScreen():
    splash_path = os.path.join(os.path.split(ilastik.__file__)[0], 'ilastik-splash.png')
    splashImage = QPixmap(splash_path)
    global splashScreen
    splashScreen = QSplashScreen(splashImage)    
    splashScreen.showMessage( ilastik.__version__, Qt.AlignBottom | Qt.AlignRight )
    splashScreen.show()
Пример #45
0
def show_splash():
    """Show the splash screen"""
    splashImage = QPixmap("images/splash.png")
    splashScreen = QSplashScreen(splashImage)
    splashScreen.showMessage("Loading . . . ")
    splashScreen.show()
    return splashScreen
Пример #46
0
def show():
    
    message = "{0}  {1} ".format(info.appname, info.version)
    pixmap = QPixmap(os.path.join(__path__[0], 'splash.png'))
    if QApplication.desktop().screenGeometry().height() < 640:
        fontsize = 23
        pixmap = pixmap.scaledToHeight(240, Qt.SmoothTransformation)
    else:
        fontsize = 40

    splash = QSplashScreen(pixmap, Qt.SplashScreen | Qt.WindowStaysOnTopHint)

    font = splash.font()
    font.setPixelSize(fontsize)
    font.setWeight(QFont.Bold)
    splash.setFont(font)

    splash.showMessage(message, Qt.AlignRight | Qt.AlignTop, Qt.white)
    splash.show()

    app.qApp.processEvents()
    splash.deleteLater()
Пример #47
0
    def __init__(self):
        QSplashScreen.__init__(self)
        self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.SplashScreen)

        splash_width = 720
        splash_height = 400

        desktop = QApplication.desktop()
        screen = desktop.screenGeometry(desktop.primaryScreen()).size()

        screen_width, screen_height = screen.width(), screen.height()
        x = screen_width / 2 - splash_width / 2
        y = screen_height / 2 - splash_height / 2
        self.setGeometry(x, y, splash_width, splash_height)

        self.splash_image = resourceImage("splash.jpg")

        self.ert = "ERT"
        self.ert_title = "Ensemble based Reservoir Tool"
        self.version = "Version string"
        self.timestamp = "Timestamp string"
        self.copyright = u"Copyright \u00A9 2017 Statoil ASA, Norway"
Пример #48
0
def main():
    app = QtGui.QApplication(sys.argv)

    splash_pix = QPixmap(':/splash/3dlp_slicer_splash.png')
    splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)
    splash.setMask(splash_pix.mask())
    splash.show()
    app.processEvents()

    window = Main()
    window.show()
    splash.finish(window)

    # It's exec_ because exec is a reserved word in Python
    sys.exit(app.exec_())
Пример #49
0
def _run(argv=[]):
    app = QApplication(argv)
    splash = QSplashScreen(QPixmap(u':/General/logo_refl_hq.png'))
    splash.showMessage(u"""<html>
                       <div style="margin-bottom: 420;"> &nbsp;</div>
                       <div style="font-size: 12pt; margin-bottom: 15;">
                       <b>RefRed</b> Version %s
                       </div>
                       <div>Starting up...</div>
                       </html>""" % version.str_version,
                       alignment=Qt.AlignBottom | Qt.AlignHCenter)
    splash.show()
    QApplication.processEvents()

    window = MainGui(argv)
    window.show()
    splash.finish(window)
    return app.exec_()
Пример #50
0
def main():
    from guidata import qapplication
    app = qapplication()
    splash = QSplashScreen(QPixmap('test/splash.png'))
    splash.show()
    app.processEvents()
    win = MainWindow()
    win.show()
    splash.finish(win)
    gl.progressManager.startNewProgress('Loading Modules', progressTest,
                                        [0, 0, 0])
    app.exec()
Пример #51
0
class gui():
    def __init__(self):
        """Launch GUI"""
        #translator = DFF_Translator()
        self.app = QApplication(sys.argv)
        #app.installTranslator(translator)
        pixmap = QPixmap(":splash.png")
        self.splash = QSplashScreen(pixmap, Qt.WindowStaysOnTopHint)
        self.splash.setMask(pixmap.mask())

    def launch(self, modPath):
        self.splash.show()
        self.loader = loader()
        self.loader.do_load(modPath, self.splash.showMessage)
        mainWindow = DFF_MainWindow(self.app)
        mainWindow.show()

        self.splash.finish(mainWindow)
        sys.exit(self.app.exec_())
Пример #52
0
def run_pygobstones():
    app = QtGui.QApplication(sys.argv)

    #Get the locale settings
    locale = str(QtCore.QLocale.system().name())

    # This is to make Qt use locale configuration; i.e. Standard Buttons
    # in your system's language.
    qtTranslator = QtCore.QTranslator()
    qtTranslator.load(
        "qt_" + locale,
        QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.TranslationsPath))
    app.installTranslator(qtTranslator)

    path = os.path.join(root_path(), 'commons')

    f = QtGui.QFontDatabase.addApplicationFont(os.path.join(
        path, 'ubuntu.ttf'))
    font = QtGui.QFont('Ubuntu Titling')
    font.setBold(True)
    font.setPixelSize(16)
    app.setFont(font)

    start = time()

    if 'huayra' in platform.uname():
        img = QPixmap(os.path.join(path, 'gobstones_huayra.png'))
    else:
        img = QPixmap(os.path.join(path, 'gobstones.png'))

    splash = QSplashScreen(img)
    splash.show()

    while time() - start < 1:
        app.processEvents()

    w = MainWindow()
    icon = QtGui.QIcon(os.path.join(path, 'logo.png'))
    w.setWindowIcon(icon)
    splash.finish(w)
    w.showMaximized()
    sys.exit(app.exec_())
Пример #53
0
def launchShell(workflowClass,
                testFunc=None,
                windowTitle="ilastikShell",
                workflowKwargs=None):
    """
    Start the ilastik shell GUI with the given workflow type.
    Note: A QApplication must already exist, and you must call this function from its event loop.
    
    workflowClass - the type of workflow to instantiate for the shell.    
    """
    if workflowKwargs is None:
        workflowKwargs = dict()

    # Splash Screen
    splashImage = QPixmap("../ilastik-splash.png")
    splashScreen = QSplashScreen(splashImage)
    splashScreen.show()

    # Create workflow
    workflow = workflowClass(**workflowKwargs)

    # Create the shell and populate it
    shell = IlastikShell(sideSplitterSizePolicy=SideSplitterSizePolicy.Manual)
    shell.setWindowTitle(windowTitle)
    for app in workflow.applets:
        shell.addApplet(app)
    shell.setImageNameListSlot(workflow.imageNameListSlot)

    # Start the shell GUI.
    shell.show()

    # Hide the splash screen
    splashScreen.finish(shell)

    # Run a test (if given)
    if testFunc:
        QTimer.singleShot(0, functools.partial(testFunc, shell, workflow))
Пример #54
0
def main(args):
    App = QApplication(args)
    splash = QSplashScreen(QPixmap("./view/winView/imgs/splash.png"))
    splash.show()  # 启动动画
    App.processEvents()
    QTextCodec.setCodecForCStrings(QTextCodec.codecForName("UTF-8"))
    initProperty()  # 初始化
    app.Music.play()  # 开机音乐
    app.MainWin.show()  # 主窗口显示
    splash.finish(app.MainWin)
    createTray()  # 创建托盘
    # 调试状态不连线上接服务器
    if app.Debug:
        host = '114.215.209.164'
        # host = 'localhost'
        thread = Worker(None, host, 1234, app.AppUser, app.MainWin)  # 子进程
        thread.start()
        server = Server(None)  # 子进程
        server.start()
    # else:
    #     # 打开工具箱
    #     app._tool_.show()

    App.exec_()
Пример #55
0
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
    splash.showMessage("Loading Files and Projects",
                       Qt.AlignRight | Qt.AlignTop, Qt.black)
    #Files in Main Tab
    main_files = qsettings.value('openFiles/mainTab', [])
    if main_files is not None:
        mainFiles = list(main_files)
    else:
        mainFiles = list()
    tempFiles = []
    for file_ in mainFiles:
        fileData = list(file_)
        tempFiles.append((fileData[0], int(fileData[1])))
    mainFiles = tempFiles
    #Files in Secondary Tab
    sec_files = qsettings.value('openFiles/secondaryTab', [])
    if sec_files is not None:
        secondaryFiles = list(sec_files)
    else:
        secondaryFiles = list()
    tempFiles = []
    for file_ in secondaryFiles:
        fileData = list(file_)
        tempFiles.append((fileData[0], int(fileData[1])))
    secondaryFiles = tempFiles
    # Recent Files
    recent = qsettings.value('openFiles/recentFiles', [])
    if recent is not None:
        recent_files = list(recent)
    else:
        recent_files = list()
    recent_files = [file_ for file_ in recent_files]
    #Current File
    current_file = qsettings.value('openFiles/currentFile', '')
    #Projects
    projects_list = qsettings.value('openFiles/projects', [])
    if projects_list is not None:
        projects = list(projects_list)
    else:
        projects = list()
    projects = [project for project in projects]
    #Include files received from console args
    file_with_nro = list(
        map(lambda f: (f[0], f[1] - 1), zip(filenames, linenos)))
    file_without_nro = list(map(lambda f: (f, 0), filenames[len(linenos):]))
    mainFiles += file_with_nro + file_without_nro
    #Include projects received from console args
    if projects_path:
        projects += projects_path
    ide.load_session_files_projects(mainFiles, secondaryFiles, projects,
                                    current_file, recent_files)
    #Load external plugins
    if extra_plugins:
        ide.load_external_plugins(extra_plugins)

    splash.finish(ide)
    ide.notify_plugin_errors()
    sys.exit(app.exec_())
Пример #56
0
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)

    #Set Stylesheet
    style_applied = False
    print(settings.NINJA_SKIN)
    if settings.NINJA_SKIN not in ('Default'):
        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 fileaccess:
                qss = fileaccess.read()
                app.setStyleSheet(qss)
                style_applied = True
    if not style_applied:
        if settings.NINJA_SKIN == 'Default':
            with open(resources.NINJA_THEME) as fileaccess:
                qss = fileaccess.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()
    #OSX workaround for ninja window not in front
    try:
        ninjaide.raise_()
    except:
        pass  # I really dont mind if this fails in any form
    #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
        files = data_qsettings.value('lastSession/openedFiles', [])
        tempFiles = []
        if files:
            for file_ in files:
                fileData = tuple(file_)
                if fileData:
                    tempFiles.append(fileData)
        files = tempFiles

        # Recent Files
        recent_files = data_qsettings.value('lastSession/recentFiles', [])
        #Current File
        current_file = data_qsettings.value('lastSession/currentFile',
                                            '',
                                            type='QString')
        #Projects
        projects = data_qsettings.value('lastSession/projects', [])
    else:
        files = []
        recent_files = []
        current_file = ''
        projects = []

    #Include files received from console args
    file_with_nro = list([(f[0], (f[1] - 1, 0), 0)
                          for f in zip(filenames, linenos)])
    file_without_nro = list([(f, (0, 0), 0) for f in filenames[len(linenos):]])
    files += file_with_nro + file_without_nro
    #Include projects received from console args
    if projects_path:
        projects += projects_path
    #FIXME: IMPROVE THIS WITH THE NEW WAY OF DO IT
    ninjaide.load_session_files_projects(files, projects, current_file,
                                         recent_files)
    #Load external plugins
    #if extra_plugins:
    #ninjaide.load_external_plugins(extra_plugins)

    splash.finish(ninjaide)
    ninjaide.notify_plugin_errors()
    ninjaide.show_python_detection()
Пример #57
0
class MainWindow(QMainWindow):
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        self.dirty = False

        self.setObjectName("MainWindow")
        self.resize(800, 600)
        self.setWindowTitle("GA")  # TODO
        # TODO        app_icon = get_icon('OpenFisca22.png')
        #        self.setWindowIcon(app_icon)
        self.setLocale(QLocale(QLocale.French, QLocale.France))
        self.setDockOptions(QMainWindow.AllowNestedDocks
                            | QMainWindow.AllowTabbedDocks
                            | QMainWindow.AnimatedDocks)

        self.centralwidget = QWidget(self)
        self.gridLayout = QGridLayout(self.centralwidget)
        self.setCentralWidget(self.centralwidget)
        self.centralwidget.hide()

        self.statusbar = QStatusBar(self)
        self.statusbar.setObjectName("statusbar")
        self.setStatusBar(self.statusbar)

        # Showing splash screen
        pixmap = QPixmap(':/images/splash.png', 'png')
        self.splash = QSplashScreen(pixmap)
        font = self.splash.font()
        font.setPixelSize(10)
        self.splash.setFont(font)
        self.splash.show()
        self.splash.showMessage(
            "Initialisation...",
            Qt.AlignBottom | Qt.AlignCenter | Qt.AlignAbsolute,
            QColor(Qt.black))
        #        if CONF.get('main', 'current_version', '') != __version__:
        #            CONF.set('main', 'current_version', __version__)
        # Execute here the actions to be performed only once after
        # each update (there is nothing there for now, but it could
        # be useful some day...

        self.start()

    def start(self, restart=False):
        '''
        Starts main process
        '''
        # Preferences
        self.general_prefs = [PathConfigPage]
        self.apply_settings()

        # Dockwidgets creation
        self.splash.showMessage(
            "Creating widgets...",
            Qt.AlignBottom | Qt.AlignCenter | Qt.AlignAbsolute,
            QColor(Qt.black))

        self.create_dockwidgets()
        self.populate_mainwidow()

        #################################################################
        ## Menu initialization
        #################################################################
        self.splash.showMessage(
            "Creating menubar...",
            Qt.AlignBottom | Qt.AlignCenter | Qt.AlignAbsolute,
            QColor(Qt.black))
        # Menu Fichier
        self.file_menu = self.menuBar().addMenu("Fichier")
        action_export_png = create_action(
            self, 'Exporter le graphique',
            icon='document-save png.png')  #, triggered = None)
        action_export_csv = create_action(
            self, 'Exporter la table',
            icon='document-save csv.png')  #, triggered = None)
        action_pref = create_action(self,
                                    u'Préférences',
                                    QKeySequence.Preferences,
                                    icon='preferences-desktop.png',
                                    triggered=self.edit_preferences)
        action_quit = create_action(self,
                                    'Quitter',
                                    QKeySequence.Quit,
                                    icon='process-stop.png',
                                    triggered=SLOT('close()'))

        file_actions = [
            action_export_png, action_export_csv, None, action_pref, None,
            action_quit
        ]
        add_actions(self.file_menu, file_actions)

        # Menu Edit
        self.edit_menu = self.menuBar().addMenu(u"Édition")
        action_copy = create_action(self,
                                    'Copier',
                                    QKeySequence.Copy,
                                    triggered=self.global_callback,
                                    data='copy')

        edit_actions = [None, action_copy]
        add_actions(self.edit_menu, edit_actions)

        # Menu Projection
        self.projection_menu = self.menuBar().addMenu(u"Projection")
        #
        self.action_refresh_project_population = create_action(
            self,
            u'Calculer les projections de population',
            shortcut='F9',
            icon='calculator_green.png',
            triggered=self.project_population)

        projection_actions = [self.action_refresh_project_population, None]
        add_actions(self.projection_menu, projection_actions)

        # Menu Help
        help_menu = self.menuBar().addMenu("&Aide")
        action_about = create_action(self,
                                     u"&About GA",
                                     triggered=self.helpAbout)
        action_help = create_action(self,
                                    "&Aide",
                                    QKeySequence.HelpContents,
                                    triggered=self.helpHelp)
        help_actions = [action_about, action_help]
        add_actions(help_menu, help_actions)

        # Display Menu
        view_menu = self.createPopupMenu()
        view_menu.setTitle("&Affichage")
        self.menuBar().insertMenu(help_menu.menuAction(), view_menu)

        # Toolbar
        self.main_toolbar = self.create_toolbar(u"Barre d'outil",
                                                'main_toolbar')
        toolbar_actions = [
            action_export_png,
            action_export_csv,
            None,
            self.action_refresh_project_population,
        ]
        add_actions(self.main_toolbar, toolbar_actions)

        # Window settings
        self.splash.showMessage(
            "Restoring settings...",
            Qt.AlignBottom | Qt.AlignCenter | Qt.AlignAbsolute,
            QColor(Qt.black))
        settings = QSettings()
        size = settings.value('MainWindow/Size',
                              QVariant(QSize(800, 600))).toSize()
        self.resize(size)
        position = settings.value('MainWindow/Position',
                                  QVariant(QPoint(0, 0))).toPoint()
        self.move(position)
        self.restoreState(settings.value("MainWindow/State").toByteArray())

        # Connectors

        self.connect(self._param_widget, SIGNAL('population_changed()'),
                     self.refresh_population)
        #        self.connect(self._param_widget, SIGNAL('rates_changed()'), self.refresh_cohorts)
        self.connect(self._param_widget, SIGNAL('state_proj_changed()'),
                     self.refresh_cohorts)

        self.refresh_population()
        self.load_data()

        self.splash.showMessage(
            "Loading survey data...",
            Qt.AlignBottom | Qt.AlignCenter | Qt.AlignAbsolute,
            QColor(Qt.black))
        self.splash.hide()
        return

    def create_toolbar(self, title, object_name, iconsize=24):
        toolbar = self.addToolBar(title)
        toolbar.setObjectName(object_name)
        toolbar.setIconSize(QSize(iconsize, iconsize))
        return toolbar

    def create_dockwidgets(self):
        '''
        Creates dockwidgets
        '''
        self._population_widget = PopulationDataWidget(self)
        self._cohorts_widget = PopulationDataWidget(self)
        self._profiles_widget = ProfilesDataWidget(self)
        self._param_widget = ParametersWidget(self)
        self._plot_widget = PlotWidget(self)

        # TODO
        # plot population pyramides/expenses pyramides
        # générational flow

    def populate_mainwidow(self):
        '''
        Creates all dockwidgets
        '''
        left_widgets = [
            self._profiles_widget, self._population_widget,
            self._cohorts_widget, self._plot_widget
        ]
        first_left_widget = None
        for widget in left_widgets:
            self.addDockWidget(Qt.LeftDockWidgetArea, widget)
            if first_left_widget is None:
                first_left_widget = widget
            else:
                self.tabifyDockWidget(first_left_widget, widget)

    def global_callback(self):
        """Global callback"""
        widget = QApplication.focusWidget()
        action = self.sender()
        callback = unicode(action.data().toString())
        if hasattr(widget, callback):
            getattr(widget, callback)()

    def load_data(self):
        '''
        Loads population and profiles data 
        '''
        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
        try:
            profiles_file = CONF.get('paths', 'profiles_file')
            store = HDFStore(profiles_file, 'r')
            profiles = store['profiles']

        except Exception, e:
            self.population_loaded = False
            QMessageBox.warning(
                self, u"Impossible de lire les données de population",
                u"GA n'a pas réussi à lire les données de population. L'erreur suivante a été renvoyée:\n%s\n\nVous pouvez configuer le chemin vers le fichier de données  Fichier>Paramètres>Chemins>Fichier données population"
                % e)
            return False
        finally:
Пример #58
0
Файл: gui.py Проект: kzwkt/dff
 def drawContents(self, painter):
     QSplashScreen.drawContents(self, painter)
     painter.drawText(10, 178, "Version " + str(self.versionNumber))