I'm trying to re-implement some python stuff in clojure. Here's how
it works: I have a class called ArrowKeySelection. I use this class
as a mixin with various gui classes. The class adds some abstract
logic for handling keys - the arrow keys move a selector around a
matrix and the enter key calls an activation method with the selected
object. The implementation details are left to the extending class.
My python class looks something like this:
class ArrowKeySelection:
def __init__(self):
self.selected_row, self.selected_col = (0,0)
def on_key_down(self, code):
if keycodes.is_arrow_key(code):
... move the selector around
if code == "return" or code == "space":
...
self.activate(selected)
def get_selected(self):
...
def select(self, desired_object):
...
def num_cols(self):
...
def num_rows(self):
...
...
----------
Then when I use it, I make something like this:
----------
class TableWidget(HtmlWidget, ArrowKeySelection):
def __init__(self, strings):
HtmlWidget.__init__(self, None)
self.strings = strings
ArrowKeySelection.__init__(self)
self.set_html()
def set_html(self):
... construct an html table from the current state
def on_key_down(self, code):
ArrowKeySelection.on_key_down(self, code)
self.set_html()
def activate(self, object):
...
------------
So what would be the best way to re-implement this functionality in
clojure?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---