~x1101/+junk/heybuddy

« back to all changes in this revision

Viewing changes to MainWindow.py

  • Committer: x1101
  • Date: 2011-01-20 23:39:38 UTC
  • Revision ID: ljmckarns@gmail.com-20110120233938-hseaiwai5mxaytyi
Pushing latest mainline before new work on avatars to notification

Show diffs side-by-side

added added

removed removed

Lines of Context:
240
240
        def set_group_filters(self, filters ):
241
241
                self.filterpage.set_group_filters(filters)
242
242
        
243
 
        def update_textbuffer_insert(self,textbuffer, iter, text, length):
 
243
        def update_textbuffer_insert(self, textbuffer, iter, text, length):
244
244
                if text=="\n" :
 
245
                        #TODO: delete the fucking \n. PS fuck you PYGTK for making this
 
246
                        #so fucking hard
 
247
                        #textbuffer.backspace(iter,True,True) doesn't work
245
248
                        self.do_submit=True
 
249
 
246
250
        
247
251
        def emit_update_textview(self):
248
252
                #get the text from the buffer
250
254
                end_iter = self.update_textbuffer.get_end_iter()
251
255
                text=self.update_textbuffer.get_text(start_iter,end_iter).strip()
252
256
                if(text!=""):
 
257
                        #disable the textview
 
258
                        self.update_textview.set_sensitive(False)
253
259
                        self.emit('update-status',text)
 
260
                        
 
261
        '''function process_update_response
 
262
        @param self self
 
263
        @param response the string response returned by the communicator
 
264
        '''
 
265
        def emit_update_textview_responsed(self, error = False):
 
266
                if not error:
254
267
                        #detach the spellchecker
255
268
                        self.detach_gtkspell()
256
269
                        #clear the text area
257
270
                        self.update_textbuffer.set_text('')
258
271
                        #reattach the spellchecker
259
272
                        self.connect_gtkspell()
 
273
                #enable the textview
 
274
                self.update_textview.set_sensitive(True)
260
275
                        
 
276
        '''function update_textbuffer_changed
 
277
        @param self self
 
278
        @param textbuffer - the textbuffer that called the function
 
279
        '''
261
280
        def update_textbuffer_changed(self,textbuffer):
262
 
                #get the last char of the text buffer
263
281
                if self.do_submit:
264
282
                        self.emit_update_textview()
265
283
                        self.do_submit=False
266
 
 
 
284
                        return 
 
285
                #we aren't submitting, check the amount of characters
267
286
                char_count = textbuffer.get_char_count()
268
287
                self.string_update_textview_append_count(140-char_count)
269
288
                if (char_count > 140 ):
 
289
                        #prune the text to 140 chars
270
290
                        start_iter = textbuffer.get_iter_at_offset(140)
271
291
                        end_iter = textbuffer.get_end_iter()
272
292
                        textbuffer.delete(start_iter,end_iter)
273
293
                elif(char_count==0 and not self.is_direct_message_mode):
 
294
                        #the text has possibly been deleted, clear associated stuff
274
295
                        self.emit('clear-respond-to-id')
275
296
 
276
297
        def notebook_page_switch(self,nb,page,page_num):