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

export_bug_dx_None #257

Merged
merged 2 commits into from
Jan 25, 2018
Merged
Changes from 1 commit
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 omero_figure/scripts/omero/figure_scripts/Figure_To_Pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,8 +774,8 @@ def get_crop_region(self, panel):
zoom = float(panel['zoom'])
frame_w = panel['width']
frame_h = panel['height']
dx = panel['dx']
dy = panel['dy']
dx = panel.get('dx', 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since you have code after checking if if dx > 0 (same for dy) it will be better to introduce a default value default_value= 0. So if later it changes it is only one place to adjust

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see that we'd ever want a default offset that wasn't zero.
The default for these offsets is really set in the panel_model.js and it's only rarely (not reproducible) that it's not set here in the script (so we have to catch it just in case).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 0 is set in get, this is "discovered" further down in another check
having a default value makes that clear and explicit

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could introduce a variable with value 0 I think it will make the logic clearer

dy = panel.get('dy', 0)
orig_w = panel['orig_width']
orig_h = panel['orig_height']

Expand Down Expand Up @@ -1065,8 +1065,8 @@ def get_panel_image(self, image, panel, orig_name=None):
size_y = image.getSizeY()
cx = size_x/2
cy = size_y/2
dx = panel['dx']
dy = panel['dy']
dx = panel.get('dx', 0)
dy = panel.get('dy', 0)

cx += dx
cy += dy
Expand Down