Hi,
I'm creating a menu for loading, storing files from my outliner and
updating the software. The interface is something like:
============================
buildBrowser
"Main method for building the interface for trees. Is getting long.
Needs refactoring"
browser := GLMTabulator new
title: 'Grafoscopio'.
browser
column: #tree span: 2;
column: [ :c |
c row: #nodeBody span: 2;
row: #nodeHeader ] span: 4.
browser
updateOn: GLMItemAdded from: #yourself;
updateOn: GLMItemRemoved from: #yourself.
(browser transmit)
to: #tree;
andShow: [:a | self treeOn: a].
"Creating a self updatable body pane"
(browser transmit)
to: #nodeBody;
from: #tree;
andShow: [ :a | self bodyOn: a].
(browser transmit )
from: #tree port: #selection;
from: #nodeBody port: #text;
when: [:node :text | text notNil];
to: #nodeBody port: #neverland;
transformed: [:node :text | node body: text asString].
(browser transmit)
from: #tree;
to: #nodeHeader;
andShow: [ :h | self headerOn: h ].
(browser transmit )
from: #tree port: #selection;
from: #nodeHeader port: #text;
when: [:node :text | text notNil];
to: #nodeHeader port: #neverland1;
transformed: [:node :text | node header: text asString]
============================
The "treeOn:" code for the menu is something like:
============================
treeOn: constructor
"Shows the correspondent tree of a node"
(constructor tree)
"Snipped code"
act: [ UbakyeBrowser new openFromFile] entitled: 'Open/Load ...';
act: [:x | x inspect] entitled: 'Save as ...';
act: [:x | x inspect] entitled: 'Update Grafoscopio';
act: [:x | x printString inspect] entitled: 'About ...'.
============================
Of course, the [:x | x inspect] is just a place holder for the real
code. In the case of a new browser, it has been replaced for [
UbakyeBrowser new openFromFile]. Now I would like to access to the
message "saveToFile" which is defined on the UbakyeBrowser-UI, but this
is different from the "Open/Load" option menu, because I'm not creating
a new browser with an existing file name as parameter, but saving the
current tree in the browser, so this doesn't seems a message to be send
to the current GLMTreePresentation tree, but to the current browser
which contains that tree (the one that was defined with "buildBrowser"
above) and that object doesn't understand the saveToFile message,
because it was defined for the UbakyeBrowser class.
So, there is any way to send messages from the a Glamorous tree to the
current instance of the UbakyeBrowser which is being displayed on the
interface and contains that tree?
As usual, I don't know if I made myself clear, but if there is any way
to make better questions, please let me know also about it.
Cheers,
Offray
Hi,
Glamour now supports the triggering of actions when a port changes value.
Until now, this was possible only through a hackish transmission, but now
you can say more succinctly:
GLMCompositePresentation new
with: [ :composite |
composite text
onChangeOfPort: #text act: [ :textPresentation |
Transcript cr; cr; show: textPresentation text ] ];
openOn: ''
As a first application, the GTPlayground now saves the content when you
type it and not when you "Go" it as it was until now.
@Offray: I implemented this feature because of your request from a while
ago. That "non-expert" question was an important trigger. You see, everyone
can have a significant contribution regardless of the "expert" status.
Thanks :)
Cheers,
Doru
--
www.tudorgirba.com
"Every thing has its own flow"
Hi,
I would like to associate a GLMAction with tags in GLMListPresentation. As
to what I have understood so far, tags can only be used to filter and
filtering can be customized with filteringBlock. This does not suit my
needs.
Is there any specific place where I can start looking if I had to extend
glamour to support such kind of a list?
tx.
uman
Andrei wrote:
>In Glamour a presentation does not know about it's parent so what you want to do might not be possible.
>Now, it's not very clear for me what you are trying to do. Is the code available somewhere?
The standard solution we use in Seaside is to sent an announcement in the child, and subscribe in
the parent. In a Glamour context you'd have the browser subscribe to the event. In the announcement
you can then provide the information the browser needs to do the right thing.
Stephan
Just made this. Fun to see :-)
-=-=-=-=-=
data := (RTView methods flatCollect: #getSource) copyFrom: 1 to: 1500.
data := data select: #isAlphaNumeric.
mousePosition := 250 @ 250.
shape := RTLabel new
colorElement: [ :anElement |
| d |
d := (anElement position - mousePosition) r abs.
d := d max: 1.
d := (10000 / d) asInteger.
d := d min: 256.
Color gray256: d ];
text: [ :aChar | aChar asString ].
v := RTView new.
es := shape elementsOn: data.
v addAll: es.
RTGridLayout new gapSize: 0; on: es.
v when: TRMouseMove do: [ :evt |
mousePosition := evt positionFromCamera.
es updateShape.
v signalUpdate
].
v
-=-=-=-=-=
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
To enhance the look&feel in dark theme, I suggest to change renderAction like that:
renderAction: anAction
^(UITheme current
newButtonIn: nil
for: anAction
getState: nil
action: #morphicActOn:
arguments: {}
getEnabled: nil
label: (AlphaImageMorph new image: anAction icon)
help: (anAction title, Character tab asString, anAction shortcutAsString) trimBoth)
valueOfProperty: #noBorder ifAbsentPut: [true]; "this is a hack to tell the GLMUITheme to not draw the border and the fill"
valueOfProperty: #noFill ifAbsentPut: [true];
setProperty: #wantsKeyboardFocusNavigation toValue: false; "to disable the focus"
borderWidth: 0;
yourself
basically, just add #borderWidth: 0. It will remove the border (invisible in the regular theme), and then dark theme will behave the same… and it will look a lot better:
before:
after:
cheers,
Esteban
ps: yes, we still need to play with the icons, but this small step is anyway needed :)
Hi,
Now, that more people are playing with the GTInspector, I would like to
raise another point that might otherwise go unnoticed: The inspector
extensions do not only work in the inspector, but can also be combined in
other browsers as well.
For example, the attached picture shows a Pillar browser that shows only
the presentations relevant to editing Pillar books. And the code looks like:
GLMPager new with: [ :pager |
pager show: [ :composite :file |
composite title: file basename.
file gtInspectorItemsIn: composite.
file gtInspectorPillarConfigurationIn: composite.
file gtInspectorPillarIn: composite.
file gtInspectorPillarProjectIn: composite.
file gtInspectorPngIn: composite.
file gtInspectorGifIn: composite.
file gtInspectorContentsIn: composite ] ];
openOn: FileSystem disk workingDirectory
[image: Inline image 1]
See here some more details:
http://www.humane-assessment.com/blog/creating-custom-browsers-out-of-inspe…
The interesting thing is that we can now easily imagine creating rather
sophisticated tools with little code and that we only use for a very short
time (like minutes). This has a rather high disruption potential given that
no other environment I know of allows for something like this.
Let us know what you think.
Cheers,
Doru
--
www.tudorgirba.com
"Every thing has its own flow"
Hi All,
In the last version of Roassal, you can enjoy a nice animation:
https://dl.dropboxusercontent.com/u/31543901/online/ForceBasedLayout2.mov
Here is the script
-=-=-=-=-=-=-=-=-=-=-=-=
| v es anim edges |
v := RTView new.
v @ RTDraggableView.
es := RTEllipse new elementsOn: RTObject withAllSubclasses.
v addAll: es.
RTMetricNormalizer new
elements: es;
normalizeSize: #numberOfLinesOfCode min: 5 max: 30 using: [:vv | vv sqrt * 5 ];
normalizeColor: #numberOfMethods using: { Color green . Color red };
alphaColor: 0.3.
anim := RTSpringLayoutStepping new view: v.
v addAnimation: anim.
v addMenu: ''add edges'' callback: [
edges := RTEdgeBuilder new
view: v;
objects: RTObject withAllSubclasses from: #superclass.
anim addEdges: edges ].
v addMenu: ''remove edges'' callback: [
v edges do: #remove.
anim removeAllEdges.
v signalUpdate ].
v open.
-=-=-=-=-=-=-=-=-=-=-=-=
Cheers,
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Hi,
Currently I don't see any way how to tell an element that another one has
been dropped onto him. For example if I want to drag an element into a
container (see example at the end).
Unfortunately in my solution i had to change the behaviour of Trachel
(RTMorph), so could this be in some (better) way incorporated into Roassal
(Trachel)?
My solution is making a subclass
-------------------------------------
TRAbstractMouseEvent subclass: #TRMouseDragDrop
-------------------------------------
And altering mouseDragEnd
-------------------------------------
RTMorph>>rtMouseDragEnd: evt
| ee dropEvent dropShape relativePosition |
"notify the dragged element"
ee := TRMouseDragEnd new.
ee shape: shapeBeingPointed.
ee canvas: trachelCanvas.
ee morph: self.
shapeBeingPointed announce: ee.
"notify the element onto which was the drag performed"
shapeBeingPointed = trachelCanvas
ifFalse: [
shapeBeingPointed element attributes
at: #rtDroppable
ifPresent: [
relativePosition := self relativePositionFor: evt.
dropShape := self shapeWithAction: TRMouseDragDrop forPositionInPixels:
relativePosition.
dropShape = shapeBeingPointed
ifFalse: [
dropEvent := TRMouseDragDrop new
shape: shapeBeingPointed;
canvas: trachelCanvas;
morph: self.
dropShape announce: dropEvent ] ] ].
eventBeginingDragging := nil.
shapeBeingPointed := nil
-------------------------------------
Example (use case) is:
-------------------------------------
view := RTView new.
container := RTBox new size: 200; color: Color white; borderColor: Color
black; element.
group := RTGroup new.
RTNest new on: container nest: group.
container trachelShape size: 200.
box := RTBox new size: 50; color: Color magenta; element.
box translateTo: 250 @ 0.
container @ RTDraggable.
container @ RTResizeable.
box @ RTDraggable.
box attributes at: #rtDroppable put: true.
container
when: TRMouseDragDrop
do: [ :event |
| el |
el := event shape element.
el attributes at: #container ifPresent: [
group remove: el.
].
group add: el.
el attributes at: #container put: group.
].
view canvas
when: TRMouseDragDrop
do: [ :event |
| el |
el := event shape element.
el attributes at: #container ifPresent: [ :parent |
parent remove: el.
el attributes removeKey: #container.
].
].
view
add: container;
add: box.
view open.
-------------------------------------
Also it would be nice to have an option to highlight the drop area. There
is TRMouseEnter/TRMouseLeave but it fires only for the top level shape,
perhaps it should for all? Or less invasive to add
TRMouseDragEnter/TRMouseDragLeave which would work like regular Enter/Leave
but on the next (on z-axis) shape.
Please let me know what you think.
Peter