Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mesonium
gajim
Commits
3ba1b532
Commit
3ba1b532
authored
5 years ago
by
Daniel Brötzmann
Browse files
Options
Downloads
Patches
Plain Diff
Avatars: Use css show colors
parent
06563efc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
gajim/gtk/avatar.py
+6
-3
6 additions, 3 deletions
gajim/gtk/avatar.py
gajim/gtk/const.py
+0
-11
0 additions, 11 deletions
gajim/gtk/const.py
gajim/gtk/util.py
+7
-0
7 additions, 0 deletions
gajim/gtk/util.py
with
13 additions
and
14 deletions
gajim/gtk/avatar.py
+
6
−
3
View file @
3ba1b532
...
@@ -28,12 +28,13 @@
...
@@ -28,12 +28,13 @@
from
gajim.common.helpers
import
Singleton
from
gajim.common.helpers
import
Singleton
from
gajim.common.helpers
import
get_groupchat_name
from
gajim.common.helpers
import
get_groupchat_name
from
gajim.common.const
import
AvatarSize
from
gajim.common.const
import
AvatarSize
from
gajim.common.const
import
StyleAttr
from
gajim.gtk.util
import
load_pixbuf
from
gajim.gtk.util
import
load_pixbuf
from
gajim.gtk.util
import
text_to_color
from
gajim.gtk.util
import
text_to_color
from
gajim.gtk.util
import
scale_with_ratio
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
'
)
log
=
logging
.
getLogger
(
'
gajim.gtk.avatar
'
)
...
@@ -108,7 +109,9 @@ def add_status_to_avatar(surface, show):
...
@@ -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
.
arc
(
width
-
clip_size
,
height
-
clip_size
,
clip_size
,
0
,
2
*
pi
)
context
.
fill
()
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_size
=
width
/
6.5
show_radius
=
show_size
*
0.80
show_radius
=
show_size
*
0.80
context
.
set_source_rgb
(
*
color
)
context
.
set_source_rgb
(
*
color
)
...
...
This diff is collapsed.
Click to expand it.
gajim/gtk/const.py
+
0
−
11
View file @
3ba1b532
...
@@ -91,17 +91,6 @@ def __str__(self):
...
@@ -91,17 +91,6 @@ def __str__(self):
return
self
.
value
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
=
{
WINDOW_MODULES
=
{
'
AccountsWindow
'
:
'
gajim.gtk.accounts
'
,
'
AccountsWindow
'
:
'
gajim.gtk.accounts
'
,
'
HistorySyncAssistant
'
:
'
gajim.gtk.history_sync
'
,
'
HistorySyncAssistant
'
:
'
gajim.gtk.history_sync
'
,
...
...
This diff is collapsed.
Click to expand it.
gajim/gtk/util.py
+
7
−
0
View file @
3ba1b532
...
@@ -444,6 +444,13 @@ def convert_rgb_to_hex(rgb_string: str) -> str:
...
@@ -444,6 +444,13 @@ def convert_rgb_to_hex(rgb_string: str) -> str:
return
'
#%02x%02x%02x
'
%
(
red
,
green
,
blue
)
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
:
def
get_monitor_scale_factor
()
->
int
:
display
=
Gdk
.
Display
.
get_default
()
display
=
Gdk
.
Display
.
get_default
()
monitor
=
display
.
get_primary_monitor
()
monitor
=
display
.
get_primary_monitor
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment