#!/usr/bin/env python
# -*- coding: ISO-8859-1 -*-
# generated by wxGlade 0.4cvs on Wed Apr 19 23:06:20 2006

import wx
import Encodings

class CodecChoice(wx.Dialog):
    def __init__(self, codec, *args, **kwds):
        self.codec = codec
        # begin wxGlade: CodecChoice.__init__
        kwds["style"] = wx.DEFAULT_DIALOG_STYLE
        wx.Dialog.__init__(self, *args, **kwds)
        self.label_question = wx.StaticText(self, -1, _("Please choose the file encoding"))
        self.list_box_codecs = wx.ListBox(self, -1, choices=[_("latin-1"), _("cp1252"), _("ascii"), _("utf-8")], style=wx.LB_SINGLE)
        self.radio_box_codecs = wx.RadioBox(self, -1, _("Codecs"), choices=[_("Main"), _("All")], majorDimension=2, style=wx.RA_SPECIFY_COLS)
        self.static_line_1 = wx.StaticLine(self, -1)
        self.button_1 = wx.Button(self, wx.ID_CANCEL, _("Cancel"))
        self.button_2 = wx.Button(self, wx.ID_OK, _("OK"))

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_RADIOBOX, self.onCodecChoice, self.radio_box_codecs)
        # end wxGlade

    def __set_properties(self):
        # begin wxGlade: CodecChoice.__set_properties
        self.SetTitle(_("Codage"))
        self.SetSize((261, 334))
        self.list_box_codecs.SetSelection(0)
        self.radio_box_codecs.SetSelection(0)
        self.button_2.SetDefault()
        # end wxGlade
        self.onCodecChoice(None)
        self.list_box_codecs.SetStringSelection(self.codec)

    def __do_layout(self):
        # begin wxGlade: CodecChoice.__do_layout
        sizer_1 = wx.BoxSizer(wx.VERTICAL)
        sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
        sizer_2 = wx.BoxSizer(wx.VERTICAL)
        sizer_1.Add(self.label_question, 0, wx.ALL|wx.ADJUST_MINSIZE, 5)
        sizer_2.Add(self.list_box_codecs, 1, wx.ALL|wx.EXPAND|wx.ADJUST_MINSIZE, 10)
        sizer_2.Add(self.radio_box_codecs, 0, wx.LEFT|wx.BOTTOM|wx.ADJUST_MINSIZE, 10)
        sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
        sizer_1.Add(self.static_line_1, 0, wx.EXPAND, 0)
        sizer_3.Add(self.button_1, 0, wx.ALL|wx.ADJUST_MINSIZE, 5)
        sizer_3.Add(self.button_2, 0, wx.TOP|wx.BOTTOM|wx.ADJUST_MINSIZE, 5)
        sizer_1.Add(sizer_3, 0, wx.RIGHT|wx.ALIGN_RIGHT, 10)
        self.SetAutoLayout(True)
        self.SetSizer(sizer_1)
        self.Layout()
        self.Centre()
        # end wxGlade

    def onCodecChoice(self, event): # wxGlade: CodecChoice.<event_handler>
        self.list_box_codecs.Clear()
        if self.radio_box_codecs.GetSelection() == 0:
            self.list_box_codecs.InsertItems(Encodings.encodings[:4],0)
        else:
            self.list_box_codecs.InsertItems(Encodings.encodings,0)

    def getCodec(self):
        return self.list_box_codecs.GetStringSelection()

# end of class CodecChoice


