parameters: (self, initial_value='')
return_statement: return filename, selected_filter
docstring: Shows a file open dialog
docstring_summary: Shows a file open dialog
docstring_tokens: Shows a file open dialog
function: def getFileName(self, initial_value=''):
          """Shows a file open dialog"""
          settings = QgsSettings()
          if os.path.isdir(initial_value):
              path = initial_value
          elif os.path.isdir(os.path.dirname(initial_value)):
              path = os.path.dirname(initial_value)
          elif settings.contains('/Processing/LastInputPath'):
              path = str(settings.value('/Processing/LastInputPath'))
          else:
              path = ''
  
          # TODO: should use selectedFilter argument for default file format
          filename, selected_filter = QFileDialog.getOpenFileName(self.widget, self.tr('Select File'),
                                                                  path, self.parameterDefinition().createFileFilter())
          if filename:
              settings.setValue('/Processing/LastInputPath',
                                os.path.dirname(str(filename)))
          return filename, selected_filter
function_tokens: def getFileName ( self , initial_value = '' ) : settings = QgsSettings ( ) if os . path . isdir ( initial_value ) : path = initial_value elif os . path . isdir ( os . path . dirname ( initial_value ) ) : path = os . path . dirname ( initial_value ) elif settings . contains ( '/Processing/LastInputPath' ) : path = str ( settings . value ( '/Processing/LastInputPath' ) ) else : path = '' # TODO: should use selectedFilter argument for default file format filename , selected_filter = QFileDialog . getOpenFileName ( self . widget , self . tr ( 'Select File' ) , path , self . parameterDefinition ( ) . createFileFilter ( ) ) if filename : settings . setValue ( '/Processing/LastInputPath' , os . path . dirname ( str ( filename ) ) ) return filename , selected_filter