Skip to content

Commit 1fa74d6

Browse files
committed
initial commit
0 parents  commit 1fa74d6

File tree

7 files changed

+663
-0
lines changed

7 files changed

+663
-0
lines changed

Diff for: .editorconfig

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
charset = utf-8
7+
indent_style = space
8+
indent_size = 4

Diff for: .gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/env
2+
/build
3+
/dist
4+
/*.egg-info
5+
__pycache__
6+
*.pyc
7+
*.bak

Diff for: LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2017 dead-beef.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

Diff for: README.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# pygtkdrawingwindow
2+
3+
## Requirements
4+
5+
- [`Python 2`](https://www.python.org/)
6+
- [`pyGTK`](http://www.pygtk.org/)
7+
- [`pycairo`](https://cairographics.org/pycairo/)
8+
- (optional) [`python-rsvg`](http://ftp.gnome.org/pub/GNOME/sources/gnome-python-desktop/)
9+
10+
## Installation
11+
12+
```
13+
python setup.py install
14+
```
15+
16+
## Licenses
17+
18+
* [`pygtkdrawingwindow`](LICENSE)

Diff for: demo.py

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/usr/bin/env python2
2+
3+
import pygtk
4+
pygtk.require('2.0')
5+
import gobject
6+
import gtk
7+
8+
import sys
9+
10+
from pygtkdrawingwindow import ImageWindow
11+
12+
13+
def main():
14+
if len(sys.argv) != 2:
15+
print 'Usage:', sys.argv[0], '<image>'
16+
exit(1)
17+
18+
gobject.threads_init()
19+
20+
wnd = gtk.Window()
21+
wnd.set_default_size(400, 300)
22+
23+
img = ImageWindow(sys.argv[1])
24+
25+
vbox = gtk.VBox()
26+
wnd.add(vbox)
27+
28+
toolbar = gtk.Toolbar()
29+
toolbar.set_style(gtk.TOOLBAR_ICONS)
30+
31+
btn = gtk.ToolButton(gtk.STOCK_ZOOM_IN)
32+
btn.set_tooltip_text('Zoom In')
33+
btn.connect('clicked', img.zoom_in)
34+
toolbar.insert(btn, -1)
35+
36+
btn = gtk.ToolButton(gtk.STOCK_ZOOM_OUT)
37+
btn.set_tooltip_text('Zoom Out')
38+
btn.connect('clicked', img.zoom_out)
39+
toolbar.insert(btn, -1)
40+
41+
btn = gtk.ToolButton(gtk.STOCK_ZOOM_FIT)
42+
btn.set_tooltip_text('Fit')
43+
btn.connect('clicked', img.zoom_fit)
44+
toolbar.insert(btn, -1)
45+
46+
btn = gtk.ToolButton(gtk.STOCK_ZOOM_FIT)
47+
btn.set_tooltip_text('Fit Width')
48+
btn.connect('clicked', img.zoom_fit_width)
49+
toolbar.insert(btn, -1)
50+
51+
btn = gtk.ToolButton(gtk.STOCK_ZOOM_FIT)
52+
btn.set_tooltip_text('Fit Height')
53+
btn.connect('clicked', img.zoom_fit_height)
54+
toolbar.insert(btn, -1)
55+
56+
btn = gtk.ToolButton(gtk.STOCK_ZOOM_FIT)
57+
btn.set_tooltip_text('Fit or 1:1')
58+
btn.connect('clicked', img.zoom_fit_or_1to1)
59+
toolbar.insert(btn, -1)
60+
61+
vbox.pack_start(toolbar, False, False)
62+
vbox.pack_start(img)
63+
64+
wnd.connect('destroy', gtk.main_quit)
65+
wnd.show_all()
66+
67+
gtk.main()
68+
69+
main()

0 commit comments

Comments
 (0)