def __init__(self, env, app, uid): """ Setup variables for the application class. :param env: Requires the common environment be passed in for access to SHOW/SEQ/SHOT :param app: Defines what application will be launched, thus what files will be searched for. :param uid: Base unique id for the application. """ self.environment = env self.app = app self.file = None self.fileExists = False self.project = None self.script = None self.version = None self.arguments = {} self.path = config.applicationSettings( self.app, self.environment.SHOW)[self.environment.os()] self.pathExists = False if os.path.isfile(self.path): self.pathExists = True self.id = uid self.rids = []
def applicationSettings(self, app): """ Returns dictionary of settings for a particular application. :param app: Application for which to return settings. :return: Dict of settings. """ settings = config.applicationSettings(app, show=self.SHOW) return settings
def fileTypes(self): """ Returns the file types for the current application. :return: list of extensions. """ if self.app: file_types = config.applicationSettings( self.app, self.environment.SHOW)['filetypes'] if file_types: return file_types return 1 return 1
def version(self): """ Returns the current version of the application. :return: Current version. """ if self.version is None: ver = config.applicationSettings(self.app, self.environment.SHOW)['version'] if ver: self.version = ver return ver return self.version
def runningprocess(self): """ Prints running processes of supported applications (defined in configuration.json) :return: None """ for a in self.supportedapps(): value = config.applicationSettings(str(a), self.SHOW)[self.os()] for p in psutil.process_iter(): try: if p.exe() == value: print '%s [%s] @ %s' % (p.name(), p.pid, p.create_time()) # It's going to lock the user out of most process except psutil.Error: pass