Merge branch 'color_string' into 'master'
Replace make_color_string() by Gdk.RGBA method See merge request !141
This commit is contained in:
commit
88609b26f8
|
@ -50,7 +50,7 @@ class Option(IntEnum):
|
||||||
opt_int = [ 'integer', 0 ]
|
opt_int = [ 'integer', 0 ]
|
||||||
opt_str = [ 'string', 0 ]
|
opt_str = [ 'string', 0 ]
|
||||||
opt_bool = [ 'boolean', 0 ]
|
opt_bool = [ 'boolean', 0 ]
|
||||||
opt_color = [ 'color', '^(#[0-9a-fA-F]{6})|()$' ]
|
opt_color = [ 'color', '^(#[0-9a-fA-F]{6})|()|rgb\(\d+,\d+,\d+\)|rgba\(\d+,\d+,\d+,[01]\.?\d*\)$' ]
|
||||||
opt_one_window_types = ['never', 'always', 'always_with_roster', 'peracct', 'pertype']
|
opt_one_window_types = ['never', 'always', 'always_with_roster', 'peracct', 'pertype']
|
||||||
opt_show_roster_on_startup = ['always', 'never', 'last_state']
|
opt_show_roster_on_startup = ['always', 'never', 'last_state']
|
||||||
opt_treat_incoming_messages = ['', 'chat', 'normal']
|
opt_treat_incoming_messages = ['', 'chat', 'normal']
|
||||||
|
|
|
@ -849,7 +849,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 = gtkgui_helpers.make_color_string(color)
|
color_string = color.to_string()
|
||||||
app.config.set(text, color_string)
|
app.config.set(text, color_string)
|
||||||
self.update_text_tags()
|
self.update_text_tags()
|
||||||
|
|
||||||
|
@ -946,8 +946,8 @@ class PreferencesWindow:
|
||||||
Set color value in prefs and update the UI
|
Set color value in prefs and update the UI
|
||||||
"""
|
"""
|
||||||
if state:
|
if state:
|
||||||
color = self.xml.get_object(widget_name).get_color()
|
color = self.xml.get_object(widget_name).get_rgba()
|
||||||
color_string = gtkgui_helpers.make_color_string(color)
|
color_string = color.to_string()
|
||||||
else:
|
else:
|
||||||
color_string = ''
|
color_string = ''
|
||||||
app.config.set(option, color_string)
|
app.config.set(option, color_string)
|
||||||
|
|
|
@ -285,8 +285,8 @@ class GajimThemesWindow:
|
||||||
Set color value in prefs and update the UI
|
Set color value in prefs and update the UI
|
||||||
"""
|
"""
|
||||||
if state:
|
if state:
|
||||||
color = widget.get_color()
|
color = widget.get_rgba()
|
||||||
color_string = gtkgui_helpers.make_color_string(color)
|
color_string = color.to_string()
|
||||||
else:
|
else:
|
||||||
color_string = ''
|
color_string = ''
|
||||||
begin_option = ''
|
begin_option = ''
|
||||||
|
|
|
@ -541,19 +541,6 @@ 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
|
|
||||||
"""
|
|
||||||
col = '#'
|
|
||||||
for i in ('red', 'green', 'blue'):
|
|
||||||
h = hex(int(getattr(color, i) / (16*16)))
|
|
||||||
h = h.split('x')[1]
|
|
||||||
if len(h) == 1:
|
|
||||||
h = '0' + h
|
|
||||||
col += h
|
|
||||||
return col
|
|
||||||
|
|
||||||
def make_pixbuf_grayscale(pixbuf):
|
def make_pixbuf_grayscale(pixbuf):
|
||||||
pixbuf2 = pixbuf.copy()
|
pixbuf2 = pixbuf.copy()
|
||||||
pixbuf.saturate_and_pixelate(pixbuf2, 0.0, False)
|
pixbuf.saturate_and_pixelate(pixbuf2, 0.0, False)
|
||||||
|
|
Loading…
Reference in New Issue