update files from trunk
This commit is contained in:
		
							parent
							
								
									119ac50004
								
							
						
					
					
						commit
						fbf6c84e52
					
				
					 8 changed files with 996 additions and 280 deletions
				
			
		|  | @ -215,7 +215,9 @@ class Chat: | |||
| 			self.xmls[jid].get_widget('conversation_textview') | ||||
| 		conversation_buffer = conversation_textview.get_buffer() | ||||
| 		end_iter = conversation_buffer.get_end_iter() | ||||
| 		conversation_buffer.create_mark('end', end_iter, 0) | ||||
| 		 | ||||
| 		conversation_buffer.create_mark('end', end_iter, False) | ||||
| 		 | ||||
| 		self.tagIn[jid] = conversation_buffer.create_tag('incoming') | ||||
| 		color = self.plugin.config['inmsgcolor'] | ||||
| 		self.tagIn[jid].set_property('foreground', color) | ||||
|  | @ -270,15 +272,17 @@ class Chat: | |||
| 		self.show_title() | ||||
| 
 | ||||
| 	def on_conversation_textview_key_press_event(self, widget, event): | ||||
| 		"""Do not black these evnts and send them to the notebook""" | ||||
| 		if event.keyval == gtk.keysyms.Tab and \ | ||||
| 			(event.state & gtk.gdk.CONTROL_MASK): # CTRL + TAB | ||||
| 		"""Do not block these events and send them to the notebook""" | ||||
| 		if (event.state & gtk.gdk.CONTROL_MASK) and \ | ||||
| 			(event.state & gtk.gdk.SHIFT_MASK): | ||||
| 			if event.hardware_keycode == 23: # CTRL + SHIFT + TAB | ||||
| 				self.notebook.emit('key_press_event', event) | ||||
| 		elif event.keyval == gtk.keysyms.Page_Down: # PAGE DOWN | ||||
| 			if event.state & gtk.gdk.CONTROL_MASK: # CTRL + PAGE DOWN | ||||
| 		elif event.state & gtk.gdk.CONTROL_MASK: | ||||
| 			if event.keyval == gtk.keysyms.Tab: # CTRL + TAB | ||||
| 				self.notebook.emit('key_press_event', event) | ||||
| 		elif event.keyval == gtk.keysyms.Page_Up: # PAGE UP | ||||
| 			if event.state & gtk.gdk.CONTROL_MASK: # CTRL + PAGE UP | ||||
| 			elif event.keyval == gtk.keysyms.Page_Down: # CTRL + PAGE DOWN | ||||
| 				self.notebook.emit('key_press_event', event) | ||||
| 			elif event.keyval == gtk.keysyms.Page_Up: # CTRL + PAGE UP | ||||
| 				self.notebook.emit('key_press_event', event) | ||||
| 				 | ||||
| 	def on_chat_notebook_key_press_event(self, widget, event): | ||||
|  | @ -286,34 +290,52 @@ class Chat: | |||
| 		jid = self.get_active_jid() | ||||
| 		if event.keyval == gtk.keysyms.Escape: # ESCAPE | ||||
| 			self.remove_tab(jid) | ||||
| 		elif event.keyval == gtk.keysyms.F4 and \ | ||||
| 			(event.state & gtk.gdk.CONTROL_MASK): # CTRL + F4 | ||||
| 				self.remove_tab(jid) | ||||
| 		elif event.string and event.string in st \ | ||||
| 			and (event.state & gtk.gdk.MOD1_MASK): # alt + 1,2,3.. | ||||
| 			self.notebook.set_current_page(st.index(event.string)) | ||||
| 		elif event.keyval == gtk.keysyms.Page_Down: # PAGE DOWN | ||||
| 			if event.state & gtk.gdk.CONTROL_MASK: | ||||
| 		elif event.keyval == gtk.keysyms.Page_Down: | ||||
| 			if event.state & gtk.gdk.CONTROL_MASK: # CTRL + PAGE DOWN | ||||
| 				current = self.notebook.get_current_page() | ||||
| 				if current > 0: | ||||
| 					self.notebook.set_current_page(current-1) | ||||
| 			elif event.state & gtk.gdk.SHIFT_MASK: | ||||
| 			elif event.state & gtk.gdk.SHIFT_MASK: # SHIFT + PAGE DOWN | ||||
| 				conversation_textview = self.xmls[jid].\ | ||||
| 					get_widget('conversation_textview') | ||||
| 				rect = conversation_textview.get_visible_rect() | ||||
| 				iter = conversation_textview.get_iter_at_location(rect.x,\ | ||||
| 					rect.y + rect.height) | ||||
| 				conversation_textview.scroll_to_iter(iter, 0.1, True, 0, 0) | ||||
| 		elif event.keyval == gtk.keysyms.Page_Up: # PAGE UP | ||||
| 			if event.state & gtk.gdk.CONTROL_MASK: | ||||
| 		elif event.keyval == gtk.keysyms.Page_Up:  | ||||
| 			if event.state & gtk.gdk.CONTROL_MASK: # CTRL + PAGE UP | ||||
| 				current = self.notebook.get_current_page() | ||||
| 				if current < (self.notebook.get_n_pages()-1): | ||||
| 					self.notebook.set_current_page(current+1) | ||||
| 			elif event.state & gtk.gdk.SHIFT_MASK: | ||||
| 			elif event.state & gtk.gdk.SHIFT_MASK: # SHIFT + PAGE UP | ||||
| 				conversation_textview = self.xmls[jid].\ | ||||
| 					get_widget('conversation_textview') | ||||
| 				rect = conversation_textview.get_visible_rect() | ||||
| 				iter = conversation_textview.get_iter_at_location(rect.x, rect.y) | ||||
| 				conversation_textview.scroll_to_iter(iter, 0.1, True, 0, 1) | ||||
| 		elif event.keyval == gtk.keysyms.Tab and \ | ||||
| 			(event.state & gtk.gdk.CONTROL_MASK): # CTRL + TAB | ||||
| 				# or event.keyval == gtk.keysyms.KP_Up | ||||
| 		elif event.keyval == gtk.keysyms.Up:  | ||||
| 			if event.state & gtk.gdk.SHIFT_MASK: # SHIFT + UP | ||||
| 				print 'be' # FIXME: find a way to to keyUP in scrolledwindow | ||||
| 				conversation_scrolledwindow = self.xml.get_widget\ | ||||
| 					('conversation_scrolledwindow') | ||||
| 				conversation_scrolledwindow.emit('scroll-child', \ | ||||
| 					gtk.SCROLL_PAGE_BACKWARD, False) | ||||
| 		elif event.hardware_keycode == 23: # TAB | ||||
| 			if (event.state & gtk.gdk.CONTROL_MASK) and \ | ||||
| 				(event.state & gtk.gdk.SHIFT_MASK): # CTRL + SHIFT + TAB | ||||
| 				current = self.notebook.get_current_page() | ||||
| 				if current > 0: | ||||
| 					self.notebook.set_current_page(current-1) | ||||
| 				else: | ||||
| 					self.notebook.set_current_page(self.notebook.get_n_pages()-1) | ||||
| 			elif event.state & gtk.gdk.CONTROL_MASK: # CTRL + TAB | ||||
| 				current = self.notebook.get_current_page() | ||||
| 				if current < (self.notebook.get_n_pages()-1): | ||||
| 					self.notebook.set_current_page(current+1) | ||||
|  | @ -322,7 +344,7 @@ class Chat: | |||
| 		elif (event.state & gtk.gdk.CONTROL_MASK) or (event.keyval ==\ | ||||
| 			gtk.keysyms.Control_L) or (event.keyval == gtk.keysyms.Control_R): | ||||
| 			# we pressed a control key or ctrl+sth: we don't block the event | ||||
| 			# in order to let ctrl+c do its work | ||||
| 			# in order to let ctrl+c (copy text) and others do their default work | ||||
| 			pass | ||||
| 		else: # it's a normal key press make sure message_textview has focus | ||||
| 			message_textview = self.xmls[jid].get_widget('message_textview') | ||||
|  | @ -375,6 +397,9 @@ class Chat: | |||
| 			iter = widget.get_iter_at_location(x, y) | ||||
| 			tags = iter.get_tags() | ||||
| 			if tags: | ||||
| 				for tag in tags: | ||||
| 					tag_name = tag.get_property('name') | ||||
| 					if 'url' in tag_name or 'mail' in tag_name: | ||||
| 						return True | ||||
| 	 | ||||
| 	def print_time_timeout(self, jid): | ||||
|  | @ -438,7 +463,7 @@ class Chat: | |||
| 			while not end_iter.ends_tag(texttag): | ||||
| 				end_iter.forward_char() | ||||
| 			word = begin_iter.get_text(end_iter) | ||||
| 			if event.button == 3: | ||||
| 			if event.button == 3: # right click | ||||
| 				self.make_link_menu(event, kind, word) | ||||
| 			else: | ||||
| 				#we launch the correct application | ||||
|  | @ -548,14 +573,26 @@ class Chat: | |||
| 			self.print_with_tag_list(conversation_buffer, special_text, end_iter, \ | ||||
| 				all_tags) | ||||
| 
 | ||||
| 	def scroll_to_end(self, textview): | ||||
| 		buffer = textview.get_buffer() | ||||
| 		textview.scroll_to_mark(buffer.get_mark('end'), 0, True, 0, 1) | ||||
| 		return False | ||||
| 
 | ||||
| 	def print_conversation_line(self, text, jid, kind, name, tim, \ | ||||
| 		other_tags_for_name = []): | ||||
| 		conversation_textview = self.xmls[jid].get_widget('conversation_textview') | ||||
| 		conversation_buffer = conversation_textview.get_buffer() | ||||
| 		print_all_special = False | ||||
| 		at_the_end = False | ||||
| 		end_iter = conversation_buffer.get_end_iter() | ||||
| 		end_rect = conversation_textview.get_iter_location(end_iter) | ||||
| 		visible_rect = conversation_textview.get_visible_rect() | ||||
| 		if end_rect.y <= (visible_rect.y + visible_rect.height): | ||||
| 			at_the_end = True | ||||
| 		if not text: | ||||
| 			text = '' | ||||
| 		end_iter = conversation_buffer.get_end_iter() | ||||
| 		if conversation_buffer.get_char_count() > 0: | ||||
| 			conversation_buffer.insert(end_iter, '\n') | ||||
| 		if self.plugin.config['print_time'] == 'always': | ||||
| 			if not tim: | ||||
| 				tim = time.localtime() | ||||
|  | @ -583,7 +620,6 @@ class Chat: | |||
| 				 + self.after_nickname_symbols + ' '  | ||||
| 			self.print_with_tag_list(conversation_buffer, format, end_iter, tags) | ||||
| 				 | ||||
| 		text += '\n' | ||||
| 		# detect urls formatting and if the user has it on emoticons | ||||
| 		index = self.detect_and_print_special_text(text, jid, \ | ||||
| 			tags, print_all_special) | ||||
|  | @ -597,16 +633,12 @@ class Chat: | |||
| 			conversation_buffer.insert(end_iter, text[index:]) | ||||
| 
 | ||||
| 		#scroll to the end of the textview | ||||
| 		end_iter = conversation_buffer.get_end_iter() | ||||
| 		end_rect = conversation_textview.get_iter_location(end_iter) | ||||
| 		visible_rect = conversation_textview.get_visible_rect() | ||||
| 		end = False | ||||
| 		if end_rect.y <= (visible_rect.y + visible_rect.height) or \ | ||||
| 			(kind == 'outgoing'): | ||||
| 		if at_the_end or (kind == 'outgoing'): | ||||
| 			#we are at the end or we are sending something | ||||
| 			end = True | ||||
| 			conversation_textview.scroll_to_mark(conversation_buffer.\ | ||||
| 				get_mark('end'), 0.1, 0, 0, 0) | ||||
| 			# We scroll to the end after the scrollbar has appeared | ||||
| 			gobject.timeout_add(50, self.scroll_to_end, conversation_textview) | ||||
| 		if ((jid != self.get_active_jid()) or (not self.window.is_active()) or \ | ||||
| 			(not end)) and kind == 'incoming': | ||||
| 			self.nb_unread[jid] += 1 | ||||
|  |  | |||
|  | @ -46,6 +46,13 @@ class Preferences_window: | |||
| 
 | ||||
| 	def on_preferences_window_show(self, widget): | ||||
| 		self.notebook.set_current_page(0) | ||||
| 		if os.name == 'nt': # if windows, player must not be visible | ||||
| 			self.xml.get_widget('soundplayer_hbox').set_property('visible', False) | ||||
| 			self.trayicon_checkbutton.set_property('visible', False) | ||||
| 
 | ||||
| 	def on_preferences_window_key_press_event(self, widget, event): | ||||
| 		if event.keyval == gtk.keysyms.Escape: # ESCAPE | ||||
| 			self.window.hide() | ||||
| 
 | ||||
| 	def on_checkbutton_toggled(self, widget, config_name, \ | ||||
| 		change_sensitivity_widgets = None): | ||||
|  | @ -56,8 +63,9 @@ class Preferences_window: | |||
| 		if change_sensitivity_widgets != None: | ||||
| 			for w in change_sensitivity_widgets: | ||||
| 				w.set_sensitive(widget.get_active()) | ||||
| 		self.plugin.save_config() | ||||
| 
 | ||||
| 	def on_tray_icon_checkbutton_toggled(self, widget): | ||||
| 	def on_trayicon_checkbutton_toggled(self, widget): | ||||
| 		if widget.get_active(): | ||||
| 			self.plugin.config['trayicon'] = 1 | ||||
| 			self.plugin.show_systray() | ||||
|  | @ -67,12 +75,14 @@ class Preferences_window: | |||
| 			self.plugin.hide_systray() | ||||
| 		self.plugin.send('CONFIG', None, ('GtkGui', self.plugin.config, 'GtkGui')) | ||||
| 		self.plugin.roster.draw_roster() | ||||
| 		self.plugin.save_config() | ||||
| 	 | ||||
| 	def on_save_position_checkbutton_toggled(self, widget): | ||||
| 		if widget.get_active(): | ||||
| 			self.plugin.config['saveposition'] = 1 | ||||
| 		else: | ||||
| 			self.plugin.config['saveposition'] = 0 | ||||
| 		self.plugin.save_config() | ||||
| 	 | ||||
| 	def on_merge_checkbutton_toggled(self, widget): | ||||
| 		if widget.get_active(): | ||||
|  | @ -81,6 +91,7 @@ class Preferences_window: | |||
| 			self.plugin.config['mergeaccounts'] = 0 | ||||
| 		self.plugin.roster.regroup = self.plugin.config['mergeaccounts'] | ||||
| 		self.plugin.roster.draw_roster() | ||||
| 		self.plugin.save_config() | ||||
| 	 | ||||
| 	def on_iconset_combobox_changed(self, widget): | ||||
| 		model = widget.get_model() | ||||
|  | @ -88,6 +99,7 @@ class Preferences_window: | |||
| 		icon_string = model[active][0] | ||||
| 		self.plugin.config['iconset'] = icon_string | ||||
| 		self.plugin.roster.reload_pixbufs() | ||||
| 		self.plugin.save_config() | ||||
| 		 | ||||
| 	def on_account_text_colorbutton_color_set(self, widget): | ||||
| 		"""Take The Color For The Account Text""" | ||||
|  | @ -96,6 +108,7 @@ class Preferences_window: | |||
| 			(hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4] | ||||
| 		self.plugin.config['accounttextcolor'] = color_string | ||||
| 		self.plugin.roster.draw_roster() | ||||
| 		self.plugin.save_config() | ||||
| 	 | ||||
| 	def on_group_text_colorbutton_color_set(self, widget): | ||||
| 		"""Take The Color For The Group Text""" | ||||
|  | @ -104,6 +117,7 @@ class Preferences_window: | |||
| 			(hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4] | ||||
| 		self.plugin.config['grouptextcolor'] = color_string | ||||
| 		self.plugin.roster.draw_roster() | ||||
| 		self.plugin.save_config() | ||||
| 
 | ||||
| 	def on_user_text_colorbutton_color_set(self, widget): | ||||
| 		"""Take The Color For The User Text""" | ||||
|  | @ -112,6 +126,7 @@ class Preferences_window: | |||
| 			(hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4] | ||||
| 		self.plugin.config['usertextcolor'] = color_string | ||||
| 		self.plugin.roster.draw_roster() | ||||
| 		self.plugin.save_config() | ||||
| 
 | ||||
| 	def on_account_text_bg_colorbutton_color_set(self, widget): | ||||
| 		"""Take The Color For The Background Of Account Text""" | ||||
|  | @ -120,6 +135,7 @@ class Preferences_window: | |||
| 			(hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4] | ||||
| 		self.plugin.config['accountbgcolor'] = color_string | ||||
| 		self.plugin.roster.draw_roster() | ||||
| 		self.plugin.save_config() | ||||
| 	 | ||||
| 	def on_group_text_bg_colorbutton_color_set(self, widget): | ||||
| 		"""Take The Color For The Background Of Group Text""" | ||||
|  | @ -128,6 +144,7 @@ class Preferences_window: | |||
| 			(hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4] | ||||
| 		self.plugin.config['groupbgcolor'] = color_string | ||||
| 		self.plugin.roster.draw_roster() | ||||
| 		self.plugin.save_config() | ||||
| 	 | ||||
| 	def on_user_text_bg_colorbutton_color_set(self, widget): | ||||
| 		"""Take The Color For The Background Of User Text""" | ||||
|  | @ -136,24 +153,28 @@ class Preferences_window: | |||
| 			(hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4] | ||||
| 		self.plugin.config['userbgcolor'] = color_string | ||||
| 		self.plugin.roster.draw_roster() | ||||
| 		self.plugin.save_config() | ||||
| 	 | ||||
| 	def on_account_text_fontbutton_font_set(self, widget): | ||||
| 		"""Take The Font For The User Text""" | ||||
| 		font_string = widget.get_font_name() | ||||
| 		self.plugin.config['accountfont'] = font_string | ||||
| 		self.plugin.roster.draw_roster() | ||||
| 		self.plugin.save_config() | ||||
| 
 | ||||
| 	def on_group_text_fontbutton_font_set(self, widget): | ||||
| 		"""Take The Font For The Group Text""" | ||||
| 		font_string = widget.get_font_name() | ||||
| 		self.plugin.config['groupfont'] = font_string | ||||
| 		self.plugin.roster.draw_roster() | ||||
| 		self.plugin.save_config() | ||||
| 	 | ||||
| 	def on_user_text_fontbutton_font_set(self, widget): | ||||
| 		"""Take The Font For The User Text""" | ||||
| 		font_string = widget.get_font_name() | ||||
| 		self.plugin.config['userfont'] = font_string | ||||
| 		self.plugin.roster.draw_roster() | ||||
| 		self.plugin.save_config() | ||||
| 	 | ||||
| 	def on_reset_colors_and_fonts_button_clicked(self, widget): | ||||
| 		defaults = self.plugin.default_config | ||||
|  | @ -185,6 +206,7 @@ class Preferences_window: | |||
| 		self.xml.get_widget('user_text_fontbutton').set_font_name(\ | ||||
| 			defaults['userfont']) | ||||
| 		self.plugin.roster.draw_roster() | ||||
| 		self.plugin.save_config() | ||||
| 	 | ||||
| 	def on_use_tabbed_chat_window_checkbutton_toggled(self, widget): | ||||
| 		buf1 = {} | ||||
|  | @ -239,6 +261,7 @@ class Preferences_window: | |||
| #							buf1[acct][jid]) | ||||
| #					self.plugin.windows[acct]['chats'][jid].xmls[jid].\ | ||||
| #						get_widget('message_textview').set_buffer(buf2[acct][jid]) | ||||
| 		self.plugin.save_config() | ||||
| 	 | ||||
| 	def update_print_time(self): | ||||
| 		"""Update time in Opened Chat Windows""" | ||||
|  | @ -253,28 +276,35 @@ class Preferences_window: | |||
| 		if widget.get_active(): | ||||
| 			self.plugin.config['print_time'] = 'never' | ||||
| 		self.update_print_time() | ||||
| 		self.plugin.save_config() | ||||
| 
 | ||||
| 	def on_time_sometimes_radiobutton_toggled(self, widget): | ||||
| 		if widget.get_active(): | ||||
| 			self.plugin.config['print_time'] = 'sometimes' | ||||
| 		self.update_print_time() | ||||
| 		self.plugin.save_config() | ||||
| 
 | ||||
| 	def on_time_always_radiobutton_toggled(self, widget): | ||||
| 		if widget.get_active(): | ||||
| 			self.plugin.config['print_time'] = 'always' | ||||
| 		self.update_print_time() | ||||
| 		self.plugin.save_config() | ||||
| 
 | ||||
| 	def on_before_time_entry_focus_out_event(self, widget, event): | ||||
| 		self.plugin.config['before_time'] = widget.get_text() | ||||
| 		self.plugin.save_config() | ||||
| 	 | ||||
| 	def on_after_time_entry_focus_out_event(self, widget, event): | ||||
| 		self.plugin.config['after_time'] = widget.get_text() | ||||
| 		self.plugin.save_config() | ||||
| 
 | ||||
| 	def on_before_nickname_entry_focus_out_event(self, widget, event): | ||||
| 		self.plugin.config['before_nickname'] = widget.get_text() | ||||
| 		self.plugin.save_config() | ||||
| 
 | ||||
| 	def on_after_nickname_entry_focus_out_event(self, widget, event): | ||||
| 		self.plugin.config['after_nickname'] = widget.get_text() | ||||
| 		self.plugin.save_config() | ||||
| 
 | ||||
| 	def update_text_tags(self): | ||||
| 		"""Update color tags in Opened Chat Windows""" | ||||
|  | @ -292,6 +322,7 @@ class Preferences_window: | |||
| 			(hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4] | ||||
| 		self.plugin.config['inmsgcolor'] = color_string | ||||
| 		self.update_text_tags() | ||||
| 		self.plugin.save_config() | ||||
| 		 | ||||
| 	def on_outgoing_msg_colorbutton_color_set(self, widget): | ||||
| 		"""Take The Color For The Outgoing Messages""" | ||||
|  | @ -300,6 +331,7 @@ class Preferences_window: | |||
| 			(hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4] | ||||
| 		self.plugin.config['outmsgcolor'] = color_string | ||||
| 		self.update_text_tags() | ||||
| 		self.plugin.save_config() | ||||
| 	 | ||||
| 	def on_status_msg_colorbutton_color_set(self, widget): | ||||
| 		"""Take The Color For The Status Messages""" | ||||
|  | @ -308,6 +340,7 @@ class Preferences_window: | |||
| 			(hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4] | ||||
| 		self.plugin.config['statusmsgcolor'] = color_string | ||||
| 		self.update_text_tags() | ||||
| 		self.plugin.save_config() | ||||
| 	 | ||||
| 	def on_reset_colors_button_clicked(self, widget): | ||||
| 		defaults = self.plugin.default_config | ||||
|  | @ -321,6 +354,7 @@ class Preferences_window: | |||
| 		self.xml.get_widget('status_msg_colorbutton').set_color(\ | ||||
| 			gtk.gdk.color_parse(defaults['statusmsgcolor']))		 | ||||
| 		self.update_text_tags() | ||||
| 		self.plugin.save_config() | ||||
| 
 | ||||
| 	def on_use_emoticons_checkbutton_toggled(self, widget): | ||||
| 		self.on_checkbutton_toggled(widget, 'useemoticons', \ | ||||
|  | @ -345,13 +379,13 @@ class Preferences_window: | |||
| 
 | ||||
| 	def on_play_sounds_checkbutton_toggled(self, widget): | ||||
| 		self.on_checkbutton_toggled(widget, 'sounds_on',\ | ||||
| 										[self.xml.get_widget('sound_player_hbox'),\ | ||||
| 										[self.xml.get_widget('soundplayer_hbox'),\ | ||||
| 										self.xml.get_widget('sounds_scrolledwindow'),\ | ||||
| 										self.xml.get_widget('browse_sounds_hbox')]) | ||||
| 	 | ||||
| 	 | ||||
| 	def on_soundplayer_entry_changed(self, widget): | ||||
| 		self.plugin.config['soundplayer'] = widget.get_text() | ||||
| 		self.plugin.save_config() | ||||
| 		 | ||||
| 	def on_prompt_online_status_message_checkbutton_toggled(self, widget): | ||||
| 		self.on_checkbutton_toggled(widget, 'ask_online_status') | ||||
|  | @ -371,6 +405,7 @@ class Preferences_window: | |||
| 			self.plugin.config['sound_' + sound_event + '_file'] = \ | ||||
| 				model.get_value(iter, 2) | ||||
| 			iter = model.iter_next(iter) | ||||
| 		self.plugin.save_config() | ||||
| 
 | ||||
| 	def on_auto_away_checkbutton_toggled(self, widget): | ||||
| 		self.on_checkbutton_toggled(widget, 'autoaway', \ | ||||
|  | @ -382,6 +417,7 @@ class Preferences_window: | |||
| 		self.plugin.sleeper = common.sleepy.Sleepy(\ | ||||
| 			self.plugin.config['autoawaytime']*60, \ | ||||
| 			self.plugin.config['autoxatime']*60) | ||||
| 		self.plugin.save_config() | ||||
| 
 | ||||
| 	def on_auto_xa_checkbutton_toggled(self, widget): | ||||
| 		self.on_checkbutton_toggled(widget, 'autoxa', \ | ||||
|  | @ -393,6 +429,7 @@ class Preferences_window: | |||
| 		self.plugin.sleeper = common.sleepy.Sleepy(\ | ||||
| 			self.plugin.config['autoawaytime']*60, \ | ||||
| 			self.plugin.config['autoxatime']*60) | ||||
| 		self.plugin.save_config() | ||||
| 
 | ||||
| 	def on_msg_treemodel_row_changed(self, model, path, iter): | ||||
| 		iter = model.get_iter_first() | ||||
|  | @ -406,6 +443,7 @@ class Preferences_window: | |||
| 			del self.plugin.config['msg%i_name' % i] | ||||
| 			del self.plugin.config['msg%i' % i] | ||||
| 			i += 1 | ||||
| 		self.plugin.save_config() | ||||
| 
 | ||||
| 	def on_msg_treemodel_row_deleted(self, model, path, iter): | ||||
| 		iter = model.get_iter_first() | ||||
|  | @ -419,6 +457,7 @@ class Preferences_window: | |||
| 			del self.plugin.config['msg%i_name' % i] | ||||
| 			del self.plugin.config['msg%i' % i] | ||||
| 			i += 1 | ||||
| 		self.plugin.save_config() | ||||
| 
 | ||||
| 	def on_links_open_with_combobox_changed(self, widget): | ||||
| 		if widget.get_active() == 2: | ||||
|  | @ -430,12 +469,15 @@ class Preferences_window: | |||
| 			if widget.get_active() == 1: | ||||
| 				self.plugin.config['openwith'] = 'kfmclient exec' | ||||
| 			self.xml.get_widget('custom_apps_frame').set_sensitive(False) | ||||
| 		self.plugin.save_config() | ||||
| 
 | ||||
| 	def on_custom_browser_entry_changed(self, widget): | ||||
| 		self.plugin.config['custombrowser'] = widget.get_text() | ||||
| 		self.plugin.save_config() | ||||
| 
 | ||||
| 	def on_custom_mail_client_entry_changed(self, widget): | ||||
| 		self.plugin.config['custommailapp'] = widget.get_text() | ||||
| 		self.plugin.save_config() | ||||
| 
 | ||||
| 	def on_log_in_contact_checkbutton_toggled(self, widget): | ||||
| 		if widget.get_active(): | ||||
|  | @ -443,6 +485,7 @@ class Preferences_window: | |||
| 		else: | ||||
| 			self.config_logger['lognotusr'] = 0 | ||||
| 		self.plugin.send('CONFIG', None, ('Logger', self.config_logger, 'GtkGui')) | ||||
| 		self.plugin.save_config() | ||||
| 
 | ||||
| 	def on_log_in_extern_checkbutton_toggled(self, widget): | ||||
| 		if widget.get_active(): | ||||
|  | @ -450,6 +493,7 @@ class Preferences_window: | |||
| 		else: | ||||
| 			self.config_logger['lognotsep'] = 0 | ||||
| 		self.plugin.send('CONFIG', None, ('Logger', self.config_logger, 'GtkGui')) | ||||
| 		self.plugin.save_config() | ||||
| 
 | ||||
| 	def on_do_not_send_os_info_checkbutton_toggled(self, widget): | ||||
| 		if widget.get_active(): | ||||
|  | @ -457,6 +501,7 @@ class Preferences_window: | |||
| 			self.plugin.config['do_not_send_os_info'] = 1 | ||||
| 		else: | ||||
| 			self.plugin.config['do_not_send_os_info'] = 0 | ||||
| 		self.plugin.save_config() | ||||
| 
 | ||||
| 
 | ||||
| 	def fill_msg_treeview(self): | ||||
|  | @ -590,15 +635,15 @@ class Preferences_window: | |||
| 		self.auto_xa_checkbutton = self.xml.get_widget('auto_xa_checkbutton') | ||||
| 		self.auto_xa_time_spinbutton = self.xml.get_widget \ | ||||
| 			('auto_xa_time_spinbutton') | ||||
| 		self.tray_icon_checkbutton = self.xml.get_widget('tray_icon_checkbutton') | ||||
| 		self.trayicon_checkbutton = self.xml.get_widget('trayicon_checkbutton') | ||||
| 		self.notebook = self.xml.get_widget('preferences_notebook') | ||||
| 		 | ||||
| 		#trayicon | ||||
| 		if self.plugin.systray_capabilities: | ||||
| 			st = self.plugin.config['trayicon'] | ||||
| 			self.tray_icon_checkbutton.set_active(st) | ||||
| 			self.trayicon_checkbutton.set_active(st) | ||||
| 		else: | ||||
| 			self.tray_icon_checkbutton.set_sensitive(False) | ||||
| 			self.trayicon_checkbutton.set_sensitive(False) | ||||
| 
 | ||||
| 		#Save position | ||||
| 		st = self.plugin.config['saveposition'] | ||||
|  | @ -726,17 +771,19 @@ class Preferences_window: | |||
| 		self.xml.get_widget('ignore_events_from_unknown_contacts_checkbutton').\ | ||||
| 			set_active(self.plugin.config['ignore_unknown_contacts']) | ||||
| 
 | ||||
| 		if not self.plugin.config['sounds_on']: | ||||
| 			self.xml.get_widget('sound_player_hbox').set_sensitive(False) | ||||
| 		#sounds | ||||
| 		if self.plugin.config['sounds_on']: | ||||
| 			self.xml.get_widget('play_sounds_checkbutton').set_active(True) | ||||
| 		else: | ||||
| 			self.xml.get_widget('soundplayer_hbox').set_sensitive(False) | ||||
| 			self.xml.get_widget('sounds_scrolledwindow').set_sensitive(False) | ||||
| 			self.xml.get_widget('browse_sounds_hbox').set_sensitive(False) | ||||
| 			#FIXME: | ||||
| 
 | ||||
| 		#sound player | ||||
| 		self.xml.get_widget('soundplayer_entry').set_text(\ | ||||
| 			self.plugin.config['soundplayer']) | ||||
| 
 | ||||
| 		#sounds | ||||
| 		#sounds treeview | ||||
| 		self.sound_tree = self.xml.get_widget('sounds_treeview') | ||||
| 		model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_BOOLEAN, \ | ||||
| 			gobject.TYPE_STRING) | ||||
|  | @ -763,12 +810,6 @@ class Preferences_window: | |||
| 		col.set_attributes(renderer, text=2) | ||||
| 		self.fill_sound_treeview() | ||||
| 		 | ||||
| 		if not os.name == 'posix': | ||||
| 			self.xml.get_widget('soundplayer_entry').set_sensitive(False) | ||||
| 			self.sound_tree.set_sensitive(False) | ||||
| 			self.xml.get_widget('sounds_entry').set_sensitive(False) | ||||
| 			self.xml.get_widget('sounds_button').set_sensitive(False) | ||||
| 		 | ||||
| 		#Autoaway | ||||
| 		st = self.plugin.config['autoaway'] | ||||
| 		self.auto_away_checkbutton.set_active(st) | ||||
|  | @ -857,13 +898,18 @@ class Account_modification_window: | |||
| 	 | ||||
| 	def on_close_button_clicked(self, widget): | ||||
| 		"""When Close button is clicked""" | ||||
| 		widget.get_toplevel().destroy() | ||||
| 		self.window.destroy() | ||||
| 
 | ||||
| 	def on_checkbutton_toggled(self, widget, widgets): | ||||
| 		"""set or unset sensitivity of widgets when widget is toggled""" | ||||
| 		for w in widgets: | ||||
| 			w.set_sensitive(widget.get_active()) | ||||
| 
 | ||||
| 	def on_use_proxy_checkbutton_toggled(self, widget): | ||||
| 		proxyhost_entry = self.xml.get_widget('proxyhost_entry') | ||||
| 		proxyport_entry = self.xml.get_widget('proxyport_entry') | ||||
| 		self.on_checkbutton_toggled(widget, [proxyhost_entry, proxyport_entry]) | ||||
| 
 | ||||
| 	def init_account(self, infos): | ||||
| 		"""Initialize window with defaults values""" | ||||
| 		if infos.has_key('accname'): | ||||
|  | @ -882,14 +928,25 @@ class Account_modification_window: | |||
| 			self.xml.get_widget('resource_entry').set_text(infos['resource']) | ||||
| 		if infos.has_key('priority'): | ||||
| 			self.xml.get_widget('priority_spinbutton').set_value(infos['priority']) | ||||
| 		 | ||||
| 		use_proxy = False | ||||
| 		if infos.has_key('use_proxy'): | ||||
| 			if infos['use_proxy'] != 0: | ||||
| 				use_proxy = True | ||||
| 			self.xml.get_widget('use_proxy_checkbutton').\ | ||||
| 				set_active(infos['use_proxy']) | ||||
| 		 | ||||
| 		self.xml.get_widget('proxyhost_entry').set_sensitive(use_proxy) | ||||
| 		self.xml.get_widget('proxyport_entry').set_sensitive(use_proxy) | ||||
| 				 | ||||
| 		if infos.has_key('proxyhost'): | ||||
| 			self.xml.get_widget('proxyhost_entry').set_text(infos['proxyhost']) | ||||
| 
 | ||||
| 		if infos.has_key('proxyport'): | ||||
| 			self.xml.get_widget('proxyport_entry').set_text(str(\ | ||||
| 				infos['proxyport'])) | ||||
| 
 | ||||
| 			 | ||||
| 		gpg_key_label = self.xml.get_widget('gpg_key_label') | ||||
| 		if not self.plugin.config.has_key('usegpg'): | ||||
| 			gpg_key_label.set_text('GPG is not usable on this computer') | ||||
|  | @ -921,7 +978,7 @@ class Account_modification_window: | |||
| 				self.xml.get_widget('log_history_checkbutton').set_active(0) | ||||
| 
 | ||||
| 	def on_save_button_clicked(self, widget): | ||||
| 		"""When save button is clicked : Save informations in config file""" | ||||
| 		"""When save button is clicked: Save information in config file""" | ||||
| 		save_password = 0 | ||||
| 		if self.xml.get_widget('save_password_checkbutton').get_active(): | ||||
| 			save_password = 1 | ||||
|  | @ -977,8 +1034,12 @@ class Account_modification_window: | |||
| 				except ValueError: | ||||
| 					Error_dialog(_('Proxy Port must be a port number')) | ||||
| 					return | ||||
| 			else: | ||||
| 				Error_dialog(_('You must enter a proxy port to use proxy')) | ||||
| 				return | ||||
| 			if proxyhost == '': | ||||
| 				Error_dialog(_('You must enter a proxy host to use proxy')) | ||||
| 				return | ||||
| 
 | ||||
| 		(login, hostname) = jid.split('@') | ||||
| 		key_name = self.xml.get_widget('gpg_name_label').get_text() | ||||
|  | @ -1045,7 +1106,7 @@ class Account_modification_window: | |||
| 				self.plugin.windows['accounts'].init_accounts() | ||||
| 			#refresh roster | ||||
| 			self.plugin.roster.draw_roster() | ||||
| 			widget.get_toplevel().destroy() | ||||
| 			self.window.destroy() | ||||
| 			return | ||||
| 		#if it's a new account | ||||
| 		if name in self.plugin.accounts.keys(): | ||||
|  | @ -1082,7 +1143,7 @@ class Account_modification_window: | |||
| 			self.plugin.windows['accounts'].init_accounts() | ||||
| 		#refresh roster | ||||
| 		self.plugin.roster.draw_roster() | ||||
| 		widget.get_toplevel().destroy() | ||||
| 		self.window.destroy() | ||||
| 
 | ||||
| 	def on_change_password_button_clicked(self, widget): | ||||
| 		dialog = Change_password_dialog(self.plugin, self.account) | ||||
|  | @ -1213,6 +1274,7 @@ class Account_modification_window: | |||
| 		self.xml.get_widget('gpg_password_entry').set_sensitive(False) | ||||
| 		self.xml.get_widget('password_entry').set_sensitive(False) | ||||
| 		self.xml.get_widget('log_history_checkbutton').set_active(1) | ||||
| 		 | ||||
| 		#default is checked | ||||
| 		self.xml.get_widget('sync_with_global_status_checkbutton').set_active(1) | ||||
| 		self.xml.signal_autoconnect(self) | ||||
|  | @ -1230,7 +1292,7 @@ class Accounts_window: | |||
| 		del self.plugin.windows['accounts']  | ||||
| 
 | ||||
| 	def on_close_button_clicked(self, widget): | ||||
| 		widget.get_toplevel().destroy() | ||||
| 		self.window.destroy() | ||||
| 
 | ||||
| 	def init_accounts(self): | ||||
| 		"""initialize listStore with existing accounts""" | ||||
|  | @ -1325,7 +1387,7 @@ class Service_registration_window: | |||
| 	Window that appears when we want to subscribe to a service""" | ||||
| 	def on_cancel_button_clicked(self, widget): | ||||
| 		"""When Cancel button is clicked""" | ||||
| 		widget.get_toplevel().destroy() | ||||
| 		self.window.destroy() | ||||
| 		 | ||||
| 	def draw_table(self): | ||||
| 		"""Draw the table in the window""" | ||||
|  | @ -1355,7 +1417,7 @@ class Service_registration_window: | |||
| 		self.plugin.roster.contacts[self.account][self.service] = [user1] | ||||
| 		self.plugin.roster.add_user_to_roster(self.service, self.account) | ||||
| 		self.plugin.send('REG_AGENT', self.account, self.service) | ||||
| 		widget.get_toplevel().destroy() | ||||
| 		self.window.destroy() | ||||
| 	 | ||||
| 	def __init__(self, service, infos, plugin, account): | ||||
| 		self.xml = gtk.glade.XML(GTKGUI_GLADE, 'service_registration_window', APP) | ||||
|  | @ -1421,6 +1483,7 @@ class Add_remove_emoticons_window: | |||
| 			iter = model.iter_next(iter) | ||||
| 		self.plugin.config['emoticons'] = '\t'.join(emots) | ||||
| 		self.plugin.init_regexp() | ||||
| 		self.plugin.save_config() | ||||
| 
 | ||||
| 	def on_emoticons_treemodel_row_changed(self, model, path, iter): | ||||
| 		if model[path][1] != None and len(model[path][1]) != 0: | ||||
|  | @ -1432,6 +1495,7 @@ class Add_remove_emoticons_window: | |||
| 				iter = model.iter_next(iter) | ||||
| 			self.plugin.config['emoticons'] = '\t'.join(emots) | ||||
| 			self.plugin.init_regexp() | ||||
| 		self.plugin.save_config() | ||||
| 
 | ||||
| 	def image_is_ok(self, image): | ||||
| 		if not os.path.exists(image): | ||||
|  | @ -1563,7 +1627,7 @@ class Service_discovery_window: | |||
| 
 | ||||
| 	def on_close_button_clicked(self, widget): | ||||
| 		"""When Close button is clicked""" | ||||
| 		widget.get_toplevel().destroy() | ||||
| 		self.window.destroy() | ||||
| 		 | ||||
| 	def browse(self, jid): | ||||
| 		"""Send a request to the core to know the available services""" | ||||
|  | @ -1733,7 +1797,7 @@ class Service_discovery_window: | |||
| 			return | ||||
| 		service = model.get_value(iter, 1) | ||||
| 		self.plugin.send('REG_AGENT_INFO', self.account, service) | ||||
| 		widget.get_toplevel().destroy() | ||||
| 		self.window.destroy() | ||||
| 	 | ||||
| 	def on_services_treeview_cursor_changed(self, widget): | ||||
| 		"""When we select a row : | ||||
|  | @ -1765,6 +1829,7 @@ class Service_discovery_window: | |||
| 			' '.join(self.latest_addresses) | ||||
| 		self.services_treeview.get_model().clear() | ||||
| 		self.browse(server_address) | ||||
| 		self.plugin.save_config() | ||||
| 	 | ||||
| 	def __init__(self, plugin, account): | ||||
| 		if plugin.connected[account] < 2: | ||||
|  |  | |||
|  | @ -31,7 +31,7 @@ import version | |||
| 
 | ||||
| GTKGUI_GLADE='plugins/gtkgui/gtkgui.glade' | ||||
| 
 | ||||
| class vcard_information_window: | ||||
| class Vcard_information_window: | ||||
| 	"""Class for user's information window""" | ||||
| 	def on_user_information_window_destroy(self, widget=None): | ||||
| 		"""close window""" | ||||
|  | @ -39,12 +39,12 @@ class vcard_information_window: | |||
| 
 | ||||
| 	def on_vcard_information_window_key_press_event(self, widget, event): | ||||
| 		if event.keyval == gtk.keysyms.Escape: # ESCAPE | ||||
| 			widget.destroy() | ||||
| 			self.window.destroy() | ||||
| 
 | ||||
| 	def on_close_button_clicked(self, widget): | ||||
| 		"""Save user's informations and update the roster on the Jabber server""" | ||||
| 		if self.vcard: | ||||
| 			widget.get_toplevel().destroy() | ||||
| 			self.window.destroy() | ||||
| 			return | ||||
| 		#update user.name if it's not "" | ||||
| 		name_entry = self.xml.get_widget('nickname_entry') | ||||
|  | @ -73,7 +73,7 @@ class vcard_information_window: | |||
| 			self.plugin.accounts[self.account] = account_info | ||||
| 			self.plugin.send('CONFIG', None, ('accounts', self.plugin.accounts, \ | ||||
| 				'Gtkgui')) | ||||
| 		widget.get_toplevel().destroy() | ||||
| 		self.window.destroy() | ||||
| 
 | ||||
| 	def set_value(self, entry_name, value): | ||||
| 		try: | ||||
|  | @ -490,7 +490,7 @@ class Add_new_contact_window: | |||
| 
 | ||||
| 	def on_cancel_button_clicked(self, widget): | ||||
| 		"""When Cancel button is clicked""" | ||||
| 		widget.get_toplevel().destroy() | ||||
| 		self.window.destroy() | ||||
| 
 | ||||
| 	def on_subscribe_button_clicked(self, widget): | ||||
| 		"""When Subscribe button is clicked""" | ||||
|  | @ -510,7 +510,7 @@ class Add_new_contact_window: | |||
| 			nickname) | ||||
| 		if self.xml.get_widget('auto_authorize_checkbutton').get_active(): | ||||
| 			self.plugin.send('AUTH', self.account, jid) | ||||
| 		widget.get_toplevel().destroy() | ||||
| 		self.window.destroy() | ||||
| 		 | ||||
| 	def fill_jid(self): | ||||
| 		protocol_combobox = self.xml.get_widget('protocol_combobox') | ||||
|  | @ -633,6 +633,7 @@ class Error_dialog: | |||
| class subscription_request_window: | ||||
| 	def __init__(self, plugin, jid, text, account): | ||||
| 		xml = gtk.glade.XML(GTKGUI_GLADE, 'subscription_request_window', APP) | ||||
| 		self.window = xml.get_widget('subscription_request_window') | ||||
| 		self.plugin = plugin | ||||
| 		self.jid = jid | ||||
| 		self.account = account | ||||
|  | @ -646,19 +647,19 @@ class subscription_request_window: | |||
| 	window that appears when a user wants to add us to his/her roster""" | ||||
| 	def on_close_button_clicked(self, widget): | ||||
| 		"""When Close button is clicked""" | ||||
| 		widget.get_toplevel().destroy() | ||||
| 		self.window.destroy() | ||||
| 		 | ||||
| 	def on_authorize_button_clicked(self, widget): | ||||
| 		"""Accept the request""" | ||||
| 		self.plugin.send('AUTH', self.account, self.jid) | ||||
| 		widget.get_toplevel().destroy() | ||||
| 		self.window.destroy() | ||||
| 		if not self.plugin.roster.contacts[self.account].has_key(self.jid): | ||||
| 			Add_new_contact_window(self.plugin, self.account, self.jid) | ||||
| 	 | ||||
| 	def on_deny_button_clicked(self, widget): | ||||
| 		"""refuse the request""" | ||||
| 		self.plugin.send('DENY', self.account, self.jid) | ||||
| 		widget.get_toplevel().destroy() | ||||
| 		self.window.destroy() | ||||
| 
 | ||||
| class Join_groupchat_window: | ||||
| 	def __init__(self, plugin, account, server='', room = ''): | ||||
|  | @ -705,7 +706,7 @@ class Join_groupchat_window: | |||
| 
 | ||||
| 	def on_cancel_button_clicked(self, widget): | ||||
| 		"""When Cancel button is clicked""" | ||||
| 		widget.get_toplevel().destroy() | ||||
| 		self.window.destroy() | ||||
| 
 | ||||
| 	def on_join_button_clicked(self, widget): | ||||
| 		"""When Join button is clicked""" | ||||
|  | @ -725,7 +726,7 @@ class Join_groupchat_window: | |||
| 		self.plugin.send('GC_JOIN', self.account, (nickname, room, server, \ | ||||
| 			password)) | ||||
| 			 | ||||
| 		widget.get_toplevel().destroy() | ||||
| 		self.window.destroy() | ||||
| 
 | ||||
| class New_message_dialog: | ||||
| 	def __init__(self, plugin, account): | ||||
|  | @ -755,7 +756,7 @@ class New_message_dialog: | |||
| 
 | ||||
| 	def on_cancel_button_clicked(self, widget): | ||||
| 		"""When Cancel button is clicked""" | ||||
| 		widget.get_toplevel().destroy() | ||||
| 		self.window.destroy() | ||||
| 
 | ||||
| 	def on_chat_button_clicked(self, widget): | ||||
| 		"""When Chat button is clicked""" | ||||
|  | @ -763,6 +764,7 @@ class New_message_dialog: | |||
| 		if jid.find('@') == -1: # if no @ was given | ||||
| 			Error_dialog(_('User ID is not valid')) | ||||
| 			return | ||||
| 		self.window.destroy() | ||||
| 		# use User class, new_chat expects it that way | ||||
| 		# is it in the roster? | ||||
| 		if self.plugin.roster.contacts[self.account].has_key(jid): | ||||
|  | @ -779,8 +781,6 @@ class New_message_dialog: | |||
| 		self.plugin.windows[self.account]['chats'][jid].window.present() | ||||
| 		#FIXME: PROBLEM WITH FOCUS | ||||
| 
 | ||||
| 		widget.get_toplevel().destroy() | ||||
| 
 | ||||
| class Change_password_dialog: | ||||
| 	def __init__(self, plugin, account): | ||||
| 		if plugin.connected[account] < 2: | ||||
|  | @ -817,8 +817,10 @@ class Change_password_dialog: | |||
| 		return message | ||||
| 
 | ||||
| class Popup_window: | ||||
| 	def __init__(self, plugin, event_type, event_desc): | ||||
| 	def __init__(self, plugin, event_type, jid, account): | ||||
| 		self.plugin = plugin | ||||
| 		self.account = account | ||||
| 		self.jid = jid | ||||
| 		 | ||||
| 		xml = gtk.glade.XML(GTKGUI_GLADE, 'popup_window', APP) | ||||
| 		self.window = xml.get_widget('popup_window') | ||||
|  | @ -828,7 +830,13 @@ class Popup_window: | |||
| 		eventbox = xml.get_widget('eventbox') | ||||
| 		 | ||||
| 		event_type_label.set_markup('<b>'+event_type+'</b>') | ||||
| 		event_description_label.set_text(event_desc) | ||||
| 
 | ||||
| 		if self.jid in self.plugin.roster.contacts[account]: | ||||
| 			txt = self.plugin.roster.contacts[account][self.jid][0].name | ||||
| 		else: | ||||
| 			txt = self.jid | ||||
| 
 | ||||
| 		event_description_label.set_text(txt) | ||||
| 		 | ||||
| 		# set colors [ http://www.w3schools.com/html/html_colornames.asp ] | ||||
| 		self.window.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('black')) | ||||
|  | @ -841,28 +849,27 @@ class Popup_window: | |||
| 		elif event_type == 'New Message': | ||||
| 			close_button.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('dodgerblue')) | ||||
| 			eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('dodgerblue')) | ||||
| 			txt = 'From ' + txt | ||||
| 	 | ||||
| 		# position the window to bottom-right of screen | ||||
| 		window_width, window_height = self.window.get_size() | ||||
| 		self.plugin.roster.popups_height += window_height | ||||
| 		window_width, self.window_height = self.window.get_size() | ||||
| 		self.plugin.roster.popups_height += self.window_height | ||||
| 		self.window.move(gtk.gdk.screen_width() - window_width, \ | ||||
| 					gtk.gdk.screen_height() - self.plugin.roster.popups_height) | ||||
| 		 | ||||
| 		xml.signal_autoconnect(self) | ||||
| 		close_button.connect('clicked', self.on_close_button_clicked, window_height) | ||||
| 		self.window.show_all() | ||||
| 		gobject.timeout_add(5000, self.on_timeout) | ||||
| 
 | ||||
| 		gobject.timeout_add(5000, self.on_timeout, window_height) | ||||
| 	def on_close_button_clicked(self, widget): | ||||
| 		self.adjust_height_and_move_popup_windows() | ||||
| 
 | ||||
| 	def on_close_button_clicked(self, widget, window_height): | ||||
| 		self.adjust_height_and_move_popup_windows(window_height) | ||||
| 	def on_timeout(self): | ||||
| 		self.adjust_height_and_move_popup_windows() | ||||
| 		 | ||||
| 	def on_timeout(self, window_height): | ||||
| 		self.adjust_height_and_move_popup_windows(window_height) | ||||
| 		 | ||||
| 	def adjust_height_and_move_popup_windows(self, window_height): | ||||
| 	def adjust_height_and_move_popup_windows(self): | ||||
| 		#remove | ||||
| 		self.plugin.roster.popups_height -= window_height | ||||
| 		self.plugin.roster.popups_height -= self.window_height | ||||
| 		self.window.destroy() | ||||
| 		 | ||||
| 		if len(self.plugin.roster.popup_windows) > 0: | ||||
|  | @ -878,4 +885,17 @@ class Popup_window: | |||
| 					gtk.gdk.screen_height() - self.plugin.roster.popups_height) | ||||
| 
 | ||||
| 	def on_popup_window_button_press_event(self, widget, event): | ||||
| 		print 'IN YOUR DREAMS ONLY..' | ||||
| 		# use User class, new_chat expects it that way | ||||
| 		# is it in the roster? | ||||
| 		if self.plugin.roster.contacts[self.account].has_key(self.jid): | ||||
| 			user = self.plugin.roster.contacts[self.account][self.jid][0] | ||||
| 		else: | ||||
| 			user = gtkgui.User(self.jid, self.jid, ['not in the roster'], \ | ||||
| 				'not in the roster', 'not in the roster', 'none', None, '', 0, '') | ||||
| 			self.plugin.roster.contacts[self.account][self.jid] = [user] | ||||
| 			self.plugin.roster.add_user_to_roster(user.self.jid, self.account)			 | ||||
| 
 | ||||
| 		self.plugin.roster.new_chat(user, self.account) | ||||
| 		self.plugin.windows[self.account]['chats'][self.jid].active_tab(self.jid) | ||||
| 		self.plugin.windows[self.account]['chats'][self.jid].window.present() | ||||
| 		self.adjust_height_and_move_popup_windows() | ||||
|  |  | |||
|  | @ -45,6 +45,7 @@ class Groupchat_window(Chat): | |||
| 		self.subjects = {} | ||||
| 		self.new_group(room_jid, nick) | ||||
| 		self.show_title() | ||||
| 		print "self.xml.get_widget('message_textview') is", self.xml.get_widget('message_textview'), "!!" | ||||
| 		self.xml.signal_connect('on_groupchat_window_destroy', \ | ||||
| 			self.on_groupchat_window_destroy) | ||||
| 		self.xml.signal_connect('on_groupchat_window_delete_event', \ | ||||
|  | @ -240,8 +241,11 @@ class Groupchat_window(Chat): | |||
| 		and printed in the conversation. Tab does autocompete in nickames""" | ||||
| 		jid = self.get_active_jid() | ||||
| 		conversation_textview = self.xmls[jid].get_widget('conversation_textview') | ||||
| 		if event.keyval == gtk.keysyms.Tab and \ | ||||
| 			(event.state & gtk.gdk.CONTROL_MASK): # CTRL + TAB | ||||
| 		if event.hardware_keycode == 23: # TAB | ||||
| 			if (event.state & gtk.gdk.CONTROL_MASK) and \ | ||||
| 				(event.state & gtk.gdk.SHIFT_MASK): # CTRL + SHIFT + TAB   | ||||
| 				self.notebook.emit('key_press_event', event) | ||||
| 			elif event.state & gtk.gdk.CONTROL_MASK: # CTRL + TAB | ||||
| 				self.notebook.emit('key_press_event', event) | ||||
| 		elif event.keyval == gtk.keysyms.Page_Down: # PAGE DOWN | ||||
| 			if event.state & gtk.gdk.CONTROL_MASK: # CTRL + PAGE DOWN | ||||
|  | @ -256,7 +260,7 @@ class Groupchat_window(Chat): | |||
| 		elif event.keyval == gtk.keysyms.Return or \ | ||||
| 			event.keyval == gtk.keysyms.KP_Enter: # ENTER | ||||
| 			if (event.state & gtk.gdk.SHIFT_MASK): | ||||
| 				return 0 | ||||
| 				return False | ||||
| 			message_buffer = widget.get_buffer() | ||||
| 			start_iter = message_buffer.get_start_iter() | ||||
| 			end_iter = message_buffer.get_end_iter() | ||||
|  | @ -266,7 +270,7 @@ class Groupchat_window(Chat): | |||
| 				self.plugin.send('GC_MSG', self.account, (room_jid, txt)) | ||||
| 				message_buffer.set_text('', -1) | ||||
| 				widget.grab_focus() | ||||
| 			return 1 | ||||
| 			return True | ||||
| 		elif event.keyval == gtk.keysyms.Tab: # TAB | ||||
| 			room_jid = self.get_active_jid() | ||||
| 			list_nick = self.get_nick_list(room_jid) | ||||
|  | @ -276,18 +280,18 @@ class Groupchat_window(Chat): | |||
| 			end_iter = message_buffer.get_iter_at_mark(cursor_position) | ||||
| 			text = message_buffer.get_text(start_iter, end_iter, 0) | ||||
| 			if not text: | ||||
| 				return 0 | ||||
| 			splited_text = text.split() | ||||
| 			begin = splited_text[-1] | ||||
| 				return False | ||||
| 			splitted_text = text.split() | ||||
| 			begin = splitted_text[-1] # begining of the latest word we typed | ||||
| 			for nick in list_nick: | ||||
| 				if nick.find(begin) == 0: | ||||
| 					if len(splited_text) == 1: | ||||
| 				if nick.find(begin) == 0: # the word is the begining of a nick | ||||
| 					if len(splitted_text) == 1: # This is the 1st word of the line ? | ||||
| 						add = ': ' | ||||
| 					else: | ||||
| 						add = ' ' | ||||
| 					message_buffer.insert_at_cursor(nick[len(begin):] + add) | ||||
| 					return 1 | ||||
| 		return 0 | ||||
| 					return True | ||||
| 		return False | ||||
| 
 | ||||
| 	def print_conversation(self, text, room_jid, contact = '', tim = None): | ||||
| 		"""Print a line in the conversation : | ||||
|  | @ -371,8 +375,10 @@ class Groupchat_window(Chat): | |||
| 		"""Call vcard_information_window class to display user's information""" | ||||
| 		if not self.plugin.windows[self.account]['infos'].has_key(jid): | ||||
| 			self.plugin.windows[self.account]['infos'][jid] = \ | ||||
| 				vcard_information_window(jid, self.plugin, self.account, True) | ||||
| 				Vcard_information_window(jid, self.plugin, self.account, True) | ||||
| 			self.plugin.send('ASK_VCARD', self.account, jid) | ||||
| 			#FIXME: maybe use roster.on_info above? | ||||
| 			 | ||||
| 			#FIXME: we need the resource but it's not saved | ||||
| 			#self.plugin.send('ASK_OS_INFO', self.account, jid, resource) | ||||
| 
 | ||||
|  |  | |||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							|  | @ -64,6 +64,11 @@ import Queue | |||
| import sre | ||||
| import common.sleepy | ||||
| 
 | ||||
| try: | ||||
| 	import winsound # windows-only built-in module for playing wav | ||||
| except ImportError: | ||||
| 	pass | ||||
| 
 | ||||
| class CellRendererImage(gtk.GenericCellRenderer): | ||||
| 
 | ||||
| 	__gproperties__ = { | ||||
|  | @ -274,19 +279,20 @@ class plugin: | |||
| 		pidp, r = os.waitpid(pid, os.WNOHANG) | ||||
| 		return 0 | ||||
| 
 | ||||
| 
 | ||||
| 	def play_sound(self, event): | ||||
| 		if os.name != 'posix': | ||||
| 		if not self.config['sounds_on']: | ||||
| 			return | ||||
| 		path_to_soundfile = self.config[event + '_file'] | ||||
| 		if not os.path.exists(path_to_soundfile): | ||||
| 			return | ||||
| 		if os.name  == 'nt': | ||||
| 			winsound.PlaySound(path_to_soundfile, \ | ||||
| 									winsound.SND_FILENAME|winsound.SND_ASYNC) | ||||
| 		elif os.name == 'posix': | ||||
| 			if self.config['soundplayer'] == '': | ||||
| 				return | ||||
| 		if not self.config[event]: | ||||
| 			return | ||||
| 		file = self.config[event + '_file'] | ||||
| 		if not os.path.exists(file): | ||||
| 			return | ||||
| 			argv = self.config['soundplayer'].split() | ||||
| 		argv.append(file) | ||||
| 			argv.append(path_to_soundfile) | ||||
| 			pid = os.spawnvp(os.P_NOWAIT, argv[0], argv) | ||||
| 			pidp, r = os.waitpid(pid, os.WNOHANG) | ||||
| 			if pidp == 0: | ||||
|  | @ -334,6 +340,7 @@ class plugin: | |||
| 		# role, affiliation, real_jid, reason, actor, statusCode)) | ||||
| 		statuss = ['offline', 'error', 'online', 'chat', 'away', 'xa', 'dnd', 'invisible'] | ||||
| 		old_show = 0 | ||||
| 		new_show = statuss.index(array[1]) | ||||
| 		jid = array[0].split('/')[0] | ||||
| 		keyID = array[5] | ||||
| 		resource = array[3] | ||||
|  | @ -370,18 +377,23 @@ class plugin: | |||
| 						user1.priority, user1.keyID) | ||||
| 					luser.append(user1) | ||||
| 				user1.resource = resource | ||||
| 			if old_show == 0 and statuss.index(array[1]) > 1: | ||||
| 			if user1.jid.find('@') > 0: # It's not an agent | ||||
| 				if old_show == 0 and new_show > 1: | ||||
| 					if not user1.jid in self.roster.newly_added[account]: | ||||
| 						self.roster.newly_added[account].append(user1.jid) | ||||
| 					if user1.jid in self.roster.to_be_removed[account]: | ||||
| 						self.roster.to_be_removed[account].remove(user1.jid) | ||||
| 				gobject.timeout_add(5000, self.roster.remove_newly_added, user1.jid, account) | ||||
| 			if old_show > 1 and statuss.index(array[1]) == 0 and self.connected[account] > 1: | ||||
| 					gobject.timeout_add(5000, self.roster.remove_newly_added, \ | ||||
| 						user1.jid, account) | ||||
| 				if old_show > 1 and new_show == 0 and self.connected[account] > 1: | ||||
| 					if not user1.jid in self.roster.to_be_removed[account]: | ||||
| 						self.roster.to_be_removed[account].append(user1.jid) | ||||
| 					if user1.jid in self.roster.newly_added[account]: | ||||
| 						self.roster.newly_added[account].remove(user1.jid) | ||||
| 				gobject.timeout_add(5000, self.roster.really_remove_user, user1, account) | ||||
| 					self.roster.redraw_jid(user1.jid, account) | ||||
| 					if not self.queues[account].has_key(jid): | ||||
| 						gobject.timeout_add(5000, self.roster.really_remove_user, \ | ||||
| 							user1, account) | ||||
| 			user1.show = array[1] | ||||
| 			user1.status = array[2] | ||||
| 			user1.priority = priority | ||||
|  | @ -395,21 +407,29 @@ class plugin: | |||
| 			#It isn't an agent | ||||
| 			self.roster.chg_user_status(user1, array[1], array[2], account) | ||||
| 			#play sound | ||||
| 			if old_show < 2 and statuss.index(user1.show) > 1 and \ | ||||
| 			if old_show < 2 and new_show > 1 and \ | ||||
| 				self.config['sound_contact_connected']: | ||||
| 				self.play_sound('sound_contact_connected') | ||||
| 				if not self.windows[account]['chats'].has_key(jid) and \ | ||||
| 					not self.queues[account].has_key(jid) and \ | ||||
| 											not self.config['autopopup']: | ||||
| 					instance = Popup_window(self, 'Contact Online', jid ) | ||||
| 					#FIXME: | ||||
| 					#DOES NOT ALWAYS WORK WHY? | ||||
| 					#I control nkour@lagaule in jabber | ||||
| 					# have nkour@lagaul in nkour@jabber.org | ||||
| 					#go online from psi in lagaule | ||||
| 					#gajim doesn't give a shit | ||||
| 					# WHY? same with offline | ||||
| 					# new message works | ||||
| 					instance = Popup_window(self, 'Contact Online', jid, account) | ||||
| 					self.roster.popup_windows.append(instance) | ||||
| 			elif old_show > 1 and statuss.index(user1.show) < 2 and \ | ||||
| 			elif old_show > 1 and new_show < 2 and \ | ||||
| 				self.config['sound_contact_disconnected']: | ||||
| 				self.play_sound('sound_contact_disconnected') | ||||
| 				if not self.windows[account]['chats'].has_key(jid) and \ | ||||
| 							not self.queues[account].has_key(jid) and \ | ||||
| 											not self.config['autopopup']: | ||||
| 					instance = Popup_window(self, 'Contact Offline', jid ) | ||||
| 					instance = Popup_window(self, 'Contact Offline', jid, account) | ||||
| 					self.roster.popup_windows.append(instance) | ||||
| 				 | ||||
| 		elif self.windows[account]['gc'].has_key(ji): | ||||
|  | @ -432,7 +452,7 @@ class plugin: | |||
| 						not self.queues[account].has_key(jid): | ||||
| 			first = True | ||||
| 			if	not self.config['autopopup']: | ||||
| 				instance = Popup_window(self, 'New Message', 'From '+ jid ) | ||||
| 				instance = Popup_window(self, 'New Message', jid, account) | ||||
| 				self.roster.popup_windows.append(instance) | ||||
| 		self.roster.on_message(jid, array[1], array[2], account) | ||||
| 		if self.config['sound_first_message_received'] and first: | ||||
|  | @ -450,6 +470,7 @@ class plugin: | |||
| 		 | ||||
| 	def handle_event_msgsent(self, account, array): | ||||
| 		#('MSG', account, (jid, msg, keyID)) | ||||
| 		if self.config['sound_message_sent']: | ||||
| 			self.play_sound('sound_message_sent') | ||||
| 		 | ||||
| 	def handle_event_subscribe(self, account, array): | ||||
|  | @ -536,7 +557,12 @@ class plugin: | |||
| 		self.roster.draw_roster() | ||||
| 
 | ||||
| 	def handle_event_quit(self, p1, p2): | ||||
| 		self.roster.on_quit() | ||||
| 		self.roster.on_quit() # SUCH FUNCTION DOES NOT EXIST!! | ||||
| 
 | ||||
| 	def save_config(self): | ||||
| 		hidden_lines = self.config['hiddenlines'].split('\t') | ||||
| 		self.config['hiddenlines'] = '\t'.join(hidden_lines) | ||||
| 		self.send('CONFIG', None, ('GtkGui', self.config, 'GtkGui')) | ||||
| 
 | ||||
| 	def handle_event_myvcard(self, account, array): | ||||
| 		nick = '' | ||||
|  | @ -927,7 +953,7 @@ class plugin: | |||
| 												#2:autoaway and use sleeper | ||||
| 												#3:autoxa and use sleeper | ||||
| 			self.send('ASK_ROSTER', a, self.queueIN) | ||||
| 		#in pygtk2.4 FIXME: (nk) WHAT DO YOU MEAN? | ||||
| 
 | ||||
| 		iconset = self.config['iconset'] | ||||
| 		if not iconset: | ||||
| 			iconset = 'sun' | ||||
|  |  | |||
|  | @ -204,7 +204,9 @@ class Roster_window: | |||
| 				prio = u.priority | ||||
| 				user = u | ||||
| 		for iter in iters: | ||||
| 			if self.plugin.queues[account].has_key(jid): | ||||
| 			if jid.find("@") <= 0: # It's an agent | ||||
| 				img = self.pixbufs[user.show] | ||||
| 			elif self.plugin.queues[account].has_key(jid): | ||||
| 				img = self.pixbufs['message'] | ||||
| 			else: | ||||
| 				if user.sub != 'both': | ||||
|  | @ -392,9 +394,11 @@ class Roster_window: | |||
| 
 | ||||
| 	def on_info(self, widget, user, account): | ||||
| 		"""Call vcard_information_window class to display user's information""" | ||||
| 		if not self.plugin.windows[account]['infos'].has_key(user.jid): | ||||
| 		if self.plugin.windows[account]['infos'].has_key(user.jid): | ||||
| 			self.plugin.windows[account]['infos'][user.jid].window.present() | ||||
| 		else: | ||||
| 			self.plugin.windows[account]['infos'][user.jid] = \ | ||||
| 				vcard_information_window(user, self.plugin, account) | ||||
| 				Vcard_information_window(user, self.plugin, account) | ||||
| 
 | ||||
| 	def on_agent_logging(self, widget, jid, state, account): | ||||
| 		"""When an agent is requested to log in or off""" | ||||
|  | @ -921,8 +925,6 @@ class Roster_window: | |||
| 			 | ||||
| 	def on_about_menuitem_activate(self, widget): | ||||
| 		About_dialog() | ||||
| 		#inst = Popup_window(self.plugin, 'Fake Message', 'nkour@') | ||||
| 		#self.popup_windows.append( inst ) | ||||
| 
 | ||||
| 	def on_accounts_menuitem_activate(self, widget): | ||||
| 		if self.plugin.windows.has_key('accounts'): | ||||
|  | @ -969,8 +971,7 @@ class Roster_window: | |||
| 				self.plugin.config['width'], self.plugin.config['height'] = \ | ||||
| 					self.window.get_size() | ||||
| 
 | ||||
| 		self.plugin.config['hiddenlines'] = '\t'.join(self.hidden_lines) | ||||
| 		self.plugin.send('CONFIG', None, ('GtkGui', self.plugin.config, 'GtkGui')) | ||||
| 		self.plugin.save_config() | ||||
| 		self.plugin.send('QUIT', None, ('gtkgui', 1)) | ||||
| 		print _("plugin gtkgui stopped") | ||||
| 		self.close_all(self.plugin.windows) | ||||
|  |  | |||
|  | @ -155,8 +155,11 @@ class Tabbed_chat_window(Chat): | |||
| 		and printed in the conversation""" | ||||
| 		jid = self.get_active_jid() | ||||
| 		conversation_textview = self.xmls[jid].get_widget('conversation_textview') | ||||
| 		if event.keyval == gtk.keysyms.Tab and \ | ||||
|          (event.state & gtk.gdk.CONTROL_MASK): # CTRL + TAB | ||||
| 		if event.hardware_keycode == 23: # TAB | ||||
| 			if (event.state & gtk.gdk.CONTROL_MASK) and \ | ||||
| 				(event.state & gtk.gdk.SHIFT_MASK): # CTRL + SHIFT + TAB | ||||
| 				self.notebook.emit('key_press_event', event) | ||||
| 			elif event.state & gtk.gdk.CONTROL_MASK: # CTRL + TAB | ||||
| 				self.notebook.emit('key_press_event', event) | ||||
| 		elif event.keyval == gtk.keysyms.Page_Down: # PAGE DOWN | ||||
| 			if event.state & gtk.gdk.CONTROL_MASK: # CTRL + PAGE DOWN | ||||
|  | @ -212,7 +215,7 @@ class Tabbed_chat_window(Chat): | |||
| 		if (user.show == 'offline' or user.show == 'error') and \ | ||||
| 			not showOffline: | ||||
| 			if len(self.plugin.roster.contacts[self.account][jid]) == 1: | ||||
| 				self.plugin.roster.remove_user(user, self.account) | ||||
| 				self.plugin.roster.really_remove_user(user, self.account) | ||||
| 
 | ||||
| 	def print_conversation(self, text, jid, contact = '', tim = None): | ||||
| 		"""Print a line in the conversation : | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue