class_docstr: View / controller for the preferences that get displayed in the main window
  
      
class_docstr_tok: ["View","\/","controller","for","the","preferences","that","get","displayed","in","the","main","window"]
docstr: Monitor progress events in the UI thread
  
  operation_id - a unique id identifying an instance of an operation
  progress - a number from 0 to 1 where 0 is the start of the operation
             and 1 is its end.
  message - the message to display to the user.
code: def progress_callback(self, operation_id, progress, message):
      """Monitor progress events in the UI thread
  
      operation_id - a unique id identifying an instance of an operation
      progress - a number from 0 to 1 where 0 is the start of the operation
                 and 1 is its end.
      message - the message to display to the user.
      """
      if progress is None:
          if message is None:
              message = WELCOME_MESSAGE
          self.set_message_text(message)
          return
  
      def reset_progress():
          self.__progress_stack = []
          self.__progress_dictionary = {}
          if self.__progress_dialog is not None:
              self.__progress_dialog.Destroy()
              self.__progress_dialog = None
          wx.SetCursor(wx.NullCursor)
          self.set_message_text(WELCOME_MESSAGE)
          wx.SafeYield(None, True)
  
      if operation_id is None:
          reset_progress()
          return
  
      if operation_id not in self.__progress_stack:
          self.__progress_stack.append(operation_id)
      else:
          loc = self.__progress_stack.index(operation_id)
          if loc == 0 and progress == 1:
              reset_progress()
              return
          if progress == 1:
              loc -= 1
          for operation_id in self.__progress_stack[(loc + 1) :]:
              del self.__progress_dictionary[operation_id]
          self.__progress_stack = self.__progress_stack[: (loc + 1)]
      self.__progress_dictionary[operation_id] = (progress, message)
      wx.SetCursor(wx.Cursor(wx.CURSOR_WAIT))
      message = ", ".join(
          [
              "%s (%d %%)" % (message, int(progress * 100))
              for progress, message in [
                  self.__progress_dictionary[o]
                  for o in self.__progress_stack
              ]
          ]
      )
      self.set_message_text(message)
      wx.SafeYield(None, True)
  
imports: import os
  import wx
  from cellprofiler_core.analysis import use_analysis
  from cellprofiler_core.preferences import DEFAULT_IMAGE_DIRECTORY
  from cellprofiler_core.preferences import DEFAULT_IMAGE_FOLDER_HELP
  from cellprofiler_core.preferences import DEFAULT_OUTPUT_DIRECTORY
  from cellprofiler_core.preferences import DEFAULT_OUTPUT_FOLDER_HELP
  from cellprofiler_core.preferences import add_image_directory_listener
  from cellprofiler_core.preferences import add_output_directory_listener
  from cellprofiler_core.preferences import add_progress_callback
  from cellprofiler_core.preferences import fire_image_directory_changed_event
  from cellprofiler_core.preferences import get_default_image_directory
  from cellprofiler_core.preferences import get_default_output_directory
  from cellprofiler_core.preferences import get_recent_files
  from cellprofiler_core.preferences import remove_image_directory_listener
  from cellprofiler_core.preferences import remove_output_directory_listener
  from cellprofiler_core.preferences import set_default_image_directory
  from cellprofiler_core.preferences import set_default_output_directory
  from cellprofiler_core.preferences import set_pixel_size
  from ._progress_watcher import ProgressWatcher
  from ..constants.preferences_view import WELCOME_MESSAGE
  from ..html.utils import rst_to_html_fragment
  from ..htmldialog import HTMLDialog
  from ..utilities.preferences_view import secs_to_timestr
label_desc: Use image node_id 10 for calling the PreferencesView obj's underlying member method code with example usage: obj.progress_callback(operation_id, progress, message) without return types