summaryrefslogtreecommitdiff
path: root/src/tab.py
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-11-22 01:39:37 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-11-22 01:39:37 +0000
commit30405d1fbb7214d81bf7ceb77db6e6eacd1d46ba (patch)
tree01784cfa5d46b4054e5a7d24d6933f9d5bcc8532 /src/tab.py
parenta1c4b35b571432242f4fdc7430528f20210df2e5 (diff)
downloadpoezio-30405d1fbb7214d81bf7ceb77db6e6eacd1d46ba.tar.gz
poezio-30405d1fbb7214d81bf7ceb77db6e6eacd1d46ba.tar.bz2
poezio-30405d1fbb7214d81bf7ceb77db6e6eacd1d46ba.tar.xz
poezio-30405d1fbb7214d81bf7ceb77db6e6eacd1d46ba.zip
rename again buffers→windows and Alt+←→ to switch tabs
Diffstat (limited to 'src/tab.py')
-rw-r--r--src/tab.py68
1 files changed, 36 insertions, 32 deletions
diff --git a/src/tab.py b/src/tab.py
index 02c84304..023c97b9 100644
--- a/src/tab.py
+++ b/src/tab.py
@@ -15,7 +15,7 @@
# along with Poezio. If not, see <http://www.gnu.org/licenses/>.
"""
-a Tab object is a way to organize various Buffers (see buffers.py)
+a Tab object is a way to organize various Windows (see windows.py)
around the screen at once.
A tab is then composed of multiple Buffer.
Each Tab object has different refresh() and resize() methods, defining how its
@@ -28,7 +28,7 @@ MIN_HEIGHT = 16
import logging
log = logging.getLogger(__name__)
-import buffers
+import windows
import theme
import curses
import difflib
@@ -145,9 +145,9 @@ class InfoTab(Tab):
"""
def __init__(self, core, name):
Tab.__init__(self, core)
- self.tab_win = buffers.GlobalInfoBar(1, self.width, self.height-2, 0, self.core.stdscr, self.visible)
- self.text_win = buffers.TextWin(self.height-2, self.width, 0, 0, self.core.stdscr, self.visible)
- self.input = buffers.Input(1, self.width, self.height-1, 0, self.core.stdscr, self.visible)
+ self.tab_win = windows.GlobalInfoBar(1, self.width, self.height-2, 0, self.core.stdscr, self.visible)
+ self.text_win = windows.TextWin(self.height-2, self.width, 0, 0, self.core.stdscr, self.visible)
+ self.input = windows.Input(1, self.width, self.height-1, 0, self.core.stdscr, self.visible)
self.name = name
self.color_state = theme.COLOR_TAB_NORMAL
@@ -196,6 +196,10 @@ class InfoTab(Tab):
def on_close(self):
return
+class ChatTab(Tab):
+ """
+
+ """
class MucTab(Tab):
"""
The tab containing a multi-user-chat room.
@@ -204,14 +208,14 @@ class MucTab(Tab):
def __init__(self, core, room):
Tab.__init__(self, core)
self._room = room
- self.topic_win = buffers.Topic(1, self.width, 0, 0, self.core.stdscr, self.visible)
- self.text_win = buffers.TextWin(self.height-4-self.core.information_win_size, (self.width//10)*9, 1, 0, self.core.stdscr, self.visible)
- self.v_separator = buffers.VerticalSeparator(self.height-3, 1, 1, 9*(self.width//10), self.core.stdscr, self.visible)
- self.user_win = buffers.UserList(self.height-3, (self.width//10), 1, 9*(self.width//10)+1, self.core.stdscr, self.visible)
- self.info_header = buffers.MucInfoWin(1, (self.width//10)*9, self.height-3-self.core.information_win_size, 0, self.core.stdscr, self.visible)
- self.info_win = buffers.TextWin(self.core.information_win_size, (self.width//10)*9, self.height-2-self.core.information_win_size, 0, self.core.stdscr, self.visible)
- self.tab_win = buffers.GlobalInfoBar(1, self.width, self.height-2, 0, self.core.stdscr, self.visible)
- self.input = buffers.MessageInput(1, self.width, self.height-1, 0, self.core.stdscr, self.visible)
+ self.topic_win = windows.Topic(1, self.width, 0, 0, self.core.stdscr, self.visible)
+ self.text_win = windows.TextWin(self.height-4-self.core.information_win_size, (self.width//10)*9, 1, 0, self.core.stdscr, self.visible)
+ self.v_separator = windows.VerticalSeparator(self.height-3, 1, 1, 9*(self.width//10), self.core.stdscr, self.visible)
+ self.user_win = windows.UserList(self.height-3, (self.width//10), 1, 9*(self.width//10)+1, self.core.stdscr, self.visible)
+ self.info_header = windows.MucInfoWin(1, (self.width//10)*9, self.height-3-self.core.information_win_size, 0, self.core.stdscr, self.visible)
+ self.info_win = windows.TextWin(self.core.information_win_size, (self.width//10)*9, self.height-2-self.core.information_win_size, 0, self.core.stdscr, self.visible)
+ self.tab_win = windows.GlobalInfoBar(1, self.width, self.height-2, 0, self.core.stdscr, self.visible)
+ self.input = windows.MessageInput(1, self.width, self.height-1, 0, self.core.stdscr, self.visible)
def resize(self):
"""
@@ -330,11 +334,11 @@ class PrivateTab(Tab):
def __init__(self, core, room):
Tab.__init__(self, core)
self._room = room
- self.text_win = buffers.TextWin(self.height-3-self.core.information_win_size, self.width, 0, 0, self.core.stdscr, self.visible)
- self.info_header = buffers.PrivateInfoWin(1, self.width, self.height-3-self.core.information_win_size, 0, self.core.stdscr, self.visible)
- self.info_win = buffers.TextWin(self.core.information_win_size, self.width, self.height-2-self.core.information_win_size, 0, self.core.stdscr, self.visible)
- self.tab_win = buffers.GlobalInfoBar(1, self.width, self.height-2, 0, self.core.stdscr, self.visible)
- self.input = buffers.MessageInput(1, self.width, self.height-1, 0, self.core.stdscr, self.visible)
+ self.text_win = windows.TextWin(self.height-3-self.core.information_win_size, self.width, 0, 0, self.core.stdscr, self.visible)
+ self.info_header = windows.PrivateInfoWin(1, self.width, self.height-3-self.core.information_win_size, 0, self.core.stdscr, self.visible)
+ self.info_win = windows.TextWin(self.core.information_win_size, self.width, self.height-2-self.core.information_win_size, 0, self.core.stdscr, self.visible)
+ self.tab_win = windows.GlobalInfoBar(1, self.width, self.height-2, 0, self.core.stdscr, self.visible)
+ self.input = windows.MessageInput(1, self.width, self.height-1, 0, self.core.stdscr, self.visible)
def resize(self):
Tab.resize(self)
@@ -418,12 +422,12 @@ class RosterInfoTab(Tab):
self.name = "Roster"
roster_width = self.width//2
info_width = self.width-roster_width-1
- self.v_separator = buffers.VerticalSeparator(self.height-2, 1, 0, roster_width, self.core.stdscr, self.visible)
- self.tab_win = buffers.GlobalInfoBar(1, self.width, self.height-2, 0, self.core.stdscr, self.visible)
- self.info_win = buffers.TextWin(self.height-2, info_width, 0, roster_width+1, self.core.stdscr, self.visible)
- self.roster_win = buffers.RosterWin(self.height-2-3, roster_width, 0, 0, self.core.stdscr, self.visible)
- self.contact_info_win = buffers.ContactInfoWin(3, roster_width, self.height-2-3, 0, self.core.stdscr, self.visible)
- self.default_help_message = buffers.HelpText(1, self.width, self.height-1, 0, self.core.stdscr, self.visible, "Enter commands with “/”. “o”: toggle offline show")
+ self.v_separator = windows.VerticalSeparator(self.height-2, 1, 0, roster_width, self.core.stdscr, self.visible)
+ self.tab_win = windows.GlobalInfoBar(1, self.width, self.height-2, 0, self.core.stdscr, self.visible)
+ self.info_win = windows.TextWin(self.height-2, info_width, 0, roster_width+1, self.core.stdscr, self.visible)
+ self.roster_win = windows.RosterWin(self.height-2-3, roster_width, 0, 0, self.core.stdscr, self.visible)
+ self.contact_info_win = windows.ContactInfoWin(3, roster_width, self.height-2-3, 0, self.core.stdscr, self.visible)
+ self.default_help_message = windows.HelpText(1, self.width, self.height-1, 0, self.core.stdscr, self.visible, "Enter commands with “/”. “o”: toggle offline show")
self.input = self.default_help_message
self.set_color_state(theme.COLOR_TAB_NORMAL)
@@ -489,7 +493,7 @@ class RosterInfoTab(Tab):
'/' is pressed, we enter "input mode"
"""
curses.curs_set(1)
- self.input = buffers.CommandInput(1, self.width, self.height-1, 0, self.default_help_message, self.visible, "", self.reset_help_message, self.execute_slash_command)
+ self.input = windows.CommandInput(1, self.width, self.height-1, 0, self.default_help_message, self.visible, "", self.reset_help_message, self.execute_slash_command)
self.input.do_command("/") # we add the slash
def reset_help_message(self, _=None):
@@ -549,7 +553,7 @@ class RosterInfoTab(Tab):
in it.
"""
curses.curs_set(1)
- self.input = buffers.CommandInput(1, self.width, self.height-1, 0, self.default_help_message, self.visible, "[Search]", self.on_search_terminate, self.on_search_terminate, self.set_roster_filter)
+ self.input = windows.CommandInput(1, self.width, self.height-1, 0, self.default_help_message, self.visible, "[Search]", self.on_search_terminate, self.on_search_terminate, self.set_roster_filter)
return True
def set_roster_filter(self, txt):
@@ -576,12 +580,12 @@ class ConversationTab(Tab):
self._text_buffer = text_buffer
self.color_state = theme.COLOR_TAB_NORMAL
self._name = jid # a conversation tab is linked to one specific full jid OR bare jid
- self.text_win = buffers.TextWin(self.height-4-self.core.information_win_size, self.width, 1, 0, self.core.stdscr, self.visible)
- self.upper_bar = buffers.ConversationStatusMessageWin(1, self.width, 0, 0, self.core.stdscr, self.visible)
- self.info_header = buffers.ConversationInfoWin(1, self.width, self.height-3-self.core.information_win_size, 0, self.core.stdscr, self.visible)
- self.info_win = buffers.TextWin(self.core.information_win_size, self.width, self.height-2-self.core.information_win_size, 0, self.core.stdscr, self.visible)
- self.tab_win = buffers.GlobalInfoBar(1, self.width, self.height-2, 0, self.core.stdscr, self.visible)
- self.input = buffers.MessageInput(1, self.width, self.height-1, 0, self.core.stdscr, self.visible)
+ self.text_win = windows.TextWin(self.height-4-self.core.information_win_size, self.width, 1, 0, self.core.stdscr, self.visible)
+ self.upper_bar = windows.ConversationStatusMessageWin(1, self.width, 0, 0, self.core.stdscr, self.visible)
+ self.info_header = windows.ConversationInfoWin(1, self.width, self.height-3-self.core.information_win_size, 0, self.core.stdscr, self.visible)
+ self.info_win = windows.TextWin(self.core.information_win_size, self.width, self.height-2-self.core.information_win_size, 0, self.core.stdscr, self.visible)
+ self.tab_win = windows.GlobalInfoBar(1, self.width, self.height-2, 0, self.core.stdscr, self.visible)
+ self.input = windows.MessageInput(1, self.width, self.height-1, 0, self.core.stdscr, self.visible)
def resize(self):
Tab.resize(self)