Show
Ignore:
Timestamp:
02/15/07 19:05:38 (19 months ago)
Author:
asterix
Message:

mrege diff from trunk

Location:
branches/gajim_0.11/src
Files:
11 modified

Legend:

Unmodified
Added
Removed
  • branches/gajim_0.11/src/chat_control.py

    r7966 r7984  
    118118                pass # Derived should implement this rather than connecting to the event itself. 
    119119 
    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): 
    122122                MessageControl.__init__(self, type_id, parent_win, widget_name, 
    123                         display_names,  contact, acct, resource = resource); 
     123                        contact, acct, resource = resource); 
    124124                # when/if we do XHTML we will put formatting buttons back 
    125125                widget = self.xml.get_widget('emoticons_button') 
     
    171171                self.sent_history = [] 
    172172                self.sent_history_pos = 0 
    173                 self.typing_new = False 
    174                 self.orig_msg = '' 
     173                self.orig_msg = None 
    175174 
    176175                # Emoticons menu 
     
    542541                        self.sent_history.append(message) 
    543542                        self.sent_history_pos = size + 1 
    544  
    545                 self.typing_new = True 
    546                 self.orig_msg = '' 
     543                self.orig_msg = None 
    547544 
    548545        def print_conversation_line(self, text, kind, name, tim, 
     
    787784        def sent_messages_scroll(self, direction, conv_buf): 
    788785                size = len(self.sent_history)  
    789                 if self.typing_new: 
    790                         #user was typing something and then went into history, so save 
    791                         #whatever is already typed 
     786                if self.orig_msg is None: 
     787                        # user was typing something and then went into history, so save 
     788                        # whatever is already typed 
    792789                        start_iter = conv_buf.get_start_iter() 
    793790                        end_iter = conv_buf.get_end_iter() 
    794791                        self.orig_msg = conv_buf.get_text(start_iter, end_iter, 0).decode( 
    795792                                'utf-8') 
    796                         self.typing_new = False 
    797793                if direction == 'up': 
    798794                        if self.sent_history_pos == 0: 
     
    803799                        if self.sent_history_pos >= size - 1: 
    804800                                conv_buf.set_text(self.orig_msg); 
    805                                 self.typing_new = True 
     801                                self.orig_msg = None 
    806802                                self.sent_history_pos = size 
    807803                                return 
     
    854850        def __init__(self, parent_win, contact, acct, resource = None): 
    855851                ChatControlBase.__init__(self, self.TYPE_ID, parent_win, 
    856                         'chat_child_vbox', (_('Chat'), _('Chats')), contact, acct, resource) 
     852                        'chat_child_vbox', contact, acct, resource) 
    857853                         
    858854                # for muc use: 
  • branches/gajim_0.11/src/common/connection.py

    r7940 r7984  
    638638                        msg = '' 
    639639                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_msg 
    646640                signed = '' 
    647641                if not auto and not show == 'offline': 
     
    10581052                self.connection.send(p) 
    10591053 
    1060                 #last date/time in history to avoid duplicate 
     1054                # last date/time in history to avoid duplicate 
    10611055                if not self.last_history_line.has_key(room_jid):  
    10621056                        # Not in memory, get it from DB 
     
    10861080                        to = room_jid) 
    10871081                self.connection.send(iq) 
    1088  
    1089         def change_gc_nick(self, room_jid, nick): 
    1090                 if not self.connection: 
    1091                         return 
    1092                 p = common.xmpp.Presence(to = '%s/%s' % (room_jid, nick)) 
    1093                 p = self.add_sha(p) 
    1094                 self.connection.send(p) 
    10951082 
    10961083        def send_gc_status(self, nick, jid, show, status): 
  • branches/gajim_0.11/src/common/dataforms.py

    r7829 r7984  
    367367                def fget(self): 
    368368                        value = u'' 
    369                         for valuenode in self.getTags('value'): 
     369                        for valuenode in self.getTags('instructions'): 
    370370                                value += '\n' + valuenode.getData() 
    371371                        return value[1:] 
     
    374374                        if value == '': return 
    375375                        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'): 
    379379                                self.delChild(value) 
    380380                return locals() 
  • branches/gajim_0.11/src/config.py

    r7940 r7984  
    762762        def on_reset_colors_button_clicked(self, widget): 
    763763                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]) 
    765765 
    766766                self.xml.get_widget('incoming_msg_colorbutton').set_color(\ 
     
    901901                        model[iter][3]) 
    902902                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) 
    903909 
    904910        def save_status_messages(self, model): 
  • branches/gajim_0.11/src/conversation_textview.py

    r7949 r7984  
    3636        '''Class for the conversation textview (where user reads already said messages) 
    3737        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 
    3842        def __init__(self, account, used_in_history_window = False): 
    3943                '''if used_in_history_window is True, then we do not show 
     
    139143 
    140144                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) 
    144145                # use it for hr too 
    145                 self.tv.focus_out_line_pixbuf = self.focus_out_line_pixbuf 
     146                self.tv.focus_out_line_pixbuf = ConversationTextview.FOCUS_OUT_LINE_PIXBUF 
    146147 
    147148        def del_handlers(self): 
     
    240241                        end_iter = buffer.get_end_iter() 
    241242                        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) 
    243245 
    244246                        end_iter = buffer.get_end_iter() 
  • branches/gajim_0.11/src/disco.py

    r7888 r7984  
    17251725                ''' Create treemodel for the window. ''' 
    17261726                # 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) 
    17301730 
    17311731                # Name column 
     
    17491749                self.window.services_treeview.set_headers_visible(True) 
    17501750 
    1751         def _add_item(self, model, jid, node, item, force): 
     1751        def _add_item(self, jid, node, item, force): 
    17521752                ''' Called when we got basic information about new node from query. 
    17531753                Show the item. ''' 
     
    17561756                if self.subscriptions is not None: 
    17571757                        dunno = False 
    1758                         subscribed = name in self.subscriptions 
     1758                        subscribed = node in self.subscriptions 
    17591759                else: 
    17601760                        dunno = True 
     
    17641764                name = '<b>%s</b>' % name 
    17651765 
    1766                 model.append((jid, node, name, dunno, subscribed)) 
     1766                self.model.append((jid, node, name, dunno, subscribed)) 
    17671767 
    17681768        def _add_actions(self): 
     
    18461846                ''' We got the subscribed groups list stanza. Now, if we already 
    18471847                have items on the list, we should actualize them. ''' 
    1848                 print 0 
    18491848                try: 
    18501849                        subscriptions = request.getTag('pubsub').getTag('subscriptions') 
     
    18521851                        return  
    18531852 
    1854                 print 1 
    18551853                groups = set() 
    18561854                for child in subscriptions.getTags('subscription'): 
    1857                         print 2, repr(child), str(child) 
    18581855                        groups.add(child['node']) 
    1859                 print 3, groups 
    18601856 
    18611857                self.subscriptions = groups 
     
    18631859                # try to setup existing items in model 
    18641860                model = self.window.services_treeview.get_model() 
    1865                 print 4 
    18661861                for row in model: 
    1867                         print 5 
    18681862                        # 1 = group node 
    18691863                        # 3 = insensitive checkbox for subscribed 
     
    18721866                        row[3]=False 
    18731867                        row[4]=groupnode in groups 
    1874                 print 6 
    18751868 
    18761869                # we now know subscriptions, update button states 
  • branches/gajim_0.11/src/gajim.py

    r7949 r7984  
    20102010                # handler when an emoticon is clicked in emoticons_menu 
    20112011                self.emoticon_menuitem_clicked = None 
    2012                 self.default_values = { 
     2012                self.default_colors = { 
    20132013                        'inmsgcolor': gajim.config.get('inmsgcolor'), 
    20142014                        'outmsgcolor': gajim.config.get('outmsgcolor'), 
     
    22132213                                try: 
    22142214                                        cli.set_restart_command(argv) 
    2215                                 except TypeError: 
     2215                                except AttributeError: 
    22162216                                        cli.set_restart_command(len(argv), argv) 
    22172217                 
  • branches/gajim_0.11/src/groupchat_control.py

    r7940 r7984  
    104104                ChatControl.__init__(self, parent_win, contact, acct) 
    105105                self.TYPE_ID = 'pm' 
    106                 self.display_names = (_('Private Chat'), _('Private Chats')) 
    107106 
    108107        def send_message(self, message): 
     
    139138class GroupchatControl(ChatControlBase): 
    140139        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'] 
    141144 
    142145        def __init__(self, parent_win, contact, acct): 
    143146                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); 
    146148 
    147149                widget = self.xml.get_widget('muc_window_actions_button') 
     
    190192 
    191193                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 
    196195                # muc attention flag (when we are mentioned in a muc) 
    197196                # if True, the room has mentioned us 
    198197                self.attention_flag = False 
    199                 self.room_creation = time.time() 
     198                self.room_creation = int(time.time()) # Use int to reduce mem usage 
    200199                self.nick_hits = [] 
    201200                self.cmd_hits = [] 
     
    10501049                                nick = message_array[0] 
    10511050                                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) 
    10531052                                self.clear(self.msg_textview) 
    10541053                        else: 
     
    12581257        def get_command_help(self, command): 
    12591258                if command == 'help': 
    1260                         self.print_conversation(_('Commands: %s') % self.muc_cmds, 'info') 
     1259                        self.print_conversation(_('Commands: %s') % GroupchatControl.MUC_CMDS, 
     1260                                'info') 
    12611261                elif command == 'ban': 
    12621262                        s = _('Usage: /%s <nickname|JID> [reason], bans the JID from the group chat.' 
     
    13301330                        nick = instance.input_entry.get_text().decode('utf-8') 
    13311331                        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) 
    13331333                        self.nick = nick 
    13341334                instance = dialogs.InputDialog(title, prompt, proposed_nick, 
     
    15061506                                text = splitted_text[0] 
    15071507                                if len(text) == 1: # user wants to cycle all commands 
    1508                                         self.cmd_hits = self.muc_cmds 
     1508                                        self.cmd_hits = GroupchatControl.MUC_CMDS 
    15091509                                else: 
    15101510                                        # cycle possible commands depending on what the user typed 
     
    15151515                                        else: # find possible commands 
    15161516                                                self.cmd_hits = [] 
    1517                                                 for cmd in self.muc_cmds: 
     1517                                                for cmd in GroupchatControl.MUC_CMDS: 
    15181518                                                        if cmd.startswith(text.lstrip('/')): 
    15191519                                                                self.cmd_hits.append(cmd) 
  • branches/gajim_0.11/src/message_control.py

    r7829 r7984  
    2626        '''An abstract base widget that can embed in the gtk.Notebook of a MessageWindow''' 
    2727 
    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): 
    3129                # dict { cb id : widget}  
    3230                # keep all registered callbacks of widgets, created by self.xml 
     
    3533                self.parent_win = parent_win 
    3634                self.widget_name = widget_name 
    37                 self.display_names = display_names 
    3835                self.contact = contact 
    3936                self.account = account 
  • branches/gajim_0.11/src/message_window.py

    r7940 r7984  
    265265 
    266266                window_mode = gajim.interface.msg_win_mgr.mode 
     267 
    267268                if self.get_num_controls() == 1: 
    268269                        label = name 
    269270                elif window_mode == MessageWindowMgr.ONE_MSG_WINDOW_PERTYPE: 
    270271                        # 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') 
    272278                else: 
    273279                        label = _('Messages') 
  • branches/gajim_0.11/src/roster_window.py

    r7940 r7984  
    28132813                        common.sleepy.STATE_UNKNOWN: 
    28142814                                gajim.sleeper_state[account] = 'online' 
    2815                         else: 
     2815                        elif gajim.sleeper_state[account] not in ('autoaway', 'autoxa'): 
    28162816                                gajim.sleeper_state[account] = 'off' 
    28172817                gajim.connections[account].change_status(status, txt, auto)