UITheme experience (please read) :)
Hi guys I want to lower the importance of UITheme - first the factory API should be pushed in the respective classes ie: UItheme>>newButtonIn: aThemedMorph for: aModel getState: stateSel action: actionSel arguments: args getEnabled: enabledSel getLabel: labelSel help: helpText "Answer a new button." |b| b := PluggableButtonMorph on: aModel getState: stateSel action: actionSel label: labelSel. b theme: self; label: ' ' font: self buttonFont; update: labelSel; arguments: (args ifNil: [{b}]); getEnabledSelector: enabledSel; cornerStyle: (self buttonCornerStyleIn: aThemedMorph); hResizing: #shrinkWrap; vResizing: #shrinkWrap; setBalloonText: helpText; extent: b minExtent; removeProperty: #theme. ^b should be transformed into PluggableButtonMorph>>newButtonFor: aModel getState: stateSel action: actionSel arguments: args getEnabled: enabledSel label: label help: helpText "Answer a new button." | b | b := self on: aModel getState: stateSel action: actionSel. b arguments: (args ifNil: [{b}]); hResizing: #shrinkWrap; vResizing: #shrinkWrap; label: label ; getEnabledSelector: enabledSel; setBalloonText: helpText; extent: b minExtent; hResizing: #rigid; vResizing: #rigid. ^b Now I do not want to lose the theme so I'm working on that. - second I wanted to experiment with the theming architecture I did the following XPGrowlMorph Object < XPGrowlThemeStrategy parentTheme := UITheme new XPGrowlThemeStrategy < XPGrowlDarkTheme parentTheme := PharoDarkTheme new growFillColor: Color white XPGrowlThemeStrategy < XPGrowlPharo30Theme parentTheme := Pharo30Theme new growFillColor: Color red minTextSize ^ parentTheme minTextSize I did the same with XPSimpleButtonMorph Conclusion: - Do we gain from object inheritance vs class? I do not think that we want to change dynamical the theme chain So I will make the widget strategy class from their theme PharoDarkTheme < XPGrowlDarkTheme Pharo30Theme < XPGrowlPharo30Theme - cons we may have duplicated behavior accross theme => traits? - Do we gain having widgets specific theming strategy - cons this generate a lot of classes so we will see + with inheritance we reuse a lot + probably we can reduce the API of UItheme (see below) - Can we reduce the API of UITheme buttonBorderColor listBorderColor â¦. Yes probably doing Pharo3Theme>>buttonBorderColor => Pharo30ButtonStrategy>>borderColor -> but should be experimented - From a widget point of view, if we want to have possibility to see the same widgets in different theme at the same time this raises the problem of the injection (or recomputation) of the theme values. Example below: We want to specify a theme but the new is calling initialize and the values are computed with a default/current theme. XPGrowlMorph new theme: XPPharo3ThemeStrategy new; label: 'The time' contents: TimeStamp now; skin; openInWorld. XPGrowlMorph new theme: XPDarkThemeStrategy new; label: 'The time' contents: TimeStamp now; openInWorld. => Question is it worth because with a default theme we would have it nearly working. Stef
Hi Stef, I do not have time right now to go into details, so take this just as an acknowledgment that I have an interest in this topic :). My initial proposal that I sent to this list a while ago (some details are provided here: http://www.humane-assessment.com/blog/a-pharo-refactoring-story-adding-theme...) went exactly in the direction of a ThemeStrategy that I call Themer. We used it already for several morphs around Glamour to play with the boundaries and it works well. I still think we need the UITheme but that should only provide a list of themers without any implementation. Like that we can package a uniform look throughout the whole environment. However, we should still be able to override the themer at the level of morph for quick prototyping and custom needs. I will get back to you. Cheers, Doru On Sat, Jul 19, 2014 at 9:15 AM, stepharo <stepharo@free.fr> wrote:
Hi guys
I want to lower the importance of UITheme
- first the factory API should be pushed in the respective classes ie:
UItheme>>newButtonIn: aThemedMorph for: aModel getState: stateSel action: actionSel arguments: args getEnabled: enabledSel getLabel: labelSel help: helpText "Answer a new button."
|b| b := PluggableButtonMorph on: aModel getState: stateSel action: actionSel label: labelSel. b theme: self; label: ' ' font: self buttonFont; update: labelSel; arguments: (args ifNil: [{b}]); getEnabledSelector: enabledSel; cornerStyle: (self buttonCornerStyleIn: aThemedMorph); hResizing: #shrinkWrap; vResizing: #shrinkWrap; setBalloonText: helpText; extent: b minExtent; removeProperty: #theme. ^b
should be transformed into
PluggableButtonMorph>>newButtonFor: aModel getState: stateSel action: actionSel arguments: args getEnabled: enabledSel label: label help: helpText "Answer a new button."
| b | b := self on: aModel getState: stateSel action: actionSel. b arguments: (args ifNil: [{b}]); hResizing: #shrinkWrap; vResizing: #shrinkWrap; label: label ; getEnabledSelector: enabledSel; setBalloonText: helpText; extent: b minExtent; hResizing: #rigid; vResizing: #rigid. ^b
Now I do not want to lose the theme so I'm working on that.
- second I wanted to experiment with the theming architecture
I did the following
XPGrowlMorph
Object < XPGrowlThemeStrategy parentTheme := UITheme new
XPGrowlThemeStrategy < XPGrowlDarkTheme parentTheme := PharoDarkTheme new growFillColor: Color white XPGrowlThemeStrategy < XPGrowlPharo30Theme parentTheme := Pharo30Theme new growFillColor: Color red minTextSize ^ parentTheme minTextSize
I did the same with XPSimpleButtonMorph
Conclusion:
- Do we gain from object inheritance vs class? I do not think that we want to change dynamical the theme chain So I will make the widget strategy class from their theme
PharoDarkTheme < XPGrowlDarkTheme
Pharo30Theme < XPGrowlPharo30Theme
- cons we may have duplicated behavior accross theme => traits?
- Do we gain having widgets specific theming strategy - cons this generate a lot of classes so we will see
+ with inheritance we reuse a lot + probably we can reduce the API of UItheme (see below)
- Can we reduce the API of UITheme buttonBorderColor listBorderColor â¦.
Yes probably doing
Pharo3Theme>>buttonBorderColor
=>
Pharo30ButtonStrategy>>borderColor
-> but should be experimented
- From a widget point of view, if we want to have possibility to see the same widgets in different theme at the same time this raises the problem of the injection (or recomputation) of the theme values. Example below: We want to specify a theme but the new is calling initialize and the values are computed with a default/current theme.
XPGrowlMorph new theme: XPPharo3ThemeStrategy new; label: 'The time' contents: TimeStamp now; skin; openInWorld.
XPGrowlMorph new theme: XPDarkThemeStrategy new; label: 'The time' contents: TimeStamp now; openInWorld.
=> Question is it worth because with a default theme we would have it nearly working.
Stef
-- www.tudorgirba.com "Every thing has its own flow"
On 19/7/14 14:16, Tudor Girba wrote:
Hi Stef,
I do not have time right now to go into details, so take this just as an acknowledgment that I have an interest in this topic :).
My initial proposal that I sent to this list a while ago (some details are provided here: http://www.humane-assessment.com/blog/a-pharo-refactoring-story-adding-theme...) went exactly in the direction of a ThemeStrategy that I call Themer. We used it already for several morphs around Glamour to play with the boundaries and it works well.
Thanks I will read it. I'm redoing the experience without object delegation but inheritance (but this is a "detail").
I still think we need the UITheme but that should only provide a list of themers without any implementation. Like that we can package a uniform look throughout the whole environment. However, we should still be able to override the themer at the level of morph for quick prototyping and custom needs.
I will get back to you.
OKi
Cheers, Doru
On Sat, Jul 19, 2014 at 9:15 AM, stepharo <stepharo@free.fr <mailto:stepharo@free.fr>> wrote:
Hi guys
I want to lower the importance of UITheme
- first the factory API should be pushed in the respective classes ie:
UItheme>>newButtonIn: aThemedMorph for: aModel getState: stateSel action: actionSel arguments: args getEnabled: enabledSel getLabel: labelSel help: helpText "Answer a new button."
|b| b := PluggableButtonMorph on: aModel getState: stateSel action: actionSel label: labelSel. b theme: self; label: ' ' font: self buttonFont; update: labelSel; arguments: (args ifNil: [{b}]); getEnabledSelector: enabledSel; cornerStyle: (self buttonCornerStyleIn: aThemedMorph); hResizing: #shrinkWrap; vResizing: #shrinkWrap; setBalloonText: helpText; extent: b minExtent; removeProperty: #theme. ^b
should be transformed into
PluggableButtonMorph>>newButtonFor: aModel getState: stateSel action: actionSel arguments: args getEnabled: enabledSel label: label help: helpText "Answer a new button."
| b | b := self on: aModel getState: stateSel action: actionSel. b arguments: (args ifNil: [{b}]); hResizing: #shrinkWrap; vResizing: #shrinkWrap; label: label ; getEnabledSelector: enabledSel; setBalloonText: helpText; extent: b minExtent; hResizing: #rigid; vResizing: #rigid. ^b
Now I do not want to lose the theme so I'm working on that.
- second I wanted to experiment with the theming architecture
I did the following
XPGrowlMorph
Object < XPGrowlThemeStrategy parentTheme := UITheme new
XPGrowlThemeStrategy < XPGrowlDarkTheme parentTheme := PharoDarkTheme new growFillColor: Color white XPGrowlThemeStrategy < XPGrowlPharo30Theme parentTheme := Pharo30Theme new growFillColor: Color red minTextSize ^ parentTheme minTextSize
I did the same with XPSimpleButtonMorph
Conclusion:
- Do we gain from object inheritance vs class? I do not think that we want to change dynamical the theme chain So I will make the widget strategy class from their theme
PharoDarkTheme < XPGrowlDarkTheme
Pharo30Theme < XPGrowlPharo30Theme
- cons we may have duplicated behavior accross theme => traits?
- Do we gain having widgets specific theming strategy - cons this generate a lot of classes so we will see
+ with inheritance we reuse a lot + probably we can reduce the API of UItheme (see below)
- Can we reduce the API of UITheme buttonBorderColor listBorderColor â¦.
Yes probably doing
Pharo3Theme>>buttonBorderColor
=>
Pharo30ButtonStrategy>>borderColor
-> but should be experimented
- From a widget point of view, if we want to have possibility to see the same widgets in different theme at the same time this raises the problem of the injection (or recomputation) of the theme values. Example below: We want to specify a theme but the new is calling initialize and the values are computed with a default/current theme.
XPGrowlMorph new theme: XPPharo3ThemeStrategy new; label: 'The time' contents: TimeStamp now; skin; openInWorld.
XPGrowlMorph new theme: XPDarkThemeStrategy new; label: 'The time' contents: TimeStamp now; openInWorld.
=> Question is it worth because with a default theme we would have it nearly working.
Stef
-- www.tudorgirba.com <http://www.tudorgirba.com>
"Every thing has its own flow"
Hi doru I think that there are two points: - moving creation API from theme to classes (I'm doing this one to also create example of the widgets) Smalltalk ui theme newButton.... sucks :) - rethinking the theming architecture Stef On 19/7/14 14:16, Tudor Girba wrote:
Hi Stef,
I do not have time right now to go into details, so take this just as an acknowledgment that I have an interest in this topic :).
My initial proposal that I sent to this list a while ago (some details are provided here: http://www.humane-assessment.com/blog/a-pharo-refactoring-story-adding-theme...) went exactly in the direction of a ThemeStrategy that I call Themer. We used it already for several morphs around Glamour to play with the boundaries and it works well.
I still think we need the UITheme but that should only provide a list of themers without any implementation. Like that we can package a uniform look throughout the whole environment. However, we should still be able to override the themer at the level of morph for quick prototyping and custom needs.
I will get back to you.
Cheers, Doru
On Sat, Jul 19, 2014 at 9:15 AM, stepharo <stepharo@free.fr <mailto:stepharo@free.fr>> wrote:
Hi guys
I want to lower the importance of UITheme
- first the factory API should be pushed in the respective classes ie:
UItheme>>newButtonIn: aThemedMorph for: aModel getState: stateSel action: actionSel arguments: args getEnabled: enabledSel getLabel: labelSel help: helpText "Answer a new button."
|b| b := PluggableButtonMorph on: aModel getState: stateSel action: actionSel label: labelSel. b theme: self; label: ' ' font: self buttonFont; update: labelSel; arguments: (args ifNil: [{b}]); getEnabledSelector: enabledSel; cornerStyle: (self buttonCornerStyleIn: aThemedMorph); hResizing: #shrinkWrap; vResizing: #shrinkWrap; setBalloonText: helpText; extent: b minExtent; removeProperty: #theme. ^b
should be transformed into
PluggableButtonMorph>>newButtonFor: aModel getState: stateSel action: actionSel arguments: args getEnabled: enabledSel label: label help: helpText "Answer a new button."
| b | b := self on: aModel getState: stateSel action: actionSel. b arguments: (args ifNil: [{b}]); hResizing: #shrinkWrap; vResizing: #shrinkWrap; label: label ; getEnabledSelector: enabledSel; setBalloonText: helpText; extent: b minExtent; hResizing: #rigid; vResizing: #rigid. ^b
Now I do not want to lose the theme so I'm working on that.
- second I wanted to experiment with the theming architecture
I did the following
XPGrowlMorph
Object < XPGrowlThemeStrategy parentTheme := UITheme new
XPGrowlThemeStrategy < XPGrowlDarkTheme parentTheme := PharoDarkTheme new growFillColor: Color white XPGrowlThemeStrategy < XPGrowlPharo30Theme parentTheme := Pharo30Theme new growFillColor: Color red minTextSize ^ parentTheme minTextSize
I did the same with XPSimpleButtonMorph
Conclusion:
- Do we gain from object inheritance vs class? I do not think that we want to change dynamical the theme chain So I will make the widget strategy class from their theme
PharoDarkTheme < XPGrowlDarkTheme
Pharo30Theme < XPGrowlPharo30Theme
- cons we may have duplicated behavior accross theme => traits?
- Do we gain having widgets specific theming strategy - cons this generate a lot of classes so we will see
+ with inheritance we reuse a lot + probably we can reduce the API of UItheme (see below)
- Can we reduce the API of UITheme buttonBorderColor listBorderColor â¦.
Yes probably doing
Pharo3Theme>>buttonBorderColor
=>
Pharo30ButtonStrategy>>borderColor
-> but should be experimented
- From a widget point of view, if we want to have possibility to see the same widgets in different theme at the same time this raises the problem of the injection (or recomputation) of the theme values. Example below: We want to specify a theme but the new is calling initialize and the values are computed with a default/current theme.
XPGrowlMorph new theme: XPPharo3ThemeStrategy new; label: 'The time' contents: TimeStamp now; skin; openInWorld.
XPGrowlMorph new theme: XPDarkThemeStrategy new; label: 'The time' contents: TimeStamp now; openInWorld.
=> Question is it worth because with a default theme we would have it nearly working.
Stef
-- www.tudorgirba.com <http://www.tudorgirba.com>
"Every thing has its own flow"
Definitely! My post was about the second point. Doru On Sat, Jul 19, 2014 at 5:22 PM, stepharo <stepharo@free.fr> wrote:
Hi doru
I think that there are two points: - moving creation API from theme to classes (I'm doing this one to also create example of the widgets) Smalltalk ui theme newButton.... sucks :) - rethinking the theming architecture
Stef
On 19/7/14 14:16, Tudor Girba wrote:
Hi Stef,
I do not have time right now to go into details, so take this just as an acknowledgment that I have an interest in this topic :).
My initial proposal that I sent to this list a while ago (some details are provided here: http://www.humane-assessment.com/blog/a-pharo-refactoring-story-adding-theme...) went exactly in the direction of a ThemeStrategy that I call Themer. We used it already for several morphs around Glamour to play with the boundaries and it works well.
I still think we need the UITheme but that should only provide a list of themers without any implementation. Like that we can package a uniform look throughout the whole environment. However, we should still be able to override the themer at the level of morph for quick prototyping and custom needs.
I will get back to you.
Cheers, Doru
On Sat, Jul 19, 2014 at 9:15 AM, stepharo <stepharo@free.fr> wrote:
Hi guys
I want to lower the importance of UITheme
- first the factory API should be pushed in the respective classes ie:
UItheme>>newButtonIn: aThemedMorph for: aModel getState: stateSel action: actionSel arguments: args getEnabled: enabledSel getLabel: labelSel help: helpText "Answer a new button."
|b| b := PluggableButtonMorph on: aModel getState: stateSel action: actionSel label: labelSel. b theme: self; label: ' ' font: self buttonFont; update: labelSel; arguments: (args ifNil: [{b}]); getEnabledSelector: enabledSel; cornerStyle: (self buttonCornerStyleIn: aThemedMorph); hResizing: #shrinkWrap; vResizing: #shrinkWrap; setBalloonText: helpText; extent: b minExtent; removeProperty: #theme. ^b
should be transformed into
PluggableButtonMorph>>newButtonFor: aModel getState: stateSel action: actionSel arguments: args getEnabled: enabledSel label: label help: helpText "Answer a new button."
| b | b := self on: aModel getState: stateSel action: actionSel. b arguments: (args ifNil: [{b}]); hResizing: #shrinkWrap; vResizing: #shrinkWrap; label: label ; getEnabledSelector: enabledSel; setBalloonText: helpText; extent: b minExtent; hResizing: #rigid; vResizing: #rigid. ^b
Now I do not want to lose the theme so I'm working on that.
- second I wanted to experiment with the theming architecture
I did the following
XPGrowlMorph
Object < XPGrowlThemeStrategy parentTheme := UITheme new
XPGrowlThemeStrategy < XPGrowlDarkTheme parentTheme := PharoDarkTheme new growFillColor: Color white XPGrowlThemeStrategy < XPGrowlPharo30Theme parentTheme := Pharo30Theme new growFillColor: Color red minTextSize ^ parentTheme minTextSize
I did the same with XPSimpleButtonMorph
Conclusion:
- Do we gain from object inheritance vs class? I do not think that we want to change dynamical the theme chain So I will make the widget strategy class from their theme
PharoDarkTheme < XPGrowlDarkTheme
Pharo30Theme < XPGrowlPharo30Theme
- cons we may have duplicated behavior accross theme => traits?
- Do we gain having widgets specific theming strategy - cons this generate a lot of classes so we will see
+ with inheritance we reuse a lot + probably we can reduce the API of UItheme (see below)
- Can we reduce the API of UITheme buttonBorderColor listBorderColor â¦.
Yes probably doing
Pharo3Theme>>buttonBorderColor
=>
Pharo30ButtonStrategy>>borderColor
-> but should be experimented
- From a widget point of view, if we want to have possibility to see the same widgets in different theme at the same time this raises the problem of the injection (or recomputation) of the theme values. Example below: We want to specify a theme but the new is calling initialize and the values are computed with a default/current theme.
XPGrowlMorph new theme: XPPharo3ThemeStrategy new; label: 'The time' contents: TimeStamp now; skin; openInWorld.
XPGrowlMorph new theme: XPDarkThemeStrategy new; label: 'The time' contents: TimeStamp now; openInWorld.
=> Question is it worth because with a default theme we would have it nearly working.
Stef
-- www.tudorgirba.com
"Every thing has its own flow"
-- www.tudorgirba.com "Every thing has its own flow"
I continued the experiment with PluggableButtonMorph and - we should remove some duplicated code in UItheme hiearchy :) - if we do not share behavior in themers (accross widgets) we will have duplicated code and logic. Side note: When I see the amount of messages sent to open a morph and the complexity of the theme in addition to Morphic intrinsic complexity it is obvious that it cannot be fast. Far too complex. I started to copy simpleButtonMorph and clean it just to understand. I would like to do the same for the widgets but this is a daunting task. I really think that Bloc will come to the rescue because simplifying is not an easy task either. Polymorph is complex and added a lot of hacks on top (because it was designed as a layer). Not talking about TextMorph and StringMorph different API. Simple API like label:font: are bogus. Widgets displaying text should have font instance variable I will try to make the XPPluggableButtonMorph works in Pharo30 and DarkTheme and let you know. The code is published in SD PetitsBazars/ StefArchitecture something. I will continue to split Polymorph and read code around and clean what I can see. Stef
Definitely!
My post was about the second point.
Doru
On Sat, Jul 19, 2014 at 5:22 PM, stepharo <stepharo@free.fr <mailto:stepharo@free.fr>> wrote:
Hi doru
I think that there are two points: - moving creation API from theme to classes (I'm doing this one to also create example of the widgets) Smalltalk ui theme newButton.... sucks :) - rethinking the theming architecture
Stef
On 19/7/14 14:16, Tudor Girba wrote:
Hi Stef,
I do not have time right now to go into details, so take this just as an acknowledgment that I have an interest in this topic :).
My initial proposal that I sent to this list a while ago (some details are provided here: http://www.humane-assessment.com/blog/a-pharo-refactoring-story-adding-theme...) went exactly in the direction of a ThemeStrategy that I call Themer. We used it already for several morphs around Glamour to play with the boundaries and it works well.
I still think we need the UITheme but that should only provide a list of themers without any implementation. Like that we can package a uniform look throughout the whole environment. However, we should still be able to override the themer at the level of morph for quick prototyping and custom needs.
I will get back to you.
Cheers, Doru
On Sat, Jul 19, 2014 at 9:15 AM, stepharo <stepharo@free.fr <mailto:stepharo@free.fr>> wrote:
Hi guys
I want to lower the importance of UITheme
- first the factory API should be pushed in the respective classes ie:
UItheme>>newButtonIn: aThemedMorph for: aModel getState: stateSel action: actionSel arguments: args getEnabled: enabledSel getLabel: labelSel help: helpText "Answer a new button."
|b| b := PluggableButtonMorph on: aModel getState: stateSel action: actionSel label: labelSel. b theme: self; label: ' ' font: self buttonFont; update: labelSel; arguments: (args ifNil: [{b}]); getEnabledSelector: enabledSel; cornerStyle: (self buttonCornerStyleIn: aThemedMorph); hResizing: #shrinkWrap; vResizing: #shrinkWrap; setBalloonText: helpText; extent: b minExtent; removeProperty: #theme. ^b
should be transformed into
PluggableButtonMorph>>newButtonFor: aModel getState: stateSel action: actionSel arguments: args getEnabled: enabledSel label: label help: helpText "Answer a new button."
| b | b := self on: aModel getState: stateSel action: actionSel. b arguments: (args ifNil: [{b}]); hResizing: #shrinkWrap; vResizing: #shrinkWrap; label: label ; getEnabledSelector: enabledSel; setBalloonText: helpText; extent: b minExtent; hResizing: #rigid; vResizing: #rigid. ^b
Now I do not want to lose the theme so I'm working on that.
- second I wanted to experiment with the theming architecture
I did the following
XPGrowlMorph
Object < XPGrowlThemeStrategy parentTheme := UITheme new
XPGrowlThemeStrategy < XPGrowlDarkTheme parentTheme := PharoDarkTheme new growFillColor: Color white XPGrowlThemeStrategy < XPGrowlPharo30Theme parentTheme := Pharo30Theme new growFillColor: Color red minTextSize ^ parentTheme minTextSize
I did the same with XPSimpleButtonMorph
Conclusion:
- Do we gain from object inheritance vs class? I do not think that we want to change dynamical the theme chain So I will make the widget strategy class from their theme
PharoDarkTheme < XPGrowlDarkTheme
Pharo30Theme < XPGrowlPharo30Theme
- cons we may have duplicated behavior accross theme => traits?
- Do we gain having widgets specific theming strategy - cons this generate a lot of classes so we will see
+ with inheritance we reuse a lot + probably we can reduce the API of UItheme (see below)
- Can we reduce the API of UITheme buttonBorderColor listBorderColor â¦.
Yes probably doing
Pharo3Theme>>buttonBorderColor
=>
Pharo30ButtonStrategy>>borderColor
-> but should be experimented
- From a widget point of view, if we want to have possibility to see the same widgets in different theme at the same time this raises the problem of the injection (or recomputation) of the theme values. Example below: We want to specify a theme but the new is calling initialize and the values are computed with a default/current theme.
XPGrowlMorph new theme: XPPharo3ThemeStrategy new; label: 'The time' contents: TimeStamp now; skin; openInWorld.
XPGrowlMorph new theme: XPDarkThemeStrategy new; label: 'The time' contents: TimeStamp now; openInWorld.
=> Question is it worth because with a default theme we would have it nearly working.
Stef
-- www.tudorgirba.com <http://www.tudorgirba.com>
"Every thing has its own flow"
-- www.tudorgirba.com <http://www.tudorgirba.com>
"Every thing has its own flow"
2014-07-19 23:18 GMT+02:00 stepharo <stepharo@free.fr>:
I continued the experiment with PluggableButtonMorph and - we should remove some duplicated code in UItheme hiearchy :) - if we do not share behavior in themers (accross widgets) we will have duplicated code and logic.
The first thing that comes to my mind is the question: What do we try to solve with UITheme, or what is the problem, UITheme is supposed to be the solution? Consistent UI, themed widgets, easy to producing UIs?
Side note:
When I see the amount of messages sent to open a morph and the complexity of the theme in addition to Morphic intrinsic complexity it is obvious that it cannot be fast. Far too complex. I started to copy simpleButtonMorph and clean it just to understand. I would like to do the same for the widgets but this is a daunting task.
I really think that Bloc will come to the rescue because simplifying is not an easy task either. Polymorph is complex and added a lot of hacks on top (because it was designed as a layer).
+1
Not talking about TextMorph and StringMorph different API. Simple API like label:font: are bogus. Widgets displaying text should have font instance variable
I don't think, this is the real problem or that a font instance variable would solve this. This is how a simple StringMorph (or TextMorph) and a Label (as part of a widget) differ. For example: a simple Button. Currently we have that PluggableButtonMorph. It is a Morph with some shape, colour, border, label and behavior. The label is actually a TextMorph to heavyvweight for a simple button label. Anyway. If we move the attributes like background color, border style, label text attributes like font, color and emphasis to the theme manager, what is left for the ButtonMorph? Text contents and behaviour - just that. A UI framework should provide "things" that play exactly this role. ButtonWidget: Hi, I am a Button, give me some Label and Actions.
I will try to make the XPPluggableButtonMorph works in Pharo30 and DarkTheme and let you know.
The code is published in SD PetitsBazars/ StefArchitecture something.
I will continue to split Polymorph and read code around and clean what I can see.
Stef
Definitely!
My post was about the second point.
Doru
On Sat, Jul 19, 2014 at 5:22 PM, stepharo <stepharo@free.fr> wrote:
Hi doru
I think that there are two points: - moving creation API from theme to classes (I'm doing this one to also create example of the widgets) Smalltalk ui theme newButton.... sucks :) - rethinking the theming architecture
Stef
+1 A Theme provides attributes for categories like ButtonLabelFont, ButtonLabelColour. But it does not actually provides the Morphs (no ButtonLabelMorph, no CheckBoxMorph). Otherwise I have to call ... theme createX, ... theme createY.... That way the theme manager would play two roles: 1. for the developer: a widget factory 2. for the widgets : a theme manager. Instead the developer needs an UI widget factory, or a widget library. These widgets doesn't need to be Morphs, at least they don't play this role. (Morphs somehow contrary to "constistent UI", they are to powerful). The widgets don't care how to draw themself. They delegate. For example, widgets displaying text. They know to whom they forward. But they don't *hold* the theme dependent attributes - like fonts. Either they or their delegates call the appropriate attribute from the theme manager. So, a ButtonWidget for example, calls its uidelegate to draw himself (my label, my state (active, inactive, selected, pressed ...). The ui delegate calls theme manager for the font, color, emphasis. Yes, this may create a another parallel ui delegate hierarchy next to the widget hierarchy. Maybe all this *can* be implemented within the same class (PluggableButtonMorph), but the crucial point is: I (the app developer) need a consistant API, so that I don't have to deal with all of that. I just want to see this thing that plays the role I am interested in: a Button with some label and some actions. nicolai
On 19/7/14 14:16, Tudor Girba wrote:
Hi Stef,
I do not have time right now to go into details, so take this just as an acknowledgment that I have an interest in this topic :).
My initial proposal that I sent to this list a while ago (some details are provided here: http://www.humane-assessment.com/blog/a-pharo-refactoring-story-adding-theme...) went exactly in the direction of a ThemeStrategy that I call Themer. We used it already for several morphs around Glamour to play with the boundaries and it works well.
I still think we need the UITheme but that should only provide a list of themers without any implementation. Like that we can package a uniform look throughout the whole environment. However, we should still be able to override the themer at the level of morph for quick prototyping and custom needs.
I will get back to you.
Cheers, Doru
On Sat, Jul 19, 2014 at 9:15 AM, stepharo <stepharo@free.fr> wrote:
Hi guys
I want to lower the importance of UITheme
- first the factory API should be pushed in the respective classes ie:
UItheme>>newButtonIn: aThemedMorph for: aModel getState: stateSel action: actionSel arguments: args getEnabled: enabledSel getLabel: labelSel help: helpText "Answer a new button."
|b| b := PluggableButtonMorph on: aModel getState: stateSel action: actionSel label: labelSel. b theme: self; label: ' ' font: self buttonFont; update: labelSel; arguments: (args ifNil: [{b}]); getEnabledSelector: enabledSel; cornerStyle: (self buttonCornerStyleIn: aThemedMorph); hResizing: #shrinkWrap; vResizing: #shrinkWrap; setBalloonText: helpText; extent: b minExtent; removeProperty: #theme. ^b
should be transformed into
PluggableButtonMorph>>newButtonFor: aModel getState: stateSel action: actionSel arguments: args getEnabled: enabledSel label: label help: helpText "Answer a new button."
| b | b := self on: aModel getState: stateSel action: actionSel. b arguments: (args ifNil: [{b}]); hResizing: #shrinkWrap; vResizing: #shrinkWrap; label: label ; getEnabledSelector: enabledSel; setBalloonText: helpText; extent: b minExtent; hResizing: #rigid; vResizing: #rigid. ^b
Now I do not want to lose the theme so I'm working on that.
- second I wanted to experiment with the theming architecture
I did the following
XPGrowlMorph
Object < XPGrowlThemeStrategy parentTheme := UITheme new
XPGrowlThemeStrategy < XPGrowlDarkTheme parentTheme := PharoDarkTheme new growFillColor: Color white XPGrowlThemeStrategy < XPGrowlPharo30Theme parentTheme := Pharo30Theme new growFillColor: Color red minTextSize ^ parentTheme minTextSize
I did the same with XPSimpleButtonMorph
Conclusion:
- Do we gain from object inheritance vs class? I do not think that we want to change dynamical the theme chain So I will make the widget strategy class from their theme
PharoDarkTheme < XPGrowlDarkTheme
Pharo30Theme < XPGrowlPharo30Theme
- cons we may have duplicated behavior accross theme => traits?
- Do we gain having widgets specific theming strategy - cons this generate a lot of classes so we will see
+ with inheritance we reuse a lot + probably we can reduce the API of UItheme (see below)
- Can we reduce the API of UITheme buttonBorderColor listBorderColor â¦.
Yes probably doing
Pharo3Theme>>buttonBorderColor
=>
Pharo30ButtonStrategy>>borderColor
-> but should be experimented
- From a widget point of view, if we want to have possibility to see the same widgets in different theme at the same time this raises the problem of the injection (or recomputation) of the theme values.
Is there any usecase for "using the same widget with a different theme"?
Example below:
We want to specify a theme but the new is calling initialize and the values are computed with a default/current theme.
XPGrowlMorph new theme: XPPharo3ThemeStrategy new; label: 'The time' contents: TimeStamp now; skin; openInWorld.
XPGrowlMorph new theme: XPDarkThemeStrategy new; label: 'The time' contents: TimeStamp now; openInWorld.
=> Question is it worth because with a default theme we would have it nearly working.
Stef
-- www.tudorgirba.com
"Every thing has its own flow"
-- www.tudorgirba.com
"Every thing has its own flow"
participants (3)
-
Nicolai Hess -
stepharo -
Tudor Girba