pharo-graphics / Bloc

Low-level UI infrastructure & framework for Pharo
MIT License
83 stars 40 forks source link

Transform BlUniverse logs into events #341

Open labordep opened 1 year ago

labordep commented 1 year ago

Actually there are BlUniverse announcer as BlParallelUniverseHostSpaceCreatedSignal. But they are not real announcers because they are used for logging with Beacon.

We need to have real announcer using SystemAnnouncer to be notified when Spaces are opened, showed, etc. For example, we need to use theses events to inject behavior is the fly with Pyramid https://github.com/OpenSmock/Pyramid/issues/83

labordep commented 1 year ago

Hi @tinchodias can you check this issue to have your feedback ? thanks :)

tinchodias commented 1 year ago

It's sure that Pyramid can't use Beacon?

I had to give a second or third opportunity to Beacon to grasp the idea (until I realized some class comments :).

Did you try this? 1. Open Transcript, 2. Evaluate: TranscriptLogger startFor: BlParallelUniverseSpaceSignal, 3. Evaluate BlSpace new show. You will see:

2023-11-16T22:31:58.583444-03:00 BlParallelUniverseOpenSpaceRequestSignal 
2023-11-16T22:31:58.600786-03:00 BlParallelUniverseSpaceAddedSignal 
2023-11-16T22:31:58.646729-03:00 BlParallelUniverseHostSpaceCreatedSignal 
2023-11-16T22:31:58.650793-03:00 BlParallelUniverseHostSpaceShownSignal 
2023-11-16T22:31:58.65119-03:00 BlParallelUniverseSpaceRootAssignedSignal 
2023-11-16T22:31:58.651342-03:00 BlParallelUniverseSpaceDispatchAddedToSceneSignal 

Do TranscriptLogger stop to finish.

But Pyramid for sure wants to subscribe to signals. This is an example to do it:

signals := OrderedCollection new.
Beacon instance
    when: BlParallelUniverseSpaceSignal
    send: #add:
    to: signals.

Then open the same space and inspect the collection to see:

Screenshot 2023-11-16 at 22 41 27

SO it is quite similar to the system announcer.

labordep commented 1 year ago

Thanks @tinchodias for your answer, I never used Beacon (and I don't know it) and I will try your solution. This topic cames from a dicussion with @plantec because we think that Beacon shoud not be used in Bloc. Is Beacon a necessary dependencies ? Can be replace by system announment ?

labordep commented 1 year ago

I made a mistake, because I though that Beacon was a dependency, but it looks like not because this is in Pharo :)