Loading features via code

72 views
Skip to first unread message

Louis LaBrunda

unread,
Feb 8, 2021, 10:35:13 AM2/8/21
to VA Smalltalk
Hi Everyone,

As an outgrowth of the conversation about loading features being different and better than just loading configuration maps, I decided automate loading features with code.  I extended #AbtFeatureLoader with #loadFeaturesNamed: to aid that effort (see below).  It takes a list of feature names and loads them.  It seems to work but the code that loads features is very tied to the window that displays the available features that it is hard to be sure I have done everything right.  Instantiations should feel free to incorporate it or something like it into the product.

I have also included below (note this new Google group thing wouldn't take the attachement) the abt.cnf that I use.  It is very much tired to how I work but it uses the extended code to load features, so you can see how that is done.  I use separate images for each program or application I work on.  When I start new development or am ready to package an image, I start with a clean image like the one supplied with a new version of VA Smalltalk v9.2.2.  Before making this extension I would have to load features and configuration maps.  Now, the abt.cnf does that and other stuff for me.

Lou

loadFeaturesNamed: aListOfFeatureNames
| theFeatures |

self getPatternsForFeatures.
theFeatures := OrderedCollection new.
aListOfFeatureNames asSet do: [:aMapName | | hidden |
hidden := self isHiddenFeature: aMapName.
(AbtFeatureLoader checkIfValidFeature: aMapName) ifNotNil: [:map |
theFeatures add: ((AbtFeatureMap map: map loader: self) visible: hidden not; yourself).
].
].
theFeatures do: [:aFeature | | prereqs |
"Find the immediate prerequisite features for aFeature"
prereqs := aFeature prereqs.
prereqs do: [:aPrereqFeature |
aFeature prerequisiteFeatures add: aPrereqFeature.
aPrereqFeature dependentFeatures add: aFeature.
].
].
self loadFeatures: theFeatures.

PostStartUp!

StsPowerTools
parseTreeMaxMethodTextSize: SmallInteger largest;
updateStyling;
superUser: true.

[ | fontName fontStruct |
fontName := ('WIN*' match: (System subsystemType: #CW))
ifTrue: ['-microsoft-times new roman-medium-r-normal--19-140-96-96-p-0-iso8859-1']
ifFalse: ['-bitstream-bitstream charter-medium-r-normal--19-180-75-75-p-102-iso10646-1'].
(fontStruct := CgDisplay default loadQueryFont: fontName) notNil
ifTrue: [EtWindow updateFontList: (CwFontList fontStruct: fontStruct)]
ifFalse: [CwMessagePrompter errorMessage: (NlsCatEST indexedMsg: 5)]. "$NLS$ Failed to load font"
] value.

Transcript shell osWidget disable.
Transcript shell osWidget class busyCursor.
AbtApplicationsOrganizerView current showBusyCursor.
(EmConfigurationMap editionsFor: 'KscFeatureLoaderExtensions') first isLoaded ifFalse: [

(EmConfigurationMap editionsFor: 'KscFeatureLoaderExtensions') first loadWithRequiredMapsAndTracing: true.
(EmConfigurationMap editionsFor: 'KscNonVisualDev') first loadWithRequiredMapsAndTracing: true.

[ | stream featureNames localPath |
localPath := CfsDirectoryDescriptor getcwd, CfsDirectoryDescriptor pathSeparatorString.
stream := CfsReadFileStream open: (localPath, 'FeaturesToLoad.Txt').
featureNames := OrderedCollection new.
[stream atEnd] whileFalse: [featureNames add: stream nextLine trimBlanks].
stream close.
featureNames notEmpty ifTrue: [AbtFeatureLoader new loadFeaturesNamed: featureNames].
] value.

].


Transcript shell osWidget disable.
Transcript shell osWidget class busyCursor.
AbtApplicationsOrganizerView current showBusyCursor.

(AbtApplicationsOrganizerView current respondsTo: #fullMenus:) ifTrue: [AbtApplicationsOrganizerView current fullMenus: true].

[ | appPrefixes |
appPrefixes := AbtApplicationsOrganizerView applicationPrefixes asSet.
appPrefixes addAll: #('Ksc' 'TestKsc').
AbtApplicationsOrganizerView applicationPrefixes: appPrefixes asSortedCollection.
AbtApplicationsOrganizerView applicationsShow: ##matchingPrefixes.
] value.

(AbtApplicationsOrganizerView current respondsTo: #addOptionsMenuItemsToOrganizer) ifTrue: [AbtApplicationsOrganizerView current addOptionsMenuItemsToOrganizer].
(StsAbtApplicationsOrganizerView current respondsTo: #addApplicationsLoadMenuItemsToOrganizer) ifTrue: [StsAbtApplicationsOrganizerView current addApplicationsLoadMenuItemsToOrganizer].

(StsAbtApplicationsOrganizerView current respondsTo: #addClassesMenuItemsToOrganizer) ifTrue: [StsAbtApplicationsOrganizerView current addClassesMenuItemsToOrganizer].

AbtPreferencesBrowsersObject current
standardBrowsers: 1; "Enhanced"
autoRefresh: true;
confirmOnDelete: false;
selectAllApps: true;
selectAllCategories: true;
showCategory: true;
showHSB: false.

AbtPreferencesCEObject current
shapeWidth: 3;
showConnectionsOnOpen: false;
showSourceIndication: true.
EtWindow defaultWindowSize: 900@500.
StsConfirmationDialog answerFor: 'Find String' put: true.

AbtApplicationsOrganizerView current applicationsRefreshNow.

[ | stream appName className localPath |
localPath := CfsDirectoryDescriptor getcwd, CfsDirectoryDescriptor pathSeparatorString.
stream := CfsReadFileStream open: (localPath, 'AppNameToSelect.Txt').
appName := stream nextLine trimBlanks.
className := stream nextLine trimBlanks.
stream close.
(appName notEmpty & className notEmpty) ifTrue: [Compiler evaluate: ('AbtApplicationsOrganizerView current selectClass: ', className, ' inApplication: ', appName) for: nil ifFail: [:e | Transcript show: e message]].
] value.

Transcript shell x: 225; y: 660; height: 365.

AbtApplicationsOrganizerView current x: 270; y: 150; setFocus.
AbtApplicationsOrganizerView current resetCursor.
Transcript shell osWidget enable.
Transcript shell osWidget class resetCursor.

Louis LaBrunda

unread,
Feb 10, 2021, 12:23:46 PM2/10/21
to VA Smalltalk
Hi Everyone,

I have made some changes to my abt.cnf file (see below).  I added some comments and the ability to load configurations maps from a list in a file.  I keep trying to add the file as an attachement but no joy.

 Lou

PostStartUp!

" set some settings."
StsPowerTools
parseTreeMaxMethodTextSize: SmallInteger largest;
updateStyling;
superUser: true.

" More settings like fonts I like."
[ | fontName fontStruct |
fontName := ('WIN*' match: (System subsystemType: #CW))
ifTrue: ['-microsoft-times new roman-medium-r-normal--19-140-96-96-p-0-iso8859-1']
ifFalse: ['-bitstream-bitstream charter-medium-r-normal--19-180-75-75-p-102-iso10646-1'].
(fontStruct := CgDisplay default loadQueryFont: fontName) notNil
ifTrue: [EtWindow updateFontList: (CwFontList fontStruct: fontStruct)]
ifFalse: [CwMessagePrompter errorMessage: (NlsCatEST indexedMsg: 5)]. "$NLS$ Failed to load font"
] value.

" Disable the windows and show busy cursor."
Transcript shell osWidget disable.
Transcript shell osWidget class busyCursor.
AbtApplicationsOrganizerView current showBusyCursor.
" Test to see if this is a clean image.  If not, load things we need to load features."
(EmConfigurationMap editionsFor: 'KscFeatureLoaderExtensions') first isLoaded ifFalse: [

(EmConfigurationMap editionsFor: 'KscFeatureLoaderExtensions') first loadWithRequiredMapsAndTracing: true.

" Read the file of features to load and load them."
[ | stream featureNames localPath |
localPath := CfsDirectoryDescriptor getcwd, CfsDirectoryDescriptor pathSeparatorString.
stream := CfsReadFileStream open: (localPath, 'FeaturesToLoad.Txt').
featureNames := OrderedCollection new.
[stream atEnd] whileFalse: [featureNames add: stream nextLine trimBlanks].
stream close.
featureNames notEmpty ifTrue: [AbtFeatureLoader new loadFeaturesNamed: featureNames].
] value.

" Read the file of maps to load and load them."
[ | stream mapNames localPath |
localPath := CfsDirectoryDescriptor getcwd, CfsDirectoryDescriptor pathSeparatorString.
stream := CfsReadFileStream open: (localPath, 'MapsToLoad.Txt').
mapNames := OrderedCollection new.
[stream atEnd] whileFalse: [mapNames add: stream nextLine trimBlanks].
stream close.
mapNames do: [:map |
(EmConfigurationMap editionsFor: map) first loadWithRequiredMapsAndTracing: true.
].
] value.

].


" Disable the windows and show busy cursor again, just ine case."
Transcript shell osWidget disable.
Transcript shell osWidget class busyCursor.
AbtApplicationsOrganizerView current showBusyCursor.

" More settings."
(AbtApplicationsOrganizerView current respondsTo: #fullMenus:) ifTrue: [AbtApplicationsOrganizerView current fullMenus: true].

[ | appPrefixes |
appPrefixes := AbtApplicationsOrganizerView applicationPrefixes asSet.
appPrefixes addAll: #('Ksc' 'TestKsc').
AbtApplicationsOrganizerView applicationPrefixes: appPrefixes asSortedCollection.
AbtApplicationsOrganizerView applicationsShow: ##matchingPrefixes.
] value.

" Add some menu options."
(AbtApplicationsOrganizerView current respondsTo: #addOptionsMenuItemsToOrganizer) ifTrue: [AbtApplicationsOrganizerView current addOptionsMenuItemsToOrganizer].
(StsAbtApplicationsOrganizerView current respondsTo: #addApplicationsLoadMenuItemsToOrganizer) ifTrue: [StsAbtApplicationsOrganizerView current addApplicationsLoadMenuItemsToOrganizer].

(StsAbtApplicationsOrganizerView current respondsTo: #addClassesMenuItemsToOrganizer) ifTrue: [StsAbtApplicationsOrganizerView current addClassesMenuItemsToOrganizer].

" More settings."
AbtPreferencesBrowsersObject current
standardBrowsers: 1; "Enhanced"
autoRefresh: true;
confirmOnDelete: false;
selectAllApps: true;
selectAllCategories: true;
showCategory: true;
showHSB: false.

AbtPreferencesCEObject current
shapeWidth: 3;
showConnectionsOnOpen: false;
showSourceIndication: true.
EtWindow defaultWindowSize: 900@500.
StsConfirmationDialog answerFor: 'Find String' put: true.

" Refresh things."
AbtApplicationsOrganizerView current applicationsRefreshNow.

" Read a file that tells us which application and class to select."
[ | stream appName className localPath |
localPath := CfsDirectoryDescriptor getcwd, CfsDirectoryDescriptor pathSeparatorString.
stream := CfsReadFileStream open: (localPath, 'AppNameToSelect.Txt').
appName := stream nextLine trimBlanks.
className := stream nextLine trimBlanks.
stream close.
(appName notEmpty & className notEmpty) ifTrue: [Compiler evaluate: ('AbtApplicationsOrganizerView current selectClass: ', className, ' inApplication: ', appName) for: nil ifFail: [:e | Transcript show: e message]].
] value.

" Move windows around, reset and enable windows and cursor."

Richard Sargent

unread,
Feb 10, 2021, 2:02:36 PM2/10/21
to VA Smalltalk
On Wednesday, February 10, 2021 at 9:23:46 AM UTC-8 L...@Keystone-Software.com wrote:
Hi Everyone,

I have made some changes to my abt.cnf file (see below).  I added some comments and the ability to load configurations maps from a list in a file.  I keep trying to add the file as an attachement but no joy.

Long ago, Windows would refuse to display the extension for these files and would display an unusual icon for them. Looking up .cnf suggests it was used for telnet configurations. I don't know what format the file actually was, but it's always been a problematic thing. So, I am not surprised attaching it is a problem. Add your initials or some other suffix or second extension and you should be able to attach it.

Louis LaBrunda

unread,
Feb 10, 2021, 2:32:35 PM2/10/21
to VA Smalltalk
Hi Richard,

It is a simple text file and I tried with an extent of .txt, that didn't work.  Now with .cnf_LL.  That failed.

Lou

Louis LaBrunda

unread,
Feb 10, 2021, 2:34:50 PM2/10/21
to VA Smalltalk
Opps, hit send by accident.  Now trying abt.LL.  That failed.  can someone try to attach anything?

Lou

Richard Sargent

unread,
Feb 10, 2021, 3:47:44 PM2/10/21
to VA Smalltalk
This is an attempt to attach a .cnf file via replying to the email notification of your post.


On Wed, Feb 10, 2021 at 11:34 AM Louis LaBrunda <L...@keystone-software.com> wrote:
Opps, hit send by accident.  Now trying abt.LL.  That failed.  can someone try to attach anything?

Lou

--
You received this message because you are subscribed to a topic in the Google Groups "VA Smalltalk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/va-smalltalk/2CiRlEBxv1U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to va-smalltalk...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/ac615b00-2e77-4053-8125-b9abf9b5906fn%40googlegroups.com.
abt.cnf

Richard Sargent

unread,
Feb 10, 2021, 3:50:47 PM2/10/21
to VA Smalltalk
And, this is an attempt to attach a .cnf file via replying through the forum.

And it fails, with the wonderfully helpful "It didn't work" diagnostic message. (Not exactly those words, but certainly the sentiment!)

Louis LaBrunda

unread,
Feb 10, 2021, 5:13:50 PM2/10/21
to VA Smalltalk
I hate the new Google Groups system/format/layout/what_ever_the_hell_they_call_it.  And not just because of this.

Seth Berman

unread,
Feb 10, 2021, 5:38:44 PM2/10/21
to VA Smalltalk
+1
I hate it too:(

Richard Sargent

unread,
Feb 10, 2021, 5:54:56 PM2/10/21
to VA Smalltalk
It does seem to be human factors hostile.

Louis LaBrunda

unread,
Feb 12, 2021, 12:26:30 PM2/12/21
to VA Smalltalk
Hey Seth,

Maybe Instantiations could build or aid in the building of a VA Smalltalk/Seaside replacement.  I'm sure it would be better than this google stuff and could show interested parties what can be done with the product.

It might even be able to run on a Raspberry Pi 4 from your house:))) but that is probably pushing it.

Lou

Seth Berman

unread,
Feb 12, 2021, 3:48:37 PM2/12/21
to VA Smalltalk
Hi Lou,

Instantiations has many higher priority items to address for our customers and our resources must be applied there.
But, it's an interesting idea and I certainly would applaud and encourage anyone that wants to start that project and give it a go.
It certainly sounds like a project that I might personally contribute to in my "free time".

"I'm sure it would be better than this google stuff"
- Knowing the skills, abilities and work-ethic of my staff, I will confidently respond with "yes...it would be".

Have a great weekend!

- Seth

Louis LaBrunda

unread,
Feb 12, 2021, 4:45:22 PM2/12/21
to VA Smalltalk
Hi Seth,

I know you guys are busy with much more important stuff.  I admit it was a somewhat tongue in cheek suggestion.  I don't know if I want to take it on myself but I would also probably try to contribute.

Lou

Richard Sargent

unread,
Feb 12, 2021, 4:56:46 PM2/12/21
to VA Smalltalk
Well, if you do take it on, you might want to look at using Pier for the foundation.

--
You received this message because you are subscribed to a topic in the Google Groups "VA Smalltalk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/va-smalltalk/2CiRlEBxv1U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to va-smalltalk...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages