#!/usr/bin/env python

import wx
import wx.grid

import Clipboard

#from filter_frame import FilterFrame

class TestFrame(wx.Frame, Clipboard.CopyAndPaste):
    rowLabels = ["uno", "dos", "tres", "quatro", "cinco"]
    colLabels = ["homer", "marge", "bart", "lisa", "maggie"]

    def __init__(self):
        wx.Frame.__init__(self, None, title="Grid Headers", size=(500,200))
        Clipboard.CopyAndPaste.__init__(self)
        grid = wx.grid.Grid(self)
        self.grid = grid
        grid.CreateGrid(5,5)
        for row in range(5):
            grid.SetRowLabelValue(row, self.rowLabels[row])
            grid.SetColLabelValue(row, self.colLabels[row])
            for col in range(5):
                grid.SetCellValue(row, col, 
                        "(%s,%s)" % (self.rowLabels[row], self.colLabels[col]))
       
        self.set_copy_and_paste()

    def on_show_popup(self, evt):
        pos = evt.GetPosition()
        pos = self.grid.ScreenToClient(pos)
        self.PopupMenu(self.popupmenu, pos)

    def get_data_for_clipboard(self,format="text"):

        text_for_clipboard = self.grid.GetCellValue(self.grid.GetGridCursorRow(), self.grid.GetGridCursorCol())
        return(text_for_clipboard)   



if __name__ == "__main__":

    app = wx.App(redirect=False)
    frame = TestFrame()
    frame.Show()
    app.MainLoop()
