Show
Ignore:
Timestamp:
01/15/07 19:51:27 (23 months ago)
Author:
asterix
Message:

merge usefull diff from trunk

Files:
1 modified

Legend:

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

    r7829 r7841  
    215215                column.pack_start(renderer) 
    216216                column.set_attributes(renderer, text = 0) 
    217                  
     217 
    218218                column = gtk.TreeViewColumn(_('In the group')) 
    219219                column.set_expand(False) 
     
    320320                        title_text = _('Status Message') 
    321321                self.window.set_title(title_text) 
    322                  
     322 
    323323                message_textview = self.xml.get_widget('message_textview') 
    324324                self.message_buffer = message_textview.get_buffer() 
     
    332332                msg = helpers.from_one_line(msg) 
    333333                self.message_buffer.set_text(msg) 
    334                  
     334 
    335335                # have an empty string selectable, so user can clear msg 
    336336                self.preset_messages_dict = {'': ''} 
     
    340340                        self.preset_messages_dict[msg_name] = msg_text 
    341341                sorted_keys_list = helpers.get_sorted_keys(self.preset_messages_dict) 
    342                  
     342 
    343343                self.message_liststore = gtk.ListStore(str) # msg_name 
    344344                self.message_combobox = self.xml.get_widget('message_combobox') 
     
    375375                name = model[active][0].decode('utf-8') 
    376376                self.message_buffer.set_text(self.preset_messages_dict[name]) 
    377          
     377 
    378378        def on_change_status_message_dialog_key_press_event(self, widget, event): 
    379379                if event.keyval == gtk.keysyms.Return or \ 
     
    388388                else: 
    389389                        btn.set_sensitive(True) 
    390          
     390 
    391391        def on_save_as_preset_button_clicked(self, widget): 
    392392                start_iter, finish_iter = self.message_buffer.get_bounds() 
     
    404404                        msg_name = msg_name.decode('utf-8') 
    405405                        iter_ = self.message_liststore.append((msg_name,)) 
    406                          
     406 
    407407                        gajim.config.add_per('statusmsg', msg_name) 
    408408                        gajim.config.set_per('statusmsg', msg_name, 'message', msg_text_1l) 
     
    602602                                'utf-8') 
    603603                        jid = jid.replace('@', '%') + '@' + transport 
    604                  
     604 
    605605                # check if jid is conform to RFC and stringprep it 
    606606                try: 
     
    727727                        text = open(copying_file_path).read() 
    728728                        dlg.set_license(text) 
    729                  
     729 
    730730                dlg.set_comments('%s\n%s %s\n%s %s'  
    731731                        % (_('A GTK+ jabber client'), \ 
     
    750750                                elif author != '': # Real author line 
    751751                                        authors.append(author) 
    752          
     752 
    753753                        thanks_file_path = None 
    754754                        if os.path.isfile(os.path.join(gajim.defs.docdir, 'THANKS')): 
     
    758758                        if thanks_file_path: 
    759759                                authors.append('\n' + _('THANKS:')) 
    760                                  
     760 
    761761                                text = open(thanks_file_path).read() 
    762762                                text_splitted = text.split('\n') 
     
    766766                                        'the package maintainers.') 
    767767                                authors.append(text) 
    768                  
     768 
    769769                        dlg.set_authors(authors) 
    770                  
     770 
    771771                if gtk.pygtk_version >= (2, 8, 0) and gtk.gtk_version >= (2, 8, 0): 
    772772                        dlg.props.wrap_license = True 
     
    778778                #here you write your name in the form Name FamilyName <someone@somewhere> 
    779779                dlg.set_translator_credits(_('translator-credits')) 
    780                  
     780 
    781781                artists = ['Anders Ström', 'Christophe Got', 'Dennis Craven', 
    782782                        'Guillaume Morin', 'Josef Vybíral', 'Membris Khan'] 
     
    785785                rep = dlg.run() 
    786786                dlg.destroy() 
    787          
     787 
    788788        def tuple2str(self, tuple_): 
    789789                str_ = '' 
     
    901901                        else: 
    902902                                self.just_destroy(dialog) 
    903                          
     903 
    904904        def just_destroy(self, widget): 
    905905                self.destroy() 
     
    10191019                        self.input_entry.set_text(input_str) 
    10201020                        self.input_entry.select_region(0, -1) # select all 
    1021                  
     1021 
    10221022                self.is_modal = is_modal 
    10231023                if not is_modal and ok_handler is not None: 
     
    10411041                else: 
    10421042                        self.ok_handler(user_input) 
    1043          
     1043 
    10441044        def on_cancelbutton_clicked(self, widget): 
    10451045                self.dialog.destroy() 
     
    10761076        def on_close_button_clicked(self, widget): 
    10771077                self.window.destroy() 
    1078                  
     1078 
    10791079        def on_authorize_button_clicked(self, widget): 
    10801080                '''accept the request''' 
     
    10971097                        gajim.interface.instances[self.account]['infos'][self.jid].xml.\ 
    10981098                                get_widget('information_notebook').remove_page(0) 
    1099          
     1099 
    11001100        def on_start_chat_activate(self, widget): 
    11011101                '''open chat''' 
     
    11391139                self._room_jid_entry = self.xml.get_widget('room_jid_entry') 
    11401140                self._nickname_entry = self.xml.get_widget('nickname_entry') 
    1141                  
     1141 
    11421142                self._room_jid_entry.set_text(room_jid) 
    11431143                self._nickname_entry.set_text(nick) 
     
    12641264        def __init__(self, account): 
    12651265                self.account = account 
    1266                  
     1266 
    12671267                if len(gajim.connections) > 1: 
    12681268                        title = _('Start Chat with account %s') % account 
     
    12711271                prompt_text = _('Fill in the nickname or the Jabber ID of the contact you would like\nto send a chat message to:') 
    12721272                InputDialog.__init__(self, title, prompt_text, is_modal = False) 
    1273                  
     1273 
    12741274                self.completion_dict = {} 
    12751275                liststore = gtkgui_helpers.get_completion_liststore(self.input_entry) 
     
    12891289                cancelbutton.connect('clicked', self.on_cancelbutton_clicked) 
    12901290                self.dialog.show_all() 
    1291                          
     1291 
    12921292        def new_chat_response(self, jid): 
    12931293                ''' called when ok button is clicked ''' 
     
    14071407                event_description_label.set_markup( 
    14081408                        '<span foreground="black">%s</span>' % text)     
    1409                          
     1409 
    14101410                # set the image 
    14111411                image.set_from_file(path_to_image) 
    1412                  
     1412 
    14131413                # position the window to bottom-right of screen 
    14141414                window_width, self.window_height = self.window.get_size() 
     
    14411441                        # we want to remove the first window added in the list 
    14421442                        gajim.interface.roster.popup_notification_windows.pop(0) # remove 1st item 
    1443                  
     1443 
    14441444                # move the rest of popup windows 
    14451445                gajim.interface.roster.popups_notification_height = 0 
     
    14721472                self.from_whom = from_whom 
    14731473                self.resource = resource 
    1474                  
     1474 
    14751475                self.xml = gtkgui_helpers.get_glade('single_message_window.glade') 
    14761476                self.window = self.xml.get_widget('single_message_window') 
     
    15051505                else: 
    15061506                        self.to_entry.set_text(to) 
    1507                  
     1507 
    15081508                if gajim.config.get('use_speller') and HAS_GTK_SPELL and action == 'send': 
    15091509                        try: 
     
    15171517                                ErrorDialog(unicode(msg), _('If that is not your language for which you want to highlight misspelled words, then please set your $LANG as appropriate. Eg. for French do export LANG=fr_FR or export LANG=fr_FR.UTF-8 in ~/.bash_profile or to make it global in /etc/profile.\n\nHighlighting misspelled words feature will not be used')) 
    15181518                                gajim.config.set('use_speller', False) 
    1519                  
     1519 
    15201520                self.send_button.set_no_show_all(True) 
    15211521                self.reply_button.set_no_show_all(True) 
     
    15291529                self.message_scrolledwindow.set_no_show_all(True) 
    15301530                self.conversation_scrolledwindow.set_no_show_all(True) 
    1531                  
     1531 
    15321532                self.prepare_widgets_for(self.action) 
    15331533 
     
    16001600                        self.conversation_scrolledwindow.hide() 
    16011601                        self.message_scrolledwindow.show() 
    1602                          
     1602 
    16031603                        if self.message: # we come from a reply? 
    16041604                                self.message_textview.grab_focus() 
     
    16111611                                if self.to: # do we already have jid? 
    16121612                                        self.subject_entry.grab_focus() 
    1613                          
     1613 
    16141614                elif action == 'receive': # prepare UI for Receiving 
    16151615                        title = _('Received %s') % title 
     
    16351635                        self.cancel_button.hide() 
    16361636                        self.close_button.show() 
    1637                  
     1637 
    16381638                self.window.set_title(title) 
    16391639 
     
    16491649                characters_no = self.message_tv_buffer.get_char_count() 
    16501650                self.count_chars_label.set_text(unicode(characters_no)) 
    1651          
     1651 
    16521652        def send_single_message(self): 
    16531653                if gajim.connections[self.account].connected <= 1: 
     
    16761676                        gajim.connections[self.account].send_message(to_whom_jid, message, 
    16771677                                keyID = None, type = 'normal', subject=subject) 
    1678                          
     1678 
    16791679                self.subject_entry.set_text('') # we sent ok, clear the subject 
    16801680                self.message_tv_buffer.set_text('') # we sent ok, clear the textview 
     
    17071707        def __init__(self, account): 
    17081708                self.account = account 
    1709                  
     1709 
    17101710                self.xml = gtkgui_helpers.get_glade('xml_console_window.glade') 
    17111711                self.window = self.xml.get_widget('xml_console_window') 
     
    17161716                end_iter = buffer.get_end_iter() 
    17171717                buffer.create_mark('end', end_iter, False) 
    1718                  
     1718 
    17191719                self.tagIn = buffer.create_tag('incoming') 
    17201720                color = gajim.config.get('inmsgcolor') 
     
    17281728                self.input_textview.modify_text( 
    17291729                        gtk.STATE_NORMAL, gtk.gdk.color_parse(color)) 
    1730                  
     1730 
    17311731                if len(gajim.connections) > 1: 
    17321732                        title = _('XML Console for %s') % self.account 
    17331733                else: 
    17341734                        title = _('XML Console') 
    1735                  
     1735 
    17361736                self.window.set_title(title) 
    17371737                self.window.show_all() 
    1738                  
     1738 
    17391739                self.xml.signal_autoconnect(self) 
    17401740 
     
    17921792                        gajim.connections[self.account].send_stanza(stanza) 
    17931793                        self.input_tv_buffer.set_text('') # we sent ok, clear the textview 
    1794          
     1794 
    17951795        def on_presence_button_clicked(self, widget): 
    17961796                self.input_tv_buffer.set_text( 
     
    18021802                        '<iq to="" type=""><query xmlns=""></query></iq>' 
    18031803                ) 
    1804          
     1804 
    18051805        def on_message_button_clicked(self, widget): 
    18061806                self.input_tv_buffer.set_text( 
     
    21882188                        self.list_of_privacy_lists_combobox.get_active()] 
    21892189                gajim.connections[self.account].del_privacy_list(active_list) 
    2190          
     2190 
    21912191        def privacy_list_removed(self, active_list): 
    21922192                self.privacy_lists_save.remove(active_list) 
     
    22412241                self.dialog = xml.get_widget('invitation_received_dialog') 
    22422242 
    2243                 #FIXME: use nickname instead of contact_jid 
    2244                 pritext = _('%(contact_jid)s has invited you to group chat %(room_jid)s')\ 
    2245                         % {'room_jid': room_jid, 'contact_jid': contact_jid } 
    2246                  
     2243                #Don't translate $Contact 
     2244                pritext = _('$Contact has invited you to group chat %(room_jid)s')\ 
     2245                        % {'room_jid': room_jid} 
     2246                contact = gajim.contacts.get_first_contact_from_jid(account, contact_jid) 
     2247                if contact and contact.name: 
     2248                        contact_text = '%s (%s)' % (contact.name, contact_jid) 
     2249                else: 
     2250                        contact_text = contact_jid 
     2251                pritext = pritext.replace('$Contact', contact_text) 
     2252 
    22472253                label_text = '<big><b>%s</b></big>' % pritext 
    22482254 
     
    22582264                        self.on_accept_button_clicked) 
    22592265                self.dialog.show_all() 
    2260          
     2266 
    22612267        def on_deny_button_clicked(self, widget): 
    22622268                self.dialog.destroy() 
    2263          
     2269 
    22642270        def on_accept_button_clicked(self, widget): 
    22652271                self.dialog.destroy() 
     
    22682274                except GajimGeneralException: 
    22692275                        pass 
    2270                          
     2276 
    22712277class ProgressDialog: 
    22722278        def __init__(self, title_text, during_text, messages_queue): 
     
    22832289                self.dialog.show_all() 
    22842290                self.xml.signal_autoconnect(self) 
    2285                  
     2291 
    22862292                self.update_progressbar_timeout_id = gobject.timeout_add(100, 
    22872293                                        self.update_progressbar)