we can now configure font in chat / gc windows
This commit is contained in:
parent
e9d28c9703
commit
cbbbb4d511
12
src/chat.py
12
src/chat.py
|
@ -72,6 +72,15 @@ class Chat:
|
|||
# we check that on opening new windows
|
||||
self.always_compact_view = gajim.config.get('always_compact_view')
|
||||
|
||||
def update_font(self):
|
||||
font = pango.FontDescription(gajim.config.get('conversation_font'))
|
||||
for jid in self.tagIn:
|
||||
conversation_textview = self.xmls[jid].get_widget(
|
||||
'conversation_textview')
|
||||
conversation_textview.modify_font(font)
|
||||
message_textview = self.xmls[jid].get_widget('message_textview')
|
||||
message_textview.modify_font(font)
|
||||
|
||||
def update_tags(self):
|
||||
for jid in self.tagIn:
|
||||
self.tagIn[jid].set_property('foreground',
|
||||
|
@ -456,6 +465,7 @@ class Chat:
|
|||
self.nb_unread[jid] = 0
|
||||
gajim.last_message_time[self.account][jid] = 0
|
||||
self.last_time_printout[jid] = 0.
|
||||
font = pango.FontDescription(gajim.config.get('conversation_font'))
|
||||
|
||||
if gajim.config.get('use_speller') and 'gtkspell' in globals():
|
||||
message_textview = self.xmls[jid].get_widget('message_textview')
|
||||
|
@ -467,6 +477,7 @@ class Chat:
|
|||
|
||||
conversation_textview = self.xmls[jid].get_widget(
|
||||
'conversation_textview')
|
||||
conversation_textview.modify_font(font)
|
||||
conversation_buffer = conversation_textview.get_buffer()
|
||||
end_iter = conversation_buffer.get_end_iter()
|
||||
|
||||
|
@ -543,6 +554,7 @@ class Chat:
|
|||
|
||||
self.notebook.append_page(child, tab_hbox)
|
||||
message_textview = self.xmls[jid].get_widget('message_textview')
|
||||
message_textview.modify_font(font)
|
||||
message_textview.connect('size-request', self.size_request,
|
||||
self.xmls[jid])
|
||||
#init new sent history for this conversation
|
||||
|
|
|
@ -126,6 +126,7 @@ class Config:
|
|||
'confirm_close_muc': [opt_bool, True], # confirm closing MUC window
|
||||
'notify_on_file_complete': [opt_bool, True], # notif. on file complete
|
||||
'file_transfers_port': [opt_int, 28011], # port, used for file transfers
|
||||
'conversation_font': [opt_str, 'Sans 10'],
|
||||
}
|
||||
|
||||
__options_per_key = {
|
||||
|
|
|
@ -236,6 +236,10 @@ class PreferencesWindow:
|
|||
self.xml.get_widget('status_msg_colorbutton').set_color(
|
||||
gtk.gdk.color_parse(colSt))
|
||||
|
||||
#Font for messages
|
||||
font = gajim.config.get('conversation_font')
|
||||
self.xml.get_widget('conversation_fontbutton').set_font_name(font)
|
||||
|
||||
# on new message
|
||||
only_in_roster = True
|
||||
if gajim.config.get('notify_on_new_message'):
|
||||
|
@ -680,12 +684,24 @@ class PreferencesWindow:
|
|||
def update_text_tags(self):
|
||||
'''Update color tags in Opened Chat Windows'''
|
||||
for a in gajim.connections:
|
||||
window = self.plugin.windows[a]['chats']
|
||||
if window.has_key('tabbed'):
|
||||
window['tabbed'].update_tags()
|
||||
else:
|
||||
for jid in window.keys():
|
||||
window[jid].update_tags()
|
||||
for kind in ['chats', 'gc']:
|
||||
windows = self.plugin.windows[a][kind]
|
||||
if windows.has_key('tabbed'):
|
||||
windows['tabbed'].update_tags()
|
||||
else:
|
||||
for jid in windows.keys():
|
||||
windows[jid].update_tags()
|
||||
|
||||
def update_text_font(self):
|
||||
'''Update text font in Opened Chat Windows'''
|
||||
for a in gajim.connections:
|
||||
for kind in ['chats', 'gc']:
|
||||
windows = self.plugin.windows[a][kind]
|
||||
if windows.has_key('tabbed'):
|
||||
windows['tabbed'].update_font()
|
||||
else:
|
||||
for jid in windows.keys():
|
||||
windows[jid].update_font()
|
||||
|
||||
def on_preference_widget_color_set(self, widget, text):
|
||||
color = widget.get_color()
|
||||
|
@ -693,6 +709,12 @@ class PreferencesWindow:
|
|||
gajim.config.set(text, color_string)
|
||||
self.update_text_tags()
|
||||
self.plugin.save_config()
|
||||
|
||||
def on_preference_widget_font_set(self, widget, text):
|
||||
font = widget.get_font_name()
|
||||
gajim.config.set(text, text)
|
||||
self.update_text_font()
|
||||
self.plugin.save_config()
|
||||
|
||||
def on_incoming_msg_colorbutton_color_set(self, widget):
|
||||
self.on_preference_widget_color_set(widget, 'inmsgcolor')
|
||||
|
@ -703,6 +725,9 @@ class PreferencesWindow:
|
|||
def on_status_msg_colorbutton_color_set(self, widget):
|
||||
self.on_preference_widget_color_set(widget, 'statusmsgcolor')
|
||||
|
||||
def on_conversation_fontbutton_font_set(self, widget):
|
||||
self.on_preference_widget_font_set(widget, 'conversation_font')
|
||||
|
||||
def on_reset_colors_button_clicked(self, widget):
|
||||
for i in ['inmsgcolor', 'outmsgcolor', 'statusmsgcolor']:
|
||||
gajim.config.set(i, self.plugin.default_values[i])
|
||||
|
|
|
@ -3724,7 +3724,7 @@
|
|||
<child>
|
||||
<widget class="GtkTable" id="table18">
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">4</property>
|
||||
<property name="n_rows">5</property>
|
||||
<property name="n_columns">2</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="row_spacing">6</property>
|
||||
|
@ -3930,6 +3930,51 @@
|
|||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="font_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Font:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkFontButton" id="conversation_fontbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="show_style">True</property>
|
||||
<property name="show_size">True</property>
|
||||
<property name="use_font">False</property>
|
||||
<property name="use_size">False</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="font_set" handler="on_conversation_fontbutton_font_set" last_modification_time="Sun, 07 Aug 2005 18:04:12 GMT"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_options">fill</property>
|
||||
|
|
Loading…
Reference in New Issue