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
53ede60d
Commit
53ede60d
authored
5 years ago
by
Philipp Hörist
Browse files
Options
Downloads
Patches
Plain Diff
CSSConfig: Fix pylint errors
parent
765180d1
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gajim/gtk/css_config.py
+15
-8
15 additions, 8 deletions
gajim/gtk/css_config.py
with
15 additions
and
8 deletions
gajim/gtk/css_config.py
+
15
−
8
View file @
53ede60d
...
...
@@ -36,7 +36,8 @@
class
CSSConfig
():
def
__init__
(
self
):
"""
CSSConfig handles loading and storing of all relevant Gajim style files
"""
CSSConfig handles loading and storing of all relevant Gajim style files
The order in which CSSConfig loads the styles
...
...
@@ -138,14 +139,15 @@ def _load_css(self):
def
_load_css_from_file
(
self
,
filename
,
priority
):
path
=
os
.
path
.
join
(
configpaths
.
get
(
'
STYLE
'
),
filename
)
try
:
with
open
(
path
,
"
r
"
)
as
f
:
css
=
f
.
read
()
with
open
(
path
,
"
r
"
)
as
f
ile_
:
css
=
f
ile_
.
read
()
except
Exception
as
exc
:
log
.
error
(
'
Error loading css: %s
'
,
exc
)
return
self
.
_activate_css
(
css
,
priority
)
def
_activate_css
(
self
,
css
,
priority
):
@staticmethod
def
_activate_css
(
css
,
priority
):
try
:
provider
=
Gtk
.
CssProvider
()
provider
.
load_from_data
(
bytes
(
css
.
encode
(
'
utf-8
'
)))
...
...
@@ -247,7 +249,7 @@ def set_value(self, selector, attr, value, pre=False):
if
not
pre
:
self
.
_add_to_cache
(
selector
,
attr
,
value
)
self
.
_write
(
pre
)
return
return
None
# The rule was not found, so we add it to this theme
log
.
info
(
'
Set %s %s %s
'
,
selector
,
attr
,
value
)
...
...
@@ -255,6 +257,7 @@ def set_value(self, selector, attr, value, pre=False):
rule
.
style
[
attr
]
=
value
css
.
add
(
rule
)
self
.
_write
(
pre
)
return
None
def
set_font
(
self
,
selector
,
description
,
pre
=
False
):
css
=
self
.
_css
...
...
@@ -297,13 +300,14 @@ def _get_attr_from_description(self, description):
family
=
description
.
get_family
()
return
family
,
size
,
style
,
weight
def
_get_default_rule
(
self
,
selector
,
attr
):
def
_get_default_rule
(
self
,
selector
,
_
attr
):
for
rule
in
self
.
_default_css
:
if
rule
.
type
!=
rule
.
STYLE_RULE
:
continue
if
rule
.
selectorText
==
selector
:
log
.
info
(
'
Get Default Rule %s
'
,
selector
)
return
rule
return
None
def
get_font
(
self
,
selector
,
pre
=
False
):
if
pre
:
...
...
@@ -316,7 +320,7 @@ def get_font(self, selector, pre=False):
pass
if
css
is
None
:
return
return
None
for
rule
in
css
:
if
rule
.
type
!=
rule
.
STYLE_RULE
:
...
...
@@ -335,10 +339,11 @@ def get_font(self, selector, pre=False):
return
desc
self
.
_add_to_cache
(
selector
,
'
fontdescription
'
,
None
)
return
None
def
_get_description_from_css
(
self
,
family
,
size
,
style
,
weight
):
if
family
is
None
:
return
return
None
desc
=
Pango
.
FontDescription
()
desc
.
set_family
(
family
)
if
weight
is
not
None
:
...
...
@@ -403,6 +408,7 @@ def get_value(self, selector, attr, pre=False):
value
=
rule
if
rule
is
None
else
rule
.
style
[
attr
]
self
.
_add_to_cache
(
selector
,
attr
,
value
)
return
value
return
None
def
remove_value
(
self
,
selector
,
attr
,
pre
=
False
):
if
attr
==
StyleAttr
.
FONT
:
...
...
@@ -423,6 +429,7 @@ def remove_value(self, selector, attr, pre=False):
rule
.
style
.
removeProperty
(
attr
)
break
self
.
_write
(
pre
)
return
None
def
remove_font
(
self
,
selector
,
pre
=
False
):
css
=
self
.
_css
...
...
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