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
06563efc
Commit
06563efc
authored
Mar 17, 2020
by
Daniel Brötzmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tooltips: Use css colors
parent
62fd32e3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
28 deletions
+35
-28
gajim/common/config.py
gajim/common/config.py
+0
-6
gajim/data/style/default.css
gajim/data/style/default.css
+12
-0
gajim/gtk/tooltips.py
gajim/gtk/tooltips.py
+10
-22
gajim/gtk/util.py
gajim/gtk/util.py
+13
-0
No files found.
gajim/common/config.py
View file @
06563efc
...
...
@@ -174,12 +174,6 @@ class Config:
'tabs_always_visible'
:
[
opt_bool
,
False
,
_
(
'Show tab when only one conversation?'
)],
'tabs_border'
:
[
opt_bool
,
False
,
_
(
'Show tabbed notebook border in chat windows?'
)],
'tabs_close_button'
:
[
opt_bool
,
True
,
_
(
'Show close button in tab?'
)],
'tooltip_status_online_color'
:
[
opt_color
,
'#73D216'
],
'tooltip_status_free_for_chat_color'
:
[
opt_color
,
'#3465A4'
],
'tooltip_status_away_color'
:
[
opt_color
,
'#EDD400'
],
'tooltip_status_busy_color'
:
[
opt_color
,
'#F57900'
],
'tooltip_status_na_color'
:
[
opt_color
,
'#CC0000'
],
'tooltip_status_offline_color'
:
[
opt_color
,
'#555753'
],
'tooltip_account_name_color'
:
[
opt_color
,
'#888A85'
],
'tooltip_idle_color'
:
[
opt_color
,
'#888A85'
],
'notification_preview_message'
:
[
opt_bool
,
True
,
_
(
'Preview new messages in notification popup?'
)],
...
...
gajim/data/style/default.css
View file @
06563efc
...
...
@@ -77,3 +77,15 @@
.gajim-notify-other
{
color
:
rgb
(
255
,
255
,
255
);
}
.gajim-status-online
{
color
:
rgb
(
102
,
191
,
16
);
}
.gajim-status-away
{
color
:
rgb
(
255
,
133
,
51
);
}
.gajim-status-dnd
{
color
:
rgb
(
230
,
46
,
0
);
}
.gajim-status-offline
{
color
:
rgb
(
154
,
154
,
154
);
}
gajim/gtk/tooltips.py
View file @
06563efc
...
...
@@ -39,6 +39,7 @@
from
gajim.common.const
import
PEPEventType
from
gajim.common.i18n
import
Q_
from
gajim.common.i18n
import
_
from
gajim.gtkgui_helpers
import
add_css_class
from
gajim.gtk.util
import
get_builder
from
gajim.gtk.util
import
get_icon_name
...
...
@@ -46,6 +47,7 @@
from
gajim.gtk.util
import
format_activity
from
gajim.gtk.util
import
format_tune
from
gajim.gtk.util
import
format_location
from
gajim.gtk.util
import
get_css_show_class
log
=
logging
.
getLogger
(
'gajim.gtk.tooltips'
)
...
...
@@ -206,7 +208,8 @@ def _populate_grid(self, contact):
# Status
show
=
helpers
.
get_uf_show
(
contact
.
show
.
value
)
self
.
_ui
.
user_show
.
set_markup
(
colorize_status
(
show
))
self
.
_ui
.
user_show
.
set_text
(
show
)
colorize_status
(
self
.
_ui
.
user_show
,
contact
.
show
)
self
.
_ui
.
user_show
.
show
()
# JID
...
...
@@ -487,7 +490,8 @@ def _set_idle_time(self, contact):
else
:
show
=
_
(
'Disconnected'
)
self
.
_ui
.
user_show
.
set_markup
(
colorize_status
(
show
))
colorize_status
(
self
.
_ui
.
user_show
,
contact
.
show
)
self
.
_ui
.
user_show
.
set_text
(
show
)
self
.
_ui
.
user_show
.
show
()
@
staticmethod
...
...
@@ -605,25 +609,9 @@ def _get_current_status(file_props):
return
Q_
(
'?transfer status:Not started'
)
def
colorize_status
(
status
):
def
colorize_status
(
widget
,
show
):
"""
Colorize the status message inside the tooltip by it's
semantics. Color palette is the Tango.
Colorize the status message inside the tooltip by it's semantics.
"""
formatted
=
"<span foreground='%s'>%s</span>"
color
=
None
if
status
.
startswith
(
Q_
(
"?user status:Available"
)):
color
=
app
.
config
.
get
(
'tooltip_status_online_color'
)
elif
status
.
startswith
(
_
(
"Free for Chat"
)):
color
=
app
.
config
.
get
(
'tooltip_status_free_for_chat_color'
)
elif
status
.
startswith
(
_
(
"Away"
)):
color
=
app
.
config
.
get
(
'tooltip_status_away_color'
)
elif
status
.
startswith
(
_
(
"Busy"
)):
color
=
app
.
config
.
get
(
'tooltip_status_busy_color'
)
elif
status
.
startswith
(
_
(
"Not Available"
)):
color
=
app
.
config
.
get
(
'tooltip_status_na_color'
)
elif
status
.
startswith
(
_
(
"Offline"
)):
color
=
app
.
config
.
get
(
'tooltip_status_offline_color'
)
if
color
:
status
=
formatted
%
(
color
,
status
)
return
status
css_class
=
get_css_show_class
(
show
)[
14
:]
add_css_class
(
widget
,
css_class
,
prefix
=
'gajim-status-'
)
gajim/gtk/util.py
View file @
06563efc
...
...
@@ -28,6 +28,7 @@
import
xml.etree.ElementTree
as
ET
from
pathlib
import
Path
from
functools
import
wraps
from
functools
import
lru_cache
try
:
from
PIL
import
Image
...
...
@@ -652,6 +653,18 @@ def get_color_for_account(account: str) -> str:
return
rgba
.
to_string
()
@
lru_cache
(
maxsize
=
16
)
def
get_css_show_class
(
show
):
if
show
in
(
'online'
,
'chat'
):
return
'.gajim-status-online'
if
show
in
(
'away'
,
'xa'
):
return
'.gajim-status-away'
if
show
==
'dnd'
:
return
'.gajim-status-dnd'
# 'offline', 'not in roster', 'requested'
return
'.gajim-status-offline'
def
scale_with_ratio
(
size
,
width
,
height
):
if
height
==
width
:
return
size
,
size
...
...
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