Philipp Hörist pushed to branch master at gajim / gajim
Commits:
c758da11 by André Apitzsch at 2017-10-07T17:03:31+02:00
Replace make_color_string() by Gdk.RGBA method
- - - - -
88609b26 by Philipp Hörist at 2017-10-07T17:38:25+02:00
Merge branch 'color_string' into 'master'
Replace make_color_string() by Gdk.RGBA method
See merge request !141
- - - - -
4 changed files:
- gajim/common/config.py
- gajim/config.py
- gajim/gajim_themes_window.py
- gajim/gtkgui_helpers.py
Changes:
=====================================
gajim/common/config.py
=====================================
--- a/gajim/common/config.py
+++ b/gajim/common/config.py
@@ -50,7 +50,7 @@ class Option(IntEnum):
opt_int = [ 'integer', 0 ]
opt_str = [ 'string', 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_show_roster_on_startup = ['always', 'never', 'last_state']
opt_treat_incoming_messages = ['', 'chat', 'normal']
=====================================
gajim/config.py
=====================================
--- a/gajim/config.py
+++ b/gajim/config.py
@@ -849,7 +849,7 @@ class PreferencesWindow:
def on_preference_widget_color_set(self, widget, text):
color = widget.get_color()
- color_string = gtkgui_helpers.make_color_string(color)
+ color_string = color.to_string()
app.config.set(text, color_string)
self.update_text_tags()
@@ -946,8 +946,8 @@ class PreferencesWindow:
Set color value in prefs and update the UI
"""
if state:
- color = self.xml.get_object(widget_name).get_color()
- color_string = gtkgui_helpers.make_color_string(color)
+ color = self.xml.get_object(widget_name).get_rgba()
+ color_string = color.to_string()
else:
color_string = ''
app.config.set(option, color_string)
=====================================
gajim/gajim_themes_window.py
=====================================
--- a/gajim/gajim_themes_window.py
+++ b/gajim/gajim_themes_window.py
@@ -285,8 +285,8 @@ class GajimThemesWindow:
Set color value in prefs and update the UI
"""
if state:
- color = widget.get_color()
- color_string = gtkgui_helpers.make_color_string(color)
+ color = widget.get_rgba()
+ color_string = color.to_string()
else:
color_string = ''
begin_option = ''
=====================================
gajim/gtkgui_helpers.py
=====================================
--- a/gajim/gtkgui_helpers.py
+++ b/gajim/gtkgui_helpers.py
@@ -541,19 +541,6 @@ def make_gtk_month_python_month(month):
def make_python_month_gtk_month(month):
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):
pixbuf2 = pixbuf.copy()
pixbuf.saturate_and_pixelate(pixbuf2, 0.0, False)
View it on GitLab:
https://dev.gajim.org/gajim/gajim/compare/d8ef967ef29c72e7b9ca35c87ef5a26ab835c788...88609b26f888917753d71dd9a937b8194de8c5be
---
View it on GitLab:
https://dev.gajim.org/gajim/gajim/compare/d8ef967ef29c72e7b9ca35c87ef5a26ab835c788...88609b26f888917753d71dd9a937b8194de8c5be
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits