コード例 #1
0
ファイル: coverwindow.py プロジェクト: Sensebloom/wallmanager
 def resume(self, app, is_screensaver):
     bring_window_to_front()
     if not is_screensaver:
         self.vote.app = app
         self.add_widget( self.vote )
         self.timer = Timer(COVER_WINDOW_RESUME_TIME, self.hide)
         self.timer.start()
     else:
         self.hide()
コード例 #2
0
 def resume(self, app, is_screensaver):
     bring_window_to_front()
     if not is_screensaver:
         self.vote.app = app
         self.add_widget(self.vote)
         self.timer = Timer(COVER_WINDOW_RESUME_TIME, self.hide)
         self.timer.start()
     else:
         self.hide()
コード例 #3
0
ファイル: models.py プロジェクト: Sensebloom/wallmanager
    def _execute(self, is_screensaver):
        """Tries to execute application's batch file.
        
        While is executing all process output (stdout/stderr) is catched 
        and handled later on when the application is terminated. 
        
        This method blocks until the application exits. Use run() instead.

        Returns:
            True if application is successfuly executed. 
            False is returned whether there is no boot file or another application is already running.
            
        Raises:
            An Exception is raised in case something goes wrong during
            process execution"""
            
            
        #hide scatter
        
        logger.info('running application: %s' % self.name)
        
        if (is_app_running()):
            get_app_mutex().unlock()
            return False
          
        
        app_boot_file = self.get_boot_file()
        success = False
        
        if app_boot_file:
            
            try:
                from mtmenu import cover_window
                cover_window.show()
                
                self.start_run()
                
                command = self.build_command(app_boot_file)
                
                # Starts application process and waits for it to terminate
                process = Popen(command, stdout = PIPE, stderr = PIPE, cwd = self.get_extraction_fullpath(), shell = False)
                
                # defines the application that is running
                set_app_running(process)
                
                
                from utils import bring_window_to_front
                bring_window_to_front(True)
                
                # Concatenate output
                output = StringIO()
                for line in process.communicate():
                    output.write(line)


                remove_app_running()
                
                cover_window.resume(self, is_screensaver)
                        
                self.end_run()                
                
                # Save output to database
                self.add_log_entry(output.getvalue())    
                    
                success = True
                logger.info("Application %s terminated" % self.name)
            except Exception, e: #Pokemon
                logger.error("EXCEPTION RUNNING APPLICATION:\n%s" % e)
コード例 #4
0
    def _execute(self, is_screensaver):
        """Tries to execute application's batch file.
        
        While is executing all process output (stdout/stderr) is catched 
        and handled later on when the application is terminated. 
        
        This method blocks until the application exits. Use run() instead.

        Returns:
            True if application is successfuly executed. 
            False is returned whether there is no boot file or another application is already running.
            
        Raises:
            An Exception is raised in case something goes wrong during
            process execution"""

        #hide scatter

        logger.info('running application: %s' % self.name)

        if (is_app_running()):
            get_app_mutex().unlock()
            return False

        app_boot_file = self.get_boot_file()
        success = False

        if app_boot_file:

            try:
                from mtmenu import cover_window
                cover_window.show()

                self.start_run()

                command = self.build_command(app_boot_file)

                # Starts application process and waits for it to terminate
                process = Popen(command,
                                stdout=PIPE,
                                stderr=PIPE,
                                cwd=self.get_extraction_fullpath(),
                                shell=False)

                # defines the application that is running
                set_app_running(process)

                from utils import bring_window_to_front
                bring_window_to_front(True)

                # Concatenate output
                output = StringIO()
                for line in process.communicate():
                    output.write(line)

                remove_app_running()

                cover_window.resume(self, is_screensaver)

                self.end_run()

                # Save output to database
                self.add_log_entry(output.getvalue())

                success = True
                logger.info("Application %s terminated" % self.name)
            except Exception, e:  #Pokemon
                logger.error("EXCEPTION RUNNING APPLICATION:\n%s" % e)