The Inbox: Tools-ct.962.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Tools-ct.962.mcz

commits-2
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.!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Tools-ct.962.mcz

marcel.taeumel
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 [hidden email] <[hidden email]>:

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.!




Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Tools-ct.962.mcz

Christoph Thiede

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 <[hidden email]> 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 [hidden email] <[hidden email]>:

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.!




Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Tools-ct.962.mcz

K K Subbu
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

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Tools-ct.962.mcz

marcel.taeumel
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 <[hidden email]>:

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



Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Tools-ct.962.mcz

marcel.taeumel
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 <[hidden email]>:

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 <[hidden email]>:

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