operate on model using path thus eliminate iter = model.get_iter(path) calls
This commit is contained in:
parent
5e67a13cd0
commit
29ec011b9a
4 changed files with 7 additions and 11 deletions
|
@ -1629,8 +1629,7 @@ class AccountsWindow:
|
||||||
|
|
||||||
def on_accounts_treeview_row_activated(self, widget, path, column):
|
def on_accounts_treeview_row_activated(self, widget, path, column):
|
||||||
model = widget.get_model()
|
model = widget.get_model()
|
||||||
iter = model.get_iter(path)
|
account = model[path][0].decode('utf-8')
|
||||||
account = model[iter][0].decode('utf-8')
|
|
||||||
self.show_modification_window(account)
|
self.show_modification_window(account)
|
||||||
|
|
||||||
def show_modification_window(self, account):
|
def show_modification_window(self, account):
|
||||||
|
|
|
@ -1333,14 +1333,13 @@ class GroupchatControl(ChatControlBase):
|
||||||
def on_list_treeview_row_activated(self, widget, path, col = 0):
|
def on_list_treeview_row_activated(self, widget, path, col = 0):
|
||||||
'''When an iter is double clicked: open the chat window'''
|
'''When an iter is double clicked: open the chat window'''
|
||||||
model = widget.get_model()
|
model = widget.get_model()
|
||||||
iter = model.get_iter(path)
|
|
||||||
if len(path) == 1: # It's a group
|
if len(path) == 1: # It's a group
|
||||||
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)
|
||||||
else: # We want to send a private message
|
else: # We want to send a private message
|
||||||
nick = model[iter][C_NICK].decode('utf-8')
|
nick = model[path][C_NICK].decode('utf-8')
|
||||||
self._start_private_message(nick)
|
self._start_private_message(nick)
|
||||||
|
|
||||||
def on_list_treeview_button_press_event(self, widget, event):
|
def on_list_treeview_button_press_event(self, widget, event):
|
||||||
|
|
|
@ -354,9 +354,8 @@ class HistoryWindow:
|
||||||
cur_year, cur_month, cur_day = self.calendar.get_date()
|
cur_year, cur_month, cur_day = self.calendar.get_date()
|
||||||
cur_month = gtkgui_helpers.make_gtk_month_python_month(cur_month)
|
cur_month = gtkgui_helpers.make_gtk_month_python_month(cur_month)
|
||||||
model = widget.get_model()
|
model = widget.get_model()
|
||||||
iter = model.get_iter(path)
|
|
||||||
# make it a tupple (Y, M, D, 0, 0, 0...)
|
# make it a tupple (Y, M, D, 0, 0, 0...)
|
||||||
tim = time.strptime(model[iter][C_UNIXTIME], '%x')
|
tim = time.strptime(model[path][C_UNIXTIME], '%x')
|
||||||
year = tim[0]
|
year = tim[0]
|
||||||
gtk_month = tim[1]
|
gtk_month = tim[1]
|
||||||
month = gtkgui_helpers.make_python_month_gtk_month(gtk_month)
|
month = gtkgui_helpers.make_python_month_gtk_month(gtk_month)
|
||||||
|
@ -367,7 +366,7 @@ class HistoryWindow:
|
||||||
self.calendar.select_month(month, year)
|
self.calendar.select_month(month, year)
|
||||||
|
|
||||||
self.calendar.select_day(day)
|
self.calendar.select_day(day)
|
||||||
unix_time = model[iter][C_TIME]
|
unix_time = model[path][C_TIME]
|
||||||
self.scroll_to_result(unix_time)
|
self.scroll_to_result(unix_time)
|
||||||
#FIXME: one day do not search just for unix_time but the whole and user
|
#FIXME: one day do not search just for unix_time but the whole and user
|
||||||
# specific format of the textbuffer line [time] nick: message
|
# specific format of the textbuffer line [time] nick: message
|
||||||
|
|
|
@ -2131,10 +2131,9 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
|
||||||
def on_roster_treeview_row_activated(self, widget, path, col = 0):
|
def on_roster_treeview_row_activated(self, widget, path, col = 0):
|
||||||
'''When an iter is double clicked: open the first event window'''
|
'''When an iter is double clicked: open the first event window'''
|
||||||
model = self.tree.get_model()
|
model = self.tree.get_model()
|
||||||
iter = model.get_iter(path)
|
account = model[path][C_ACCOUNT].decode('utf-8')
|
||||||
account = model[iter][C_ACCOUNT].decode('utf-8')
|
type = model[path][C_TYPE]
|
||||||
type = model[iter][C_TYPE]
|
jid = model[path][C_JID].decode('utf-8')
|
||||||
jid = model[iter][C_JID].decode('utf-8')
|
|
||||||
if type in ('group', 'account'):
|
if type in ('group', 'account'):
|
||||||
if self.tree.row_expanded(path):
|
if self.tree.row_expanded(path):
|
||||||
self.tree.collapse_row(path)
|
self.tree.collapse_row(path)
|
||||||
|
|
Loading…
Add table
Reference in a new issue