Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gajim
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Philipp Hörist
gajim
Commits
3ba1b532
Commit
3ba1b532
authored
Mar 17, 2020
by
Daniel Brötzmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avatars: Use css show colors
parent
06563efc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
14 deletions
+13
-14
gajim/gtk/avatar.py
gajim/gtk/avatar.py
+6
-3
gajim/gtk/const.py
gajim/gtk/const.py
+0
-11
gajim/gtk/util.py
gajim/gtk/util.py
+7
-0
No files found.
gajim/gtk/avatar.py
View file @
3ba1b532
...
...
@@ -28,12 +28,13 @@
from
gajim.common.helpers
import
Singleton
from
gajim.common.helpers
import
get_groupchat_name
from
gajim.common.const
import
AvatarSize
from
gajim.common.const
import
StyleAttr
from
gajim.gtk.util
import
load_pixbuf
from
gajim.gtk.util
import
text_to_color
from
gajim.gtk.util
import
scale_with_ratio
from
gajim.gtk.
const
import
SHOW_COLORS
from
gajim.gtk.
util
import
get_css_show_class
from
gajim.gtk.util
import
convert_rgb_string_to_float
log
=
logging
.
getLogger
(
'gajim.gtk.avatar'
)
...
...
@@ -108,7 +109,9 @@ def add_status_to_avatar(surface, show):
context
.
arc
(
width
-
clip_size
,
height
-
clip_size
,
clip_size
,
0
,
2
*
pi
)
context
.
fill
()
color
=
SHOW_COLORS
[
show
]
css_color
=
get_css_show_class
(
show
)
color
=
convert_rgb_string_to_float
(
app
.
css_config
.
get_value
(
css_color
,
StyleAttr
.
COLOR
))
show_size
=
width
/
6.5
show_radius
=
show_size
*
0.80
context
.
set_source_rgb
(
*
color
)
...
...
gajim/gtk/const.py
View file @
3ba1b532
...
...
@@ -91,17 +91,6 @@ def __str__(self):
return
self
.
value
SHOW_COLORS
=
{
'online'
:
(
102
/
255
,
191
/
255
,
16
/
255
),
'offline'
:
(
154
/
255
,
154
/
255
,
154
/
255
),
'not in roster'
:
(
154
/
255
,
154
/
255
,
154
/
255
),
'chat'
:
(
102
/
255
,
191
/
255
,
16
/
255
),
'away'
:
(
255
/
255
,
133
/
255
,
51
/
255
),
'dnd'
:
(
230
/
255
,
46
/
255
,
0
),
'xa'
:
(
106
/
255
,
0
,
242
/
255
)
}
WINDOW_MODULES
=
{
'AccountsWindow'
:
'gajim.gtk.accounts'
,
'HistorySyncAssistant'
:
'gajim.gtk.history_sync'
,
...
...
gajim/gtk/util.py
View file @
3ba1b532
...
...
@@ -444,6 +444,13 @@ def convert_rgb_to_hex(rgb_string: str) -> str:
return
'#%02x%02x%02x'
%
(
red
,
green
,
blue
)
@
lru_cache
(
maxsize
=
1024
)
def
convert_rgb_string_to_float
(
rgb_string
:
str
)
->
Tuple
[
float
,
float
,
float
]:
rgba
=
Gdk
.
RGBA
()
rgba
.
parse
(
rgb_string
)
return
(
rgba
.
red
,
rgba
.
green
,
rgba
.
blue
)
def
get_monitor_scale_factor
()
->
int
:
display
=
Gdk
.
Display
.
get_default
()
monitor
=
display
.
get_primary_monitor
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment