Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Python Briar Wrapper
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
briar
Python Briar Wrapper
Commits
39867356
Verified
Commit
39867356
authored
6 years ago
by
Nico
Browse files
Options
Downloads
Patches
Plain Diff
gi_composites: Make pep8 happy
parent
91f00f29
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
src/gi_composites.py
+8
-13
8 additions, 13 deletions
src/gi_composites.py
with
8 additions
and
13 deletions
src/gi_composites.py
+
8
−
13
View file @
39867356
...
...
@@ -28,9 +28,11 @@ from gi.repository import Gtk
__all__
=
[
'
GtkTemplate
'
]
class
GtkTemplateWarning
(
UserWarning
):
pass
def
_connect_func
(
builder
,
obj
,
signal_name
,
handler_name
,
connect_object
,
flags
,
cls
):
'''
Handles GtkBuilder signal connect events
'''
...
...
@@ -44,7 +46,7 @@ def _connect_func(builder, obj, signal_name, handler_name,
# so ask GtkBuilder for the template instance
template_inst
=
builder
.
get_object
(
cls
.
__gtype_name__
)
if
template_inst
is
None
:
# This should never happen
if
template_inst
is
None
:
# This should never happen
errmsg
=
"
Internal error: cannot find template instance! obj: %s;
"
\
"
signal: %s; handler: %s; connect_obj: %s; class: %s
"
%
\
(
obj
,
signal_name
,
handler_name
,
connect_object
,
cls
)
...
...
@@ -84,7 +86,7 @@ def _register_template(cls, template_bytes):
if
hasattr
(
o
,
'
_gtk_callback
'
):
bound_methods
.
add
(
name
)
# Don't need to call this, as connect_func always gets called
#cls.bind_template_callback_full(name, o)
#
cls.bind_template_callback_full(name, o)
elif
isinstance
(
o
,
_Child
):
cls
.
bind_template_child_full
(
name
,
True
,
0
)
bound_widgets
.
add
(
name
)
...
...
@@ -106,8 +108,8 @@ def _init_template(self, cls, base_init_template):
# TODO: could disallow using a metaclass.. but this is good enough
# .. if you disagree, feel free to fix it and issue a PR :)
if
self
.
__class__
is
not
cls
:
raise
TypeError
(
"
Inheritance from classes with @GtkTemplate decorators
"
"
is not allowed at this time
"
)
raise
TypeError
(
"
Inheritance from classes with @GtkTemplate decorators
"
"
is not allowed at this time
"
)
connected_signals
=
set
()
self
.
__connected_template_signals__
=
connected_signals
...
...
@@ -213,7 +215,6 @@ class _GtkTemplate(object):
f
.
_gtk_callback
=
True
return
f
Child
=
_Child
@staticmethod
...
...
@@ -231,7 +232,6 @@ class _GtkTemplate(object):
'''
_GtkTemplate
.
__ui_path__
=
abspath
(
join
(
*
path
))
def
__init__
(
self
,
ui
):
self
.
ui
=
ui
...
...
@@ -248,7 +248,8 @@ class _GtkTemplate(object):
# - Prefer the resource path first
try
:
template_bytes
=
Gio
.
resources_lookup_data
(
self
.
ui
,
Gio
.
ResourceLookupFlags
.
NONE
)
template_bytes
=
\
Gio
.
resources_lookup_data
(
self
.
ui
,
Gio
.
ResourceLookupFlags
.
NONE
)
except
GLib
.
GError
:
ui
=
self
.
ui
if
isinstance
(
ui
,
(
list
,
tuple
)):
...
...
@@ -264,10 +265,4 @@ class _GtkTemplate(object):
return
cls
# Future shim support if this makes it into PyGI?
#if hasattr(Gtk, 'GtkTemplate'):
# GtkTemplate = lambda c: c
#else:
GtkTemplate
=
_GtkTemplate
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