File: CodecChoice.py

package info (click to toggle)
bibus 1.5.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 12,488 kB
  • sloc: python: 30,790; sql: 211; makefile: 158; xml: 10; sh: 3
file content (69 lines) | stat: -rw-r--r-- 2,810 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/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