agronholm / jython-swingutils (http://pypi.python.org/pypi/jython-swingutils/)
An assortment of utility classes and functions that ease the task of writing GUI applications with the Java Swing toolkit.
Clone this repository (size: 401.9 KB): HTTPS / SSH
$ hg clone http://bitbucket.org/agronholm/jython-swingutils/
| commit 68: | 0d254ca530ff |
| parent 67: | c6f4e2cfec82 |
| branch: | default |
Added JCalendar binding
Changed (Δ693 bytes):
raw changeset »
swingutils/thirdparty/jcalendar.py (18 lines added, 0 lines removed)
Up to file-list swingutils/thirdparty/jcalendar.py:
1 |
from swingutils.binding import PropertyAdapter |
|
2 |
||
3 |
||
4 |
class CalendarAdapter(PropertyAdapter): |
|
5 |
def __init__(self, holder, srcProperty, dateChooser): |
|
6 |
PropertyAdapter.__init__(self, holder, srcProperty, dateChooser, |
|
7 |
u'date') |
|
8 |
||
9 |
def propertyChange(self, event): |
|
10 |
PropertyAdapter.propertyChange(self, event) |
|
11 |
self.destination.enabled = self.source.value is not None |
|
12 |
||
13 |
||
14 |
def bindDateChooser(holder, srcProperty, dateChooser, twoway=True): |
|
15 |
adapter = CalendarAdapter(holder, srcProperty, dateChooser) |
|
16 |
holder.addPropertyChangeListener(srcProperty, adapter) |
|
17 |
if twoway: |
|
18 |
dateChooser.addPropertyChangeListener(u'date', adapter) |
