@BloGTK using a liststore would be way harder, using colors... and how would word wrap work with that?
@smartbei i looked at xchats source code, but it's really hard to understand, i's written in C and there is so many files.
@BloGTK using a liststore would be way harder, using colors... and how would word wrap work with that?
@smartbei i looked at xchats source code, but it's really hard to understand, i's written in C and there is so many files.
I decided that this was an intriguing enough challenge to see if I could do what you want to do with a list store. Here's some sample code that demonstrates how this work.
Now, the problem is that the width of the cell is a fixed size. If that works for you, great. If not, then here's a quick HOWTO on how to let the wrap width change as the column size changes.
You can change the font formatting by setting other properties in the cellrenderer.
Feel free to steal this code if it helps you.
I hope this helps!
Last edited by BloGTK; September 19th, 2009 at 04:35 AM. Reason: Fixed error in sample code.
BloGTK - An Open Source Weblog Editor
BloGTK 2.0 -- available now. Details at the official blog or the Launchpad project page
Thanks a lot for taking the time to put this together!
This is a solution but a lot of the features that the TextView has aren't there for example, you can't select and copy text and i'm sure there is more that i would need, images in text, links in text.
Would there be anyway to make it act just like the TextView?
If not then is there anyone who knows C and could easily look at xchats source code to check how they do it ? i would really appreciate it.
I'm not sure exactly how flexible that would be.
The other solution is to completely cheat and use python-webkit and do the interface in HTML. That would give you tons of flexibility. The downside is that part of your interface would have to be programmed in HTML, CSS, and JavaScript. But, I believe that the WebKit bindings let you go between JavaScript and Python objects.
BloGTK - An Open Source Weblog Editor
BloGTK 2.0 -- available now. Details at the official blog or the Launchpad project page
Yeah that's an option too, but that would propably waste way too many resources.
And anyway xchat does it, there must be a way to do it.
Is there anyone who could take a look at xchats source to see how xchat does it ?
anyone ?
dom96, have you thought of using a number of gtk.ListStore's packed in a table rather using a textView as it looks like you are only displaying data?
Yes, BloGTK suggested that
By the way i understand it, this should work.
but doesn't "dom96" and "Message" is just LEFT ALIGNED!PHP Code:
#!/usr/bin/env python
import gtk
import gtksourceview2 as gtksv
window = gtk.Window()
window.set_default_size(400, 400)
window.connect("destroy", gtk.main_quit)
vp = gtk.Viewport()
sv = gtksv.View()
sv.set_right_margin_position(10)
sv.set_show_right_margin(True)
sb = gtksv.Buffer()
msgTag = sb.create_tag(None)
msgTag.set_property("justification",gtk.JUSTIFY_RIGHT)
msgTag1 = sb.create_tag(None)
msgTag1.set_property("justification",gtk.JUSTIFY_LEFT)
sb.insert_with_tags(sb.get_end_iter(),"dom96",msgTag1)
sb.insert_with_tags(sb.get_end_iter(),"Message",msgTag)
sv.set_buffer(sb)
vp.add(sv)
window.add(vp)
window.show_all()
gtk.main()
Could someone tell me why ?
Bookmarks