parameters: (self)
docstring: invoke a font file chooser dialog and send result to ShapeString to
docstring_summary: invoke a font file chooser dialog and send result to ShapeString to
docstring_tokens: invoke a font file chooser dialog and send result to ShapeString to
function: def pickFile(self):
          ''' invoke a font file chooser dialog and send result to ShapeString to'''
          if self.sourceCmd:
              if (self.chooserButton.isVisible()):
                  try:
                      dialogCaption = translate("draft", "Select a Font file")
                      dialogDir = os.path.dirname(Draft.getParam("FontFile",)) # reasonable default?
                      dialogFilter = "Fonts (*.ttf *.pfb *.otf);;All files (*.*)"
                      fname = QtGui.QFileDialog.getOpenFileName(self.baseWidget,
                                                                dialogCaption,
                                                                dialogDir,
                                                                dialogFilter)
                      # fname = utf8_decode(fname[0])  # 1947: utf8_decode fails ('ascii' codec can't encode character)
                                                      # when fname[0] contains accented chars
                      fname = fname[0].encode('utf8') #TODO: this needs changing for Py3??
                                                      # accented chars cause "UnicodeEncodeError" failure in DraftGui.todo without
                                                      # .encode('utf8')
  
                  except Exception as e:
                      FreeCAD.Console.PrintMessage("DraftGui.pickFile: unable to select a font file.")
                      print(type(e))
                      print(e.args)
                  else:
                      if fname[0]:
                          self.FFileValue.setText(fname)
                          self.sourceCmd.validFFile(fname)
                      else:
                          FreeCAD.Console.PrintMessage("DraftGui.pickFile: no file selected.")
function_tokens: def pickFile ( self ) : if self . sourceCmd : if ( self . chooserButton . isVisible ( ) ) : try : dialogCaption = translate ( "draft" , "Select a Font file" ) dialogDir = os . path . dirname ( Draft . getParam ( "FontFile" , ) ) # reasonable default? dialogFilter = "Fonts (*.ttf *.pfb *.otf);;All files (*.*)" fname = QtGui . QFileDialog . getOpenFileName ( self . baseWidget , dialogCaption , dialogDir , dialogFilter ) # fname = utf8_decode(fname[0])  # 1947: utf8_decode fails ('ascii' codec can't encode character) # when fname[0] contains accented chars fname = fname [ 0 ] . encode ( 'utf8' ) #TODO: this needs changing for Py3?? # accented chars cause "UnicodeEncodeError" failure in DraftGui.todo without # .encode('utf8') except Exception as e : FreeCAD . Console . PrintMessage ( "DraftGui.pickFile: unable to select a font file." ) print ( type ( e ) ) print ( e . args ) else : if fname [ 0 ] : self . FFileValue . setText ( fname ) self . sourceCmd . validFFile ( fname ) else : FreeCAD . Console . PrintMessage ( "DraftGui.pickFile: no file selected." )