Open webbrowser after submitting a Flamenco job

This can be disabled in the add-on preferences.
This commit is contained in:
Sybren A. Stüvel 2017-01-24 15:14:43 +01:00
parent 60018cd78c
commit 95699aca36
2 changed files with 15 additions and 0 deletions

View File

@ -200,6 +200,11 @@ class BlenderCloudPreferences(AddonPreferences):
default=0, default=0,
soft_max=4, soft_max=4,
) )
flamenco_open_browser_after_submit = BoolProperty(
name='Open Browser after Submitting Job',
description='When enabled, Blender will open a webbrowser',
default=True
)
def draw(self, context): def draw(self, context):
import textwrap import textwrap
@ -389,6 +394,8 @@ class BlenderCloudPreferences(AddonPreferences):
props = path_box.operator('flamenco.explore_file_path', text='', icon='DISK_DRIVE') props = path_box.operator('flamenco.explore_file_path', text='', icon='DISK_DRIVE')
props.path = str(output_path.parent) props.path = str(output_path.parent)
flamenco_box.prop(self, 'flamenco_open_browser_after_submit')
# TODO: make a reusable way to select projects, and use that for Attract and Flamenco. # TODO: make a reusable way to select projects, and use that for Attract and Flamenco.
note_box = flamenco_box.column(align=True) note_box = flamenco_box.column(align=True)
note_box.label('NOTE: For now, Flamenco uses the same project as Attract.') note_box.label('NOTE: For now, Flamenco uses the same project as Attract.')

View File

@ -201,6 +201,14 @@ class FLAMENCO_OT_render(async_loop.AsyncModalOperatorMixin,
self.quit() self.quit()
return return
if prefs.flamenco_open_browser_after_submit:
import webbrowser
from urllib.parse import urljoin
from ..blender import PILLAR_WEB_SERVER_URL
url = urljoin(PILLAR_WEB_SERVER_URL, '/flamenco/jobs/%s/redir' % job_info['_id'])
webbrowser.open_new_tab(url)
# Do a final report. # Do a final report.
if missing_sources: if missing_sources:
names = (ms.name for ms in missing_sources) names = (ms.name for ms in missing_sources)