Re: Script to expand toolbar

2024-04-02 Thread Edward K. Ream


On Tuesday, April 2, 2024 at 4:25:35 AM UTC-5 lewis wrote:

@vitalije first provided a script to expand the toolbar in 
https://github.com/leo-editor/leo-editor/issues/407
Here is an update that works with PyQt6


Hurray! I'll check it out soon!

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/9a15b221-16d7-4d6d-96ed-be06c77a3cbdn%40googlegroups.com.


Re: Script to expand toolbar

2024-04-02 Thread Edward K. Ream
On Tue, Apr 2, 2024 at 4:25 AM lewis  wrote:

> @vitalije first provided a script to expand the toolbar in
> https://github.com/leo-editor/leo-editor/issues/407
> Here is an update that works with PyQt6
>

It doesn't work for me.  Where is qt_toolbar_ext_button defined??

Edward

>
> """
> Expand button bar
> """
>
> from PyQt6.QtCore import QPointF, Qt
> from PyQt6.QtGui import QMouseEvent
> from PyQt6.QtWidgets import QApplication
>
> pos = QPointF(0, 0)
> button = Qt.MouseButton.LeftButton
> btns = Qt.MouseButton(0)
> mods = Qt.KeyboardModifier(0)
>
> # Define the event types directly without accessing them through Qt
> e1 = QMouseEvent(QMouseEvent.Type.MouseButtonPress, pos, button, btns,
> mods)
> e2 = QMouseEvent(QMouseEvent.Type.MouseButtonRelease, pos, button, btns,
> mods)
>
> # Assuming 'c' and 'w' are already defined
> for w in c.frame.iconBar.w.children():
> if w.objectName() == 'qt_toolbar_ext_button':
> QApplication.sendEvent(w, e1)
> QApplication.sendEvent(w, e2)
> break
>
> Again thanks to Vitalije for the original script.
>
> --
> 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/6590e9b3-9ffa-4ed8-ba38-cf403c4ed62fn%40googlegroups.com
> 
> .
>


-- 
-
Edward K. Ream: edream...@gmail.com
Leo Editor: https://leo-editor.github.io/leo-editor/ 
-

-- 
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/CAMF8tS14thw44_zqp%3DU%2Bkq6NSO0ao1-PL%3DaFnuN%2BfJ6TL8G-jw%40mail.gmail.com.


Re: Script to expand toolbar

2024-04-02 Thread lewis
>From original issue #407 - You can put that in *@button expand-toolbar* 
node in your myLeoSettings.leo under @buttons node.
If it is first child of @buttons then this button will be on left side of 
toolbar and it will be easier to click this button and then to find button 
you need. 

I confirmed it also works for me as a script using Ctrl-B.

I'm not aware of where  w.objectName() == 'qt_toolbar_ext_button'   is 
defined.
On Wednesday, April 3, 2024 at 12:26:44 AM UTC+11 Edward K. Ream wrote:

> On Tue, Apr 2, 2024 at 4:25 AM lewis  wrote:
>
>> @vitalije first provided a script to expand the toolbar in 
>> https://github.com/leo-editor/leo-editor/issues/407
>> Here is an update that works with PyQt6
>>
>
> It doesn't work for me.  Where is qt_toolbar_ext_button defined??
>
> Edward
>
>>
>> """
>> Expand button bar
>> """
>>
>> from PyQt6.QtCore import QPointF, Qt
>> from PyQt6.QtGui import QMouseEvent
>> from PyQt6.QtWidgets import QApplication
>>
>> pos = QPointF(0, 0)
>> button = Qt.MouseButton.LeftButton
>> btns = Qt.MouseButton(0)
>> mods = Qt.KeyboardModifier(0)
>>
>> # Define the event types directly without accessing them through Qt
>> e1 = QMouseEvent(QMouseEvent.Type.MouseButtonPress, pos, button, btns, 
>> mods)
>> e2 = QMouseEvent(QMouseEvent.Type.MouseButtonRelease, pos, button, btns, 
>> mods)
>>
>> # Assuming 'c' and 'w' are already defined
>> for w in c.frame.iconBar.w.children():
>> if w.objectName() == 'qt_toolbar_ext_button':
>> QApplication.sendEvent(w, e1)
>> QApplication.sendEvent(w, e2)
>> break
>>
>> Again thanks to Vitalije for the original script.
>>
>> -- 
>> 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+...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/leo-editor/6590e9b3-9ffa-4ed8-ba38-cf403c4ed62fn%40googlegroups.com
>>  
>> 
>> .
>>
>
>
> -- 
> -
> Edward K. Ream: edre...@gmail.com
> Leo Editor: https://leo-editor.github.io/leo-editor/ 
> 
> -
>

-- 
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/6592561b-f0e6-4b93-91d5-d5786291d79fn%40googlegroups.com.


Re: Script to expand toolbar

2024-04-03 Thread Edward K. Ream
On Tue, Apr 2, 2024 at 4:29 PM lewis  wrote:

> From original issue #407 - You can put that in *@button expand-toolbar*
> node in your myLeoSettings.leo under @buttons node.
> If it is first child of @buttons then this button will be on left side of
> toolbar and it will be easier to click this button and then to find button
> you need.
>
> I confirmed it also works for me as a script using Ctrl-B.
>

Thanks for the clarification.  It took me a while to understand what the
@button node is doing.

If all buttons are visible in the icon bar, the script does nothing.
Otherwise, clicking (and releasing) `@button expand-toolbar` will
(temporarily!) show all buttons.

I'm satisfied neither with #407
 nor with the script.
I would prefer some ways of splitting the icon bar at specific places. I
have just created #3851
.

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/CAMF8tS3Ltc5nmbZBCba635ev29-PdZMgJEZb8Ov0B_iYCH9oPw%40mail.gmail.com.


Re: Script to expand toolbar

2024-04-03 Thread Edward K. Ream
On Wednesday, April 3, 2024 at 4:54:32 AM UTC-5 Edward K. Ream wrote:

It took me a while to understand what the @button node is doing.
...
I'm satisfied neither with #407 
 nor with the script. 
I would prefer some ways of splitting the icon bar at specific places. I 
have just created #3851 
.


Alright, I think I understand the bounds of the problem.


Googling shows that the QToolbar class has inherent limitations. There is *no 
way* to split QToolButton widgets into separate rows. Happily, the toolbar 
shows an *extension icon* on the far right when there are too many buttons. 
Clicking this icon will show the remaining widgets on separate lines. The 
newly revealed icons *remain visible* until the user clicks the extension 
icon again.


I never noticed this behavior before. Worse, my dark theme obscured the 
extension icon! I've corrected that bug by giving the icon a lighter 
background color.


*@button expand-toolbar*


This script needs more explanation. The script creates a button that 
duplicates the purpose of the extension icon. The script (@button node) 
does nothing if everything in the icon bar is already visible.


The script simulates a *single* keypress (and release) on the extension 
icon. Therefore, the newly revealed icons will *remain visible* until the 
user presses the button (or the actual extension icon).


The test:  if w.objectName() == 'qt_toolbar_ext_button':


looks for the name that Qt assigns to the expansion icon. This name *has 
nothing to do with the headline of the @button node!*


*Summary*


At long last, I understand the inherent limitations of the QToolbar widget. 
There seems to be no way to split its contents into separate (always 
visible) lines.


Otoh, the extension icon shows all widgets when clicked and *continues to 
do so* until clicked again. This behavior is good enough for most purposes.


I've corrected my dark theme to show the extension icon. The icon must not 
have a black background.


The given @button script works, but it needs some explanation. I'll amend 
#3851  accordingly.


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/3ed6961a-4ced-4b55-9126-9762a8b9f2edn%40googlegroups.com.


Re: Script to expand toolbar

2024-04-03 Thread Thomas Passin
It's not just a black background that hides it.  There must be a css 
selector for it, mustn't there? 

On Wednesday, April 3, 2024 at 10:56:16 AM UTC-4 Edward K. Ream wrote:

> On Wednesday, April 3, 2024 at 4:54:32 AM UTC-5 Edward K. Ream wrote:
>
> It took me a while to understand what the @button node is doing.
>
> ...
>
> I'm satisfied neither with #407 
>  nor with the 
> script. I would prefer some ways of splitting the icon bar at specific 
> places. I have just created #3851 
> .
>
>
> Alright, I think I understand the bounds of the problem.
>
>
> Googling shows that the QToolbar class has inherent limitations. There is *no 
> way* to split QToolButton widgets into separate rows. Happily, the 
> toolbar shows an *extension icon* on the far right when there are too 
> many buttons. Clicking this icon will show the remaining widgets on 
> separate lines. The newly revealed icons *remain visible* until the user 
> clicks the extension icon again.
>
>
> I never noticed this behavior before. Worse, my dark theme obscured the 
> extension icon! I've corrected that bug by giving the icon a lighter 
> background color.
>
>
> *@button expand-toolbar*
>
>
> This script needs more explanation. The script creates a button that 
> duplicates the purpose of the extension icon. The script (@button node) 
> does nothing if everything in the icon bar is already visible.
>
>
> The script simulates a *single* keypress (and release) on the extension 
> icon. Therefore, the newly revealed icons will *remain visible* until the 
> user presses the button (or the actual extension icon).
>
>
> The test:  if w.objectName() == 'qt_toolbar_ext_button':
>
>
> looks for the name that Qt assigns to the expansion icon. This name *has 
> nothing to do with the headline of the @button node!*
>
>
> *Summary*
>
>
> At long last, I understand the inherent limitations of the QToolbar 
> widget. There seems to be no way to split its contents into separate 
> (always visible) lines.
>
>
> Otoh, the extension icon shows all widgets when clicked and *continues to 
> do so* until clicked again. This behavior is good enough for most 
> purposes.
>
>
> I've corrected my dark theme to show the extension icon. The icon must not 
> have a black background.
>
>
> The given @button script works, but it needs some explanation. I'll amend 
> #3851  accordingly.
>
>
> 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/bf2cc648-946f-4784-bc1d-59366014037fn%40googlegroups.com.


Re: Script to expand toolbar

2024-04-03 Thread Edward K. Ream


On Wednesday, April 3, 2024 at 11:04:00 AM UTC-5 Tom wrote:

It's not just a black background that hides it.  There must be a css 
selector for it, mustn't there? 


Probably yes, but the defaults for buttons should work.  Here is my 
selector:

QToolButton#qt_toolbar_ext_button 
{ 
background-color: @solarized-blue;
border: none;
}

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/c320f578-af4a-4109-9edc-b614db9a8c35n%40googlegroups.com.


Re: Script to expand toolbar

2024-04-03 Thread Edward K. Ream


On Wednesday, April 3, 2024 at 9:56:16 AM UTC-5 Edward K. Ream wrote:

Googling shows that the QToolbar class has inherent limitations. There is *no 
way* to split QToolButton widgets into separate rows. 


This statement is misleading. The easiest workaround is to assign 
buttons/widgets to *multiple* QToolbar instances.

And one can probably use QLayouts to control placement of toolbar items.

But I'll leave all such issues to the interested reader, hehe.

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/bcab7e1e-3817-490c-ab1d-1f192d3a70f6n%40googlegroups.com.


Re: Script to expand toolbar

2024-04-03 Thread Thomas Passin
Better, I think: background-color: @text-foreground; This should work for 
any (dark) color theme. If you omit the #qt_toolbar_ext_button, the style 
will get applied to the menubar's "menu-indicator" also, as well as any 
other toolbar (yes, the menubar also has an overflow indicator, if you can 
see it).  This is most likely what one wants.

On Wednesday, April 3, 2024 at 12:47:35 PM UTC-4 Edward K. Ream wrote:

> On Wednesday, April 3, 2024 at 9:56:16 AM UTC-5 Edward K. Ream wrote:
>
> Googling shows that the QToolbar class has inherent limitations. There is *no 
> way* to split QToolButton widgets into separate rows. 
>
>
> This statement is misleading. The easiest workaround is to assign 
> buttons/widgets to *multiple* QToolbar instances.
>
> And one can probably use QLayouts to control placement of toolbar items.
>
> But I'll leave all such issues to the interested reader, hehe.
>
> 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/4faf3b44-001a-4679-b853-87e720b7b271n%40googlegroups.com.


Re: Script to expand toolbar

2024-04-03 Thread Edward K. Ream
On Wed, Apr 3, 2024 at 1:10 PM Thomas Passin  wrote:

> Better, I think: background-color: @text-foreground; This should work for
> any (dark) color theme. If you omit the #qt_toolbar_ext_button, the style
> will get applied to the menubar's "menu-indicator" also, as well as any
> other toolbar (yes, the menubar also has an overflow indicator, if you can
> see it).  This is most likely what one wants.
>

Thanks for the tip.  I'll try it out.

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/CAMF8tS2MnnzjnCuYoN0qnUuwXdiZ555WZQZNy55pzSPGRHt%3D5A%40mail.gmail.com.


Re: Script to expand toolbar

2024-04-04 Thread Edward K. Ream
On Wed, Apr 3, 2024 at 1:10 PM Thomas Passin  wrote:

> Better, I think: background-color: @text-foreground; This should work for
> any (dark) color theme. If you omit the #qt_toolbar_ext_button, the style
> will get applied to the menubar's "menu-indicator" also, as well as any
> other toolbar (yes, the menubar also has an overflow indicator, if you can
> see it).  This is most likely what one wants.
>

Thanks Thomas. Your suggestions are exactly right.

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/CAMF8tS3LAwY1jnB9pN0FQyKNF8tOoLZCZn_keSuXrHg%3D3RJ4yg%40mail.gmail.com.