From f5328379e84ff869faa1cfcc8cc4fd51f3d9a0b9 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Tue, 15 Nov 2022 13:31:11 -0600 Subject: [PATCH] Fixed list buffer creation --- src/controller/mainController.py | 5 ++++- src/controller/twitter/handler.py | 4 ++-- src/controller/twitter/lists.py | 5 +++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/controller/mainController.py b/src/controller/mainController.py index f076d298..acf5d101 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -300,6 +300,8 @@ class Controller(object): def create_buffer(self, buffer_type="baseBuffer", session_type="twitter", buffer_title="", parent_tab=None, start=False, kwargs={}): log.debug("Creating buffer of type {0} with parent_tab of {2} arguments {1}".format(buffer_type, kwargs, parent_tab)) + if kwargs.get("parent") == None: + kwargs["parent"] = self.view.nb if not hasattr(buffers, session_type): raise AttributeError("Session type %s does not exist yet." % (session_type)) available_buffers = getattr(buffers, session_type) @@ -458,7 +460,8 @@ class Controller(object): buffer = self.get_best_buffer() handler = self.get_handler(type=buffer.session.type) if handler != None and hasattr(handler, "list_manager"): - return handler.list_manager(session=buffer.session) + lists_buffer_position = self.view.search("lists", buffer.session.get_name()) + return handler.list_manager(session=buffer.session, lists_buffer_position=lists_buffer_position) def configuration(self, *args, **kwargs): """ Opens the global settings dialogue.""" diff --git a/src/controller/twitter/handler.py b/src/controller/twitter/handler.py index 2d7a8e7d..de8dfb01 100644 --- a/src/controller/twitter/handler.py +++ b/src/controller/twitter/handler.py @@ -155,8 +155,8 @@ class Handler(object): output.speak("error %s" % (str(e))) log.exception("error %s" % (str(e))) - def list_manager(self, session): - return lists.listsController(session=session) + def list_manager(self, session, lists_buffer_position): + return lists.listsController(session=session, lists_buffer_position=lists_buffer_position) def account_settings(self, buffer, controller): d = settings.accountSettingsController(buffer, controller) diff --git a/src/controller/twitter/lists.py b/src/controller/twitter/lists.py index b5736bc4..419aec1a 100644 --- a/src/controller/twitter/lists.py +++ b/src/controller/twitter/lists.py @@ -10,9 +10,10 @@ from pubsub import pub log = logging.getLogger("controller.listsController") class listsController(object): - def __init__(self, session, user=None): + def __init__(self, session, user=None, lists_buffer_position=0): super(listsController, self).__init__() self.session = session + self.lists_buffer_position = lists_buffer_position if user == None: self.dialog = lists.listViewer() self.dialog.populate_list(self.get_all_lists()) @@ -90,7 +91,7 @@ class listsController(object): 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.name) + pub.sendMessage("createBuffer", buffer_type="ListBuffer", session_type=self.session.type, buffer_title=_("List for {}").format(list.name), parent_tab=self.lists_buffer_position, start=True, kwargs=dict(function="list_timeline", name="%s-list" % (list.name,), sessionObject=self.session, account=self.session.get_name(), bufferType=None, sound="list_tweet.ogg", list_id=list.id, include_ext_alt_text=True, tweet_mode="extended")) def subscribe(self, *args, **kwargs): if self.dialog.lista.get_count() == 0: return