Skip to content

Commit

Permalink
Error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
sowwic committed Jul 28, 2020
1 parent b040b77 commit 507a78d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions dsPlayblast/clientFn.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ def connect(self, port: int = -1):
return True

def disconnect(self):
if not self.maya_socket:
return False
try:
self.maya_socket.close()
except BaseException:
Expand Down
5 changes: 4 additions & 1 deletion dsPlayblast/playblastUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ def always_on_top(self, state):
def closeEvent(self, event):
super().closeEvent(event)
self.save_settings()
try:
self.maya_client.disconnect()
except AttributeError:
pass

# Settings
def save_settings(self):
Expand Down Expand Up @@ -324,7 +328,6 @@ def playblast(self) -> None:
avi_result_path = self.output_path.get_path().replace(".mp4", ".avi")
self.update_progress_bar()
self.maya_client.send(self.playblast_command())
self.maya_client.disconnect()
self.update_progress_bar()

# Conversion
Expand Down

0 comments on commit 507a78d

Please sign in to comment.