Changeset 7984 for branches/gajim_0.11/src
- Timestamp:
- 02/15/07 19:05:38 (19 months ago)
- Location:
- branches/gajim_0.11/src
- Files:
-
- 11 modified
-
chat_control.py (modified) (6 diffs)
-
common/connection.py (modified) (3 diffs)
-
common/dataforms.py (modified) (2 diffs)
-
config.py (modified) (2 diffs)
-
conversation_textview.py (modified) (3 diffs)
-
disco.py (modified) (8 diffs)
-
gajim.py (modified) (2 diffs)
-
groupchat_control.py (modified) (8 diffs)
-
message_control.py (modified) (2 diffs)
-
message_window.py (modified) (1 diff)
-
roster_window.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/gajim_0.11/src/chat_control.py
r7966 r7984 118 118 pass # Derived should implement this rather than connecting to the event itself. 119 119 120 def __init__(self, type_id, parent_win, widget_name, display_names, contact,121 acct,resource = None):120 def __init__(self, type_id, parent_win, widget_name, contact, acct, 121 resource = None): 122 122 MessageControl.__init__(self, type_id, parent_win, widget_name, 123 display_names,contact, acct, resource = resource);123 contact, acct, resource = resource); 124 124 # when/if we do XHTML we will put formatting buttons back 125 125 widget = self.xml.get_widget('emoticons_button') … … 171 171 self.sent_history = [] 172 172 self.sent_history_pos = 0 173 self.typing_new = False 174 self.orig_msg = '' 173 self.orig_msg = None 175 174 176 175 # Emoticons menu … … 542 541 self.sent_history.append(message) 543 542 self.sent_history_pos = size + 1 544 545 self.typing_new = True 546 self.orig_msg = '' 543 self.orig_msg = None 547 544 548 545 def print_conversation_line(self, text, kind, name, tim, … … 787 784 def sent_messages_scroll(self, direction, conv_buf): 788 785 size = len(self.sent_history) 789 if self. typing_new:790 # user was typing something and then went into history, so save791 # whatever is already typed786 if self.orig_msg is None: 787 # user was typing something and then went into history, so save 788 # whatever is already typed 792 789 start_iter = conv_buf.get_start_iter() 793 790 end_iter = conv_buf.get_end_iter() 794 791 self.orig_msg = conv_buf.get_text(start_iter, end_iter, 0).decode( 795 792 'utf-8') 796 self.typing_new = False797 793 if direction == 'up': 798 794 if self.sent_history_pos == 0: … … 803 799 if self.sent_history_pos >= size - 1: 804 800 conv_buf.set_text(self.orig_msg); 805 self. typing_new = True801 self.orig_msg = None 806 802 self.sent_history_pos = size 807 803 return … … 854 850 def __init__(self, parent_win, contact, acct, resource = None): 855 851 ChatControlBase.__init__(self, self.TYPE_ID, parent_win, 856 'chat_child_vbox', (_('Chat'), _('Chats')),contact, acct, resource)852 'chat_child_vbox', contact, acct, resource) 857 853 858 854 # for muc use: -
branches/gajim_0.11/src/common/connection.py
r7940 r7984 638 638 msg = '' 639 639 keyID = gajim.config.get_per('accounts', self.name, 'keyid') 640 if keyID and USE_GPG and not msg:641 lowered_uf_status_msg = helpers.get_uf_show(show).lower()642 # do not show I'm invisible!643 if lowered_uf_status_msg == _('invisible').lower():644 lowered_uf_status_msg = _('offline').lower()645 msg = _("I'm %s") % lowered_uf_status_msg646 640 signed = '' 647 641 if not auto and not show == 'offline': … … 1058 1052 self.connection.send(p) 1059 1053 1060 # last date/time in history to avoid duplicate1054 # last date/time in history to avoid duplicate 1061 1055 if not self.last_history_line.has_key(room_jid): 1062 1056 # Not in memory, get it from DB … … 1086 1080 to = room_jid) 1087 1081 self.connection.send(iq) 1088 1089 def change_gc_nick(self, room_jid, nick):1090 if not self.connection:1091 return1092 p = common.xmpp.Presence(to = '%s/%s' % (room_jid, nick))1093 p = self.add_sha(p)1094 self.connection.send(p)1095 1082 1096 1083 def send_gc_status(self, nick, jid, show, status): -
branches/gajim_0.11/src/common/dataforms.py
r7829 r7984 367 367 def fget(self): 368 368 value = u'' 369 for valuenode in self.getTags(' value'):369 for valuenode in self.getTags('instructions'): 370 370 value += '\n' + valuenode.getData() 371 371 return value[1:] … … 374 374 if value == '': return 375 375 for line in value.split('\n'): 376 self.addChild(' value').setData(line)377 def fdel(self): 378 for value in self.getTags(' value'):376 self.addChild('instructions').setData(line) 377 def fdel(self): 378 for value in self.getTags('instructions'): 379 379 self.delChild(value) 380 380 return locals() -
branches/gajim_0.11/src/config.py
r7940 r7984 762 762 def on_reset_colors_button_clicked(self, widget): 763 763 for i in ('inmsgcolor', 'outmsgcolor', 'statusmsgcolor', 'urlmsgcolor'): 764 gajim.config.set(i, gajim.interface.default_ values[i])764 gajim.config.set(i, gajim.interface.default_colors[i]) 765 765 766 766 self.xml.get_widget('incoming_msg_colorbutton').set_color(\ … … 901 901 model[iter][3]) 902 902 gajim.config.set_per('defaultstatusmsg', status, 'message', message) 903 904 def on_default_status_expander_activate(self, expander): 905 eventbox = self.xml.get_widget('default_status_eventbox') 906 vbox = self.xml.get_widget('status_vbox') 907 vbox.set_child_packing(eventbox, not expander.get_expanded(), True, 0, 908 gtk.PACK_START) 903 909 904 910 def save_status_messages(self, model): -
branches/gajim_0.11/src/conversation_textview.py
r7949 r7984 36 36 '''Class for the conversation textview (where user reads already said messages) 37 37 for chat/groupchat windows''' 38 39 path_to_file = os.path.join(gajim.DATA_DIR, 'pixmaps', 'muc_separator.png') 40 FOCUS_OUT_LINE_PIXBUF = gtk.gdk.pixbuf_new_from_file(path_to_file) 41 38 42 def __init__(self, account, used_in_history_window = False): 39 43 '''if used_in_history_window is True, then we do not show … … 139 143 140 144 self.line_tooltip = tooltips.BaseTooltip() 141 142 path_to_file = os.path.join(gajim.DATA_DIR, 'pixmaps', 'muc_separator.png')143 self.focus_out_line_pixbuf = gtk.gdk.pixbuf_new_from_file(path_to_file)144 145 # use it for hr too 145 self.tv.focus_out_line_pixbuf = self.focus_out_line_pixbuf146 self.tv.focus_out_line_pixbuf = ConversationTextview.FOCUS_OUT_LINE_PIXBUF 146 147 147 148 def del_handlers(self): … … 240 241 end_iter = buffer.get_end_iter() 241 242 buffer.insert(end_iter, '\n') 242 buffer.insert_pixbuf(end_iter, self.focus_out_line_pixbuf) 243 buffer.insert_pixbuf(end_iter, 244 ConversationTextview.FOCUS_OUT_LINE_PIXBUF) 243 245 244 246 end_iter = buffer.get_end_iter() -
branches/gajim_0.11/src/disco.py
r7888 r7984 1725 1725 ''' Create treemodel for the window. ''' 1726 1726 # JID, node, name (with description) - pango markup, dont have info?, subscribed? 1727 model = gtk.ListStore(str, str, str, bool, bool)1728 model.set_sort_column_id(3, gtk.SORT_ASCENDING)1729 self.window.services_treeview.set_model( model)1727 self.model = gtk.ListStore(str, str, str, bool, bool) 1728 self.model.set_sort_column_id(3, gtk.SORT_ASCENDING) 1729 self.window.services_treeview.set_model(self.model) 1730 1730 1731 1731 # Name column … … 1749 1749 self.window.services_treeview.set_headers_visible(True) 1750 1750 1751 def _add_item(self, model,jid, node, item, force):1751 def _add_item(self, jid, node, item, force): 1752 1752 ''' Called when we got basic information about new node from query. 1753 1753 Show the item. ''' … … 1756 1756 if self.subscriptions is not None: 1757 1757 dunno = False 1758 subscribed = n ame in self.subscriptions1758 subscribed = node in self.subscriptions 1759 1759 else: 1760 1760 dunno = True … … 1764 1764 name = '<b>%s</b>' % name 1765 1765 1766 model.append((jid, node, name, dunno, subscribed))1766 self.model.append((jid, node, name, dunno, subscribed)) 1767 1767 1768 1768 def _add_actions(self): … … 1846 1846 ''' We got the subscribed groups list stanza. Now, if we already 1847 1847 have items on the list, we should actualize them. ''' 1848 print 01849 1848 try: 1850 1849 subscriptions = request.getTag('pubsub').getTag('subscriptions') … … 1852 1851 return 1853 1852 1854 print 11855 1853 groups = set() 1856 1854 for child in subscriptions.getTags('subscription'): 1857 print 2, repr(child), str(child)1858 1855 groups.add(child['node']) 1859 print 3, groups1860 1856 1861 1857 self.subscriptions = groups … … 1863 1859 # try to setup existing items in model 1864 1860 model = self.window.services_treeview.get_model() 1865 print 41866 1861 for row in model: 1867 print 51868 1862 # 1 = group node 1869 1863 # 3 = insensitive checkbox for subscribed … … 1872 1866 row[3]=False 1873 1867 row[4]=groupnode in groups 1874 print 61875 1868 1876 1869 # we now know subscriptions, update button states -
branches/gajim_0.11/src/gajim.py
r7949 r7984 2010 2010 # handler when an emoticon is clicked in emoticons_menu 2011 2011 self.emoticon_menuitem_clicked = None 2012 self.default_ values = {2012 self.default_colors = { 2013 2013 'inmsgcolor': gajim.config.get('inmsgcolor'), 2014 2014 'outmsgcolor': gajim.config.get('outmsgcolor'), … … 2213 2213 try: 2214 2214 cli.set_restart_command(argv) 2215 except TypeError:2215 except AttributeError: 2216 2216 cli.set_restart_command(len(argv), argv) 2217 2217 -
branches/gajim_0.11/src/groupchat_control.py
r7940 r7984 104 104 ChatControl.__init__(self, parent_win, contact, acct) 105 105 self.TYPE_ID = 'pm' 106 self.display_names = (_('Private Chat'), _('Private Chats'))107 106 108 107 def send_message(self, message): … … 139 138 class GroupchatControl(ChatControlBase): 140 139 TYPE_ID = message_control.TYPE_GC 140 # alphanum sorted 141 MUC_CMDS = ['ban', 'chat', 'query', 'clear', 'close', 'compact', 142 'help', 'invite', 'join', 'kick', 'leave', 'me', 'msg', 'nick', 143 'part', 'names', 'say', 'topic'] 141 144 142 145 def __init__(self, parent_win, contact, acct): 143 146 ChatControlBase.__init__(self, self.TYPE_ID, parent_win, 144 'muc_child_vbox', (_('Group Chat'), _('Group Chats')), 145 contact, acct); 147 'muc_child_vbox', contact, acct); 146 148 147 149 widget = self.xml.get_widget('muc_window_actions_button') … … 190 192 191 193 self._last_selected_contact = None # None or holds jid, account tuple 192 # alphanum sorted 193 self.muc_cmds = ['ban', 'chat', 'query', 'clear', 'close', 'compact', 194 'help', 'invite', 'join', 'kick', 'leave', 'me', 'msg', 'nick', 195 'part', 'names', 'say', 'topic'] 194 196 195 # muc attention flag (when we are mentioned in a muc) 197 196 # if True, the room has mentioned us 198 197 self.attention_flag = False 199 self.room_creation = time.time()198 self.room_creation = int(time.time()) # Use int to reduce mem usage 200 199 self.nick_hits = [] 201 200 self.cmd_hits = [] … … 1050 1049 nick = message_array[0] 1051 1050 nick = helpers.parse_resource(nick) 1052 gajim.connections[self.account]. change_gc_nick(self.room_jid, nick)1051 gajim.connections[self.account].join_gc(nick, self.room_jid, None) 1053 1052 self.clear(self.msg_textview) 1054 1053 else: … … 1258 1257 def get_command_help(self, command): 1259 1258 if command == 'help': 1260 self.print_conversation(_('Commands: %s') % self.muc_cmds, 'info') 1259 self.print_conversation(_('Commands: %s') % GroupchatControl.MUC_CMDS, 1260 'info') 1261 1261 elif command == 'ban': 1262 1262 s = _('Usage: /%s <nickname|JID> [reason], bans the JID from the group chat.' … … 1330 1330 nick = instance.input_entry.get_text().decode('utf-8') 1331 1331 nick = helpers.parse_resource(nick) 1332 gajim.connections[self.account]. change_gc_nick(self.room_jid, nick)1332 gajim.connections[self.account].join_gc(nick, self.room_jid, None) 1333 1333 self.nick = nick 1334 1334 instance = dialogs.InputDialog(title, prompt, proposed_nick, … … 1506 1506 text = splitted_text[0] 1507 1507 if len(text) == 1: # user wants to cycle all commands 1508 self.cmd_hits = self.muc_cmds1508 self.cmd_hits = GroupchatControl.MUC_CMDS 1509 1509 else: 1510 1510 # cycle possible commands depending on what the user typed … … 1515 1515 else: # find possible commands 1516 1516 self.cmd_hits = [] 1517 for cmd in self.muc_cmds:1517 for cmd in GroupchatControl.MUC_CMDS: 1518 1518 if cmd.startswith(text.lstrip('/')): 1519 1519 self.cmd_hits.append(cmd) -
branches/gajim_0.11/src/message_control.py
r7829 r7984 26 26 '''An abstract base widget that can embed in the gtk.Notebook of a MessageWindow''' 27 27 28 def __init__(self, type_id, parent_win, widget_name, display_names, contact, account, resource = None): 29 '''The display_names argument is a two element tuple containing the desired 30 display name (pretty string) for the control in both singular and plural form''' 28 def __init__(self, type_id, parent_win, widget_name, contact, account, resource = None): 31 29 # dict { cb id : widget} 32 30 # keep all registered callbacks of widgets, created by self.xml … … 35 33 self.parent_win = parent_win 36 34 self.widget_name = widget_name 37 self.display_names = display_names38 35 self.contact = contact 39 36 self.account = account -
branches/gajim_0.11/src/message_window.py
r7940 r7984 265 265 266 266 window_mode = gajim.interface.msg_win_mgr.mode 267 267 268 if self.get_num_controls() == 1: 268 269 label = name 269 270 elif window_mode == MessageWindowMgr.ONE_MSG_WINDOW_PERTYPE: 270 271 # Show the plural form since number of tabs > 1 271 label = control.display_names[1] 272 if self.type == 'chat': 273 label = _('Chats') 274 elif self.type == 'gc': 275 label = _('Group Chats') 276 else: 277 label = _('Private Chats') 272 278 else: 273 279 label = _('Messages') -
branches/gajim_0.11/src/roster_window.py
r7940 r7984 2813 2813 common.sleepy.STATE_UNKNOWN: 2814 2814 gajim.sleeper_state[account] = 'online' 2815 el se:2815 elif gajim.sleeper_state[account] not in ('autoaway', 'autoxa'): 2816 2816 gajim.sleeper_state[account] = 'off' 2817 2817 gajim.connections[account].change_status(status, txt, auto)
