From 83575b14b977f0a1e7a4fb25f40384b80f704eab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Fri, 5 Jun 2015 05:21:49 -0500 Subject: [PATCH] Opening lists as a buffer is now possible from the list manager --- src/controller/listsController.py | 7 +++++++ src/controller/mainController.py | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/controller/listsController.py b/src/controller/listsController.py index d09cbf4f..41daf315 100644 --- a/src/controller/listsController.py +++ b/src/controller/listsController.py @@ -4,6 +4,7 @@ import output from wxUI.dialogs import lists from twython import TwythonError from twitter import compose, utils +from pubsub import pub class listsController(object): def __init__(self, session, user=None): @@ -14,6 +15,7 @@ class listsController(object): self.dialog.populate_list(self.get_all_lists()) widgetUtils.connect_event(self.dialog.createBtn, widgetUtils.BUTTON_PRESSED, self.create_list) widgetUtils.connect_event(self.dialog.editBtn, widgetUtils.BUTTON_PRESSED, self.edit_list) + widgetUtils.connect_event(self.dialog.view, widgetUtils.BUTTON_PRESSED, self.open_list_as_buffer) self.dialog.get_response() def get_all_lists(self): @@ -67,3 +69,8 @@ class listsController(object): self.dialog.lista.remove_item(self.dialog.get_item()) except TwythonError as e: output.speak("error %s: %s" % (e.error_code, e.msg)) + + def open_list_as_buffer(self, *args, **kwargs): + if self.dialog.lista.get_count() == 0: return + list = self.session.db["lists"][self.dialog.get_item()] + pub.sendMessage("create-new-buffer", buffer="list", account=self.session.db["user_name"], create=list["slug"]) \ No newline at end of file diff --git a/src/controller/mainController.py b/src/controller/mainController.py index 39a04d21..7e008d78 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -1197,6 +1197,17 @@ class Controller(object): self.view.insert_buffer(events.buffer, name=_(u"Events"), pos=self.view.search(buff.session.db["user_name"], buff.session.db["user_name"])) elif create == False: self.destroy_buffer(buffer, buff.session.db["user_name"]) + elif buffer == "list": + if create in buff.session.settings["other_buffers"]["lists"]: + output.speak(_(u"This list is already opened"), True) + 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"])) + buff.session.lists.append(tl) + self.buffers.append(tl) + 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() + buff.session.settings["other_buffers"]["lists"].append(create) + pub.sendMessage("restart-streams", streams=["timelinesStream"], session=buff.session) def restart_streams(self, streams=[], session=None): for i in streams: