Timelines fix

This commit is contained in:
Manuel Cortez 2015-08-08 09:42:55 -05:00
parent 1706414171
commit a016932ac7
2 changed files with 8 additions and 19 deletions

View File

@ -90,13 +90,14 @@ class Controller(object):
""" Gets the last valid buffer for an account. """ Gets the last valid buffer for an account.
account str: A twitter username. account str: A twitter username.
The last valid buffer is the last buffer that contains a session object assigned.""" The last valid buffer is the last buffer that contains a session object assigned."""
results = self.get_buffers_for_account(account) # results = self.get_buffers_for_account(account)
results = self.get_buffers_for_account(account) results = self.get_buffers_for_account(account)
return self.view.search(results[-1].name, results[-1].account) return self.view.search(results[-1].name, results[-1].account)
def get_buffers_for_account(self, account): def get_buffers_for_account(self, account):
results = [] results = []
[results.append(i) for i in self.buffers if i.account == account and i.invisible == True] buffers = self.view.get_buffers()
[results.append(self.search_buffer(i.name, i.account)) for i in buffers if i.account == account]
return results return results
def bind_stream_events(self): def bind_stream_events(self):
@ -1254,7 +1255,8 @@ class Controller(object):
return return
tl = buffersController.listBufferController(self.view.nb, "get_list_statuses", create+"-list", buff.session, buff.session.db["user_name"], bufferType=None, list_id=utils.find_list(create, buff.session.db["lists"])) tl = buffersController.listBufferController(self.view.nb, "get_list_statuses", create+"-list", buff.session, buff.session.db["user_name"], bufferType=None, list_id=utils.find_list(create, buff.session.db["lists"]))
buff.session.lists.append(tl) buff.session.lists.append(tl)
self.buffers.append(tl) pos=self.view.search("lists", buff.session.db["user_name"])
self.insert_buffer(tl, pos)
self.view.insert_buffer(tl.buffer, name=_(u"List for {}").format(create), pos=self.view.search("lists", buff.session.db["user_name"])) self.view.insert_buffer(tl.buffer, name=_(u"List for {}").format(create), pos=self.view.search("lists", buff.session.db["user_name"]))
tl.start_stream() tl.start_stream()
buff.session.settings["other_buffers"]["lists"].append(create) buff.session.settings["other_buffers"]["lists"].append(create)
@ -1339,22 +1341,7 @@ class Controller(object):
os.chdir("../../") os.chdir("../../")
def insert_buffer(self, buffer, position): def insert_buffer(self, buffer, position):
buffers = self.get_buffers_for_account(buffer.account) self.buffers.insert(position, buffer)
try:
ref_buf = self.buffers[position]
except IndexError:
self.buffers.append(buffer)
return
empty = True
for i in buffers[position:]:
if i.type == "account" or i.invisible == False:
empty = True
else:
empty = False
if empty == True:
self.buffers.append(buffer)
else:
self.buffers.insert(position, buffer)
def copy_to_clipboard(self, *args, **kwargs): def copy_to_clipboard(self, *args, **kwargs):
output.copy(self.get_current_buffer().get_message()) output.copy(self.get_current_buffer().get_message())

View File

@ -126,6 +126,8 @@ class mainFrame(wx.Frame):
self.SetClientSize(self.sizer.CalcMin()) self.SetClientSize(self.sizer.CalcMin())
# print self.GetSize() # print self.GetSize()
def get_buffers(self):
return [self.nb.GetPage(i) for i in range(0, self.nb.GetPageCount())]
def search(self, name_, account): def search(self, name_, account):
for i in range(0, self.nb.GetPageCount()): for i in range(0, self.nb.GetPageCount()):