-
Notifications
You must be signed in to change notification settings - Fork 54
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
APS Upload Pipeline Polish #1048
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
|
||
from proto.proto_out import assembly_pb2, types_pb2 | ||
|
||
from ...APS.APS import upload_mirabuf # This line causes everything to break | ||
from ...APS.APS import getAuth, upload_mirabuf | ||
from ...general_imports import * | ||
from ...Logging import getLogger, logFailure, timed | ||
from ...Types import ExportLocation, ExportMode | ||
|
@@ -34,6 +34,10 @@ def export(self) -> None: | |
app = adsk.core.Application.get() | ||
design: adsk.fusion.Design = app.activeDocument.design | ||
|
||
if not getAuth(): | ||
app.userInterface.messageBox("APS Login Required for Uploading.", "APS Login") | ||
return | ||
|
||
assembly_out = assembly_pb2.Assembly() | ||
fill_info( | ||
assembly_out, | ||
|
@@ -178,9 +182,9 @@ def export(self) -> None: | |
folder_id = project.rootFolder.id | ||
file_name = f"{self.exporterOptions.fileLocation}.mira" | ||
if upload_mirabuf(project_id, folder_id, file_name, assembly_out.SerializeToString()) is None: | ||
gm.ui.messageBox("FAILED TO UPLOAD FILE TO APS", "ERROR") # add throw later | ||
# Download Mirabuf File | ||
raise RuntimeError("Could not upload to APS") | ||
else: | ||
assert self.exporterOptions.exportLocation == ExportLocation.DOWNLOAD | ||
Comment on lines
186
to
+187
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I forgot that enums could be undefined 🤦♀️ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm more so just checking to make sure we don't add different export locations in the future. Sort of a "this was the entire behaviour of |
||
# check if entire path exists and create if not since gzip doesn't do that. | ||
path = pathlib.Path(self.exporterOptions.fileLocation).parent | ||
path.mkdir(parents=True, exist_ok=True) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it display a messagebox or smth if the path is invalid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking not. Just means that the user is not currently logged in / has never logged in before. But this could be up for debate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
omg I'm dumb, I was thinking of the download path oml, totally out of the scope of this PR + smth that won't ever be undefined. 🤦♀️