reduced arguments to launch djv to executable and filepath

This commit is contained in:
iLLiCiTiT 2021-02-01 15:12:55 +01:00
parent af80aee424
commit 355fc7b7ea
2 changed files with 17 additions and 87 deletions

View file

@ -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)
)
}

View file

@ -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)