Help with python scrolledwindow

More
7 years 3 months ago #139315 by persei8
I'm hoping a python expert can help me out here. First, what I am trying to do is display a HTML file in a notebook tab in my gscreen handler file. This tab contains a gtk scrolledwindow. I made a test program that works, shown below:

#!/usr/bin/env python
import webkit, gtk
win = gtk.Window()
win.set_position(gtk.WIN_POS_CENTER_ALWAYS)
win.resize(800,600)
win.connect('destroy', lambda w: gtk.main_quit())
win.set_title('WTF')
scrolled_window = gtk.ScrolledWindow()
browser = webkit.WebView()
browser.open("file:///home/jim/linuxcnc/configs/silverdragon/GCodes.html")
scrolled_window.add_with_viewport(browser)
win.add(scrolled_window)
win.show_all()
gtk.main()

If I replace:
scrolled_window.add_with_viewport(browser)
with:
self.widgets.scrolledwindow1.add_with_viewport(self.browser)

(browser became self.browser because the handler file defines classes that the test program does not have.)
in my handler file, it does not work. It just shows a blank tab. So I guess the question is - Can a widget created by python be added to a widget created by Glade? Thanks for any help.

Please Log in to join the conversation.

More
7 years 3 months ago #139321 by cmorley
It is indeed possible to add python created widgets to GLADE created widgets.
Did you add self.browser.show() anywhere?
could you post your handler file?

Chris

Please Log in to join the conversation.

More
7 years 3 months ago #139328 by persei8
"Did you add self.browser.show() anywhere?"

Sonofa *****, that's all it takes?
I assumed that init_show_windows() would take care of that, but obviously not.
It now shows the HTML file in a notebook tab. Now I just need to figure out how to disable clicking of links because that causes a X Window System Error. I guess I should be careful what I wish for.

Anyway, I was also going to ask if you are interested in an updated silverdragon? I made several updates which actually improve the usability. I would leave out the HTML business because the user would then have to find and install python webkit which was in itself an ordeal. Thanks for the reply.

Please Log in to join the conversation.

More
7 years 3 months ago #139337 by cmorley
Glad I could help.
Maybe I should add show_all() to init_show_windows() - it's not often people add their own widgets so I probably never caught this....

I would happily updates silverdragon in linuxcnc.
If you felt like writing up some docs for silverdragon I would add that (which would make it standout more and probably used more.)


Chris M

Please Log in to join the conversation.

More
7 years 3 months ago #139422 by persei8
I can do that. Do you have an HTML documentation template? If not, I think I can reuse an existing one from the documentation pages. Do you prefer to use the forum or is there another communication channel?

Please Log in to join the conversation.

More
7 years 3 months ago #139539 by cmorley
That's great!
I don't have a template - I hand write my docs as I go.
Forum is fine or linuxcnc dev mail list

Chris

Please Log in to join the conversation.

More
7 years 3 months ago #139655 by cmorley
I messaged you

Chris

Please Log in to join the conversation.

More
7 years 3 months ago #139785 by andypugh
(I temp-deleted the email to hide the email address from casual scrutiny)

Please Log in to join the conversation.

More
7 years 3 months ago #139788 by tommylight

andypugh wrote: (I temp-deleted the email to hide the email address from casual scrutiny)

Thought the same thing, but it would be nice to have a visit from "not petya" or "wanacry", that would discurage them from showing e-mail addresses on public forums.

Please Log in to join the conversation.

More
7 years 3 months ago #139819 by persei8
Thanks for doing that. Since this forum has no PM facility, I don't know how else to communicate 1 to 1 with someone and not clog up the forum with irrelevant posts and not expose file attachments to the general public. However, I should have at least obfuscated it with someone at somewhere dot com.

Please Log in to join the conversation.

Time to create page: 0.100 seconds
Powered by Kunena Forum