diff options
author | lovetox <philipp@hoerist.com> | 2022-06-23 22:01:53 +0300 |
---|---|---|
committer | lovetox <philipp@hoerist.com> | 2022-06-23 22:01:53 +0300 |
commit | d982f6b8c5df5660bf2ffd1cd1d82adcb0441834 (patch) | |
tree | 6cba59a662efe241b6bbacf01328e519fbf2d2a2 | |
parent | b56ee020a0f11091bd13b5eb45d5f55410aeede8 (diff) |
refactor: Change layout of chat page
Add new Chat Stack to aid in the upcoming refactor
-rw-r--r-- | gajim/gtk/chat_page.py | 7 | ||||
-rw-r--r-- | gajim/gtk/chat_stack.py | 43 | ||||
-rw-r--r-- | pyrightconfig.json | 1 |
3 files changed, 49 insertions, 2 deletions
diff --git a/gajim/gtk/chat_page.py b/gajim/gtk/chat_page.py index 255131d9a..5f296d97f 100644 --- a/gajim/gtk/chat_page.py +++ b/gajim/gtk/chat_page.py @@ -34,6 +34,7 @@ from .builder import get_builder from .chat_filter import ChatFilter from .chat_list import ChatList from .chat_list_stack import ChatListStack +from .chat_stack import ChatStack from .control_stack import ControlStack from .search_view import SearchView from .types import ControlT @@ -57,8 +58,10 @@ class ChatPage(Gtk.Box): self.add(self._ui.paned) self._ui.connect_signals(self) - self._control_stack = ControlStack() - self._ui.right_grid_overlay.add(self._control_stack) + self._chat_stack = ChatStack() + self._ui.right_grid_overlay.add(self._chat_stack) + + self._control_stack = self._chat_stack.get_control_stack() self._search_view = SearchView() self._search_view.connect('hide-search', self._on_search_hide) diff --git a/gajim/gtk/chat_stack.py b/gajim/gtk/chat_stack.py new file mode 100644 index 000000000..2bb3e1601 --- /dev/null +++ b/gajim/gtk/chat_stack.py @@ -0,0 +1,43 @@ +# This file is part of Gajim. +# +# Gajim is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation; version 3 only. +# +# Gajim is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Gajim. If not, see <http://www.gnu.org/licenses/>. + +import logging + +from gi.repository import Gtk + +from .control_stack import ControlStack +from .util import EventHelper + +log = logging.getLogger('gajim.gui.chatstack') + + +class ChatStack(Gtk.Stack, EventHelper): + def __init__(self): + Gtk.Stack.__init__(self) + EventHelper.__init__(self) + + self.set_vexpand(True) + self.set_hexpand(True) + + self._control_stack = ControlStack() + + box = Gtk.Box() + box.add(self._control_stack) + + self.add_named(box, 'controls') + + self.show_all() + + def get_control_stack(self) -> ControlStack: + return self._control_stack diff --git a/pyrightconfig.json b/pyrightconfig.json index b3c0f6531..c23ac82ff 100644 --- a/pyrightconfig.json +++ b/pyrightconfig.json @@ -61,6 +61,7 @@ "gajim/gtk/chat_list_stack.py", "gajim/gtk/chat_list.py", "gajim/gtk/chat_page.py", + "gajim/gtk/chat_stack.py", "gajim/gtk/control_stack.py", "gajim/gtk/const.py", "gajim/gtk/contact_info.py", |