Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blender: Use self.process consistently, fix project file discovery for Picture Frame #3421

Merged
merged 3 commits into from
May 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/blender/picture_frames_4.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,28 @@
<default>TitleFileName</default>
</param>

<param name="project_files1" type="dropdown" title="Picture 1 Path" description="">
<param name="project_files1" type="dropdown" title="Picture 1" description="">
<values>
<value name="" num=""/>
</values>
<default></default>
</param>

<param name="project_files2" type="dropdown" title="Picture 2 Path" description="">
<param name="project_files2" type="dropdown" title="Picture 2" description="">
<values>
<value name="" num=""/>
</values>
<default></default>
</param>

<param name="project_files3" type="dropdown" title="Picture 3 Path" description="">
<param name="project_files3" type="dropdown" title="Picture 3" description="">
<values>
<value name="" num=""/>
</values>
<default></default>
</param>

<param name="project_files4" type="dropdown" title="Picture 4 Path" description="">
<param name="project_files4" type="dropdown" title="Picture 4" description="">
<values>
<value name="" num=""/>
</values>
Expand Down
20 changes: 11 additions & 9 deletions src/windows/views/blender_listview.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,12 @@ def currentChanged(self, selected, deselected):
continue

param["values"][fileName] = "|".join(
file.data["path"], str(file.data["height"]),
str(file.data["width"]), file.data["media_type"],
str(file.data["fps"]["num"] / file.data["fps"]["den"])
(file.data["path"],
str(file.data["height"]),
str(file.data["width"]),
file.data["media_type"],
str(file.data["fps"]["num"] / file.data["fps"]["den"])
)
)

# Add normal values
Expand Down Expand Up @@ -705,7 +708,7 @@ def Render(self, blend_file_path, target_script, preview_mode=False):
log.info("Checking Blender version, command: {}".format(
" ".join([shlex.quote(x) for x in command_get_version])))

proc = subprocess.Popen(
self.process = subprocess.Popen(
command_get_version,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
startupinfo=startupinfo,
Expand All @@ -714,7 +717,7 @@ def Render(self, blend_file_path, target_script, preview_mode=False):
# Check the version of Blender
try:
# Give Blender up to 10 seconds to respond
(out, err) = proc.communicate(timeout=10)
(out, err) = self.process.communicate(timeout=10)
except subprocess.TimeoutExpired:
self.blender_error_nodata.emit()
return
Expand All @@ -739,12 +742,11 @@ def Render(self, blend_file_path, target_script, preview_mode=False):
log.info("Blender output:")

# Run real command to render Blender project
proc = subprocess.Popen(
self.process = subprocess.Popen(
command_render, bufsize=512,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
startupinfo=startupinfo,
)
self.process = proc
self.is_running = True

except subprocess.SubprocessError:
Expand All @@ -757,8 +759,8 @@ def Render(self, blend_file_path, target_script, preview_mode=False):
log.error("{}".format(ex))
return

while self.is_running and proc.poll() is None:
for outline in iter(proc.stdout.readline, b''):
while self.is_running and self.process.poll() is None:
for outline in iter(self.process.stdout.readline, b''):
line = outline.decode('utf-8').strip()

# Skip blank output
Expand Down