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.!
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@source.squeak.org commits@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.!
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@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@source.squeak.org commits@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.!
On 25/03/20 12:03 AM, Thiede, Christoph wrote:
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? :-)
You could generate a name and leave it selected, like in the result of printIt. If you don't like the name, just type the new name as usual. But if the name is okay, then press right arrow and continue with the rest of the line. This will go with the flow.
Regards .. Subbu
Sounds good. It is also very easy to rename the generated variable. In the workspace just type: "preferredName := " then drop the object. No need for a disruptive dialog window.
Still -1 for the extra dialog window.
Best, Marcel
Am 24.03.2020 20:38:02 schrieb K K Subbu kksubbu.ml@gmail.com: On 25/03/20 12:03 AM, Thiede, Christoph wrote:
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? :-)
You could generate a name and leave it selected, like in the result of printIt. If you don't like the name, just type the new name as usual. But if the name is okay, then press right arrow and continue with the rest of the line. This will go with the flow.
Regards .. Subbu
What about a preference for this particular behavior? :-)
That's even worse for this issue here. ;-) I think we can do better.
Best, Marcel Am 25.03.2020 09:23:01 schrieb Marcel Taeumel marcel.taeumel@hpi.de: Sounds good. It is also very easy to rename the generated variable. In the workspace just type: "preferredName := " then drop the object. No need for a disruptive dialog window.
Still -1 for the extra dialog window.
Best, Marcel
Am 24.03.2020 20:38:02 schrieb K K Subbu kksubbu.ml@gmail.com: On 25/03/20 12:03 AM, Thiede, Christoph wrote:
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? :-)
You could generate a name and leave it selected, like in the result of printIt. If you don't like the name, just type the new name as usual. But if the name is okay, then press right arrow and continue with the rest of the line. This will go with the flow.
Regards .. Subbu
Hi Marcel, hi Subbu,
You could generate a name and leave it selected, like in the result of printIt. If you don't like the name, just type the new name as usual.
In the workspace just type: "preferredName := " then drop the object.
But this will still force me to rename the variable manually. Your proposed workflow requires me to 1. prepare the workspace, 2. perform the drag-drop gesture, and 3. execute the do-it. And the bindings of the workspace will be polluted with the ugly name anyway. :-)
Personally, I very rarely use this feature because this is so complicated. I would still like a preference for this, but I think a prefilled dialog window would not be more disruptive than doing a manual assignment first.
(PS: Just another bug I did not yet find the time to fix - since the Inspector refactoring, you cannot even longer drag the object from an inspector field into a workspace. Instead, you will always end up with a variable pointing to the InspectorField instance itself ...)
Best, Christoph
--- Sent from Squeak Inbox Talk
On 2020-03-25T09:23:41+01:00, marcel.taeumel@hpi.de wrote:
What about a preference for this particular behavior? :-)
That's even worse for this issue here. ;-) I think we can do better.
Best, Marcel Am 25.03.2020 09:23:01 schrieb Marcel Taeumel <marcel.taeumel at hpi.de>: Sounds good. It is also very easy to rename the generated variable. In the workspace just type: "preferredName := " then drop the object. No need for a disruptive dialog window.
Still -1 for the extra dialog window.
Best, Marcel
Am 24.03.2020 20:38:02 schrieb K K Subbu <kksubbu.ml at gmail.com>: On 25/03/20 12:03 AM, Thiede, Christoph wrote:
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? :-)
You could generate a name and leave it selected, like in the result of printIt. If you don't like the name, just type the new name as usual. But if the name is okay, then press right arrow and continue with the rest of the line. This will go with the flow.
Regards .. Subbu
Hi Christoph --
Be careful to integrate the latest changes to #addModelItemstoWindowMenu and use #resetBindings instead of #initializeBindings.
#asLegalSelector does #withFirstCharacterDownshifted already.
Do not cancel the drop if the user entered an illegal selector but repeat the process until the user cancels it explicitly.
Other than that: Sure, go ahead.
Best, Marcel
Am 06.12.2021 20:03:17 schrieb christoph.thiede@student.hpi.uni-potsdam.de christoph.thiede@student.hpi.uni-potsdam.de: Hi Marcel, hi Subbu,
You could generate a name and leave it selected, like in the result of printIt. If you don't like the name, just type the new name as usual.
In the workspace just type: "preferredName := " then drop the object.
But this will still force me to rename the variable manually. Your proposed workflow requires me to 1. prepare the workspace, 2. perform the drag-drop gesture, and 3. execute the do-it. And the bindings of the workspace will be polluted with the ugly name anyway. :-)
Personally, I very rarely use this feature because this is so complicated. I would still like a preference for this, but I think a prefilled dialog window would not be more disruptive than doing a manual assignment first.
(PS: Just another bug I did not yet find the time to fix - since the Inspector refactoring, you cannot even longer drag the object from an inspector field into a workspace. Instead, you will always end up with a variable pointing to the InspectorField instance itself ...)
Best, Christoph
--- Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk]
On 2020-03-25T09:23:41+01:00, marcel.taeumel@hpi.de wrote:
What about a preference for this particular behavior? :-)
That's even worse for this issue here. ;-) I think we can do better.
Best, Marcel Am 25.03.2020 09:23:01 schrieb Marcel Taeumel <marcel.taeumel at hpi.de>: Sounds good. It is also very easy to rename the generated variable. In the workspace just type: "preferredName := " then drop the object. No need for a disruptive dialog window.
Still -1 for the extra dialog window.
Best, Marcel
Am 24.03.2020 20:38:02 schrieb K K Subbu <kksubbu.ml at gmail.com>: On 25/03/20 12:03 AM, Thiede, Christoph wrote:
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? :-)
You could generate a name and leave it selected, like in the result of printIt. If you don't like the name, just type the new name as usual. But if the name is okay, then press right arrow and continue with the rest of the line. This will go with the flow.
Regards .. Subbu
squeak-dev@lists.squeakfoundation.org