Telescope is an engine to create visualizations: the user describes nodes, connections, layouts, styles and interactions, and a connector renders them with a graphical framework. TelescopeBloc is the connector which renders them with Bloc, the graphical framework of Pharo, in a Bloc window. The API of Telescope, which is the same for every connector, is described in the Telescope documentation, with the same pictures and GIFs as below.
Metacello new
githubUser: 'TelescopeSt' project: 'TelescopeBloc' commitish: 'development' path: 'src';
baseline: 'TelescopeBloc';
loadTo depend on it from a baseline:
spec baseline: 'TelescopeBloc' with: [ spec repository: 'github://TelescopeSt/TelescopeBloc:development/src' ]The baseline loads the stable Bloc (the releases tagged v3.x.x) and the core of Telescope v2.x.x.
The demos of Telescope are loaded too, for the demo browser.
The groups are core (the connector), demo (the demo browser), tests and default (all of them).
A visualization of Telescope is rendered by the connector with the highest priority of the image, so once TelescopeBloc is loaded:
visualization := TLVisualization new.
visualization styleSheet nodeLabel: #asString.
visualization addNodesFromEntities: (1 to: 10).
visualization openTo choose the connector, or to open the window without a display (for tests):
connector := TLBlocConnector new.
connector host: BlHeadlessHost default.
visualization generator: connector.
visualization openThe demos of Telescope are in TLDemos: for example TLDemos exampleSimpleConnections open.
The demo browser lists them, filters them, shows the visualization and the source of the demo: in the world menu, Telescope > Telescope bloc demo browser, or TLBlocDemoPresenter open. The pictures below come from them and from the examples of the documentation: the demos to open in the browser are named after each picture.
- The mouse wheel zooms around the mouse, and a press on the background pans.
- A press on a node and a move drag the node, and the connections follow. A layout which is applied again puts it back.
- The toolbar at the top fits the visualization into the window, zooms, exports it as a PNG or as a SVG (a file chooser opens), and turns the auto fit on or off. Each button has a tooltip after one second.
- The legend of the visualization is at the bottom left.
- A visualization is fitted into its window when it opens, and again when a layout applied again moves or adds nodes, unless the auto fit is off.
- The nodes move smoothly when a layout is applied again, and the ones an interaction adds slide from the node of the interaction.
- The colors of the window, of the toolbar, of the legend, of the menus and of the pop ups come from a theme: light by default, dark, or dark blue (see Themes).
A theme gives the colors of what surrounds a visualization: the canvas behind it, the toolbar and its buttons, the legend, the menus and the pop ups.
TelescopeBloc has a light theme, TLBlocLightTheme, the default one, a dark theme, TLBlocDarkTheme, and a dark blue theme, TLBlocDarkBlueTheme, which has the colors of the dark blue theme of Pharo.
| Light | Dark | Dark blue |
|---|---|---|
![]() |
![]() |
![]() |
The same visualization in the three themes: the toolbar, the legend at the bottom left, and the pop up of the node under the mouse take the colors of the theme. The labels of the dark themes are white, given by the style sheet (see What a theme does not change).
Give the theme to the connector before the visualization is opened:
connector := TLBlocConnector new.
connector theme: TLBlocDarkTheme new.
visualization generator: connector.
visualization openThe theme is given to the elements when they are made: changing it once the visualization is open does not change the colors of what is shown.
TLBlocTheme available answers an instance of each theme, sorted by name, and TLBlocTheme default the theme of a connector which is not given one.
In the demo browser, the list under the filter shows the available themes: the demos are shown in the chosen one, and choosing another theme shows the selected demo again in it.
A theme is a subclass of TLBlocTheme which answers its name and the colors listed by TLBlocTheme colorSelectors.
The simplest way is to subclass an existing theme and to change some of its colors:
TLBlocLightTheme << #MySepiaTheme
slots: {};
package: 'MyProject'.
MySepiaTheme >> name
^ 'Sepia'
MySepiaTheme >> canvasColor
^ Color r: 0.98 g: 0.95 b: 0.88
MySepiaTheme >> panelColor
^ (Color r: 0.95 g: 0.9 b: 0.8) alpha: 0.9Every subclass which is not abstract is in TLBlocTheme available, so the new theme is also in the list of the demo browser.
The colors of a theme are:
| Color | Used for |
|---|---|
canvasColor |
the background of the window, behind the visualization |
panelColor |
the background of the toolbar |
panelBorderColor |
the border of the toolbar, of its buttons, of the legend and of the menus |
legendColor |
the background of the legend |
textColor |
the text of the buttons, of the legend and of the menus |
iconColor |
the arrows of the buttons, of the menus and of the legend |
buttonColor, buttonHoverColor |
a button, and a button under the mouse |
toggledButtonColor, toggledButtonHoverColor |
a button which is on (the auto fit), and the same under the mouse |
menuColor, menuHoverColor |
a menu, and the line under the mouse |
popUpColor, popUpBorderColor, popUpTextColor, popUpShadowColor |
the pop ups and the tooltips |
swatchOutlineColor |
the outline of the swatches of the legend which show a color |
The colors of the nodes, of their labels and of the connections are the ones of the style sheet of the visualization, which a theme does not change. The default style sheet of Telescope has black texts and borders, made for a light canvas: with the dark theme, give the labels which are outside of the nodes a light color, for example:
visualization styleSheet textColor: Color white- Nodes: the shapes of Telescope, colors (also from the entity, with a block or a gradient), borders (solid, dashed, dotted, double), sizes from the entity, labels (positions, wrapping, ellipsis, text color),
takeAllSpace, composite nodes with their children and a header for an inside label. - Groups and every layout of Telescope.
- Connections: Bezier curves (arcs for parallel connections), direct lines, segments with right angles which go around the other nodes, loops for a node connected to itself, line styles, head shapes, arrows at the start and at the middle (substyles
base,middleandmiddleReversed), and labels next to the line. - Interactions: mouse over, click, double click, right click, drop, moved, menus, pop ups, shape triggers (
triggerPosition) and external triggers (connector triggerExternal: interactionOrId). - Legends: static and dynamic entries.
Everything below is what the connector renders from the API of Telescope. Each chapter of the Telescope documentation has the code of these examples and all the options.
The window is fitted to the visualization when it opens. The mouse wheel zooms around the mouse, a press on the background pans, and the toolbar fits, zooms, turns the auto fit off and exports the visualization as a PNG or a SVG. A press on a node drags it, and the connections follow it (the demo Simple connections):
When a layout is applied again the nodes slide to their new places, here when the layout of a group is replaced by a click (the demo Changing layout):
Every interaction of Telescope is supported: mouse over, click, double click, right click, menus, pop ups, drag and drop, node moved, shape triggers and external triggers. See the chapter on interactions.
Expanding the nodes of a tree with a click, the new nodes sliding from the node (Expand collapse nodes action):
The shape triggers are the small shapes beside a node which run an action, such as the ones of the tree explorer:
Nodes which contain nodes, with the label of a composite node in a header above its children, and the triggers which expand and collapse it (Recursive composite node). See the composite nodes chapter.
The shapes of the nodes, which can have all the colors, borders and sizes you want, from their entity (the demo All shapes), the layouts, and their direction. See groups and layouts and styling.
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
The connections, with the curves of Telescope (arcs for the connections which join the same nodes, lines, and segments with right angles which go around the nodes), the line styles, the heads and the arrows (the demos Simple connections and Connection arrows). See the connections chapter.
![]() |
![]() |
The ready-made visualizations of Telescope, such as the butterfly, the flow graph and the distribution map (the demos Butterfly using style functionnality, F low control and Distribution map). See visualization templates.
![]() |
![]() |
showChildrenConnectionsOnParent, which Telescope itself leaves as a stub.generatePopupInteraction:andgenerateBasicInteraction:onNode:of the connector, which nothing calls.
The tests are in Telescope-Bloc-Tests and use the headless host of Bloc, so they need no display:
(TestSuite named: 'TelescopeBloc') in: [ :suite |
(PackageOrganizer default packageNamed: 'Telescope-Bloc-Tests') definedClasses
select: [ :class | class inheritsFrom: TestCase ]
thenDo: [ :class | class suite tests do: [ :test | suite addTest: test ] ].
suite run ]The continuous integration runs them with smalltalkCI on Pharo 14 and Pharo 15 (.smalltalk.ston).
MIT, see LICENSE.



























