fix sth minor (delmonico), various cleanup

This commit is contained in:
Nikos Kouremenos 2005-06-10 16:45:54 +00:00
parent e774467002
commit 9847eca2f0
4 changed files with 39 additions and 37 deletions

View File

@ -2333,6 +2333,7 @@ class ManageBookmarksWindow:
self.view = self.xml.get_widget('bookmarks_treeview') self.view = self.xml.get_widget('bookmarks_treeview')
self.view.set_model(self.treestore) self.view.set_model(self.treestore)
self.view.expand_all()
renderer = gtk.CellRendererText() renderer = gtk.CellRendererText()
column = gtk.TreeViewColumn('Bookmarks', renderer, text=1) column = gtk.TreeViewColumn('Bookmarks', renderer, text=1)
@ -2385,6 +2386,8 @@ class ManageBookmarksWindow:
account = model.get_value(add_to, 1) account = model.get_value(add_to, 1)
self.treestore.append(add_to, [account,_('New Room'), '', '', '', '']) self.treestore.append(add_to, [account,_('New Room'), '', '', '', ''])
self.view.expand_row(model.get_path(add_to), True)
def on_remove_bookmark_button_clicked(self, widget): def on_remove_bookmark_button_clicked(self, widget):
@ -2480,7 +2483,9 @@ class ManageBookmarksWindow:
def on_title_entry_changed(self, widget): def on_title_entry_changed(self, widget):
(model, iter) = self.selection.get_selected() (model, iter) = self.selection.get_selected()
if iter: #After removing a bookmark, we got nothing selected if iter: #After removing a bookmark, we got nothing selected
model.set_value(iter, 1, self.title_entry.get_text()) if model.iter_parent(iter):
#Don't clear the title field for account nodes
model.set_value(iter, 1, self.title_entry.get_text())
def on_nick_entry_changed(self, widget): def on_nick_entry_changed(self, widget):
(model, iter) = self.selection.get_selected() (model, iter) = self.selection.get_selected()

View File

@ -170,7 +170,7 @@ class Interface:
return return
if os.name == 'nt': if os.name == 'nt':
try: try:
winsound.PlaySound(path_to_soundfile, \ winsound.PlaySound(path_to_soundfile,
winsound.SND_FILENAME|winsound.SND_ASYNC) winsound.SND_FILENAME|winsound.SND_ASYNC)
except: except:
pass pass

View File

@ -657,41 +657,38 @@ class Groupchat_window(chat.Chat):
def on_list_treeview_button_press_event(self, widget, event): def on_list_treeview_button_press_event(self, widget, event):
"""popup user's group's or agent menu""" """popup user's group's or agent menu"""
if event.type == gtk.gdk.BUTTON_PRESS: if event.button == 3: # right click
if event.button == 3: # right click try:
try: path, column, x, y = widget.get_path_at_pos(int(event.x),
path, column, x, y = widget.get_path_at_pos(int(event.x), \ int(event.y))
int(event.y)) except TypeError:
except TypeError: widget.get_selection().unselect_all()
widget.get_selection().unselect_all() return False
return False widget.get_selection().select_path(path)
widget.get_selection().select_path(path) model = widget.get_model()
model = widget.get_model() iter = model.get_iter(path)
iter = model.get_iter(path) if len(path) == 2:
if len(path) == 2: room_jid = self.get_active_jid()
room_jid = self.get_active_jid() self.mk_menu(room_jid, event, iter)
self.mk_menu(room_jid, event, iter) return True
return True if event.button == 1: # left click
if event.button == 1: # left click try:
try: path, column, x, y = widget.get_path_at_pos(int(event.x),
path, column, x, y = widget.get_path_at_pos(int(event.x), \ int(event.y))
int(event.y)) except TypeError:
except TypeError: widget.get_selection().unselect_all()
widget.get_selection().unselect_all() return False
return False
model = widget.get_model() model = widget.get_model()
iter = model.get_iter(path) iter = model.get_iter(path)
status = model.get_value(iter, 3) # if no status: it's a group status = model.get_value(iter, 3) # if no status: it's a group
if not status: if not status:
if x < 20: # first cell in 1st column (the arrow SINGLE clicked) if x < 20: # first cell in 1st column (the arrow SINGLE clicked)
if (widget.row_expanded(path)): if (widget.row_expanded(path)):
widget.collapse_row(path) widget.collapse_row(path)
else: else:
widget.expand_row(path, False) widget.expand_row(path, False)
#FIXME: should popup chat window for GC contact DOUBLE clicked
# also chat [in context menu]
return False return False
def on_list_treeview_key_press_event(self, widget, event): def on_list_treeview_key_press_event(self, widget, event):

View File

@ -279,7 +279,7 @@ class Tabbed_chat_window(chat.Chat):
def on_message_textview_key_press_event(self, widget, event): def on_message_textview_key_press_event(self, widget, event):
"""When a key is pressed: """When a key is pressed:
if enter is pressed without the shit key, message (if not empty) is sent if enter is pressed without the shift key, message (if not empty) is sent
and printed in the conversation""" and printed in the conversation"""
jid = self.get_active_jid() jid = self.get_active_jid()
conversation_textview = self.xmls[jid].get_widget('conversation_textview') conversation_textview = self.xmls[jid].get_widget('conversation_textview')