NMGRL / pychron

Data acquisition and processing framework for Ar-Ar geochronology and noble gas mass spectrometry
http://pychron.readthedocs.org/en/latest/
Apache License 2.0
26 stars 26 forks source link

Unable to save pdf of ideogram #2204

Open mjz1983 opened 1 year ago

mjz1983 commented 1 year ago

Error message:

Traceback (most recent call last): File "/Users/argonlab2/miniconda2/envs/pychron3/lib/python3.7/site-packages/reportlab/pdfbase/pdfmetrics.py", line 711, in getFont return _fonts[fontName] KeyError: 'helvetica'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/argonlab2/miniconda2/envs/pychron3/lib/python3.7/site-packages/pyface/ui/qt4/action/action_item.py", line 371, in _qt4_on_triggered self.controller.perform(action, action_event) File "/Users/argonlab2/miniconda2/envs/pychron3/lib/python3.7/site-packages/pyface/tasks/action/task_action_controller.py", line 31, in perform return action.perform(event) File "/Users/argonlab2/miniconda2/envs/pychron3/lib/python3.7/site-packages/pyface/action/listening_action.py", line 74, in perform method() File "/Users/argonlab2/.pychron.1/updates/pychron/pipeline/tasks/task.py", line 457, in save_figure_pdf save_pdf(ed.component, path=path, options=sfm.pdf_options, view=True) File "/Users/argonlab2/.pychron.1/updates/pychron/core/pdf/save_pdf_dialog.py", line 150, in save_pdf component, valign=options.valign, halign=options.halign File "/Users/argonlab2/.pychron.1/updates/pychron/core/pdf/pdf_graphics_context.py", line 220, in render_component component.draw(self, view_bounds=(0, 0, width, height)) File "/Users/argonlab2/miniconda2/envs/pychron3/lib/python3.7/site-packages/enable/component.py", line 427, in draw self._draw(gc, view_bounds, mode) File "/Users/argonlab2/miniconda2/envs/pychron3/lib/python3.7/site-packages/enable/component.py", line 779, in _draw self._dispatch_draw(layer, gc, view_bounds, mode) File "/Users/argonlab2/miniconda2/envs/pychron3/lib/python3.7/site-packages/enable/container.py", line 273, in _dispatch_draw component._dispatch_draw(layer, gc, new_bounds, mode) File "/Users/argonlab2/miniconda2/envs/pychron3/lib/python3.7/site-packages/enable/container.py", line 273, in _dispatch_draw component._dispatch_draw(layer, gc, new_bounds, mode) File "/Users/argonlab2/miniconda2/envs/pychron3/lib/python3.7/site-packages/enable/container.py", line 273, in _dispatch_draw component._dispatch_draw(layer, gc, new_bounds, mode) File "/Users/argonlab2/miniconda2/envs/pychron3/lib/python3.7/site-packages/enable/component.py", line 799, in _dispatch_draw handler(gc, view_bounds, mode) File "/Users/argonlab2/miniconda2/envs/pychron3/lib/python3.7/site-packages/enable/component.py", line 877, in _draw_overlay overlay.overlay(self, gc, view_bounds, mode) File "/Users/argonlab2/.pychron.1/updates/pychron/pipeline/plot/overlays/mean_indicator_overlay.py", line 292, in overlay o.overlay(other_component, gc, view_bounds=view_bounds, mode=mode) File "/Users/argonlab2/miniconda2/envs/pychron3/lib/python3.7/site-packages/chaco/plot_label.py", line 89, in overlay self._draw_overlay(gc, view_bounds, mode) File "/Users/argonlab2/.pychron.1/updates/pychron/pipeline/plot/overlays/mean_indicator_overlay.py", line 97, in _draw_overlay self._label.draw(gc) File "/Users/argonlab2/miniconda2/envs/pychron3/lib/python3.7/site-packages/chaco/label.py", line 169, in draw gc.set_font(self.font) File "/Users/argonlab2/miniconda2/envs/pychron3/lib/python3.7/site-packages/kiva/pdf.py", line 629, in set_font self.gc.setFont(face_name, font.size) File "/Users/argonlab2/miniconda2/envs/pychron3/lib/python3.7/site-packages/reportlab/pdfgen/canvas.py", line 1691, in setFont font = pdfmetrics.getFont(self._fontname) File "/Users/argonlab2/miniconda2/envs/pychron3/lib/python3.7/site-packages/reportlab/pdfbase/pdfmetrics.py", line 713, in getFont return findFontAndRegister(fontName) File "/Users/argonlab2/miniconda2/envs/pychron3/lib/python3.7/site-packages/reportlab/pdfbase/pdfmetrics.py", line 695, in findFontAndRegister face = getTypeFace(fontName) File "/Users/argonlab2/miniconda2/envs/pychron3/lib/python3.7/site-packages/reportlab/pdfbase/pdfmetrics.py", line 652, in getTypeFace return _typefaces[faceName] KeyError: 'helvetica'

mjz1983 commented 1 year ago

Note that this is a problem on ArgonLab2

jirhiker commented 1 year ago

helvetica is not an available font on ArgonLab2 and given the current version of pychron used on ArgonLab2 cannot be used. newer versions of pychron should handle fonts better

mjz1983 commented 1 year ago

The font Arial doesn’t work either. Why does helvetica work for isochron and spectrum on ArgonLab2?

Matt Zimmerer Interim Mapping Program Manager Field Geologist II New Mexico Bureau of Geology New Mexico Tech 801 Leroy Pl Socorro, NM 87801 @.*** 575.835.5114

On Mar 24, 2023, at 3:24 PM, Jake Ross @.***> wrote:

Closed #2204 https://github.com/NMGRL/pychron/issues/2204 as completed.

— Reply to this email directly, view it on GitHub https://github.com/NMGRL/pychron/issues/2204#event-8842925502, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRMVZ3YNUN5TYGVN6YI6YLW5YGH5ANCNFSM6AAAAAAWG7JBJM. You are receiving this because you were assigned.

mjz1983 commented 1 year ago

The problem appears to be with ArgonLab2. However, ideograms cannot be saved with any of the fonts whereas all fonts work with spectrum/isochron. Does this mean ArgonLab2 can no longer be used for making pdfs of ideograms?

jirhiker commented 1 year ago

Thanks I think that should be useful information.

I'll have to get back to you on argonlab2. I don't know its status

jirhiker commented 1 year ago

I think there is a specific element in the ideogram that is breaking things. If you turn off mean indicator that may work

mjz1983 commented 1 year ago

Turning off mean indicator fixes the problem. Of course an ideogram without that info isn’t super helpful.

Matt Zimmerer Interim Mapping Program Manager Field Geologist II New Mexico Bureau of Geology New Mexico Tech 801 Leroy Pl Socorro, NM 87801 @.*** 575.835.5114

On Mar 25, 2023, at 8:47 AM, Jake Ross @.***> wrote:

I think there is a specific element in the ideogram that is breaking things. If you turn off mean indicator that my work

— Reply to this email directly, view it on GitHub https://github.com/NMGRL/pychron/issues/2204#issuecomment-1483842338, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRMVZ5GSGGSBYAYM3ORDD3W54AQLANCNFSM6AAAAAAWG7JBJM. You are receiving this because you modified the open/close state.