Added an @ button for user panes that loads up an @user pane
This commit is contained in:
parent
cdfb5f35f5
commit
a1a0da7059
|
@ -61,6 +61,10 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_View</property>
|
||||
<property name="use_underline">True</property>
|
||||
<child>
|
||||
<widget class="GtkMenu" id="view_menu">
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
|
@ -240,7 +244,20 @@
|
|||
</child>
|
||||
|
||||
<child>
|
||||
<placeholder/>
|
||||
<widget class="GtkButton" id="at_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">@</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="on_at_button_clicked" last_modification_time="Fri, 16 Apr 2010 02:54:24 GMT"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
|
|
15
mytwitter.py
15
mytwitter.py
|
@ -49,6 +49,7 @@ class MyTwitter():
|
|||
self.status_bar = self.widget_tree.get_widget('status_bar')
|
||||
self.search_entry = self.widget_tree.get_widget('search_entry')
|
||||
self.following_button = self.widget_tree.get_widget('following_button')
|
||||
self.at_button = self.widget_tree.get_widget('at_button')
|
||||
|
||||
self.context_id = self.status_bar.get_context_id('message')
|
||||
|
||||
|
@ -75,7 +76,6 @@ class MyTwitter():
|
|||
menu_item.show()
|
||||
|
||||
# Timer to update periodically
|
||||
self.update_windows()
|
||||
gobject.timeout_add(self.refresh_time * 1000, self.update_windows)
|
||||
|
||||
|
||||
|
@ -215,6 +215,7 @@ class MyTwitter():
|
|||
self.update_status_bar('Error retrieving tweet id: ' + str(single_tweet))
|
||||
return
|
||||
|
||||
self.update_windows()
|
||||
self.tweet_notebook.set_current_page(-1) # switch to the new pane
|
||||
|
||||
|
||||
|
@ -222,13 +223,16 @@ class MyTwitter():
|
|||
pane = self.tweet_notebook.get_nth_page(page_num)
|
||||
pane.set_tweets_read()
|
||||
self.update_follow_button(pane)
|
||||
if pane.get_is_user():
|
||||
self.at_button.show()
|
||||
else:
|
||||
self.at_button.hide()
|
||||
|
||||
|
||||
def on_search(self, event):
|
||||
search_string = self.search_entry.get_text()
|
||||
self.search_entry.set_text('')
|
||||
self.add_to_notebook(search_string)
|
||||
self.update_windows()
|
||||
|
||||
|
||||
def update_status_bar(self, text):
|
||||
|
@ -270,13 +274,18 @@ class MyTwitter():
|
|||
|
||||
def show_user(self, name):
|
||||
self.add_to_notebook('user: ' + name)
|
||||
self.update_windows()
|
||||
|
||||
|
||||
def show_user_callback(self, widget, data):
|
||||
self.show_user(data)
|
||||
|
||||
|
||||
def on_at_button_clicked(self, widget):
|
||||
current_pane = self.tweet_notebook.get_nth_page(self.tweet_notebook.get_current_page())
|
||||
user_name = re.sub('^user: ', '', current_pane.get_list_name())
|
||||
self.add_to_notebook('@' + user_name)
|
||||
|
||||
|
||||
### end class MyTwitter
|
||||
|
||||
|
||||
|
|
Reference in New Issue
Block a user