def __init__(self, name, help_message, header_text, cols): """Parameters: name: The name of the tab help_message: The default help message displayed instead of the input header_text: The text displayed on the header line, at the top of the tab cols: a tuple of 2-tuples. e.g. (('column1_name', number), ('column2_name', number)) """ Tab.__init__(self) self.state = 'normal' self.name = name columns = collections.OrderedDict() for col, num in cols: columns[col] = num self.list_header = windows.ColumnHeaderWin(list(columns)) self.listview = windows.ListWin(columns) self.info_header = windows.MucListInfoWin(header_text) self.default_help_message = windows.HelpText(help_message) self.input = self.default_help_message self.key_func["KEY_DOWN"] = self.move_cursor_down self.key_func["KEY_UP"] = self.move_cursor_up self.key_func['^I'] = self.completion self.key_func["/"] = self.on_slash self.key_func['KEY_LEFT'] = self.list_header.sel_column_left self.key_func['KEY_RIGHT'] = self.list_header.sel_column_right self.key_func[' '] = self.sort_by self.register_command('close', self.close, shortdesc='Close this tab.') self.resize() self.update_keys() self.update_commands()
def __init__(self, bookmarks: BookmarkList): Tab.__init__(self) self.name = "Bookmarks" self.bookmarks = bookmarks self.new_bookmarks = [] self.removed_bookmarks = [] self.header_win = windows.ColumnHeaderWin(('room@server/nickname', 'password', 'autojoin', 'storage')) self.bookmarks_win = windows.BookmarksWin(self.bookmarks, self.height-4, self.width, 1, 0) self.help_win = windows.HelpText('Ctrl+Y: save, Ctrl+G: cancel, ' '↑↓: change lines, tab: change ' 'column, M-a: add bookmark, C-k' ': delete bookmark') self.info_header = windows.BookmarksInfoWin() self.key_func['KEY_UP'] = self.bookmarks_win.go_to_previous_line_input self.key_func['KEY_DOWN'] = self.bookmarks_win.go_to_next_line_input self.key_func['^I'] = self.bookmarks_win.go_to_next_horizontal_input self.key_func['^G'] = self.on_cancel self.key_func['^Y'] = self.on_save self.key_func['M-a'] = self.add_bookmark self.key_func['^K'] = self.del_bookmark self.resize() self.update_commands()
def __init__(self, form, on_cancel, on_send, kwargs): Tab.__init__(self) self._form = form self._on_cancel = on_cancel self._on_send = on_send self._kwargs = kwargs self.fields = [] for field in self._form: self.fields.append(field) self.topic_win = windows.Topic() self.form_win = windows.FormWin(form, self.height-4, self.width, 1, 0) self.help_win = windows.HelpText("Ctrl+Y: send form, Ctrl+G: cancel") self.help_win_dyn = windows.HelpText() self.key_func['KEY_UP'] = self.form_win.go_to_previous_input self.key_func['KEY_DOWN'] = self.form_win.go_to_next_input self.key_func['^G'] = self.on_cancel self.key_func['^Y'] = self.on_send self.resize() self.update_commands()
def __init__(self): Tab.__init__(self) self.state = 'normal' self.name = 'XMLTab' self.filters = [] self.core_buffer = self.core.xml_buffer self.filtered_buffer = text_buffer.TextBuffer() self.info_header = windows.XMLInfoWin() self.text_win = windows.XMLTextWin() self.core_buffer.add_window(self.text_win) self.default_help_message = windows.HelpText("/ to enter a command") self.register_command('close', self.close, shortdesc=_("Close this tab.")) self.register_command('clear', self.command_clear, shortdesc=_('Clear the current buffer.')) self.register_command('reset', self.command_reset, shortdesc=_('Reset the stanza filter.')) self.register_command( 'filter_id', self.command_filter_id, usage='<id>', desc=_('Show only the stanzas with the id <id>.'), shortdesc=_('Filter by id.')) self.register_command( 'filter_xpath', self.command_filter_xpath, usage='<xpath>', desc=_( 'Show only the stanzas matching the xpath <xpath>.' ' Any occurrences of %n will be replaced by jabber:client.'), shortdesc=_('Filter by XPath.')) self.register_command( 'filter_jid', self.command_filter_jid, usage='<jid>', desc=_( 'Show only the stanzas matching the jid <jid> in from= or to=.' ), shortdesc=_('Filter by JID.')) self.register_command( 'filter_from', self.command_filter_from, usage='<jid>', desc=_('Show only the stanzas matching the jid <jid> in from=.'), shortdesc=_('Filter by JID from.')) self.register_command( 'filter_to', self.command_filter_to, usage='<jid>', desc=_('Show only the stanzas matching the jid <jid> in to=.'), shortdesc=_('Filter by JID to.')) self.register_command( 'filter_xmlmask', self.command_filter_xmlmask, usage=_('<xml mask>'), desc=_('Show only the stanzas matching the given xml mask.'), shortdesc=_('Filter by xml mask.')) self.register_command( 'dump', self.command_dump, usage=_('<filename>'), desc=_('Writes the content of the XML buffer into a file.'), shortdesc=_('Write in a file.')) self.input = self.default_help_message self.key_func['^T'] = self.close self.key_func['^I'] = self.completion self.key_func["KEY_DOWN"] = self.on_scroll_down self.key_func["KEY_UP"] = self.on_scroll_up self.key_func["^K"] = self.on_freeze self.key_func["/"] = self.on_slash self.resize() # Used to display the infobar self.filter_type = '' self.filter = ''
def __init__(self): Tab.__init__(self) self.name = "Roster" self.v_separator = windows.VerticalSeparator() self.information_win = windows.TextWin() self.core.information_buffer.add_window(self.information_win) self.roster_win = windows.RosterWin() self.contact_info_win = windows.ContactInfoWin() self.default_help_message = windows.HelpText( "Enter commands with “/”. “o”: toggle offline show") self.input = self.default_help_message self.state = 'normal' self.key_func['^I'] = self.completion self.key_func[' '] = self.on_space self.key_func["/"] = self.on_slash self.key_func["KEY_UP"] = self.move_cursor_up self.key_func["KEY_DOWN"] = self.move_cursor_down self.key_func["M-u"] = self.move_cursor_to_next_contact self.key_func["M-y"] = self.move_cursor_to_prev_contact self.key_func["M-U"] = self.move_cursor_to_next_group self.key_func["M-Y"] = self.move_cursor_to_prev_group self.key_func["M-[1;5B"] = self.move_cursor_to_next_group self.key_func["M-[1;5A"] = self.move_cursor_to_prev_group self.key_func["l"] = self.command_last_activity self.key_func["o"] = self.toggle_offline_show self.key_func["v"] = self.get_contact_version self.key_func["i"] = self.show_contact_info self.key_func["n"] = self.change_contact_name self.key_func["s"] = self.start_search self.key_func["S"] = self.start_search_slow self.register_command( 'deny', self.command_deny, usage=_('[jid]'), desc= _('Deny your presence to the provided JID (or the selected contact in your roster), who is asking you to be in his/here roster.' ), shortdesc=_('Deny an user your presence.'), completion=self.completion_deny) self.register_command( 'accept', self.command_accept, usage=_('[jid]'), desc= _('Allow the provided JID (or the selected contact in your roster), to see your presence.' ), shortdesc=_('Allow an user your presence.'), completion=self.completion_deny) self.register_command( 'add', self.command_add, usage=_('<jid>'), desc= _('Add the specified JID to your roster, ask him to allow you to see his presence, and allow him to see your presence.' ), shortdesc=_('Add an user to your roster.')) self.register_command('name', self.command_name, usage=_('<jid> [name]'), shortdesc=_('Set the given JID\'s name.'), completion=self.completion_name) self.register_command('groupadd', self.command_groupadd, usage=_('<jid> <group>'), desc=_('Add the given JID to the given group.'), shortdesc=_('Add an user to a group'), completion=self.completion_groupadd) self.register_command( 'groupmove', self.command_groupmove, usage=_('<jid> <old group> <new group>'), desc=_('Move the given JID from the old group to the new group.'), shortdesc=_('Move an user to another group.'), completion=self.completion_groupmove) self.register_command( 'groupremove', self.command_groupremove, usage=_('<jid> <group>'), desc=_('Remove the given JID from the given group.'), shortdesc=_('Remove an user from a group.'), completion=self.completion_groupremove) self.register_command( 'remove', self.command_remove, usage=_('[jid]'), desc= _('Remove the specified JID from your roster. This wil unsubscribe you from its presence, cancel its subscription to yours, and remove the item from your roster.' ), shortdesc=_('Remove an user from your roster.'), completion=self.completion_remove) self.register_command( 'reconnect', self.command_reconnect, desc= _('Disconnect from the remote server if you are currently connected and then connect to it again.' ), shortdesc=_('Disconnect and reconnect to the server.')) self.register_command('disconnect', self.command_disconnect, desc=_('Disconnect from the remote server.'), shortdesc=_('Disconnect from the server.')) self.register_command( 'export', self.command_export, usage=_('[/path/to/file]'), desc= _('Export your contacts into /path/to/file if specified, or $HOME/poezio_contacts if not.' ), shortdesc=_('Export your roster to a file.'), completion=partial(self.completion_file, 1)) self.register_command( 'import', self.command_import, usage=_('[/path/to/file]'), desc= _('Import your contacts from /path/to/file if specified, or $HOME/poezio_contacts if not.' ), shortdesc=_('Import your roster from a file.'), completion=partial(self.completion_file, 1)) self.register_command('clear', self.command_clear, shortdesc=_('Clear the info buffer.')) self.register_command( 'last_activity', self.command_last_activity, usage=_('<jid>'), desc=_('Informs you of the last activity of a JID.'), shortdesc=_('Get the activity of someone.'), completion=self.core.completion_last_activity) self.register_command('password', self.command_password, usage='<password>', shortdesc=_('Change your password')) self.resize() self.update_commands() self.update_keys()