Пример #1
0
 def closeApp(self):
     self.nodeManager.stop()
     self.config['warren']['last_window_pos'] = [
         str(self.x()), str(self.y())
     ]
     self.config.write()
     qApp.quit()
Пример #2
0
    def impl(self):
        try:
            # Capture the window before we change anything
            beforeImg = QPixmap.grabWindow( self.w.winId() ).toImage()
            
            # Change the visibility of the *selected* layer
            self.o2.visible = False
            
            self.w.repaint()
            
            # Make sure the GUI is caught up on paint events
            QApplication.processEvents()
            
            # We must sleep for the screenshot to be right.
            time.sleep(0.1) 

            # Capture the window now that we've changed a layer.
            afterImg = QPixmap.grabWindow( self.w.winId() ).toImage()
    
            # Optional: Save the files so we can inspect them ourselves...
            #beforeImg.save('before.png')
            #afterImg.save('after.png')

            # Before and after should NOT match.
            assert beforeImg != afterImg
        except:
            # Catch all exceptions and print them
            # We must finish so we can quit the app.
            import traceback
            traceback.print_exc()
            TestLayerWidget.errors = True

        qApp.quit()
Пример #3
0
 def finished(self):
     """Catch the signal emitted when the track has finished
     if the app is in cli mode then quit after the track has finished
     """
     #print('Caught finished')
     if self.disableGui or self.quitOnFinish:
         qApp.quit()
Пример #4
0
    def impl(self):
        try:
            # Capture the window before we change anything
            beforeImg = QPixmap.grabWindow( self.w.winId() ).toImage()
            
            # Change the visibility of the *selected* layer
            self.o2.visible = False
            
            self.w.repaint()
            
            # Make sure the GUI is caught up on paint events
            QApplication.processEvents()
            
            # We must sleep for the screenshot to be right.
            time.sleep(0.1) 

            # Capture the window now that we've changed a layer.
            afterImg = QPixmap.grabWindow( self.w.winId() ).toImage()
    
            # Optional: Save the files so we can inspect them ourselves...
            #beforeImg.save('before.png')
            #afterImg.save('after.png')

            # Before and after should NOT match.
            assert beforeImg != afterImg
        except:
            # Catch all exceptions and print them
            # We must finish so we can quit the app.
            import traceback
            traceback.print_exc()
            TestLayerWidget.errors = True

        qApp.quit()
Пример #5
0
 def cleanupAndQuit(self):
     """
     cleans state before shutting down app.
     """
     # TODO:make sure to shutdown all child process / threads
     # in conductor
     self.conductor.cleanup()
     qApp.quit()
Пример #6
0
 def cleanExit(self): 
    # Provides an "ARE YOU SURE" method for clean exits.
    if self.state == 2: # See setState()
       reply = QMessageBox.question(self, 'Message', self.quit_msg, QMessageBox.Yes, QMessageBox.No)
       if reply == QMessageBox.Yes:
          qApp.quit()
       else:
          pass
    else:   
       qApp.quit()
Пример #7
0
 def catchStateChanged(self, newstate, oldstate):
     """Catch the stateChanged signal to check for errors quit app
     if in CLI mode
     """
     #print('State = ' + str(newstate))
     #print('Meta Info')
     #print(self.mediaObject.metaData())
     if newstate == Phonon.ErrorState:
         print('Error playing back file')
         if self.disableGui:
             qApp.quit()
Пример #8
0
    def closeAndQuit(self, quitApp=True):
        self.projectManager.closeCurrentProject()

        # Stop the thread that checks for log config changes.
        ilastik.ilastik_logging.stopUpdates()

        # Close the window first, so applets can reimplement hideEvent() and such.
        self.close()

        # For testing purposes, sometimes this function is called even though we don't want to really quit.
        if quitApp:
            qApp.quit()
Пример #9
0
    def closeAndQuit(self, quitApp=True):
        self.projectManager.closeCurrentProject()

        # Stop the thread that checks for log config changes.
        ilastik.ilastik_logging.stopUpdates()

        # Close the window first, so applets can reimplement hideEvent() and such.
        self.close()
        
        # For testing purposes, sometimes this function is called even though we don't want to really quit.
        if quitApp:
            qApp.quit()
Пример #10
0
    def closeEvent(self, event):
        """
        Handling saving state before application when application is
        being closed.
        """
        settings = QtCore.QSettings()
        settings.setValue("main_WindowGeometry", self.saveGeometry())
        settings.setValue("mainWindowState", self.saveState())
        settings.setValue("backgroundColor", self.background_color)
        settings.setValue("textColor", self.text_color)
        settings.setValue("labelColor", self.label_color)

        #screen_shape = QtGui.QDesktopWidget().screenGeometry()
        main_window = self.window()
        width = main_window.frameGeometry().width()
        height = main_window.frameGeometry().height()
        settings.setValue('screen_shape', (width, height))

        qpos = self.pos()
        pos = qpos.x(), qpos.y()
        settings.setValue('pos', pos)
        qApp.quit()
Пример #11
0
    def closeEvent(self, event):
        """
        Handling saving state before application when application is
        being closed.
        """
        settings = QtCore.QSettings()
        settings.setValue("main_WindowGeometry", self.saveGeometry())
        settings.setValue("mainWindowState", self.saveState())
        settings.setValue("backgroundColor", self.background_color)
        settings.setValue("textColor", self.text_color)
        settings.setValue("labelColor", self.label_color)

        #screen_shape = QtGui.QDesktopWidget().screenGeometry()
        main_window = self.window()
        width = main_window.frameGeometry().width()
        height = main_window.frameGeometry().height()
        settings.setValue('screen_shape', (width, height))

        qpos = self.pos()
        pos = qpos.x(), qpos.y()
        settings.setValue('pos', pos)
        qApp.quit()
def quitApp():
    qApp.quit()
Пример #13
0
 def on_actionExit_clicked(self):
     print('Exiting...')
     qApp.quit()
Пример #14
0
 def keyPressEvent(self, ev):
     if ev.key() == Qt.Key_Escape:
         qApp.quit()
Пример #15
0
 def close(self):
     qApp.quit()
Пример #16
0
 def app_exit(self):
     shutil.rmtree(tmp_dir)
     return qApp.quit()
Пример #17
0
 def quit(self):
     qApp.quit() 
Пример #18
0
 def keyPressEvent(self, ev):
     if ev.key() == Qt.Key_Escape:
         qApp.quit()
Пример #19
0
 def closeApp(self):
     self.nodeManager.stop()
     self.config['warren']['last_window_pos'] = [str(self.x()),str(self.y())]
     self.config.write()
     qApp.quit()
Пример #20
0
 def close(self):
     qApp.quit()
def quitApp():
    if qApp is not None:
        qApp.quit()
Пример #22
0
 def interpret(self, command):
     """Interprets command
     Returns turple (output, exitCode)
     """
     print '~~~~~~~~~ interpret'
     ec = pConsoleCommand.NotFound
     output, ec = pConsoleCommand.interpret( command)
     parts = self.parseCommands( command )
     if parts:
         cmd = parts.takeFirst()
     else:
         cmd = ''
     
     if ec != pConsoleCommand.NotFound :            # nothing to do
         pass
     elif  cmd == "ls" :
         if sys.platform.startswith('win'):
             cmd = "dir %s" % \
             " ".join(pConsoleCommand.quotedStringList(parts)).trim()
         else:
             cmd = "dir %s" % " ".join( \
                 pConsoleCommand.quotedStringList(parts)).trimmed()
         
         process = QProcess()
         process.setProcessChannelMode( QProcess.MergedChannels )
         process.start( cmd )
         process.waitForStarted()
         process.waitForFinished()
         
         output = process.readAll().trimmed()
         ec = process.exitCode()
     elif  cmd == "echo" :
         if parts:
             output = "\n".join(parts)
             ec = pConsoleCommand.Error
         else:
             output = pConsole.tr(console, "No argument given" )
             ec = pConsoleCommand.Success
     elif  cmd == "quit":
         output = pConsole.tr(console, "Quitting the application..." )
         ec = pConsoleCommand.Success
         
         QTimer.singleShot(1000, qApp.quit() )
     elif  cmd == "style" :
         if  parts.count() != 1 :
             output = pConsole.tr(console, "%s take only 1 parameter, %d given"  %
                                     (cmd, len(parts)) )
             ec = pConsoleCommand.Error
         elif  parts[-1] == "list" :
             output = pConsole.tr(console, "Available styles:\n%s" % 
                                     '\n'.join(QStyleFactory.keys()) )
             ec = pConsoleCommand.Success
         else:
             styleExists = parts[-1].lower() in \
                         [key.lower() for key in QStyleFactory.keys()]
             if styleExists:
                 output = pConsole.tr(console, "Setting style to %s..." % parts[-1])
                 self.mMainWindow.setCurrentStyle( parts[-1] )
                 ec = pConsoleCommand.Success
             else:
                 output = pConsole.tr(console, "This style does not exists" )
                 ec = pConsoleCommand.Error
     
     return (output, ec)
Пример #23
0
def quitApp():
    if qApp is not None:
        qApp.quit()
Пример #24
0
 def __quit(self):
     self.__saveSettings()
     qApp.quit()
Пример #25
0
 def __quit(self):
     self.__saveSettings()
     qApp.quit()
Пример #26
0
 def process_return_code(self, ret):
     if ret == QMessageBox.Yes:
         qApp.quit()
     elif ret == QMessageBox.No:
         pass
Пример #27
0
def quitApp():
    qApp.quit()
Пример #28
0
 def app_exit(self):
     shutil.rmtree(tmp_dir)
     return qApp.quit()