gtristan commented on code in PR #2035:
URL: https://github.com/apache/buildstream/pull/2035#discussion_r2199950215


##########
src/buildstream/types.py:
##########
@@ -389,6 +389,40 @@ def new_from_node(cls, node: MappingNode) -> 
"_SourceMirror":
 
         return cls(name, aliases)
 
+# Used to indicate the state of a given element
+class _ElementState(FastEnum):

Review Comment:
   I also feel skeptical about this.
   
   If we do add this, I would prefer for it to be properly integrated, and come 
in the form of a preceding commit which adds the functionality:
   
   * Adds the new `_ElementState` (or perhaps `_ElementUIState` in order to 
emphasize that this is not to be used in the core for any decision making, but 
only for reporting purposes to the UI).
   * Adds `Element._compute_ui_state() -> _ElementState`, such that the 
reporting of this state is done by the `Element` class
     * This *internal method* (i.e. one leading underscore, not class private, 
and using comments for documentation rather than docstrings) should document 
the conditions under which states will be reported. I.e. it should be clear 
that *cached* state will not be reported unless the cache has been initialized.
   * Updates the existing code in `_frontend/widget.py` to use this function to 
obtain the `_ElementUIState` and do the `p.fmt_subst(line, "state", 
ui_state.value, color)`
   
   Noticing that we have colors associated to states, these could probably be 
encoded into `_ElementUIState` in some way in order to avoid having a separate 
switch case around this.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to