Focal Point Basics Jobsheets

Making a Product Part Editable

Purpose:

Product parts are classified as "displayable", "editable", and "required", each of these having a true/false value to define it. This jobsheet will walk you through how to change a product part from non-editable to editable.

Tasks:

You should have set up the method that allows you to view the product parts in a previous jobsheet (Setting up the Product Part Debugger), but if you haven't, please make sure to do this before beginning this jobsheet. 

  1. Open the D2D or Hydro perspective in CAVE and create a hazard of any "FFW" type. 
  2. Click "Preview" to open the product editor as well as run the "printDebugProductParts" method. 
  3. While the product editor remains open, open a terminal window and enter the following command to print the results of the "printDebugProductParts" method:
    cat /tmp/printDebugProductParts.txt
  4. Compare the output of the command to the product editor, making note of the "basisTime" product part, and how it is currently an un-editable field in the Product Editor. 
  5. Open the localization perspective and locate the file called ProductEditorFields.py in the Utilities folder. This file holds most of the fields that populate a product editor.  (Note: Some fields exist in other places. This will be touched on at the end of the jobsheet). Locate the field called "basisTime". 
  6. Create a user override for this file, which supports incremental overrides. Copy and paste the "basisTime" field into the user override, remembering to include the dictionary name at the top, which is ProductEditorFields. In the override file, change the value of "editable" to True.
  7. Save the override file. Switch back to D2D or Hydro, where the hazard was created. If the product editor is still open, close it by clicking "Dismiss". If the HID is still open, you do not need to close it, unless the option to click "Preview" is grayed-out. If so, close and reopen the HID for the same hazard. 
  8. Click Preview on the HID to open the Product Editor, and now notice that the Basis Time field is editable. 
    1. While it appears that the Basis Time can be edited now, what you'll find when looking at the formatter tab is that manually changing the basis time will not cause the new time to propagate through to the final product. This is because an additional change needs to be made in IBW_FFW_FFS_Formatter.py.
    2. Note: This will not always be the case, but if you find this occurring elsewhere, it is always best to look at the formatter file to find the cause. 
  9. Open the IBW_FFW_FFS_Formatter.py file and find the method that includes "basisTime". You'll notice a method being called within this named "processPartValue" which takes an argument of "True". 
  10. If you open NWS_Base_Formatter.py, you will find this method, called processPartValue, which is inherited by the class defined in IBW_FFW_FFS_Formatter.py (remember class inheritance!). One of the required arguments is called forceRegeneration, which by default is true, however, it is specified as False in the basisTime method from above. You'll notice there is a note about this argument, stating that when true, it forces the part to be regenerated (reference image below). 
  11. Create a user override of IBW_FFW_FFS_Formatter.py (NOT NWS_Base_Formatter.py) with just the basisTime method included (be sure to include the class definition at the top as well). 
  12. In the override, change the "True" (seen in blue) to "False" and save the file. 
  13. If you now try to generate a FFW product with an editable basis time, you should see the changed time propagate all the way through to the final product. 

 

That's it! 

 

Note that in some hazard types you will find that the product editor fields listed by the printDebugProductParts method are not available in the ProductEditorFields.py file, specifically the firstBullet and attribution product parts. You can find more information on these product parts in section 4.4 of the Focal Point Guide