def scan_software(self): """ Scan the filesystem for VRED executables. :return: A list of :class:`SoftwareVersion` objects. """ self.logger.debug("Scanning for VRED executables...") if is_macos(): # No Mac version return [] if is_linux(): # TODO: Add linux support self.logger.debug("Linux support coming soon.") return [] supported_sw_versions = [] for sw_version in self._find_software(): supported, reason = self._is_supported(sw_version) if re.search("Presenter", sw_version.product): supported = False if supported: supported_sw_versions.append(sw_version) else: self.logger.debug("SoftwareVersion %s is not supported: %s" % (sw_version, reason)) return supported_sw_versions
def _launch_viewer(self, path): """ Launches an image viewer based on config settings. We assume that the path to the image is just passed as a param to the viewer. This seems to be standard for most apps. """ try: app_path = None if util.is_linux(): app_path = self.get_setting("viewer_path_linux") cmd = '%s "%s" &' % (app_path, path) elif util.is_macos(): app_path = self.get_setting("viewer_path_mac") cmd = 'open -n "%s" --args "%s"' % (app_path, path) elif util.is_windows(): app_path = self.get_setting("viewer_path_windows") cmd = 'start /B "Maya" "%s" "%s"' % (app_path, path) if not app_path: raise KeyError() except KeyError: raise Exception("Platform '%s' is not supported." % sys.platform) self.log_debug("Executing launch command '%s'" % cmd) exit_code = os.system(cmd) if exit_code != 0: self.log_error( "Failed to launch Viewer! This is most likely because the path " "to the viewer executable is not set to a correct value. The " "current value is '%s' - please double check that this path " "is valid and update as needed in this app's configuration. " "If you have any questions, don't hesitate to contact support " "on [email protected]." % app_path )
def get_adobe_cep_dir(): # the CEP install directory is OS-specific if util.is_windows(): app_data = os.getenv("APPDATA") elif util.is_macos(): app_data = os.path.expanduser("~/Library/Application Support") else: raise Exception("This engine only runs on OSX & Windows.") # the adobe CEP install directory. This is where the extension is stored. return os.path.join(app_data, "Adobe", "CEP", "extensions")
def launch(self, path): self.log_debug("Launching default system viewer for file %s" % path) # run the app if util.is_linux(): cmd = 'xdg-open "%s"' % path elif util.is_macos(): cmd = 'open "%s"' % path elif util.is_windows(): cmd = 'cmd.exe /C start "file" "%s"' % path else: raise Exception("Platform '%s' is not supported." % sys.platform) self.log_debug("Executing command '%s'" % cmd) exit_code = os.system(cmd) if exit_code != 0: self.log_error("Failed to launch '%s'!" % cmd)
def _jump_to_fs(self): """ Jump from a context to the filesystem. """ # launch one window for each location on disk paths = self._engine.context.filesystem_locations for disk_location in paths: if is_linux(): cmd = 'xdg-open "%s"' % disk_location elif is_macos(): cmd = 'open "%s"' % disk_location elif is_windows(): cmd = 'cmd.exe /C start "Folder" "%s"' % disk_location else: raise Exception("Platform is not supported.") self._engine.logger.debug("Jump to filesystem command: {}".format(cmd)) exit_code = os.system(cmd) if exit_code != 0: self._engine.logger.error("Failed to launch '%s'!", cmd)