-
Notifications
You must be signed in to change notification settings - Fork 0
/
SwaImageConfiguration.st
337 lines (253 loc) · 10.4 KB
/
SwaImageConfiguration.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
"-=-=-=-=-="
|progdir base options balloon|
"Initial Setup"
FileStream startUp: true.
TranscriptStream redirectToStdOut: true.
Deprecation showDeprecationWarnings: false.
"To account for an issue together with the current SwaSource"
MCHttpRepository useSharedWebClientInstance: false.
"The following code is copied from SmalltalkImage>>arguments which seems to return nil here ..."
options := Smalltalk commandLine arguments.
Transcript showln: 'Received options: ', options.
progdir := (Smalltalk commandLine argumentAt: 1) ifNil: [FileDirectory default fullName].
base := (Smalltalk commandLine argumentAt: 2) ifNil: ['SWA'].
[[MCMcmUpdater default doUpdate: false. "non-interactive"]
on: MCEmptyVersion do: [:warning | warning resume].
"-=-=-=-=-="
"For all trunk repositories add the inbox repository."
(MCWorkingCopy allManagers collect: #repositoryGroup) do: [:g |
g addRepository: ReleaseBuilder inboxRepository].
"-=-=-=-=-="
Installer ensureRecentMetacello.
"-=-=-=-=-="
Utilities setAuthorInitials: 'hpi'. "changed at end"
[(Smalltalk at: #Metacello) new
baseline: 'SwaLint';
repository: 'github://hpi-swa-teaching/SwaLint:main/packages';
get;
load: #default]
on: (Smalltalk at: #MetacelloSkipDirtyPackageLoad) new
do: [:e | e resume: false].
(Smalltalk at: #Metacello) new
baseline: 'Koans';
githubUser: 'HPI-SWA-Teaching' project: 'Koans' commitish: '' path: 'src';
load.
(Smalltalk at: #Metacello) new
configuration: 'RefactoringTools';
load.
"-=-=-=-=-="
"Install Squot SWA UI."
"[(Smalltalk at: #Metacello) new
baseline: 'Squot';
repository: 'github://hpi-swa/Squot:swa-ui/src';
load.
] on: Warning do: [:e | e resume]."
"The tools menu in the docking bar should use the swa git ui"
(Smalltalk at: #TheWorldMainDockingBar) compile: 'installAndOpenGitBrowser
self inform: ''Unavailable. Please use\ Apps > Git Browser\ Apps > Git Asset Browser'' withCRs.'.
"-=-=-=-=-="
"Install new Git Client made by Marius and Tom for WiSe 24/25"
Metacello new
baseline: 'GitS';
repository: 'github://hpi-swa/git-s:latest-release/src';
load.
"-=-=-=-=-="
(Smalltalk at: #Metacello) new
baseline: 'AutoTDD';
repository: 'github://hpi-swa-teaching/AutoTDD:master/packages';
onConflict: [:ex | ex allow];
load.
"-=-=-=-=-="
Preferences disable: #projectZoom.
Preferences enable: #mouseOverForKeyboardFocus.
Preferences disable: #alternativeBrowseIt.
SystemBrowser default: Browser.
TextEditor autoEnclose: false.
TextEditor destructiveBackWord: true.
Workspace shouldStyle: true.
SoundPlayer stopReverb.
"-=-=-=-=-="
Project current resourceManager reset.
Smalltalk cleanUp: true except: {Warning}.
MCHttpRepository clearCredentials.
Environment allInstancesDo: [:env | env purgeUndeclared].
Undeclared removeUnreferencedKeys.
Smalltalk garbageCollect.
"-=-=-=-=-="
Utilities setAuthorInitials: 'hpi'. "changed at end"
"-=-=-=-=-="
(Smalltalk at: #Metacello) new
repository: 'github://LinqLover/Squeak-TipOfTheDay/packages';
baseline: 'TipOfTheDay';
load.
"-=-=-=-=-="
(Smalltalk at: #Metacello) new
repository: 'github://MrModder/Autocompletion:master/packages';
baseline: 'Autocompletion';
load.
(Smalltalk at: #ECPreferences) perform: #smartCharacters: with: false.
(Smalltalk at: #ECPreferences) matchSubStrings: true.
"-=-=-=-=-="
(Smalltalk at: #Metacello) new
baseline: 'GameMecha';
repository: 'github://hpi-swa-teaching/GameMecha:main/src';
load: 'test'. "more examples and tests"
"-=-=-=-=-="
(Smalltalk at: #Metacello) new
repository: 'github://hpi-swa/signals:master/repository';
baseline: 'Signals';
load.
"-=-=-=-=-="
(Smalltalk at: #Metacello) new
repository: 'github://hpi-swa/animations:master/repository';
baseline: 'Animations';
load.
"-=-=-=-=-="
(Smalltalk at: #Metacello) new
baseline: 'MorphicTutorial';
repository: 'github://hpi-swa-teaching/SWT18-Project-06:master/packages';
load.
"-=-=-=-=-="
Metacello new
baseline: 'PoppyPrint';
repository: 'github://tom95/poppy-print/packages';
load.
Behavior compile: 'prettyPrinterClass ^ PPFormatter'.
"-=-=-=-=-="
"Do update again to update JSON, overwritten prior other projects."
[MCMcmUpdater default doUpdate: false. "non-interactive"]
on: MCEmptyVersion do: [:warning | warning resume].
"-=-=-=-=-="
"w shortcut to delete windows - experimental for SWA WiSe 23/24"
(Smalltalk at: #SystemWindow) compile: 'filterEvent: aKeyboardEvent for: anObject
"Provide keyboard shortcuts."
aKeyboardEvent isKeystroke
ifFalse: [^ aKeyboardEvent].
aKeyboardEvent hand halo ifNotNil: [ : halo | halo target isSystemWindow ifTrue: [ aKeyboardEvent hand removeHalo ] ].
aKeyboardEvent commandKeyPressed ifTrue: [
aKeyboardEvent keyCharacter caseOf: {
[$\] -> [self class sendTopWindowToBack].
[Character escape] -> [self class deleteTopWindow].
[$w] -> [self class deleteTopWindow].
[$/] -> [self class bringWindowUnderHandToFront].
} otherwise: [^ aKeyboardEvent "no hit"].
^ aKeyboardEvent ignore "hit!!"].
aKeyboardEvent controlKeyPressed ifTrue: [
aKeyboardEvent keyCharacter caseOf: {
[Character escape] -> [self world findWindow: aKeyboardEvent].
} otherwise: [^ aKeyboardEvent "no hit"].
^ aKeyboardEvent ignore "hit!!"].
^ aKeyboardEvent "no hit"'.
"-=-=-=-=-="
"Remove Git Updates from PreferenceWizard as we use a special git version"
(Smalltalk at: #PreferenceWizardMorph) compile: 'initializePage99ExtraPackages
"Let the user install extra packages."
| currentPage packagesList installButton |
currentPage := self createPage.
currentPage
cellPositioning: #topCenter;
addMorphBack: self createHorizontalSpacer;
addMorphBack: ((self createLabel: ''Do you want to install extra packages?'' translated color: Color white)
hResizing: #shrinkWrap;
averageLineLength: 65;
yourself);
addMorphBack: ((self createLabel: ''Note that the installation process requires a network connection with Internet access and might take several minutes.'' translated color: (Color gray: 0.9))
hResizing: #shrinkWrap;
averageLineLength: 65;
yourself).
currentPage submorphs last text addAttribute: TextAlignment centered.
currentPage submorphs last layoutChanged.
currentPage addMorphBack: (self createVerticalSpace height: self layoutInset).
packagesList := self createScrollPane.
packagesList
width: (self defaultTextStyle compositionWidthFor: 65);
hResizing: #rigid;
vResizing: #spaceFill.
packagesList scroller firstSubmorph addAllMorphsBack: {
self createCheckbox: ''Latest system updates'' translated for: #InstallLatestUpdates help: ''Install the latest patches for '' translated, SystemVersion current version.
self createCheckbox: ''Foreign function interface (FFI)'' translated for: #InstallFFI help: ''FFI, the Squeak Foreign Function Interface, is used to call functions located in shared libraries that are not part of the Squeak VM nor its plugins'' translated.
self createCheckbox: ''Access OS functions'' translated for: #InstallOSProcess help: ''OSProcess provides access to operating system functions, including pipes and child process creation'' translated.
self createCheckbox: ''Integrate Squeak''''s mailing lists'' translated for: #InstallSqueakInboxTalk help: ''Through Squeak Inbox Talk, you can engage with our community from within Squeak using tools that integrate our mailing lists such as squeak-dev and vm-dev'' translated.
}.
currentPage addMorphBack: packagesList.
currentPage addMorphBack: ((self createLabel: ''Find more on www.squeak.org/projects'' color: (Color gray: 0.9))
hResizing: #shrinkWrap; yourself).
installButton := self createButton
action: #installExtraPackagesVia:;
label: ''Yes, install selected packages.'' translated;
yourself.
installButton
setProperty: #label toValue: installButton label;
arguments: {installButton}.
currentPage addMorphBack: installButton.
currentPage addMorphBack: (self createButton action: #showSqueak; label: ''No, maybe later.'' translated).
^ currentPage'.
"-=-=-=-=-="
(options includes: '-startrack') ifTrue:
[(Smalltalk at: #Metacello) new
baseline: 'StarTrack';
repository: 'github://hpi-swa-lab/learning-liveness/packages';
load: 'client'].
"-=-=-=-=-="
MCFileBasedRepository flushAllCaches.
MCCacheRepository instVarNamed: 'default' put: nil.
ChangeSet current clear.
ChangeSet current name: 'Unnamed1'.
Smalltalk garbageCollect.
MCCacheRepository cacheDirectory recursiveDelete.
Smalltalk fixObsoleteReferences.
"-=-=-=-=-="
Utilities setAuthorInitials: 'hpi'. "changed at end"
#(('/HPIicon.png' 'smallFullscreenOnIcon') ('/HPIicon_sw.png' 'smallFullscreenOffIcon')) do: [:info | | image stream |
FileStream fileNamed: (progdir , info first) do: [:f | |writer |
writer := PNGReadWriter on: f.
image := [writer nextImage] ensure: [writer close]].
"store string representation"
stream := String new writeStream.
stream
nextPutAll: info last, 'Contents' ; cr;
nextPutAll: (MenuIcons methodStart: (info last)).
image storeOn: stream.
stream nextPutAll: MenuIcons methodEnd.
MenuIcons class compile: stream contents classified: '*HPI-private icons-override' notifying: nil.
"create accessor method"
stream := String new writeStream.
stream
nextPutAll: info last ; cr;
nextPutAll: (MenuIcons methodAccessorFor: (info last)).
MenuIcons class compile: stream contents classified: '*HPI-accessing icons-override' notifying: nil.
].
MenuIcons initializeIcons.
"Load fancy clean Arc UI theme."
FileStream
fileNamed: progdir, '/arc-theme.cs'
do: [:stream | stream fileIn].
(Smalltalk at: #ArcDarkTheme) create.
(Smalltalk at: #ArcLightTheme) create.
"Patch drag-drop issue in tree morphs."
FileStream
fileNamed: progdir, '/fix-tree-dragdrop.cs'
do: [:stream | stream fileIn].
Utilities setAuthorInitials: String empty.
Smalltalk garbageCollect.
"-=-=-=-=-="
Project current in: [:oldProject |
WorldState addDeferredUIMessage: [
ReleaseBuilder configureProjects.
Model useColorfulWindows: false.
(UserInterfaceTheme named: 'Arc (light)') applyScaled.
ReleaseBuilder deleteAllWindows.
ReleaseBuilder deleteAllOtherMorphs.
[Flaps disableGlobalFlaps] valueSupplyingAnswer: true.
balloon := Form fromFileNamed: progdir, '/balloon.png'.
WorldState addDeferredUIMessage: [
ReleaseBuilder openWelcomeWorkspacesWith: nil.
PreferenceWizardMorph open].
Project current world doOneCycle.
Display platformScaleFactor: 1.0.
ReleaseBuilder setDisplayExtent: 1024@768.
Smalltalk snapshot: true andQuit: true.
].
(Smalltalk at: #AnimMorphicProject) new enter: false.
]] ensure: [
TranscriptStream redirectToStdOut: false.]