Skip to content

Commit 4604227

Browse files
Add stage 4
1 parent 14cab17 commit 4604227

File tree

17 files changed

+277
-0
lines changed

17 files changed

+277
-0
lines changed

setup.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from setuptools import setup, find_packages
2+
3+
4+
setup(
5+
name="ets_tutorial",
6+
version="0.0.1",
7+
description='Common utilities and tools for all applications in the '
8+
'tutorial',
9+
packages=find_packages(),
10+
)

stage4_first_application/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Hello world in ETS pyface!
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
__version__ = "0.0.1"

stage4_first_application/pycasa/app/__init__.py

Whitespace-only changes.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# coding=utf-8
2+
""" TaskApplication object for the Pycasa app.
3+
"""
4+
import logging
5+
6+
from pyface.tasks.api import TasksApplication, TaskFactory
7+
from ..ui.tasks.pycasa_task import PycasaTask
8+
9+
logger = logging.getLogger(__name__)
10+
11+
12+
class PycasaApplication(TasksApplication):
13+
""" An application to say hello.
14+
"""
15+
id = "pycasa_application"
16+
17+
name = "Pycasa"
18+
19+
description = "An example Tasks application that explores image files."
20+
21+
def _task_factories_default(self):
22+
return [
23+
TaskFactory(
24+
id='pycasa.hello_world_task',
25+
name="Hellow World Editor",
26+
factory=PycasaTask
27+
)
28+
]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
from pycasa.app.app import PycasaApplication
3+
4+
5+
def main():
6+
app = PycasaApplication()
7+
app.run()
8+
9+
10+
if __name__ == '__main__':
11+
main()

stage4_first_application/pycasa/model/__init__.py

Whitespace-only changes.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from os.path import expanduser
2+
from traits.api import Directory, Event, HasStrictTraits
3+
4+
5+
class FileBrowser(HasStrictTraits):
6+
root = Directory(expanduser("~"))
7+
8+
#: Item last double-clicked on in the tree view
9+
requested_item = Event
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import PIL.Image
2+
from PIL.ExifTags import TAGS
3+
4+
from traits.api import Dict, File, HasStrictTraits, observe, Property
5+
6+
7+
class ImageFile(HasStrictTraits):
8+
""" Model to hold an image file.
9+
"""
10+
filepath = File
11+
12+
metadata = Dict
13+
14+
@observe("filepath")
15+
def load_metadata(self, event):
16+
img = PIL.Image.open(self.filepath)
17+
exif = img._getexif()
18+
if exif:
19+
self.metadata = {TAGS[k]: v for k, v in exif.items()
20+
if k in TAGS}

stage4_first_application/pycasa/ui/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)