On Thu, 27 Aug 2015 13:05:57 -0700 (PDT)
john lunzer <lun...@gmail.com> wrote:

> I sort of checked this out, enough to think that it might be overkill
> for my plugin. For one under no circumstances would I expect my
> plugin to be put into a pane, it's window is too small for that. 

I don't think there's a lower size limit below which interface
components don't warrant their own pane, it's more a question of
"always popup behavior" vs. "sometimes want it to hang around" behavior.
Even then, free_layout supports popup behavior through the "Open
window" behavior.  You only need to cover the 'minimal' case at the end
of
https://github.com/leo-editor/snippets/blob/master/examples/demo_widget.py,
not the whole palaver shown first.

Having said that, 
(1)
leo-editor/leo/core/LeoPy.leo#Code-->Qt gui-->@file 
../plugins/nested_splitter.py-->class NestedSplitter (QSplitter)-->open_window
shows how free layout copies the style, instead of w = self.root you
could do w = c.frame.top or something.

Or based on 
leo-editor/leo/core/LeoPy.leo#Code-->Qt gui-->@file 
../plugins/qt_gui.py-->class StyleSheetManager-->ssm.set selected_style_sheet

you could get the sheet from 
(2)
c.styleSheetManager.get_master_widget(c.frame.top).styleSheet()

That's probably the best way.

Cheers -Terry

> So beyond that I was searching through some of Leo's source and I saw
> a pattern that seemed like it might fit the bill:
> 
> self.sheet = c.config.getData('qt-gui-plugin-style-sheet')
> 
> if self.sheet:
> 
>     self.sheet = '\n'.join(self.sheet)
> 
>     self.setStyleSheet(self.sheet)
> 
> However... when inspecting the stylesheet I see that the @ colors are
> still there, nothing has been substituted. What am I doing wrong?
> 
> On Tuesday, August 25, 2015 at 3:49:35 PM UTC-4, john lunzer wrote:
> >
> > Sounds like a plan, I'll check it out soon, thanks for the link to
> > the demo widget.
> >
> > On Tuesday, August 25, 2015 at 1:18:30 PM UTC-4, Terry Brown wrote:
> >>
> >> On Tue, 25 Aug 2015 10:14:17 -0700 (PDT) 
> >> john lunzer <lun...@gmail.com> wrote: 
> >>
> >> > I'm at the point where I'm trying to convert my quick-replace 
> >> > @command to a plugin and I looked around in the current plugins
> >> > but I couldn't find an example of how I apply Leo's main
> >> > stylesheet to floating QtWidgets. I'm trying to match Leo's look
> >> > and feel. Any guidance would be greatly appreciated. 
> >>
> >> I'd aim for free_layout integration. 
> >>
> >> https://github.com/leo-editor/snippets/blob/master/examples/demo_widget.py 
> >>
> >> then your widget can be mixed into the pane layout in the main
> >> window or opened in its own window (which supports panes and other
> >> widgets too).  I think this will handle the stylesheet thing as
> >> well. 
> >>
> >> Cheers -Terry 
> >>
> >
> 

-- 
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 post to this group, send email to leo-editor@googlegroups.com.
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to