move a helper to gtkguihelpers
This commit is contained in:
parent
5ab797ae7e
commit
4e96e1d03c
2 changed files with 26 additions and 27 deletions
|
@ -49,14 +49,6 @@ gtk.glade.textdomain (APP)
|
||||||
|
|
||||||
GTKGUI_GLADE = 'gtkgui.glade'
|
GTKGUI_GLADE = 'gtkgui.glade'
|
||||||
|
|
||||||
|
|
||||||
# helper function to create #aabbcc color string
|
|
||||||
def mk_color_string(color):
|
|
||||||
return '#' + (hex(color.red) + '0')[2:4] + \
|
|
||||||
(hex(color.green) + '0')[2:4] + \
|
|
||||||
(hex(color.blue) + '0')[2:4]
|
|
||||||
|
|
||||||
|
|
||||||
#---------- PreferencesWindow class -------------#
|
#---------- PreferencesWindow class -------------#
|
||||||
class PreferencesWindow:
|
class PreferencesWindow:
|
||||||
'''Class for Preferences window'''
|
'''Class for Preferences window'''
|
||||||
|
@ -73,21 +65,21 @@ class PreferencesWindow:
|
||||||
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'preferences_window', APP)
|
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'preferences_window', APP)
|
||||||
self.window = self.xml.get_widget('preferences_window')
|
self.window = self.xml.get_widget('preferences_window')
|
||||||
self.iconset_combobox = self.xml.get_widget('iconset_combobox')
|
self.iconset_combobox = self.xml.get_widget('iconset_combobox')
|
||||||
self.notify_on_new_message_radiobutton = self.xml.get_widget \
|
self.notify_on_new_message_radiobutton = self.xml.get_widget(
|
||||||
('notify_on_new_message_radiobutton')
|
'notify_on_new_message_radiobutton')
|
||||||
self.popup_new_message_radiobutton = self.xml.get_widget \
|
self.popup_new_message_radiobutton = self.xml.get_widget(
|
||||||
('popup_new_message_radiobutton')
|
'popup_new_message_radiobutton')
|
||||||
self.notify_on_signin_checkbutton = self.xml.get_widget \
|
self.notify_on_signin_checkbutton = self.xml.get_widget(
|
||||||
('notify_on_signin_checkbutton')
|
'notify_on_signin_checkbutton')
|
||||||
self.notify_on_signout_checkbutton = self.xml.get_widget \
|
self.notify_on_signout_checkbutton = self.xml.get_widget(
|
||||||
('notify_on_signout_checkbutton')
|
'notify_on_signout_checkbutton')
|
||||||
self.auto_popup_away_checkbutton = self.xml.get_widget \
|
self.auto_popup_away_checkbutton = self.xml.get_widget(
|
||||||
('auto_popup_away_checkbutton')
|
'auto_popup_away_checkbutton')
|
||||||
self.auto_away_checkbutton = self.xml.get_widget('auto_away_checkbutton')
|
self.auto_away_checkbutton = self.xml.get_widget('auto_away_checkbutton')
|
||||||
self.auto_away_time_spinbutton = self.xml.get_widget \
|
self.auto_away_time_spinbutton = self.xml.get_widget(
|
||||||
('auto_away_time_spinbutton')
|
'auto_away_time_spinbutton')
|
||||||
self.auto_away_message_entry = self.xml.get_widget \
|
self.auto_away_message_entry = self.xml.get_widget(
|
||||||
('auto_away_message_entry')
|
'auto_away_message_entry')
|
||||||
self.auto_xa_checkbutton = self.xml.get_widget('auto_xa_checkbutton')
|
self.auto_xa_checkbutton = self.xml.get_widget('auto_xa_checkbutton')
|
||||||
self.auto_xa_time_spinbutton = self.xml.get_widget(
|
self.auto_xa_time_spinbutton = self.xml.get_widget(
|
||||||
'auto_xa_time_spinbutton')
|
'auto_xa_time_spinbutton')
|
||||||
|
@ -116,7 +108,8 @@ class PreferencesWindow:
|
||||||
|
|
||||||
# Display status msg under contact name in roster
|
# Display status msg under contact name in roster
|
||||||
st = gajim.config.get('show_status_msgs_in_roster')
|
st = gajim.config.get('show_status_msgs_in_roster')
|
||||||
self.xml.get_widget('show_status_msgs_in_roster_checkbutton').set_active(st)
|
self.xml.get_widget('show_status_msgs_in_roster_checkbutton').set_active(
|
||||||
|
st)
|
||||||
|
|
||||||
|
|
||||||
#Use emoticons
|
#Use emoticons
|
||||||
|
@ -131,9 +124,9 @@ class PreferencesWindow:
|
||||||
renderer_image = cell_renderer_image.CellRendererImage()
|
renderer_image = cell_renderer_image.CellRendererImage()
|
||||||
renderer_text = gtk.CellRendererText()
|
renderer_text = gtk.CellRendererText()
|
||||||
renderer_text.set_property('xpad', 5)
|
renderer_text.set_property('xpad', 5)
|
||||||
self.iconset_combobox.pack_start(renderer_image, expand=False)
|
self.iconset_combobox.pack_start(renderer_image, expand = False)
|
||||||
self.iconset_combobox.pack_start(renderer_text, expand=True)
|
self.iconset_combobox.pack_start(renderer_text, expand = True)
|
||||||
self.iconset_combobox.set_attributes(renderer_text, text=1)
|
self.iconset_combobox.set_attributes(renderer_text, text = 1)
|
||||||
self.iconset_combobox.add_attribute(renderer_image, 'image', 0)
|
self.iconset_combobox.add_attribute(renderer_image, 'image', 0)
|
||||||
self.iconset_combobox.set_model(model)
|
self.iconset_combobox.set_model(model)
|
||||||
l = []
|
l = []
|
||||||
|
@ -706,7 +699,7 @@ class PreferencesWindow:
|
||||||
|
|
||||||
def on_preference_widget_color_set(self, widget, text):
|
def on_preference_widget_color_set(self, widget, text):
|
||||||
color = widget.get_color()
|
color = widget.get_color()
|
||||||
color_string = mk_color_string(color)
|
color_string = gtkgui_helpers.make_color_string(color)
|
||||||
gajim.config.set(text, color_string)
|
gajim.config.set(text, color_string)
|
||||||
self.update_text_tags()
|
self.update_text_tags()
|
||||||
gajim.interface.save_config()
|
gajim.interface.save_config()
|
||||||
|
|
|
@ -452,3 +452,9 @@ def make_gtk_month_python_month(month):
|
||||||
|
|
||||||
def make_python_month_gtk_month(month):
|
def make_python_month_gtk_month(month):
|
||||||
return month - 1
|
return month - 1
|
||||||
|
|
||||||
|
def make_color_string(color):
|
||||||
|
'''create #aabbcc color string from gtk color'''
|
||||||
|
return '#' + (hex(color.red) + '0')[2:4] + \
|
||||||
|
(hex(color.green) + '0')[2:4] + \
|
||||||
|
(hex(color.blue) + '0')[2:4]
|
||||||
|
|
Loading…
Add table
Reference in a new issue