Skip to content

Commit

Permalink
Fix removal of errant char
Browse files Browse the repository at this point in the history
  • Loading branch information
Trybuche committed Jun 1, 2021
1 parent 95d0760 commit e2b3f7f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Analyze/Microscope Measurement Tools/Draw_Measurement_-_Line.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ def run():


'''Draw text annotation'''
unit = imp.getCalibration().getUnit().encode('utf8') # get the unit as UTF-8 (for \mu)
print "Draw_Meas(): Unit (raw) = `", unit,"`", type(unit),
if unit[0] == u'\xc2': unit=unit[1:] # strip weird char at start of \mu
unit = imp.getCalibration().getUnit().encode('utf-8') # get the unit as UTF-8 (for \mu)
if len(unit) == 3 : unit=unit[1:] # strip weird char at start of \mu
print "Draw_Meas(): Unit (raw) = `", unit,"`", type(unit),


# format of measurement text (eg. 3 decimal points):
lenstr = "%0.3f" % roi.getLength() + " %s" % (unit) # string to print as length
print "DrawMeas(): Line length= %s" % lenstr
Expand Down

1 comment on commit e2b3f7f

@demisjohn
Copy link
Owner

Choose a reason for hiding this comment

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

if len(unit) == 3 seems too restrictive, someone may want a 3-character long unit like "mil" for example.

Please sign in to comment.