Re: ENB: Improving popup menus

2020-03-24 Thread Edward K. Ream
On Tuesday, March 24, 2020 at 10:11:30 AM UTC-5, Edward K. Ream wrote:

The configuredcommands_rclick function in contextmenu.py does not work as 
> is with cut/copy/paste-text. These commands require an event arg which the 
> callback must create. The necessary change should be safe enough, but it's 
> uncomfortably late.
>

I have just closed #1531 
. Imo, there is no 
need for further work.

New code will be part of 6.2. The new code is in the 6.2 and devel 
branches. The "popup" branch has been deleted. It was never used.

The new way is much better than all previous versions. You should be able 
to add any Leo command to the popup menu described by @data 
contextmenu-commands. You can also add menu separators by adding a line 
containing only "-".

Please test and report any problems.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/b6387558-a6e7-4697-a06f-fb5b4274b1bc%40googlegroups.com.


Re: ENB: Improving popup menus

2020-03-24 Thread vitalije
Deleting the two lines in leo/plugins/qt_text.py in the 
LeoQTextBrowser.__init__ method:
self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
self.customContextMenuRequested.connect(self.onContextMenu)

Will revert to the old style. Context menu in the body would have standard 
commands like Cut, Copy, Paste,...

Vitalije

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/32fce787-1b4d-4ebc-a896-812c3a8b7ed9%40googlegroups.com.


Re: ENB: Improving popup menus

2020-03-24 Thread Edward K. Ream
On Tuesday, March 24, 2020 at 8:14:37 AM UTC-5, Edward K. Ream wrote:

For 6.2, I *will *add items to @data contextmenu-commands in 
> leoSettings.leo. These items will create cut/copy/paste/select-all *text* 
> items popup menus. These items will be added in the 6.2 branch, and merged 
> into devel.
>

This plan did not survive first contact with the code.

The configuredcommands_rclick function in contextmenu.py does not work as 
is with cut/copy/paste-text. These commands require an event arg which the 
callback must create. The necessary change should be safe enough, but it's 
uncomfortably late.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/4ef138bb-1efc-4ec8-8fc0-8dafd3a9f477%40googlegroups.com.


ENB: Improving popup menus

2020-03-24 Thread Edward K. Ream
This is #1531 , which 
arises from a less-than-perfect fix for #1286 
.

This post describes the details and choices. But first, a summary of my 
plans...

*Plans*

It's too late to complete #1531 
 for Leo 6.2 final. 
It has been rescheduled for Leo 6.3.

For 6.2, I *will *add items to @data contextmenu-commands in 
leoSettings.leo. These items will create cut/copy/paste/select-all *text* 
items popup menus. These items will be added in the 6.2 branch, and merged 
into devel.

The "popup" branch will contain all code changes for 6.3. This branch is 
based on devel. The popup branch will *not* be merged into 6.2.

*Background*

I completed #1286  
without a great deal of thought. My reasoning was that popups containing 
cut/copy/paste/select-all *text* popups were almost useless. Better to add 
outline-oriented commands everywhere. Several people have questioned this 
choice.

This is the kind of apparently trivial fit-and-finish issue that newbies 
often use to evaluate the "worth" of an app. They see something like this 
and start pontificating :-) Yes, it's ridiculous, but it's a fact of life. 
So something must be done...

*Specifying popup items*

1. Users can specify additional entries for the popup menu using *@data 
contextmenu-commands*. At present, the default, in leoSettings.leo, is:

# Important: the contextmenu.py plugin must be enabled for these settings 
to take effect.

# Add commands to contextmenu
# The format is  SPACE 

copy-node Copy Node
cut-node Cut Node
paste-node Paste Node
paste-retaining-clones Paste Node As Clone

2. The contextmenu plugin *itself* adds a set of "standard" items.

There is a buglet in this code that I *will* correct for 6.2. The old code 
added a "Delete" item. It should be labelled "Delete Node".

3. Finally, *other* plugins can add items to the list.

At present, the (misnamed) *g.tree_popup_handlers* list contains entries 
for all entries. I forget when items get added to this list. The load order 
of plugins is likely significant.

*Choices*

Vitalije and I have been considering whether there should be *two* popup 
menus: one for the tree, and one for the body.

Imo, this will create needless complexity. With proper labels, it should be 
clear which popup items apply to the outline and which apply to the body 
(or other text widgets). Furthermore, I see no reason ever to hide one set 
of commands.

Vitalije suggests putting outline commands first when the outline pane has 
focus, and putting body commands first otherwise. It's a reasonable 
suggestion, but it would create lots of behind-the-scenes complexities 
because now all specifications must include tree/body switch. This is not 
worth doing, imo. Neither newbies nor anyone else will swoon with delight. 
Probably, nobody will even notice. It doesn't add to Leo's *perceived* 
quality :-)

*My Goals*

1. At present, the contextmenu plugin specifies default entries for the pop 
menu. This is silly. Probably *all* standard entries can be specified by 
adding entries to the @data setting.

2. The @data setting should allow the user to specify separators in the 
popup menu.

3. (Probably not) The @data setting might allow the user to specify 
sub-menus in the popup menu.

At present, the todo.py plugin adds the Task sub menu. It would take 
considerable work to allow users to specify sub menus.

4. Show plugins-defined popup items after user-defined items, with a menu 
separator between them.

This will require a new global list, say g.plugins_popup_handlers.

*Summary*

6.2 will contain new items in @data contextmenu-commands for common text 
oriented commands. That should satisfy most users.

All code changes will be deferred to Leo 6.3. The "popup" branch will hold 
the work.

Imo, using the same popup for all panes is plenty good enough. This change 
is not worth extra code complexity.

All comments welcome.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/8aa15618-e139-443f-9da8-44f9eceb9a9d%40googlegroups.com.