Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
pygobject
Commits
725483a5
Commit
725483a5
authored
Mar 22, 2012
by
Johan Dahlin
Committed by
Johan Dahlin
Mar 22, 2012
Browse files
PEP8: run via --fix from craigds fork
https://bugzilla.gnome.org/show_bug.cgi?id=672627
parent
917275d4
Changes
58
Hide whitespace changes
Inline
Side-by-side
demos/gtk-demo/demos/Entry/entry_buffer.py
View file @
725483a5
...
...
@@ -64,6 +64,7 @@ class EntryBufferApp:
self
.
window
.
destroy
()
Gtk
.
main_quit
()
def
main
(
demoapp
=
None
):
EntryBufferApp
()
Gtk
.
main
()
...
...
demos/gtk-demo/demos/Entry/entry_completion.py
View file @
725483a5
...
...
@@ -78,6 +78,7 @@ class EntryBufferApp:
self
.
window
.
destroy
()
Gtk
.
main_quit
()
def
main
(
demoapp
=
None
):
EntryBufferApp
()
Gtk
.
main
()
...
...
demos/gtk-demo/demos/Entry/search_entry.py
View file @
725483a5
...
...
@@ -29,6 +29,7 @@ from gi.repository import Gtk, GObject
(
PIXBUF_COL
,
TEXT_COL
)
=
range
(
2
)
class
SearchboxApp
:
def
__init__
(
self
,
demoapp
):
self
.
demoapp
=
demoapp
...
...
@@ -199,7 +200,6 @@ class SearchboxApp:
return
menu
def
icon_press_cb
(
self
,
entry
,
position
,
event
,
menu
):
if
position
==
Gtk
.
EntryIconPosition
.
PRIMARY
:
menu
.
popup
(
None
,
None
,
None
,
None
,
...
...
@@ -244,6 +244,7 @@ class SearchboxApp:
item
.
set_submenu
(
search_menu
)
menu
.
append
(
item
)
def
main
(
demoapp
=
None
):
SearchboxApp
(
demoapp
)
Gtk
.
main
()
...
...
demos/gtk-demo/demos/Icon View/iconviewbasics.py
View file @
725483a5
...
...
@@ -212,6 +212,7 @@ class IconViewApp:
pixbuf
=
self
.
file_to_icon_pixbuf
(
path
)
store
.
append
((
path
,
name
,
pixbuf
,
is_dir
))
def
main
(
demoapp
=
None
):
IconViewApp
(
demoapp
)
Gtk
.
main
()
...
...
demos/gtk-demo/demos/Icon View/iconviewedit.py
View file @
725483a5
...
...
@@ -26,6 +26,7 @@ The GtkIconView widget supports Editing and Drag-and-Drop. This example also dem
from
gi.repository
import
Gtk
,
Gdk
,
GdkPixbuf
class
IconviewEditApp
:
COL_TEXT
=
0
NUM_COLS
=
1
...
...
@@ -88,6 +89,7 @@ class IconviewEditApp:
iter_
=
model
.
get_iter
(
path
)
model
.
set_row
(
iter_
,
[
text
])
def
main
(
demoapp
=
None
):
IconviewEditApp
()
Gtk
.
main
()
...
...
demos/gtk-demo/demos/Tree View/liststore.py
View file @
725483a5
...
...
@@ -26,6 +26,7 @@ The GtkListStore is used to store data in list form, to be used later on by a Gt
from
gi.repository
import
Gtk
,
GObject
class
Bug
:
def
__init__
(
self
,
is_fixed
,
number
,
severity
,
description
):
self
.
is_fixed
=
is_fixed
...
...
@@ -49,6 +50,7 @@ data = [Bug(False, 60482, "Normal", "scrollable notebooks and hidden tabs"),
Bug
(
False
,
6112
,
"Enhancement"
,
"netscape-like collapsable toolbars"
),
Bug
(
False
,
1
,
"Normal"
,
"First bug :=)"
)]
class
ListStoreApp
:
(
COLUMN_FIXED
,
COLUMN_NUMBER
,
...
...
@@ -196,6 +198,7 @@ class ListStoreApp:
model
.
set_value
(
iter_
,
self
.
COLUMN_FIXED
,
is_fixed
)
def
main
(
demoapp
=
None
):
ListStoreApp
()
Gtk
.
main
()
...
...
demos/gtk-demo/demos/appwindow.py
View file @
725483a5
...
...
@@ -34,9 +34,11 @@ window = None
messagelabel
=
None
_demoapp
=
None
def
widget_destroy
(
widget
,
button
):
widget
.
destroy
()
def
activate_action
(
action
,
user_data
=
None
):
global
window
...
...
@@ -48,7 +50,6 @@ def activate_action(action, user_data=None):
settings
.
set_property
(
'gtk-application-prefer-dark-theme'
,
value
)
return
dialog
=
Gtk
.
MessageDialog
(
message_type
=
Gtk
.
MessageType
.
INFO
,
buttons
=
Gtk
.
ButtonsType
.
CLOSE
,
text
=
'You activated action: "%s" of type %s'
%
(
name
,
_type
))
...
...
@@ -58,6 +59,7 @@ def activate_action(action, user_data=None):
dialog
.
connect
(
'response'
,
widget_destroy
)
dialog
.
show
()
def
activate_radio_action
(
action
,
current
,
user_data
=
None
):
global
infobar
global
messagelabel
...
...
@@ -72,6 +74,7 @@ def activate_radio_action(action, current, user_data=None):
infobar
.
set_message_type
(
Gtk
.
MessageType
(
value
))
infobar
.
show
()
def
update_statusbar
(
buffer
,
statusbar
):
statusbar
.
pop
(
0
)
count
=
buffer
.
get_char_count
()
...
...
@@ -83,9 +86,11 @@ def update_statusbar(buffer, statusbar):
statusbar
.
push
(
0
,
msg
)
def
mark_set_callback
(
buffer
,
new_location
,
mark
,
data
):
update_statusbar
(
buffer
,
data
)
def
about_cb
(
widget
,
user_data
=
None
):
global
window
...
...
@@ -258,9 +263,11 @@ ui_info = """
</ui>
"""
def
_quit
(
*
args
):
Gtk
.
main_quit
()
def
register_stock_icons
():
"""
This function registers our custom toolbar icons, so they can be themed.
...
...
@@ -294,11 +301,14 @@ def register_stock_icons():
factory
.
add
(
'demo-gtk-logo'
,
icon_set
)
class
ToolMenuAction
(
Gtk
.
Action
):
__gtype_name__
=
"GtkToolMenuAction"
def
do_create_tool_item
(
self
):
return
Gtk
.
MenuToolButton
()
def
main
(
demoapp
=
None
):
global
infobar
global
window
...
...
@@ -352,7 +362,6 @@ def main(demoapp=None):
Gtk
.
AttachOptions
.
EXPAND
|
Gtk
.
AttachOptions
.
FILL
,
0
,
0
,
0
)
infobar
=
Gtk
.
InfoBar
()
infobar
.
set_no_show_all
(
True
)
messagelabel
=
Gtk
.
Label
()
...
...
demos/gtk-demo/demos/assistant.py
View file @
725483a5
...
...
@@ -125,6 +125,7 @@ class AssistantApp:
None
)
self
.
assistant
.
set_page_header_image
(
label
,
pixbuf
)
def
main
(
demoapp
=
None
):
AssistantApp
()
Gtk
.
main
()
...
...
demos/gtk-demo/demos/builder.py
View file @
725483a5
...
...
@@ -55,6 +55,7 @@ class BuilderApp:
def
quit_activate
(
self
,
action
):
Gtk
.
main_quit
()
def
main
(
demoapp
=
None
):
BuilderApp
(
demoapp
)
Gtk
.
main
()
...
...
demos/gtk-demo/demos/button_box.py
View file @
725483a5
...
...
@@ -112,6 +112,7 @@ class ButtonBoxApp:
return
frame
def
main
(
demoapp
=
None
):
ButtonBoxApp
()
Gtk
.
main
()
...
...
demos/gtk-demo/demos/clipboard.py
View file @
725483a5
...
...
@@ -64,7 +64,6 @@ class ClipboardApp:
label
=
Gtk
.
Label
(
label
=
'"Paste" will paste the text from the clipboard to the entry'
)
vbox
.
pack_start
(
label
,
False
,
False
,
0
)
hbox
=
Gtk
.
HBox
(
homogeneous
=
False
,
spacing
=
4
)
hbox
.
set_border_width
(
8
)
vbox
.
pack_start
(
hbox
,
False
,
False
,
0
)
...
...
@@ -223,6 +222,7 @@ class ClipboardApp:
self
.
menu
.
popup
(
None
,
None
,
None
,
None
,
event
.
button
,
event
.
time
)
def
main
(
demoapp
=
None
):
ClipboardApp
()
Gtk
.
main
()
...
...
demos/gtk-demo/demos/colorselector.py
View file @
725483a5
...
...
@@ -102,6 +102,7 @@ class ColorSelectorApp:
dialog
.
destroy
()
def
main
(
demoapp
=
None
):
ColorSelectorApp
()
Gtk
.
main
()
...
...
demos/gtk-demo/demos/combobox.py
View file @
725483a5
...
...
@@ -35,6 +35,7 @@ from gi.repository import Gtk, Gdk, GdkPixbuf, GLib
(
PIXBUF_COL
,
TEXT_COL
)
=
range
(
2
)
class
MaskEntry
(
Gtk
.
Entry
):
__gtype_name__
=
'MaskEntry'
...
...
@@ -66,6 +67,7 @@ class MaskEntry(Gtk.Entry):
def
changed_cb
(
self
,
entry
):
self
.
set_background
()
class
ComboboxApp
:
def
__init__
(
self
,
demoapp
):
self
.
demoapp
=
demoapp
...
...
@@ -323,13 +325,13 @@ class ComboboxApp:
sensitive
=
not
tree_model
.
iter_has_child
(
treeiter
)
cell
.
set_property
(
'sensitive'
,
sensitive
)
def
fill_combo_entry
(
self
,
entry
):
entry
.
append_text
(
'One'
)
entry
.
append_text
(
'Two'
)
entry
.
append_text
(
'2
\302\275
'
)
entry
.
append_text
(
'Three'
)
def
main
(
demoapp
=
None
):
ComboboxApp
(
demoapp
)
Gtk
.
main
()
...
...
demos/gtk-demo/demos/dialogs.py
View file @
725483a5
...
...
@@ -26,6 +26,7 @@ Dialog widgets are used to pop up a transient window for user feedback.
from
gi.repository
import
Gtk
class
DialogsApp
:
def
__init__
(
self
):
self
.
dialog_counter
=
1
...
...
@@ -145,6 +146,7 @@ class DialogsApp:
self
.
dialog_counter
+=
1
dialog
.
destroy
()
def
main
(
demoapp
=
None
):
DialogsApp
()
Gtk
.
main
()
...
...
demos/gtk-demo/demos/drawingarea.py
View file @
725483a5
...
...
@@ -197,6 +197,7 @@ class DrawingAreaApp:
return
True
def
main
(
demoapp
=
None
):
DrawingAreaApp
()
Gtk
.
main
()
...
...
demos/gtk-demo/demos/expander.py
View file @
725483a5
...
...
@@ -27,13 +27,14 @@ This is also known as "disclosure triangle".
from
gi.repository
import
Gtk
class
ExpanderApp
:
def
__init__
(
self
):
self
.
window
=
Gtk
.
Dialog
(
"GtkExpander"
,
None
,
0
,
(
Gtk
.
STOCK_CLOSE
,
Gtk
.
ResponseType
.
NONE
))
self
.
window
.
set_resizable
(
False
)
self
.
window
.
connect
(
'response'
,
lambda
window
,
x
:
window
.
destroy
())
self
.
window
.
connect
(
'response'
,
lambda
window
,
x
:
window
.
destroy
())
self
.
window
.
connect
(
'destroy'
,
Gtk
.
main_quit
)
content_area
=
self
.
window
.
get_content_area
()
...
...
@@ -52,6 +53,7 @@ class ExpanderApp:
self
.
window
.
show_all
()
def
main
(
demoapp
=
None
):
ExpanderApp
()
Gtk
.
main
()
...
...
demos/gtk-demo/demos/images.py
View file @
725483a5
...
...
@@ -29,6 +29,7 @@ from os import path
from
gi.repository
import
Gtk
,
Gdk
,
GdkPixbuf
,
GLib
,
Gio
,
GObject
class
ImagesApp
:
def
__init__
(
self
):
self
.
pixbuf_loader
=
None
...
...
@@ -168,7 +169,7 @@ class ImagesApp:
self
.
load_timeout
=
0
dialog
.
show
()
dialog
.
connect
(
'response'
,
lambda
x
,
y
:
dialog
.
destroy
())
dialog
.
connect
(
'response'
,
lambda
x
,
y
:
dialog
.
destroy
())
return
False
# uninstall the timeout
...
...
@@ -187,7 +188,7 @@ class ImagesApp:
self
.
load_timeout
=
0
dialog
.
show
()
dialog
.
connect
(
'response'
,
lambda
x
,
y
:
dialog
.
destroy
())
dialog
.
connect
(
'response'
,
lambda
x
,
y
:
dialog
.
destroy
())
return
False
# uninstall the timeout
...
...
@@ -210,7 +211,7 @@ class ImagesApp:
self
.
load_timeout
=
0
dialog
.
show
()
dialog
.
connect
(
'response'
,
lambda
x
,
y
:
dialog
.
destroy
())
dialog
.
connect
(
'response'
,
lambda
x
,
y
:
dialog
.
destroy
())
return
False
# uninstall the timeout
else
:
...
...
@@ -225,7 +226,7 @@ class ImagesApp:
str
(
e
))
self
.
load_timeout
=
0
dialog
.
show
()
dialog
.
connect
(
'response'
,
lambda
x
,
y
:
dialog
.
destroy
())
dialog
.
connect
(
'response'
,
lambda
x
,
y
:
dialog
.
destroy
())
return
False
# uninstall the timeout
...
...
@@ -292,6 +293,7 @@ class ImagesApp:
Gtk
.
main_quit
()
def
main
(
demoapp
=
None
):
ImagesApp
()
Gtk
.
main
()
...
...
demos/gtk-demo/demos/infobars.py
View file @
725483a5
...
...
@@ -26,6 +26,7 @@ Info bar widgets are used to report important messages to the user.
from
gi.repository
import
Gtk
class
InfobarApp
:
def
__init__
(
self
):
self
.
window
=
Gtk
.
Window
()
...
...
@@ -91,6 +92,7 @@ class InfobarApp:
dialog
.
run
()
dialog
.
destroy
()
def
main
(
demoapp
=
None
):
InfobarApp
()
Gtk
.
main
()
...
...
demos/gtk-demo/demos/links.py
View file @
725483a5
...
...
@@ -27,6 +27,7 @@ their URI, but it is possible to override this with a custom handler.
from
gi.repository
import
Gtk
class
LinksApp
:
def
__init__
(
self
):
self
.
window
=
Gtk
.
Window
()
...
...
@@ -66,6 +67,7 @@ a program (exclusively) via keyboard input."""
def
response_cb
(
self
,
dialog
,
response_id
):
dialog
.
destroy
()
def
main
(
demoapp
=
None
):
LinksApp
()
Gtk
.
main
()
...
...
demos/gtk-demo/demos/menus.py
View file @
725483a5
...
...
@@ -28,6 +28,7 @@ GtkUIManager provides a higher-level interface for creating menu bars and menus;
from
gi.repository
import
Gtk
class
MenusApp
:
def
__init__
(
self
):
self
.
window
=
Gtk
.
Window
()
...
...
@@ -111,6 +112,7 @@ class MenusApp:
else
:
menubar
.
props
.
pack_direction
=
Gtk
.
PackDirection
.
LTR
def
main
(
demoapp
=
None
):
MenusApp
()
Gtk
.
main
()
...
...
Prev
1
2
3
Next
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment