Skip to content

Commit 2dfb647

Browse files
committed
fix export zoom percentage bug
corrects issue where zoom percentages were being stored as a multiplier, meaning the image size was shrinking with each export
1 parent 6399225 commit 2dfb647

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

‎plotdevice/gui/widgets.py‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,9 @@ def beginExport(self, kind):
376376
format = self.image['format']
377377
accessory = self.imageAccessory
378378

379+
# Set the zoom value so that UI reflects the previously stored value
380+
self.imageZoom.setStringValue_("%i%%" % self.image['zoom'])
381+
379382
if self.image['single']:
380383
self.imageFormat.selectItemAtIndex_(1)
381384
else:
@@ -442,7 +445,17 @@ def exportPanelDidEnd_returnCode_contextInfo_(self, panel, returnCode, context):
442445
kind, opts = 'movie', self.movieState()
443446
else:
444447
kind, opts = 'image', self.imageState()
445-
setattr(self, kind, dict(opts)) # save the options for next time
448+
449+
# Convert zoom multiplier back to percentage before saving
450+
saved_opts = dict(opts)
451+
if 'zoom' in saved_opts:
452+
saved_opts['zoom'] = saved_opts['zoom'] * 100
453+
454+
# Save the modified options (with percentage zoom)
455+
setattr(self, kind, saved_opts)
456+
print("Export options:", saved_opts)
457+
458+
# Continue with the export using the original options (with decimal zoom)
446459
self.last = os.path.split(fname) # save the path we exported to
447460
self.script.exportInit(kind, fname, opts)
448461

0 commit comments

Comments
 (0)