the next iteration of your gui - europython next iteration of your gui pep 342 (coroutines via...

47
THE NEXT ITERATION OF YOUR GUI PEP 342 (Coroutines via Enhanced Generators) PEP 380 (Syntax for Delegating to a Subgenerator) conceptive.be @erikjanss shore.be @jeroendierckx python-camelot.com

Upload: ngonhan

Post on 27-May-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

THE NEXT ITERATION OF YOUR GUI

PEP 342 (Coroutines via Enhanced Generators) PEP 380 (Syntax for Delegating to a Subgenerator)

conceptive.be @erikjanssshore.be @jeroendierckxpython-camelot.com

WHAT'S GOING ONinteraction

TRADEOFFS

user friendlinesssimplicity of development

testability

TRADEOFFSuser friendliness

• use a progress indicator

• provide a cancel button

• respond to events

• similar controls as in other places

USER FRIENDLINESSOSX human interface guidlines

USER FRIENDLINESSMultithreaded toolkits - A failed dream?

Graham Hamiltonhttps://weblogs.java.net/blog/kgh/archive/2004/10/multithreaded_t.html

TRADEOFFSsimplicity of development

TRADEOFFStestability

TRADEOFFStestability

EXAMPLE APPLICATIONprocess pickinglist

PROCESS PICKINGLISTstep one. scan items in warehouse

example application

PROCESS PICKINGLISTstep two. import scanned lines

example application

PROCESS PICKINGLISTstep two. import scanned lines

example application

PROCESS PICKINGLISTstep three. verify import data

example application

PROCESS PICKINGLISTpossible issues. freeze

example application

PROCESS PICKINGLISTpossible issues. exceptions

example application

PROCESS PICKINGLISTshow and tell

example application

THE COMPETITION

user friendlinesssimplicity of development

testability

THE COMPETITION

TRADEOFFSuser friendliness

TRADEOFFStestability

TRADEOFFSsimplicity of development

user friendlinesssimplicity of development

testability

BALANCEvisual basic

THE COMPETITION

TRADEOFFSuser friendliness

TRADEOFFStestability

TRADEOFFSsimplicity of development

BALANCEjava

user friendlinesssimplicity of development

testability

PYTHONunique language features

PEP 255Simple generators

PEP 342Coroutines via Enhanced Generators

PEP 342Coroutines via Enhanced Generators

1. Redefine `yield` to be an expression2. Add a new send() method3. Add a new throw() method4. Allow "yield" to be used in try/finally blocks

PEP 342An application as a series of action steps

EXAMPLE APPLICATIONselect a file

PEP 342

• ChangeObject

• ChangeObjects

• PrintChart

• PrintPreview

• PrintHtml

ACTION STEPS

• PrintJinjaTemplate

•OpenFile

•OpenStream

•OpenJinjaTemplate

• CloseView

•MessageBox

• Refresh

•OpenFormView

• ShowPixmap

• ShowChart

• SelectFile

• SelectObject

out of the box in Camelot

EVENT LOOP INTEGRATIONUsing multiple threads to prevent freezes

EXAMPLE APPLICATIONimport data

event loop integration

EXCEPTIONSwait ... what?

EXAMPLE APPLICATIONuser cancels import

•get_collection

•get_selection

•get_object

WHAT'S THE CONTEXT

obligatory xkcd comic

TESTABILITY

UNITTESTINGexample application in action and code ...

THE SWEET SPOT

BALANCEpython (camelot)

user friendlinesssimplicity of development

testability

PEP 380delegating to a subgenerator

THE NEXT ITERATION OF YOUR GUI

PEP 342 (Coroutines via Enhanced Generators) PEP 380 (Syntax for Delegating to a Subgenerator)

python-camelot.com

conceptive.be @erikjanssshore.be @jeroendierckx

THE NEXT ITERATION OF YOUR GUI

PEP 342 (Coroutines via Enhanced Generators) PEP 380 (Syntax for Delegating to a Subgenerator)

python-camelot.comThanks !Questions ?

We’re hiring !

conceptive.be @erikjanssshore.be @jeroendierckx