# -*- coding: utf-8 -*-
# generated by wxGlade 0.6.3 on Wed Jan 20 17:51:53 2010

import wx

# begin wxGlade: dependencies
# end wxGlade

# begin wxGlade: extracode

# end wxGlade

class ExportLexDialog(wx.Dialog):
    def __init__(self, *args, **kwds):
        # begin wxGlade: ExportLexDialog.__init__
        kwds["style"] = wx.DEFAULT_DIALOG_STYLE
        wx.Dialog.__init__(self, *args, **kwds)
        self.sizer_78_staticbox = wx.StaticBox(self, -1, _(u"Opções"))
        self.label_33 = wx.StaticText(self, -1, _("Tipo de arquivo:"))
        self.cbo_file_type = wx.ComboBox(self, -1, choices=[_("Texto (CSV)"), _("Hipertexto (HTML)")], style=wx.CB_DROPDOWN|wx.CB_READONLY)
        self.chk_order = wx.CheckBox(self, -1, _(u"Lista em ordem alfabética"))
        self.chk_group = wx.CheckBox(self, -1, _("Agrupar itens por similaridade (forma original)"))
        self.button_ok = wx.Button(self, -1, _("Ok"))
        self.button_cancel = wx.Button(self, -1, _("Cancelar"))

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_CHECKBOX, self.OnGroupClick, self.chk_group)
        self.Bind(wx.EVT_BUTTON, self.OnOkButtonClick, self.button_ok)
        self.Bind(wx.EVT_BUTTON, self.OnCancelButtonClick, self.button_cancel)
        # end wxGlade

        self.Bind(wx.EVT_CHAR_HOOK, self.OnKeyDown)

        self.file_type = None
        self.options = []
  
    def OnKeyDown(self, event):
        keycode = event.GetKeyCode()
        if keycode == wx.WXK_ESCAPE:
            self.Close(True)
        event.Skip()

    def __set_properties(self):
        # begin wxGlade: ExportLexDialog.__set_properties
        self.SetTitle(_(u"Exportar léxico de edições"))
        self.label_33.SetMinSize((122, 14))
        self.cbo_file_type.SetSelection(0)
        # end wxGlade

    def __do_layout(self):
        # begin wxGlade: ExportLexDialog.__do_layout
        sizer_74 = wx.BoxSizer(wx.VERTICAL)
        sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
        sizer_78 = wx.StaticBoxSizer(self.sizer_78_staticbox, wx.VERTICAL)
        sizer_76 = wx.BoxSizer(wx.HORIZONTAL)
        sizer_76.Add(self.label_33, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
        sizer_76.Add(self.cbo_file_type, 0, wx.ALL, 2)
        sizer_74.Add(sizer_76, 0, wx.EXPAND, 0)
        sizer_78.Add(self.chk_order, 0, 0, 0)
        sizer_78.Add(self.chk_group, 0, 0, 0)
        sizer_74.Add(sizer_78, 1, wx.EXPAND, 0)
        sizer_2.Add(self.button_ok, 1, wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 30)
        sizer_2.Add(self.button_cancel, 1, wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 30)
        sizer_74.Add(sizer_2, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 10)
        self.SetSizer(sizer_74)
        sizer_74.Fit(self)
        self.Layout()
        # end wxGlade

    def OnOkButtonClick(self, event): # wxGlade: ExportLexDialog.<event_handler>
        self.file_type = self.cbo_file_type.GetStringSelection()
        if self.chk_order.GetValue():
            self.options.append("ORDERED")
        if self.chk_group.GetValue():
            self.options.append("GROUPED")
        # Close window
        self.EndModal(wx.ID_OK)

    def OnCancelButtonClick(self, event): # wxGlade: ExportLexDialog.<event_handler>
        self.file_type = None
        self.options = []
        self.EndModal(wx.ID_CANCEL)

    def getFileType(self):
        return self.file_type
    
    def getOptions(self):
        return self.options
    
    def OnGroupClick(self, event): # wxGlade: ExportLexDialog.<event_handler>
        if self.chk_group.GetValue():
            self.chk_order.SetValue(True)
            self.chk_order.Enable(False)
        else:
            self.chk_order.Enable(True)

# end of class ExportLexDialog


