[squeak-dev] The Trunk: PreferenceBrowser-mt.139.mcz

Tobias Pape Das.Linux at gmx.de
Mon Mar 28 13:37:00 UTC 2022



> On 28. Mar 2022, at 15:20, Thiede, Christoph <Christoph.Thiede at student.hpi.uni-potsdam.de> wrote:
> 
> Very nice! :-)
> 
> > - Merge lowercase categories into uppercase ones
> 
> Is this actually useful? I used to distinguish between lowercase "aspects" or "functionalities" (such as mouse, keyboard, ...) and uppercase "Tools" or "Components" (such as OCompletion, Sandblocks etc.). What do you think?

There have been different views on how to treat protocol/category name cases, and different "best practices".
So, merging them is actually useful for viewing, but for editing, i don't know.

-t


> 
> Best,
> Christoph
> Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von commits at source.squeak.org<commits at source.squeak.org>
> Gesendet: Mittwoch, 23. März 2022 10:22:57
> An: squeak-dev at lists.squeakfoundation.org; packages at lists.squeakfoundation.org
> Betreff: [squeak-dev] The Trunk: PreferenceBrowser-mt.139.mcz
>  
> Marcel Taeumel uploaded a new version of PreferenceBrowser to project The Trunk:
> http://source.squeak.org/trunk/PreferenceBrowser-mt.139.mcz
> 
> ==================== Summary ====================
> 
> Name: PreferenceBrowser-mt.139
> Author: mt
> Time: 23 March 2022, 10:22:57.915972 am
> UUID: 801aa3e9-251d-4b72-9809-7e44ebf4e9ed
> Ancestors: PreferenceBrowser-mt.138
> 
> Some visual clean-up and changes in preference browser:
> - Merge lowercase categories into uppercase ones
> - Show number of prefs per category
> - Correct list margin in prefs list
> - Cache category list for smooth interaction
> - Use default button color
> - Fixes line breaks several balloon texts
> 
> =============== Diff against PreferenceBrowser-mt.138 ===============
> 
> Item was changed:
>   ----- Method: PBPreferenceButtonMorph>>initializeLayout (in category 'initialization') -----
>   initializeLayout
>          self layoutPolicy: TableLayout new;
>                  beTransparent;
> +                layoutInset: PluggableListMorph listMargins;
> -                layoutInset: 0;
>                  cellGap: 0;
>                  listCentering: #topLeft;
>                  cellPositioning: #topLeft;
>                  listDirection: #topToBottom;
>                  hResizing: #spaceFill;
>                  vResizing: #shrinkWrap.         !
> 
> Item was changed:
>   Model subclass: #PreferenceBrowser
> +        instanceVariableNames: 'selectedCategoryIndex selectedPreference searchPattern searchResults lastExecutedSearch preferences title categoryList categoryLabelList'
> -        instanceVariableNames: 'selectedCategoryIndex selectedPreference searchPattern searchResults lastExecutedSearch preferences title'
>          classVariableNames: ''
>          poolDictionaries: ''
>          category: 'PreferenceBrowser'!
> 
> Item was added:
> + ----- Method: PreferenceBrowser>>categoryLabelList (in category 'accessing') -----
> + categoryLabelList
> + 
> +        ^ categoryLabelList ifNil: [categoryLabelList := self categoryList
> +                collect: [:category | '{1} ({2})' format: {
> +                        category.
> +                        self numPreferencesInCategory: category }]]!
> 
> Item was changed:
>   ----- Method: PreferenceBrowser>>categoryList (in category 'accessing') -----
>   categoryList
> + 
> +        ^ categoryList ifNil: [categoryList := OrderedCollection new
> -        ^OrderedCollection new
>                  add:  self allCategoryLabel;
> +                addAll: (preferences categoryList collect: [:ea | ea capitalized]) sorted;
> -                addAll: preferences categoryList sorted;
>                  add: self searchResultsCategoryLabel;
> +                yourself].
> -                yourself.
>          
>          !
> 
> Item was changed:
>   ----- Method: PreferenceBrowser>>defaultSelected (in category 'preferences search') -----
>   defaultSelected
>   
>          (Project uiManager 
> +                confirm: 'Do you really want to restore the default preferences?\\If you want to keep the current state, you have to save it first.' translated withCRs
> +                title: 'Restore Default Preferences')
> -                confirm: 'Do you really want to restore the default\preferences?\\If you want to keep the current state,\you have to save it first.' translated withCRs
> -                title: 'Restore Preferences')
>                          ifFalse: [^ self].
>   
>          Preferences chooseInitialSettings.!
> 
> Item was changed:
>   ----- Method: PreferenceBrowser>>loadFromDiskSelected (in category 'preferences search') -----
>   loadFromDiskSelected 
>   
>          (Project uiManager
> +                confirm: 'Do you really want to restore your personal preferences from disk?\\The file ''my.prefs'' will be loaded.' translated withCRs
> +                title: 'Restore Preferences from Disk' translated) ifFalse: [^ self].
> -                confirm: 'Do you really want to restore your\personal preferences from disk?\\The file ''my.prefs'' will be loaded.' translated withCRs
> -                title: 'Restore Preferences from Disk') ifFalse: [^ self].
>   
>          preferences restorePreferencesFromDisk!
> 
> Item was changed:
>   ----- Method: PreferenceBrowser>>loadSelected (in category 'preferences search') -----
>   loadSelected
>   
>          (Project uiManager
> +                confirm: 'Do you really want to restore your personal preferences?' translated
> -                confirm: 'Do you really want to restore\your personal preferences?' translated withCRs
>                  title: 'Restore Preferences') ifFalse: [^ self].
>                  
>          preferences restorePersonalPreferences.!
> 
> Item was added:
> + ----- Method: PreferenceBrowser>>numPreferencesInCategory: (in category 'accessing') -----
> + numPreferencesInCategory: aCategory
> + 
> +        aCategory = self allCategoryLabel
> +                ifTrue: [^ preferences allPreferences size].
> +        aCategory = self searchResultsCategoryLabel
> +                ifTrue: [^ self searchResults size].
> +        ^ (preferences preferencesInCategory: aCategory) size!
> 
> Item was changed:
>   ----- Method: PreferenceBrowser>>saveSelected (in category 'preferences search') -----
>   saveSelected
>   
>          (Project uiManager
> +                confirm: 'Do you really want to overwrite your personal preferences?' translated
> -                confirm: 'Do you really want to overwrite\your personal preferences?' translated withCRs
>                  title: 'Save Preferences') ifFalse: [^ self].
>   
>          preferences savePersonalPreferences.!
> 
> Item was changed:
>   ----- Method: PreferenceBrowser>>saveToDiskSelected (in category 'preferences search') -----
>   saveToDiskSelected 
>   
>          (Project uiManager
> +                confirm: 'Do you really want to overwrite your personal preferences on disk?\\The file ''my.prefs'' will be updated.' translated withCRs
> +                title: 'Save Preferences to Disk' translated) ifFalse: [^ self].
> -                confirm: 'Do you really want to overwrite your\personal preferences on disk?\\The file ''my.prefs'' will be updated.' translated withCRs
> -                title: 'Save Preferences to Disk') ifFalse: [^ self].
>                  
>          preferences storePreferencesToDisk!
> 
> Item was changed:
>   ----- Method: PreferenceBrowser>>searchPreferencesFor: (in category 'preferences search') -----
>   searchPreferencesFor: pattern
>          | result |
>          result := pattern asString asLowercase withBlanksTrimmed.
>          result ifEmpty: [^self].
>          searchResults := self allPreferences select: [:aPreference |
>                  ((aPreference name includesSubstring: result caseSensitive: false)
>                          or: [aPreference helpString includesSubstring: result caseSensitive: false])
> +                        or: [aPreference codeString includesSubstring: result caseSensitive: false] ].
> +        self updateSearchResultsLabel.
> -                        or: [aPreference codeString includesSubstring: result caseSensitive: false] ].          
>          self selectSearchResultsCategory.
>          self lastExecutedSearch: pattern.
>   !
> 
> Item was changed:
>   ----- Method: PreferenceBrowser>>selectedCategoryPreferences (in category 'accessing') -----
>   selectedCategoryPreferences
>          self allCategorySelected
>                  ifTrue: [^self allPreferences].
>          self searchResultsCategorySelected 
>                  ifTrue: [^self searchResults].
> +        ^ self selectedCategory
> +                ifNil: [#()]
> +                ifNotNil: [:cat | self preferencesInCategory: cat]
> -        ^self preferencesInCategory: self selectedCategory.
>          !
> 
> Item was added:
> + ----- Method: PreferenceBrowser>>updateSearchResultsLabel (in category 'user interface') -----
> + updateSearchResultsLabel
> + 
> +        self categoryLabelList
> +                at: self categoryLabelList size
> +                put: ('{1} ({2})' format: {
> +                        self searchResultsCategoryLabel.
> +                        self searchResults size }).
> +        self changed: #categoryLabelList.!
> 
> Item was changed:
>   ----- Method: PreferenceBrowserMorph>>basicButton (in category 'submorphs - buttons') -----
>   basicButton
>   
>          ^ PluggableButtonMorph new
>                  model: self model;
> -                offColor: self paneColor;
>                  hResizing: #spaceFill;
>                  vResizing: #spaceFill;
>                  yourself!
> 
> Item was changed:
>   ----- Method: PreferenceBrowserMorph>>helpButton (in category 'submorphs - buttons') -----
>   helpButton
>          ^helpButton ifNil: 
>                  [helpButton := self basicButton 
>                                                  label: 'help' translated; 
> +                                                setBalloonText: 'Click here to get some hints on use of this Preferences Panel' translated;
> -                                                setBalloonText: 
> -                                                        'Click here to get some hints on use of this Preferences ',
> -                                                        'Panel' translated;
>                                                  action: #helpSelected]!
> 
> Item was changed:
>   ----- Method: PreferenceBrowserMorph>>loadButton (in category 'submorphs - buttons') -----
>   loadButton
>          ^loadButton ifNil: 
>                  [loadButton := self basicButton 
>                                                  label: 'load' translated; 
>                                                  action: #loadSelected;                                          
> +                                                setBalloonText: 'Click here to reset all the preferences to their values in your Personal Preferences.' translated]!
> -                                                setBalloonText: 
> -                                                        'Click here to reset all the preferences to their values ',
> -                                                        'in your Personal Preferences.' translated]!
> 
> Item was changed:
>   ----- Method: PreferenceBrowserMorph>>loadFromDiskButton (in category 'submorphs - buttons') -----
>   loadFromDiskButton
>          ^loadFromDiskButton ifNil: 
>                  [loadFromDiskButton := self basicButton 
>                                                  label: 'load from disk' translated; 
>                                                  action: #loadFromDiskSelected;                                          
> +                                                setBalloonText: 'Click here to load all the preferences from their saved values on disk.' translated]!
> -                                                setBalloonText: 
> -                                                        'Click here to load all the preferences from ',
> -                                                        'their saved values on disk.' translated]!
> 
> Item was changed:
>   ----- Method: PreferenceBrowserMorph>>newButtonRow (in category 'submorphs - buttons') -----
>   newButtonRow
>          ^BorderedMorph new
>                  color: Color transparent;
>                  borderWidth: 0;
> +                cellGap: ToolBuilder default panelSpacing;
> -                cellGap: 2;
>                  layoutPolicy: TableLayout new;
>                  listDirection: #leftToRight;
>                  listCentering: #topLeft;
>                  cellPositioning: #topLeft;
>                  on: #mouseEnter send: #paneTransition: to: self;
>                  on: #mouseLeave send: #paneTransition: to: self;
>                  addMorphBack: self defaultButton;
>                  addMorphBack: self newSeparator;
>                  addMorphBack: self saveButton;
>                  addMorphBack: self loadButton;
>                  addMorphBack: self newSeparator;
>                  addMorphBack: self saveToDiskButton;
>                  addMorphBack: self loadFromDiskButton;
>                  addMorphBack: self newSeparator;
>                  addMorphBack: self themeButton;
>                  addMorphBack: self newTransparentFiller;
>                  addMorphBack: self helpButton;
>                  yourself.!
> 
> Item was changed:
>   ----- Method: PreferenceBrowserMorph>>newCategoryList (in category 'submorphs - category list') -----
>   newCategoryList 
>          ^(PluggableListMorph
>                  on: self model
> +                list: #categoryLabelList
> -                list: #categoryList
>                  selected: #selectedCategoryIndex
>                  changeSelected: #selectedCategoryIndex:)
>                          hResizing: #spaceFill;
>                          vResizing: #spaceFill;
>                          layoutFrame: (LayoutFrame fractions: (0 at 0 corner: 0.25 at 1));
>                          yourself.!
> 
> Item was changed:
>   ----- Method: PreferenceBrowserMorph>>newSeparator (in category 'submorphs - buttons') -----
>   newSeparator
> +        ^ Morph new
> +                color: Color transparent;
> +                width: (5 * RealEstateAgent scaleFactor) truncated;
> -        ^BorderedMorph new
> -                borderWidth: 2;
> -                borderColor: Color transparent;
> -                color: self paneColor;
> -                hResizing: #rigid;
> -                width: 5;
>                  vResizing: #spaceFill;
>                  yourself!
> 
> Item was changed:
>   ----- Method: PreferenceBrowserMorph>>saveButton (in category 'submorphs - buttons') -----
>   saveButton
>          ^saveButton ifNil: 
>                  [saveButton := self basicButton 
>                                                  label: 'save' translated; 
>                                                  action: #saveSelected;                                          
> +                                                setBalloonText: 'Click here to save the current constellation of Preferences settings as your personal defaults; you can get them all reinstalled with a single gesture by clicking the "Restore my Personal Preferences".' translated]!
> -                                                setBalloonText: 
> -                                                        'Click here to save the current constellation of Preferences ',
> -                                                        'settings as your personal defaults; you can get them all ',
> -                                                        'reinstalled with a single gesture by clicking the "Restore ',
> -                                                        'my Personal Preferences".' translated]!
> 
> Item was changed:
>   ----- Method: PreferenceBrowserMorph>>saveToDiskButton (in category 'submorphs - buttons') -----
>   saveToDiskButton
>          ^saveToDiskButton ifNil: 
>                  [saveToDiskButton := self basicButton 
>                                                  label: 'save to disk' translated; 
>                                                  action: #saveToDiskSelected;                                            
> +                                                setBalloonText: 'Click here to save the current constellation of Preferences settings to a file; you can get them all reinstalled with a single gesture by clicking "Restore Settings From Disk".' translated]!
> -                                                setBalloonText: 
> -                                                        'Click here to save the current constellation of Preferences ',
> -                                                        'settings to a file; you can get them all reinstalled with a ', 
> -                                                        'single gesture by clicking "Restore Settings From Disk".'
> -                                                                 translated]!
> 
> Item was changed:
>   ----- Method: PreferenceBrowserMorph>>updateSelectedCategoryPreferences (in category 'updating') -----
>   updateSelectedCategoryPreferences
> + 
> +        | newPanel |
> +        self preferenceList vScrollBarValue: 0.
> +        self preferenceList scroller removeAllMorphs.
> + 
> +        (self model allCategorySelected or: [self model searchResultsCategorySelected])
> +                ifTrue: [Cursor wait showWhile: [newPanel := self newPreferenceListInnerPanel]]
> +                ifFalse: [newPanel := self newPreferenceListInnerPanel].
> +                
> +        self preferenceList scroller addMorphBack: newPanel.
> +        self adoptPaneColor: self paneColor.!
> -        Cursor wait showWhile: 
> -                [self preferenceList 
> -                                hScrollBarValue: 0;
> -                                vScrollBarValue: 0.
> -                self preferenceList scroller removeAllMorphs.
> -                self preferenceList scroller addMorphBack: self newPreferenceListInnerPanel.
> -                self adoptPaneColor: self paneColor]!




More information about the Squeak-dev mailing list