From 355fc7b7eae299c2257f426e2b805b857bec539b Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Mon, 1 Feb 2021 15:12:55 +0100 Subject: [PATCH] reduced arguments to launch djv to executable and filepath --- pype/modules/ftrack/actions/action_djvview.py | 54 ++++--------------- pype/plugins/global/load/open_djv.py | 50 +++-------------- 2 files changed, 17 insertions(+), 87 deletions(-) diff --git a/pype/modules/ftrack/actions/action_djvview.py b/pype/modules/ftrack/actions/action_djvview.py index 6036f9a35b..dfaa1ebeb9 100644 --- a/pype/modules/ftrack/actions/action_djvview.py +++ b/pype/modules/ftrack/actions/action_djvview.py @@ -90,9 +90,7 @@ class DJVViewAction(BaseAction): items = [] base_label = "v{0} - {1} - {2}" - default_component = self.config_data.get( - 'default_component', None - ) + default_component = None last_available = None select_value = None for version in versions: @@ -152,55 +150,23 @@ class DJVViewAction(BaseAction): # Launching application if "values" not in event["data"]: return - filename = event['data']['values']['path'] + filpath = event['data']['values']['path'] - fps = entities[0].get('custom_attributes', {}).get('fps', None) - - cmd = [] - # DJV path - cmd.append(os.path.normpath(self.djv_path)) - # DJV Options Start ############################################## - # '''layer name''' - # cmd.append('-file_layer (value)') - # ''' Proxy scale: 1/2, 1/4, 1/8''' - # cmd.append('-file_proxy 1/2') - # ''' Cache: True, False.''' - # cmd.append('-file_cache True') - # ''' Start in full screen ''' - # cmd.append('-window_fullscreen') - # ''' Toolbar controls: False, True.''' - # cmd.append("-window_toolbar False") - # ''' Window controls: False, True.''' - # cmd.append("-window_playbar False") - # ''' Grid overlay: None, 1x1, 10x10, 100x100.''' - # cmd.append("-view_grid None") - # ''' Heads up display: True, False.''' - # cmd.append("-view_hud True") - ''' Playback: Stop, Forward, Reverse.''' - cmd.append("-playback Forward") - # ''' Frame.''' - # cmd.append("-playback_frame (value)") - if fps is not None: - cmd.append("-playback_speed {}".format(int(fps))) - # ''' Timer: Sleep, Timeout. Value: Sleep.''' - # cmd.append("-playback_timer (value)") - # ''' Timer resolution (seconds): 0.001.''' - # cmd.append("-playback_timer_resolution (value)") - ''' Time units: Timecode, Frames.''' - cmd.append("-time_units Frames") - # DJV Options End ################################################ - - # PATH TO COMPONENT - cmd.append(os.path.normpath(filename)) + cmd = [ + # DJV path + os.path.normpath(self.djv_path), + # PATH TO COMPONENT + os.path.normpath(filpath) + ] try: # Run DJV with these commands - subprocess.Popen(' '.join(cmd)) + subprocess.Popen(cmd) except FileNotFoundError: return { 'success': False, 'message': 'File "{}" was not found.'.format( - os.path.basename(filename) + os.path.basename(filpath) ) } diff --git a/pype/plugins/global/load/open_djv.py b/pype/plugins/global/load/open_djv.py index a500333875..39b54364d9 100644 --- a/pype/plugins/global/load/open_djv.py +++ b/pype/plugins/global/load/open_djv.py @@ -43,54 +43,18 @@ class OpenInDJV(api.Loader): if not remainder: seqeunce = collections[0] first_image = list(seqeunce)[0] - # start = min(collections) - # end = max(collections) - # - # range = (padding % start) + '-' + (padding % end) - # filename = re.sub('%[0-9]*d', range, filename) else: first_image = self.fname filepath = os.path.normpath(os.path.join(directory, first_image)) self.log.info("Opening : {}".format(filepath)) - fps = context.get('project', {}).get('data', {}).get('fps', 24) - - cmd = [] - # DJV path - cmd.append(os.path.normpath(self.djv_path)) - # DJV Options Start ############################################## - '''layer name''' - # cmd.append('-file_layer (value)') - ''' Proxy scale: 1/2, 1/4, 1/8''' - # cmd.append('-file_proxy 1/2') - ''' Cache: True, False.''' - cmd.append('-file_cache True') - ''' Start in full screen ''' - # cmd.append('-window_fullscreen') - ''' Toolbar controls: False, True.''' - # cmd.append("-window_toolbar False") - ''' Window controls: False, True.''' - # cmd.append("-window_playbar False") - ''' Grid overlay: None, 1x1, 10x10, 100x100.''' - # cmd.append("-view_grid None") - ''' Heads up display: True, False.''' - # cmd.append("-view_hud True") - ''' Playback: Stop, Forward, Reverse.''' - cmd.append("-playback Forward") - ''' Frame.''' - # cmd.append("-playback_frame (value)") - cmd.append("-playback_speed " + str(fps)) - ''' Timer: Sleep, Timeout. Value: Sleep.''' - # cmd.append("-playback_timer (value)") - ''' Timer resolution (seconds): 0.001.''' - # cmd.append("-playback_timer_resolution (value)") - ''' Time units: Timecode, Frames.''' - cmd.append("-time_units Frames") - # DJV Options End ################################################ - - # PATH TO COMPONENT - cmd.append(os.path.normpath(filepath)) + cmd = [ + # DJV path + os.path.normpath(self.djv_path), + # PATH TO COMPONENT + os.path.normpath(filepath) + ] # Run DJV with these commands - subprocess.Popen(' '.join(cmd)) + subprocess.Popen(cmd)