[squeak-dev] The Inbox: Tools-ct.962.mcz

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Tue Mar 24 18:33:49 UTC 2020


Hi Marcel,


I have found myself never being happy with a generated name - just because a computer cannot not know the semantics and the role I would like to give the just-dropped object. The first thing I do after dropping a variable is assigning it to another variable by hand, so for me, such a prompt would be really helpful. What about a preference for this particular behavior? :-)


> What about using String >> #findFeatures and a serial number that starts at 1 for each new workspace?

As a proposed value - interesting! But don't we want to support #externalName here?

Best,
Christoph

________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel
Gesendet: Montag, 23. März 2020 10:54:33
An: gettimothy via Squeak-dev
Betreff: Re: [squeak-dev] The Inbox: Tools-ct.962.mcz

Hi Christoph.

> - Ask for a useful variable name when dropping something into a workspace

Note that adding a disruptive prompt for the user is a substantial change to existing workflows. It would be better if one could come up with a better variable name automatically instead of prompting the user.

What about using String >> #findFeatures and a serial number that starts at 1 for each new workspace?

 a BorderedMorph(3550942) -> #(bordered morph) -> morph1

Best,
Marcel

Am 20.03.2020 18:58:29 schrieb commits at source.squeak.org <commits at source.squeak.org>:

Christoph Thiede uploaded a new version of Tools to project The Inbox:
http://source.squeak.org/inbox/Tools-ct.962.mcz

==================== Summary ====================

Name: Tools-ct.962
Author: ct
Time: 20 March 2020, 6:58:18.856237 pm
UUID: c4cbd7b0-ddf5-3b4b-93ed-55e5b2c80465
Ancestors: Tools-mt.955

Makes variable bindings in Workspace more comfortable:

- Ask for a useful variable name when dropping something into a workspace
- Validate variable name before creating inaccessible bindings
- Do not propose invalid names at all (for example, dropped class were given an invalid name in the past)
- Ask before removing variable bindings. This also increases responsiveness of the UI.
- Improves multilingual support

=============== Diff against Tools-mt.955 ===============

Item was changed:
----- Method: Workspace>>acceptDroppingMorph:event:inMorph: (in category 'drag and drop') -----
acceptDroppingMorph: dropee event: evt inMorph: targetMorph
+ "Return the dropee to its old position, and add a reference to it at the cursor point."
+
- "Return the dropee to its old position, and add a reference to it at the
- cursor point."
| bindingName externalName reference |
(dropee isKindOf: TransferMorph)
ifTrue: [reference := dropee passenger.
externalName := dropee passenger className]
ifFalse: [reference := dropee.
externalName := dropee externalName].
externalName := externalName isOctetString
+ ifTrue: [externalName]
+ ifFalse: ['a' , externalName].
+
+ bindingName := Project uiManager
+ request: 'Please enter a name for the dropped object:' translated
+ initialAnswer: (externalName withFirstCharacterDownshifted , reference identityHash printString) asLegalSelector.
+ bindingName isEmptyOrNil ifTrue: [^ false].
+ bindingName := Parser new parseSelector: bindingName.
+ bindingName ifNil: [
+ self inform: 'Invalid selector.' translated.
+ ^ false].
+
- ifTrue: [externalName]
- ifFalse: ['a' , externalName].
- bindingName := externalName withFirstCharacterDownshifted , reference identityHash printString.
- targetMorph correctSelectionWithString: bindingName , ' '.
(self bindingOf: bindingName)
value: reference.
+ targetMorph correctSelectionWithString: bindingName , ' '.
(dropee isKindOf: TransferMorph)
ifFalse: [dropee rejectDropMorphEvent: evt].
+ ^ true "success"!
- ^ true"success"!

Item was changed:
----- Method: Workspace>>addModelItemsToWindowMenu: (in category 'menu commands') -----
addModelItemsToWindowMenu: aMenu

aMenu addLine.
aMenu
+ add: 'save contents to file...' translated
- add: 'save contents to file...'
target: self
action: #saveContentsInFile.
aMenu
+ add: 'inspect variables' translated
- add: 'inspect variables'
target: self
action: #inspectBindings.
aMenu
+ add: 'reset variables' translated
- add: 'reset variables'
target: self
+ action: #resetBindings.
- action: #initializeBindings.
aMenu
addUpdating: #mustDeclareVariableWording
target: self
action: #toggleVariableDeclarationMode.
aMenu
addUpdating: #acceptDroppedMorphsWording
target: self
action: #toggleDroppingMorphForReference.

+ self addToggleStylingMenuItemTo: aMenu.!
- self addToggleStylingMenuItemTo: aMenu.
- !

Item was added:
+ ----- Method: Workspace>>resetBindings (in category 'menu commands') -----
+ resetBindings
+
+ (self bindings notEmpty ==> [self confirm: ('Are you sure you would like to remove {1} variables?' translated format: {self bindings size})])
+ ifFalse: [^ self].
+ self initializeBindings.!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200324/c011af3b/attachment.html>


More information about the Squeak-dev mailing list