Advertising
Paste Description for cody-somerville
Why doesn't the tree show anything?
- cody-somerville
- Sunday, January 13th, 2008 at 4:46:06pm MST
- #!/usr/bin/env python
- #
- # Reddit View V0.01
- # Author: Cody A.W. Somerville <cody-somerville@ubuntu.com>
- # Copyright (C) 2008 Cody A.W. Somerville
- # Released under the Open Source BSD Revised license
- #
- import sys
- sys.path.append("..")
- sys.path.append("../feedparser")
- import pygtk
- pygtk.require('2.0')
- import gtk
- import gtk.glade
- import reddit
- class RedditView:
- def __init__(self):
- self.gladefile = "redditView.glade"
- self.widgetTree = gtk.glade.XML(self.gladefile)
- self.widgetTree.signal_autoconnect( { "on_about_button_clicked" : \
- self.about_button_clicked, "gtk_main_quit" : gtk.main_quit, \
- "on_aboutdialog_destroy" : self.about_window_destroyed, \
- "on_refresh_button_clicked" : self.refresh_button_clicked, } )
- self.combobox = self.widgetTree.get_widget("communityList_comboBox")
- if(self.combobox):
- for community in reddit.COMMUNITIES:
- self.combobox.insert_text(0, community.capitalize())
- self.combobox.set_active(len(reddit.COMMUNITIES))
- self.window = self.widgetTree.get_widget("window1")
- if(self.window):
- self.window.connect("destroy", gtk.main_quit)
- self.tree = self.widgetTree.get_widget("treeview1")
- if(self.tree):
- self.liststore = gtk.ListStore(str, str)
- column = gtk.TreeViewColumn("Title", gtk.CellRendererText(), \
- text=1)
- column.set_sort_column_id(1)
- column.set_visible(True)
- self.tree.append_column(column)
- column = gtk.TreeViewColumn("Synopsis", gtk.CellRendererText(), \
- text=2)
- column.set_sort_column_id(2)
- column.set_visible(True)
- self.tree.append_column(column)
- self.liststore.append(["moo", "asdfasfasfasfasdfasfasfd"])
- self.window.show_all()
- def about_button_clicked(self, widget):
- gtk.glade.XML(self.gladefile).get_widget("aboutdialog").show()
- def refresh_button_clicked(self, widget):
- pass
- # self.new_list = []
- # if self.combobox.get_active() is "Reddit":
- if __name__ == "__main__":
- hwg = RedditView()
- gtk.main()
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.