Pharo-dev
By thread
pharo-dev@lists.pharo.org
By month
Messages by month
- ----- 2026 -----
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- 2 participants
- 144614 messages
Re: [Pharo-project] Preferences refactoring
by Gary Chambers
Fair. I guess a simplified version of the announcement pattern could be used
for notification.
Of course, to avoid repeating code one might want a Preferences instance
(not like the current Preferences class stuff) that can be registered with
for those classses supporting preferences.
E.g. for a subscriber:
XYZClass preferences observe: #windowColor do: [:pref | ...]
And for a preferences supplier you might have the Preferences instance
referenced by a class var or something.
Regards, Gary
----- Original Message -----
From: "Michael Rueger" <m.rueger(a)acm.org>
To: <Pharo-project(a)lists.gforge.inria.fr>
Sent: Monday, February 16, 2009 3:50 PM
Subject: Re: [Pharo-project] Preferences refactoring
> Gary Chambers wrote:
>> I'll have a think. Some theme settings can currently be set (manually) on
>> a
>> per theme basis.
>> Would be nice to handle that, though the pragma route suggests that a
>> static
>> facade would be needed to delegate to the defaults for the current
>> theme...
>>
>> I'd see something like
>>
>> X class>>myPreference
>> <preference: 'Readable name' type: #Boolean set: #myPreference:
>> default:
>> #defaultMyPreference description: 'Helpful text'>
>> ^ myPreference ifNil: [myPreference := self defaultMyPreference]
>
> In Sophie we have a Preference system supporting user and system level
> preferences as well as preference definitions similar to the one above.
>
> In my ySqueak experiments I extended that so classes can register as
> "preference provider" and also as listeners to preference changes.
>
> Michael
>
> _______________________________________________
> Pharo-project mailing list
> Pharo-project(a)lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Feb. 16, 2009
Re: [Pharo-project] Preferences refactoring
by Michael Rueger
Gary Chambers wrote:
> I'll have a think. Some theme settings can currently be set (manually) on a
> per theme basis.
> Would be nice to handle that, though the pragma route suggests that a static
> facade would be needed to delegate to the defaults for the current theme...
>
> I'd see something like
>
> X class>>myPreference
> <preference: 'Readable name' type: #Boolean set: #myPreference: default:
> #defaultMyPreference description: 'Helpful text'>
> ^ myPreference ifNil: [myPreference := self defaultMyPreference]
In Sophie we have a Preference system supporting user and system level
preferences as well as preference definitions similar to the one above.
In my ySqueak experiments I extended that so classes can register as
"preference provider" and also as listeners to preference changes.
Michael
Feb. 16, 2009
Re: [Pharo-project] Preferences refactoring
by Gary Chambers
I'll have a think. Some theme settings can currently be set (manually) on a
per theme basis.
Would be nice to handle that, though the pragma route suggests that a static
facade would be needed to delegate to the defaults for the current theme...
I'd see something like
X class>>myPreference
<preference: 'Readable name' type: #Boolean set: #myPreference: default:
#defaultMyPreference description: 'Helpful text'>
^ myPreference ifNil: [myPreference := self defaultMyPreference]
X class>>defaultMyPreference
^false
X class>>myPreference: aTValue
myPreference := aTValue.
"do any stuff to notify/apply change..."
That would be enough got get the value (selector of pragma) and all the
rest. The default value needs to be by method since pragma arguents only
support literals (some preferences may be complex objects). The type can be
used by the preference browser to determine how to handle the values... I
suggest having the class name of the expected value here to help with that
(the class may have extensions allowing it to work with the preference
browser).
Of course, another approach is to just decentralize the preferences...
X class>>xyzColorPreference
<preference>
^Preference new
name: #xyzColor
defaultValue: Color red
helpString: 'Specifies the xyz color of abc'
localToProject: false
categoryList: #(#'window colors')
changeInformee: self
changeSelector: #xyzColor:
viewRegistry: (PreferenceViewRegistry registryOf:
#windowColorPreferences)
And tweak Preference>>notifyInformeeOfChange to handle the argument for the
changeSelector (passing the new preference value).
That should work ok with the existing preference browser with a few tweaks
(the preference browser should have a its preferences var set to a new
instance of a class that provides the relevant protocol that is used on the
Preference class side but with the preferences discovered via the code
below).
(Object withAllSubclasses
inject: OrderedCollection new
into: [:pragmas :class | pragmas, (Pragma allNamed: #preference in:
class)])
collect: [:pragma | pragma methodClass theNonMetaClass perform: pragma
selector]
This means that we can retain the categorisation of preferences and existing
editing machinery etc.
All pretty hideous, one way or another...
Regards, Gary
----- Original Message -----
From: "Alain Plantec" <beranger22(a)gmail.com>
To: <Pharo-project(a)lists.gforge.inria.fr>
Sent: Monday, February 16, 2009 2:15 PM
Subject: Re: [Pharo-project] Preferences refactoring
Alain Plantec a écrit :
> Alain Plantec a écrit :
>
>> Gary Chambers a écrit :
>>
>>
>>> Not sure I like having the code changed all the time.
>>> If the code is changed then the MC package will show changes...
>>>
>>>
>> ok, but I liked the idea of not to have variable for simple preferences.
>>
>>
> and not to be forced to use a particular tool or an inspector in order
> to change a preference.
> just use your favorite browser.
> alain
>
ok one can have:
XX class>>myPreference: aValue
"self myPreference: myValue"
myPreference := aValue
and the user edits the comment of the setter and evaluates it without
saving the code.
Cheers
alain
>> a solution could be to use update notification. in the case of a
>> preference -> do not implies package change.
>> But I can agry with your solution easily. :)
>>
>>
> .....
>
> _______________________________________________
> Pharo-project mailing list
> Pharo-project(a)lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
>
_______________________________________________
Pharo-project mailing list
Pharo-project(a)lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Feb. 16, 2009
Re: [Pharo-project] Preferences refactoring
by Alain Plantec
Alain Plantec a écrit :
> Alain Plantec a écrit :
>
>> Gary Chambers a écrit :
>>
>>
>>> Not sure I like having the code changed all the time.
>>> If the code is changed then the MC package will show changes...
>>>
>>>
>> ok, but I liked the idea of not to have variable for simple preferences.
>>
>>
> and not to be forced to use a particular tool or an inspector in order
> to change a preference.
> just use your favorite browser.
> alain
>
ok one can have:
XX class>>myPreference: aValue
"self myPreference: myValue"
myPreference := aValue
and the user edits the comment of the setter and evaluates it without
saving the code.
Cheers
alain
>> a solution could be to use update notification. in the case of a
>> preference -> do not implies package change.
>> But I can agry with your solution easily. :)
>>
>>
> .....
>
> _______________________________________________
> Pharo-project mailing list
> Pharo-project(a)lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
>
Feb. 16, 2009
Re: [Pharo-project] Preferences refactoring
by Alain Plantec
Alain Plantec a écrit :
> Gary Chambers a écrit :
>
>> Not sure I like having the code changed all the time.
>> If the code is changed then the MC package will show changes...
>>
> ok, but I liked the idea of not to have variable for simple preferences.
>
and not to be forced to use a particular tool or an inspector in order
to change a preference.
just use your favorite browser.
alain
> a solution could be to use update notification. in the case of a
> preference -> do not implies package change.
> But I can agry with your solution easily. :)
>
.....
Feb. 16, 2009
Re: [Pharo-project] Preferences refactoring
by Alain Plantec
Gary Chambers a écrit :
> Not sure I like having the code changed all the time.
> If the code is changed then the MC package will show changes...
ok, but I liked the idea of not to have variable for simple preferences.
a solution could be to use update notification. in the case of a
preference -> do not implies package change.
But I can agry with your solution easily. :)
>
> The Pragma could instead specify how to set the preference (variable
> defined by the class/instance that declares the pragma).
maybe no need for that by default:
for a preference named "myPreference" in class X, one can have, by
default, X class>>myPreference and X class>>myPreference:
first case with implicit setter:
X class>>myPreference
<preferenceType: T defaultValue: aTValue>
^ myPreference ifNil: [myPreference := aTValue]
Or
X class>>myPreference
<preferenceType: T defaultGetter: #(how to get default)>
^ myPreference ifNil: [myPreference := ahow to get default]
And
X class>>myPreference: aTValue
myPreference := aTValue
second case with explicit setter:
X class>>myPreference
<preferenceType: T defaultValue: aTValue setter: #anothetSetter:>
^ myPreference ifNil: [myPreference := aTValue]
Or
X class>>myPreference
<preferenceType: T defaultGetter: #(how to get default) setter:
#anothetSetter:>
^ myPreference ifNil: [myPreference := ahow to get default]
And
X class>>anothetSetter: aTValue
myPreference := aTValue
Remark about implicit case:
Usually I don't like implicit things but, here it can be a way to
implement extensions (as helpers are)
Possible implicit methods :
X class>>myPreference: aTValue
myPreference := aTValue
X class>>myPreferenceHelpText
^ 'help text the helper need'
X class>>myPreferenceGroups
^ #(#Morphic #Colors)
X class>>myPreference<Something>
^ "something used somewhere"
Cheers
alain
>
> Regards, Gary
>
> ----- Original Message ----- From: "Alain Plantec" <beranger22(a)gmail.com>
> To: <Pharo-project(a)lists.gforge.inria.fr>
> Sent: Monday, February 16, 2009 12:25 PM
> Subject: Re: [Pharo-project] Preferences refactoring
>
>
> Here is a first proposition:
>
> preference declaration: a class method with pragma.
> In the image, a preference is stored as a Pragma instance (no Preference
> class).
> Actual preferences can be stored into a set of Pragma.
> One can use a dictionary (a class variable somewhere) in order to store
> several named preference set.
> Installing a preference set is done by the loading (code compilation)
> of all pragmas of the preference set.
>
> Example:
> AClassSomewhere>>loadPreferencesFrom: aSetOfPragma
> aSetOfPragma do: [:p | (p method methodReference
> asMethodDefinition) load]
>
> Preference method
> two kinds: value preference object preference
> - simple preference: a preference which type is a literal type
>
> examples:
> ChangeSet class>>checkForSlips
> <preferenceType: #Boolean defaultValue: true>
> ^ true
>
> HTTPSocket class>>httpProxyPort
> <preferenceType: #Integer defaultValue: 80>
> ^ 80
>
> - object preference: a preference which type is any class, such a
> preference method return a "complex" object instance.
> the value is stored in a class instance variable which name is the
> preference name. the variable initialization is lazy.
> the value as well as the default value are the result of a message send
> to a particular class.
> example with font:
>
> AClassSomewhere class>>standardFont
> <preferenceType: #LogicalFont defaultGetter: #(#LogicalFont
> #familyName: 'Arial' #fallbackFamilyNames: nil #pointSize: 12
> #stretchValue: 5 #weightValue: 400 #slantValue: 0)>
> ^ standardFont
> ifNil: [standardFont := LogicalFont
> familyName: 'Arial'
> fallbackFamilyNames: nil
> pointSize: 12
> stretchValue: 5
> weightValue: 400
> slantValue: 0]
>
> Interoperability with file system:
> File in/out via standard code file, cool :)
> All we need is present, mainly, we have MCStWriter and MCStReader
>
> Tested example:
> stream := RWBinaryOrTextStream on: String new.
> writer := MCStWriter on: stream.
> "collecting and writing"
> PreferenceCollector allPreferencePragmas do: [ :p | (p method
> methodReference asMethodDefinition) accept: writer].
> "reading and loading"
> reader := MCStReader on: stream readStream.
> reader definitions do: [:d | d load].
>
> Changing a preference value:
> It can be simply done via code editing (no particular tool is mandatory)
>
> Helpers
> What we need: a cool tool to set preference values (actual
> PreferenceBrowser replacement)
> Let's call it PreferencesSetter (better name ?)
> PreferenceSetter needs an helper builder for each individual preference
> type.
> For a particular preference (stored as a Pragma instance), The
> PreferenceSetter tool ask the preference type class (found in the Pragma
> instance)
> to build the helper.
> as an example, we need an helper in order to present and input a Boolean
> preference.
> In that case, the related helper is built by the sending of
> preferenceHelper to Boolean.
> Another example for font, the helper is built by the sending of
> preferenceHelper to LogicalFont.
>
> A preference helper is responsible for the input a the preference and
> for the building of the textual representation
> of the value which is used to code the preference method.
>
> alain
>
> Stéphane Ducasse a écrit :
>>
>> On Feb 15, 2009, at 6:05 PM, Alain Plantec wrote:
>>
>>> Stéphane Ducasse a écrit :
>>>> Alain
>>>>
>>>> It would be nice to redesign completely preferences.
>>> yes, it is the reason why I don't want to spend to much time on
>>> the improvement of actual PreferenceBrowser.
>>>> Did you read the thread
>>>> Re: [Pharo-project] About Preference Flow
>>>> of 4 of Feb ?
>>> yes, I had it in mind.
>>> Do someone know where I can find documentation on pragmas ?
>>
>> Pragma class je pense.
>>
>> Stef
>>
>>>
>>> thanks
>>> alain
>>>>
>>>> Summary here
>>>>
>>>> Instead of having the current situation ie
>>>>
>>>> MyTool>>doSomething
>>>>
>>>> ....
>>>> Preferences useNewDiffTool
>>>> ifTrue: [kjlhkjhjkh ]
>>>> ifFalse: [nkjhkjkjhkj]
>>>>
>>>>
>>>> and not been able to remove the preferences (or that the
>>>> preference is
>>>> just a configuration layer).
>>>>
>>>> I would like to have the preference made that way
>>>>
>>>> MyTool class>>useNewDiff
>>>>
>>>> MyTool class>> useOldDiff
>>>>
>>>> **NO REFERENCE TO PREFERENCE IN THE METHOD FLOW!!!!
>>>>
>>>>
>>>> Preferences useNewDiffTool
>>>> MyTool useNewDiff
>>>>
>>>> I like the idea of lukas to use pragmas.
>>>>
>>>> Why not use pragmas on accessors of the class side that would be
>>>> picked up by the preference browser? Then all state would be
>>>> local to
>>>> the affected code.
>>>>
>>>> Something along these lines:
>>>>
>>>> MCMonticelloBrowser>>showAdvanceDiffTool: aBoolean
>>>> <preference: 'Show advanced diff tool' group: 'Monticello'
>>>> type: #Boolean>
>>>>
>>>> advancedDiffTool := aBoolean
>>>>
>>>>
>>>>>>> Hi all,
>>>>> Here is a changeset with a new version of the PreferencesBrowser.
>>>>> It is for testing. I can improve it a little bit
>>>>> (by including display depth, desktop color, gradient color and author
>>>>> initials)
>>>>> and provide a slice if it is ok.
>>>>>
>>>>> I've investigated how preferences are implemented and it seems to me
>>>>> that
>>>>> current situation is the result of succesives hacks.
>>>>> I would like to clean out this part of the system.
>>>>> I will provide a roadmap before any coding.
>>>>> Can I start working on it ?
>>>>>
>>>>> Cheers
>>>>> alain
>>>>>>>
>>>>>>>> On 11 Feb 2009, at 16:22, Alain Plantec wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>> Hi all,
>>>>>>>>> I would like to improve the PreferencesBrowser so that it
>>>>>>>>> includes
>>>>>>>>> standard Fonts preferences (see joined snapshot).
>>>>>>>>> It's almost done except that, if a preference font is set to
>>>>>>>>> Arial,
>>>>>>>>> clicking on Save button leads to an infinite loop.
>>>>>>>>>
>>>>>>>>> To reproduce it, set button font to Arial-12 and
>>>>>>>>> Preferences standardButtonFont deepCopy.
>>>>>>>>>
>>>>>>>>> Cheers
>>>>>>>>> alain
>>>>>>>>> <
>>>>>>>>> FontsInPreferences
>>>>>>>>> .png
>>>>>>>>>
>>>>>>>>>> <FTFdeepcopy.png>_______________________________________________
>>>>>>>>>>
>>>>>>>>> Pharo-project mailing list
>>>>>>>>> Pharo-project(a)lists.gforge.inria.fr
>>>>>>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Pharo-project mailing list
>>>>>>> Pharo-project(a)lists.gforge.inria.fr
>>>>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> <PBFont.8.cs.gz>_______________________________________________
>>>>> Pharo-project mailing list
>>>>> Pharo-project(a)lists.gforge.inria.fr
>>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>>
>>>>
>>>>
>>>
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> Pharo-project(a)lists.gforge.inria.fr
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>
>>
>>
>>
>
>
> _______________________________________________
> Pharo-project mailing list
> Pharo-project(a)lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
Feb. 16, 2009
Re: [Pharo-project] Preferences refactoring
by Gary Chambers
Not sure I like having the code changed all the time.
If the code is changed then the MC package will show changes...
The Pragma could instead specify how to set the preference (variable defined
by the class/instance that declares the pragma).
Regards, Gary
----- Original Message -----
From: "Alain Plantec" <beranger22(a)gmail.com>
To: <Pharo-project(a)lists.gforge.inria.fr>
Sent: Monday, February 16, 2009 12:25 PM
Subject: Re: [Pharo-project] Preferences refactoring
Here is a first proposition:
preference declaration: a class method with pragma.
In the image, a preference is stored as a Pragma instance (no Preference
class).
Actual preferences can be stored into a set of Pragma.
One can use a dictionary (a class variable somewhere) in order to store
several named preference set.
Installing a preference set is done by the loading (code compilation)
of all pragmas of the preference set.
Example:
AClassSomewhere>>loadPreferencesFrom: aSetOfPragma
aSetOfPragma do: [:p | (p method methodReference
asMethodDefinition) load]
Preference method
two kinds: value preference object preference
- simple preference: a preference which type is a literal type
examples:
ChangeSet class>>checkForSlips
<preferenceType: #Boolean defaultValue: true>
^ true
HTTPSocket class>>httpProxyPort
<preferenceType: #Integer defaultValue: 80>
^ 80
- object preference: a preference which type is any class, such a
preference method return a "complex" object instance.
the value is stored in a class instance variable which name is the
preference name. the variable initialization is lazy.
the value as well as the default value are the result of a message send
to a particular class.
example with font:
AClassSomewhere class>>standardFont
<preferenceType: #LogicalFont defaultGetter: #(#LogicalFont
#familyName: 'Arial' #fallbackFamilyNames: nil #pointSize: 12
#stretchValue: 5 #weightValue: 400 #slantValue: 0)>
^ standardFont
ifNil: [standardFont := LogicalFont
familyName: 'Arial'
fallbackFamilyNames: nil
pointSize: 12
stretchValue: 5
weightValue: 400
slantValue: 0]
Interoperability with file system:
File in/out via standard code file, cool :)
All we need is present, mainly, we have MCStWriter and MCStReader
Tested example:
stream := RWBinaryOrTextStream on: String new.
writer := MCStWriter on: stream.
"collecting and writing"
PreferenceCollector allPreferencePragmas do: [ :p | (p method
methodReference asMethodDefinition) accept: writer].
"reading and loading"
reader := MCStReader on: stream readStream.
reader definitions do: [:d | d load].
Changing a preference value:
It can be simply done via code editing (no particular tool is mandatory)
Helpers
What we need: a cool tool to set preference values (actual
PreferenceBrowser replacement)
Let's call it PreferencesSetter (better name ?)
PreferenceSetter needs an helper builder for each individual preference
type.
For a particular preference (stored as a Pragma instance), The
PreferenceSetter tool ask the preference type class (found in the Pragma
instance)
to build the helper.
as an example, we need an helper in order to present and input a Boolean
preference.
In that case, the related helper is built by the sending of
preferenceHelper to Boolean.
Another example for font, the helper is built by the sending of
preferenceHelper to LogicalFont.
A preference helper is responsible for the input a the preference and
for the building of the textual representation
of the value which is used to code the preference method.
alain
Stéphane Ducasse a écrit :
>
> On Feb 15, 2009, at 6:05 PM, Alain Plantec wrote:
>
>> Stéphane Ducasse a écrit :
>>> Alain
>>>
>>> It would be nice to redesign completely preferences.
>> yes, it is the reason why I don't want to spend to much time on
>> the improvement of actual PreferenceBrowser.
>>> Did you read the thread
>>> Re: [Pharo-project] About Preference Flow
>>> of 4 of Feb ?
>> yes, I had it in mind.
>> Do someone know where I can find documentation on pragmas ?
>
> Pragma class je pense.
>
> Stef
>
>>
>> thanks
>> alain
>>>
>>> Summary here
>>>
>>> Instead of having the current situation ie
>>>
>>> MyTool>>doSomething
>>>
>>> ....
>>> Preferences useNewDiffTool
>>> ifTrue: [kjlhkjhjkh ]
>>> ifFalse: [nkjhkjkjhkj]
>>>
>>>
>>> and not been able to remove the preferences (or that the
>>> preference is
>>> just a configuration layer).
>>>
>>> I would like to have the preference made that way
>>>
>>> MyTool class>>useNewDiff
>>>
>>> MyTool class>> useOldDiff
>>>
>>> **NO REFERENCE TO PREFERENCE IN THE METHOD FLOW!!!!
>>>
>>>
>>> Preferences useNewDiffTool
>>> MyTool useNewDiff
>>>
>>> I like the idea of lukas to use pragmas.
>>>
>>> Why not use pragmas on accessors of the class side that would be
>>> picked up by the preference browser? Then all state would be
>>> local to
>>> the affected code.
>>>
>>> Something along these lines:
>>>
>>> MCMonticelloBrowser>>showAdvanceDiffTool: aBoolean
>>> <preference: 'Show advanced diff tool' group: 'Monticello'
>>> type: #Boolean>
>>>
>>> advancedDiffTool := aBoolean
>>>
>>>
>>>>>> Hi all,
>>>> Here is a changeset with a new version of the PreferencesBrowser.
>>>> It is for testing. I can improve it a little bit
>>>> (by including display depth, desktop color, gradient color and author
>>>> initials)
>>>> and provide a slice if it is ok.
>>>>
>>>> I've investigated how preferences are implemented and it seems to me
>>>> that
>>>> current situation is the result of succesives hacks.
>>>> I would like to clean out this part of the system.
>>>> I will provide a roadmap before any coding.
>>>> Can I start working on it ?
>>>>
>>>> Cheers
>>>> alain
>>>>>>
>>>>>>> On 11 Feb 2009, at 16:22, Alain Plantec wrote:
>>>>>>>
>>>>>>>
>>>>>>>> Hi all,
>>>>>>>> I would like to improve the PreferencesBrowser so that it includes
>>>>>>>> standard Fonts preferences (see joined snapshot).
>>>>>>>> It's almost done except that, if a preference font is set to
>>>>>>>> Arial,
>>>>>>>> clicking on Save button leads to an infinite loop.
>>>>>>>>
>>>>>>>> To reproduce it, set button font to Arial-12 and
>>>>>>>> Preferences standardButtonFont deepCopy.
>>>>>>>>
>>>>>>>> Cheers
>>>>>>>> alain
>>>>>>>> <
>>>>>>>> FontsInPreferences
>>>>>>>> .png
>>>>>>>>
>>>>>>>>> <FTFdeepcopy.png>_______________________________________________
>>>>>>>>>
>>>>>>>> Pharo-project mailing list
>>>>>>>> Pharo-project(a)lists.gforge.inria.fr
>>>>>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>> _______________________________________________
>>>>>> Pharo-project mailing list
>>>>>> Pharo-project(a)lists.gforge.inria.fr
>>>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>> <PBFont.8.cs.gz>_______________________________________________
>>>> Pharo-project mailing list
>>>> Pharo-project(a)lists.gforge.inria.fr
>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>
>>>
>>>
>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> Pharo-project(a)lists.gforge.inria.fr
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
>
>
_______________________________________________
Pharo-project mailing list
Pharo-project(a)lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Feb. 16, 2009
Re: [Pharo-project] Preferences refactoring
by Alain Plantec
Here is a first proposition:
preference declaration: a class method with pragma.
In the image, a preference is stored as a Pragma instance (no Preference
class).
Actual preferences can be stored into a set of Pragma.
One can use a dictionary (a class variable somewhere) in order to store
several named preference set.
Installing a preference set is done by the loading (code compilation)
of all pragmas of the preference set.
Example:
AClassSomewhere>>loadPreferencesFrom: aSetOfPragma
aSetOfPragma do: [:p | (p method methodReference
asMethodDefinition) load]
Preference method
two kinds: value preference object preference
- simple preference: a preference which type is a literal type
examples:
ChangeSet class>>checkForSlips
<preferenceType: #Boolean defaultValue: true>
^ true
HTTPSocket class>>httpProxyPort
<preferenceType: #Integer defaultValue: 80>
^ 80
- object preference: a preference which type is any class, such a
preference method return a "complex" object instance.
the value is stored in a class instance variable which name is the
preference name. the variable initialization is lazy.
the value as well as the default value are the result of a message send
to a particular class.
example with font:
AClassSomewhere class>>standardFont
<preferenceType: #LogicalFont defaultGetter: #(#LogicalFont
#familyName: 'Arial' #fallbackFamilyNames: nil #pointSize: 12
#stretchValue: 5 #weightValue: 400 #slantValue: 0)>
^ standardFont
ifNil: [standardFont := LogicalFont
familyName: 'Arial'
fallbackFamilyNames: nil
pointSize: 12
stretchValue: 5
weightValue: 400
slantValue: 0]
Interoperability with file system:
File in/out via standard code file, cool :)
All we need is present, mainly, we have MCStWriter and MCStReader
Tested example:
stream := RWBinaryOrTextStream on: String new.
writer := MCStWriter on: stream.
"collecting and writing"
PreferenceCollector allPreferencePragmas do: [ :p | (p method
methodReference asMethodDefinition) accept: writer].
"reading and loading"
reader := MCStReader on: stream readStream.
reader definitions do: [:d | d load].
Changing a preference value:
It can be simply done via code editing (no particular tool is mandatory)
Helpers
What we need: a cool tool to set preference values (actual
PreferenceBrowser replacement)
Let's call it PreferencesSetter (better name ?)
PreferenceSetter needs an helper builder for each individual preference
type.
For a particular preference (stored as a Pragma instance), The
PreferenceSetter tool ask the preference type class (found in the Pragma
instance)
to build the helper.
as an example, we need an helper in order to present and input a Boolean
preference.
In that case, the related helper is built by the sending of
preferenceHelper to Boolean.
Another example for font, the helper is built by the sending of
preferenceHelper to LogicalFont.
A preference helper is responsible for the input a the preference and
for the building of the textual representation
of the value which is used to code the preference method.
alain
Stéphane Ducasse a écrit :
>
> On Feb 15, 2009, at 6:05 PM, Alain Plantec wrote:
>
>> Stéphane Ducasse a écrit :
>>> Alain
>>>
>>> It would be nice to redesign completely preferences.
>> yes, it is the reason why I don't want to spend to much time on
>> the improvement of actual PreferenceBrowser.
>>> Did you read the thread
>>> Re: [Pharo-project] About Preference Flow
>>> of 4 of Feb ?
>> yes, I had it in mind.
>> Do someone know where I can find documentation on pragmas ?
>
> Pragma class je pense.
>
> Stef
>
>>
>> thanks
>> alain
>>>
>>> Summary here
>>>
>>> Instead of having the current situation ie
>>>
>>> MyTool>>doSomething
>>>
>>> ....
>>> Preferences useNewDiffTool
>>> ifTrue: [kjlhkjhjkh ]
>>> ifFalse: [nkjhkjkjhkj]
>>>
>>>
>>> and not been able to remove the preferences (or that the
>>> preference is
>>> just a configuration layer).
>>>
>>> I would like to have the preference made that way
>>>
>>> MyTool class>>useNewDiff
>>>
>>> MyTool class>> useOldDiff
>>>
>>> **NO REFERENCE TO PREFERENCE IN THE METHOD FLOW!!!!
>>>
>>>
>>> Preferences useNewDiffTool
>>> MyTool useNewDiff
>>>
>>> I like the idea of lukas to use pragmas.
>>>
>>> Why not use pragmas on accessors of the class side that would be
>>> picked up by the preference browser? Then all state would be
>>> local to
>>> the affected code.
>>>
>>> Something along these lines:
>>>
>>> MCMonticelloBrowser>>showAdvanceDiffTool: aBoolean
>>> <preference: 'Show advanced diff tool' group: 'Monticello'
>>> type: #Boolean>
>>>
>>> advancedDiffTool := aBoolean
>>>
>>>
>>>>>> Hi all,
>>>> Here is a changeset with a new version of the PreferencesBrowser.
>>>> It is for testing. I can improve it a little bit
>>>> (by including display depth, desktop color, gradient color and author
>>>> initials)
>>>> and provide a slice if it is ok.
>>>>
>>>> I've investigated how preferences are implemented and it seems to me
>>>> that
>>>> current situation is the result of succesives hacks.
>>>> I would like to clean out this part of the system.
>>>> I will provide a roadmap before any coding.
>>>> Can I start working on it ?
>>>>
>>>> Cheers
>>>> alain
>>>>>>
>>>>>>> On 11 Feb 2009, at 16:22, Alain Plantec wrote:
>>>>>>>
>>>>>>>
>>>>>>>> Hi all,
>>>>>>>> I would like to improve the PreferencesBrowser so that it includes
>>>>>>>> standard Fonts preferences (see joined snapshot).
>>>>>>>> It's almost done except that, if a preference font is set to
>>>>>>>> Arial,
>>>>>>>> clicking on Save button leads to an infinite loop.
>>>>>>>>
>>>>>>>> To reproduce it, set button font to Arial-12 and
>>>>>>>> Preferences standardButtonFont deepCopy.
>>>>>>>>
>>>>>>>> Cheers
>>>>>>>> alain
>>>>>>>> <
>>>>>>>> FontsInPreferences
>>>>>>>> .png
>>>>>>>>
>>>>>>>>> <FTFdeepcopy.png>_______________________________________________
>>>>>>>>>
>>>>>>>> Pharo-project mailing list
>>>>>>>> Pharo-project(a)lists.gforge.inria.fr
>>>>>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>> _______________________________________________
>>>>>> Pharo-project mailing list
>>>>>> Pharo-project(a)lists.gforge.inria.fr
>>>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>> <PBFont.8.cs.gz>_______________________________________________
>>>> Pharo-project mailing list
>>>> Pharo-project(a)lists.gforge.inria.fr
>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>
>>>
>>>
>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> Pharo-project(a)lists.gforge.inria.fr
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
>
>
Feb. 16, 2009
Re: [Pharo-project] Loading Polymorph
by Gary Chambers
Loads from 42 upwards should be ok as normal. Polymorph-Widgets-gvc-45 now
on SqueakSource
with some lint related changes and a few other goodies ;-)
Regards, Gary
----- Original Message -----
From: "Stéphane Ducasse" <stephane.ducasse(a)inria.fr>
To: <Pharo-project(a)lists.gforge.inria.fr>
Sent: Sunday, February 15, 2009 2:53 PM
Subject: Re: [Pharo-project] Loading Polymorph
>I will try to see what I can do to load it.
>
> Stef
>
>
>> Latest Polymorph-Widgets versions (from 41 to 42) require the MC
>> workaround to load/merge, unfortunately.
>> Anything down to drawing... in this case the change to dropShadows.
>>
>> Regards, Gary
>> _______________________________________________
>> Pharo-project mailing list
>> Pharo-project(a)lists.gforge.inria.fr
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> Pharo-project(a)lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Feb. 16, 2009
Re: [Pharo-project] unnecessary =, == :)
by Damien Cassou
On Sat, Feb 14, 2009 at 4:23 PM, Stéphane Ducasse
<stephane.ducasse(a)inria.fr> wrote:
> Check for a =, ==, ~=, or ~~ message being sent to true/false or with
> true/false as the argument. Many times these can be eliminated since
> their receivers are already booleans. For example, "anObject isFoo ==
> false" could be replaced with "anObject isFoo not" if isFoo always
> returns a boolean. Sometimes variables might refer to true, false, and
> something else, but this is considered bad style since the variable
> has multiple types.
Issue #577
--
Damien Cassou
http://damiencassou.seasidehosting.st
Feb. 16, 2009