Beispiel #1
0
    def __init__(self, parent):
        super(WattrMainFrame, self).__init__(parent)
        date_picker_container = self.m_panel_stats_date_pickers
        date_picker_sizer = wx.BoxSizer(wx.HORIZONTAL)

        #Start Date/Time
        start_text = wx.StaticText(date_picker_container, wx.ID_ANY,
                                   u"Start Date/Time:", wx.DefaultPosition,
                                   wx.DefaultSize, 0)
        self.start_date_picker = wx.DatePickerCtrl(
            date_picker_container, wx.ID_ANY, wx.DateTimeFromTimeT(1),
            wx.DefaultPosition, wx.DefaultSize,
            wx.DP_DEFAULT | wx.DP_SHOWCENTURY)
        self.start_time_spinner = wx.SpinButton(self.m_panel_stats, wx.ID_ANY,
                                                wx.DefaultPosition,
                                                wx.DefaultSize, 0)
        self.start_time_picker = TimeCtrl(date_picker_container,
                                          wx.ID_ANY,
                                          pos=wx.DefaultPosition,
                                          size=wx.DefaultSize,
                                          spinButton=self.start_time_spinner,
                                          limited=False,
                                          oob_color='white')

        #Add Start Date/Time to Panel
        date_picker_sizer.AddSpacer((0, 0), 1, wx.EXPAND, 5)
        date_picker_sizer.Add(start_text, 0, wx.TOP, 10)
        date_picker_sizer.Add(self.start_date_picker, 0, wx.ALL, 5)
        date_picker_sizer.Add(self.start_time_picker, 0, wx.TOP | wx.RIGHT, 10)
        date_picker_sizer.Add(self.start_time_spinner, 0, wx.TOP, 14)
        date_picker_sizer.AddSpacer((0, 0), 1, wx.EXPAND, 5)
        date_picker_container.SetSizerAndFit(date_picker_sizer)

        # Add seperator
        date_picker_sizer.AddSpacer((0, 0), 1, wx.EXPAND, 5)

        #End Date/Time
        end_text = wx.StaticText(date_picker_container, wx.ID_ANY,
                                 u"End Date/Time:", wx.DefaultPosition,
                                 wx.DefaultSize, 0)
        self.end_date_picker = wx.DatePickerCtrl(
            date_picker_container, wx.ID_ANY, wx.DateTime.Today(),
            wx.DefaultPosition, wx.DefaultSize,
            wx.DP_DEFAULT | wx.DP_SHOWCENTURY)
        self.end_time_spinner = wx.SpinButton(self.m_panel_stats, wx.ID_ANY,
                                              wx.DefaultPosition,
                                              wx.DefaultSize, 0)
        self.end_time_picker = TimeCtrl(date_picker_container,
                                        wx.ID_ANY,
                                        pos=wx.DefaultPosition,
                                        size=wx.DefaultSize,
                                        spinButton=self.end_time_spinner,
                                        limited=False,
                                        value='23:59:59',
                                        oob_color='white')

        #Add End Date/Time to Panel
        date_picker_sizer.AddSpacer((0, 0), 1, wx.EXPAND, 5)
        date_picker_sizer.Add(end_text, 0, wx.TOP, 10)
        date_picker_sizer.Add(self.end_date_picker, 0, wx.ALL, 5)
        date_picker_sizer.Add(self.end_time_picker, 0, wx.TOP | wx.RIGHT, 10)
        date_picker_sizer.Add(self.end_time_spinner, 0, wx.TOP, 14)
        date_picker_sizer.AddSpacer((0, 0), 1, wx.EXPAND, 5)
        date_picker_container.SetSizerAndFit(date_picker_sizer)

        # Update Button
        self.stats_update_button = wx.Button(date_picker_container, wx.ID_ANY,
                                             u"Update", wx.DefaultPosition,
                                             wx.DefaultSize, 0)
        date_picker_sizer.Add(self.stats_update_button, 0, wx.TOP, 10)
Beispiel #2
0
    def __init__(self, parent, config):
        wx.Dialog.__init__(self,
                           parent,
                           -1,
                           _('Settings'),
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)

        # notebook
        self.notebook = wx.Notebook(self, -1)
        self.notebook_gammu = wx.Panel(self.notebook, -1)
        self.notebook_connection = wx.Panel(self.notebook, -1)
        self.notebook_messages = wx.Panel(self.notebook, -1)
        self.notebook_view = wx.Panel(self.notebook, -1)
        self.notebook_other = wx.Panel(self.notebook, -1)
        self.notebook_hacks = wx.Panel(self.notebook, -1)

        # main layout
        self.sizer = wx.lib.rcsizer.RowColSizer()

        self.sizer.AddGrowableCol(2)
        self.sizer.AddGrowableRow(1)

        self.sizer.AddSpacer(1, 1, pos=(0, 0))
        self.sizer.AddSpacer(1, 1, pos=(0, 4))

        self.sizer.Add(self.notebook, pos=(1, 1), colspan=3, flag=wx.EXPAND)

        self.sizer.Add(wx.StaticLine(self, -1),
                       pos=(2, 1),
                       colspan=3,
                       flag=wx.EXPAND)

        self.button_sizer = wx.StdDialogButtonSizer()
        self.button_sizer.AddButton(wx.Button(self, wx.ID_OK))
        self.button_sizer.AddButton(wx.Button(self, wx.ID_CANCEL))
        self.button_sizer.Realize()

        self.sizer.Add(self.button_sizer,
                       pos=(3, 1),
                       colspan=3,
                       flag=wx.ALIGN_RIGHT)

        self.sizer.AddSpacer(1, 1, pos=(4, 0), colspan=5)

        self.config = config
        self.gammu_config = config.gammu

        # gammu tab
        self.sizer_gammu = wx.lib.rcsizer.RowColSizer()

        self.sizer_gammu.AddGrowableCol(1)

        self.sizer_gammu.AddSpacer(1, 1, pos=(0, 0))
        r = 1

        self.editcfgpath = FileBrowseButton(
            self.notebook_gammu,
            size=(250, -1),
            labelText='',
            initialValue=config.Read('/Gammu/Gammurc', False),
            toolTip=
            _('Please enter here path to gammu configuration file you want to use.'
              ),
            changeCallback=self.OnConfigChange,
            fileMode=wx.OPEN)
        self.sizer_gammu.Add(wx.StaticText(self.notebook_gammu, -1,
                                           _('Gammurc path')),
                             pos=(r, 1),
                             flag=wx.ALIGN_CENTER_VERTICAL)
        self.sizer_gammu.Add(self.editcfgpath, pos=(r, 2), flag=wx.EXPAND)
        r += 1

        self.sizer_gammu.Add(wx.StaticText(
            self.notebook_gammu, -1,
            _('You can configure connection parameters on Connection tab.')),
                             pos=(r, 1),
                             colspan=2)
        r += 1

        self.sizer_gammu.AddSpacer(1, 1, pos=(r, 3))
        r += 1

        self.editauto = wx.CheckBox(
            self.notebook_gammu, -1,
            _('Automatically connect to phone on startup'))
        self.editauto.SetToolTipString(
            _('Whether you want application automatically connect to phone when it is started.'
              ))
        self.editauto.SetValue(config.Read('/Wammu/AutoConnect') == 'yes')
        self.sizer_gammu.Add(self.editauto, pos=(r, 1), colspan=2)
        r += 1

        self.editdebug = wx.CheckBox(self.notebook_gammu, -1,
                                     _('Show debug log'))
        self.editdebug.SetToolTipString(
            _('Show debug information on error output.'))
        self.editdebug.SetValue(config.Read('/Debug/Show') == 'yes')
        self.sizer_gammu.Add(self.editdebug, pos=(r, 1), colspan=2)
        r += 1

        self.editsync = wx.CheckBox(self.notebook_gammu, -1,
                                    _('Synchronize time'))
        self.editsync.SetToolTipString(
            _('Synchronise time in phone with computer time while connecting.')
        )
        self.editsync.SetValue(config.ReadBool('/Gammu/SyncTime'))
        self.sizer_gammu.Add(self.editsync, pos=(r, 1), colspan=2)
        r += 1

        self.editinfo = wx.CheckBox(self.notebook_gammu, -1,
                                    _('Startup information'))
        self.editinfo.SetToolTipString(
            _('Display startup on phone (not supported by all models).'))
        self.editinfo.SetValue(config.ReadBool('/Gammu/StartInfo'))
        self.sizer_gammu.Add(self.editinfo, pos=(r, 1), colspan=2)
        r += 1

        if sys.platform != 'win32':
            # locking not available on windoze
            self.editlock = wx.CheckBox(self.notebook_gammu, -1,
                                        _('Lock device'))
            self.editlock.SetToolTipString(
                _('Whether to lock device in /var/lock. On some systems you might lack privileges to do so.'
                  ))
            self.editlock.SetValue(config.ReadBool('/Gammu/LockDevice'))
            self.sizer_gammu.Add(self.editlock, pos=(r, 1), colspan=2)
            r += 1

        self.sizer_gammu.AddSpacer(1, 1, pos=(r, 3))

        # size gammu tab
        self.notebook_gammu.SetAutoLayout(True)
        self.notebook_gammu.SetSizer(self.sizer_gammu)
        self.sizer_gammu.Fit(self.notebook_gammu)
        self.sizer_gammu.SetSizeHints(self.notebook_gammu)

        # connection tab
        self.sizer_connection = wx.lib.rcsizer.RowColSizer()

        self.sizer_connection.AddGrowableCol(1)

        self.sizer_connection.AddSpacer(1, 1, pos=(0, 0))
        r = 1

        lst, choices = config.gammu.GetConfigList()
        self.editsection = wx.Choice(self.notebook_connection,
                                     choices=choices,
                                     size=(250, -1))
        section = config.ReadInt('/Gammu/Section')
        for i in range(len(lst)):
            if lst[i]['Id'] == section:
                self.editsection.SetSelection(i)
                break
        self.sizer_connection.Add(wx.StaticText(self.notebook_connection, -1,
                                                _('Phone connection')),
                                  pos=(r, 1),
                                  rowspan=2,
                                  flag=wx.ALIGN_CENTER_VERTICAL)
        self.sizer_connection.Add(self.editsection, pos=(r, 2))
        self.Bind(wx.EVT_CHOICE, self.OnConnectionChange, self.editsection)
        r += 1

        self.addsection = wx.Button(self.notebook_connection, wx.ID_ADD)
        self.sizer_connection.Add(self.addsection, pos=(r, 2), flag=wx.EXPAND)
        r += 1

        self.sizer_connection.AddSpacer(1, 1, pos=(r, 3))
        r += 1

        self.editname = wx.TextCtrl(self.notebook_connection,
                                    -1,
                                    '',
                                    size=(250, -1))
        self.editname.SetToolTipString(_('Name for this configuration.'))
        self.sizer_connection.Add(wx.StaticText(self.notebook_connection, -1,
                                                _('Name')),
                                  pos=(r, 1),
                                  flag=wx.ALIGN_CENTER_VERTICAL)
        self.sizer_connection.Add(self.editname, pos=(r, 2))
        r += 1

        self.editdev = wx.ComboBox(self.notebook_connection,
                                   -1,
                                   '',
                                   choices=Wammu.Data.Devices,
                                   size=(150, -1))
        self.editdev.SetToolTipString(
            _('Device, where your phone is connected.'))
        self.sizer_connection.Add(wx.StaticText(self.notebook_connection, -1,
                                                _('Device')),
                                  pos=(r, 1),
                                  flag=wx.ALIGN_CENTER_VERTICAL)
        self.sizer_connection.Add(self.editdev,
                                  pos=(r, 2),
                                  flag=wx.ALIGN_RIGHT | wx.EXPAND)
        r += 1

        self.editconn = wx.ComboBox(self.notebook_connection,
                                    -1,
                                    '',
                                    choices=Wammu.Data.Connections,
                                    size=(150, -1))
        self.editconn.SetToolTipString(
            _('Connection which your phone understands, check Gammu documentation for connection details.'
              ))
        self.sizer_connection.Add(wx.StaticText(self.notebook_connection, -1,
                                                _('Connection')),
                                  pos=(r, 1),
                                  flag=wx.ALIGN_CENTER_VERTICAL)
        self.sizer_connection.Add(self.editconn,
                                  pos=(r, 2),
                                  flag=wx.ALIGN_RIGHT | wx.EXPAND)
        r += 1

        self.editmodel = wx.ComboBox(self.notebook_connection,
                                     -1,
                                     '',
                                     choices=Wammu.Data.Models,
                                     size=(150, -1))
        self.editmodel.SetToolTipString(
            _('Phone model, you can usually keep here auto unless you have any problems.'
              ))
        if self.editmodel.GetValue() == '':
            self.editmodel.SetValue('auto')
        self.sizer_connection.Add(wx.StaticText(self.notebook_connection, -1,
                                                _('Model')),
                                  pos=(r, 1),
                                  flag=wx.ALIGN_CENTER_VERTICAL)
        self.sizer_connection.Add(self.editmodel,
                                  pos=(r, 2),
                                  flag=wx.ALIGN_RIGHT | wx.EXPAND)
        r += 1

        # Initialise above fields
        self.OnConnectionChange()

        self.sizer_connection.AddSpacer(1, 1, pos=(r, 3))

        # size connection tab
        self.notebook_connection.SetAutoLayout(True)
        self.notebook_connection.SetSizer(self.sizer_connection)
        self.sizer_connection.Fit(self.notebook_connection)
        self.sizer_connection.SetSizeHints(self.notebook_connection)

        # messages tab
        self.sizer_messages = wx.lib.rcsizer.RowColSizer()

        self.sizer_messages.AddGrowableCol(1)

        self.sizer_messages.AddSpacer(1, 1, pos=(0, 0))
        r = 1

        v = config.ReadInt('/Message/ScaleImage')
        self.editscale = wx.SpinCtrl(self.notebook_messages,
                                     -1,
                                     str(v),
                                     style=wx.SP_WRAP | wx.SP_ARROW_KEYS,
                                     min=1,
                                     max=20,
                                     initial=v,
                                     size=(150, -1))
        self.editscale.SetToolTipString(
            _('Whether images in messages should be scaled when displayed. This is usually good idea as they are pretty small.'
              ))
        self.sizer_messages.Add(wx.StaticText(self.notebook_messages, -1,
                                              _('Scale images')),
                                pos=(r, 1))
        self.sizer_messages.Add(self.editscale, pos=(r, 2))
        r += 1

        self.editformat = wx.CheckBox(self.notebook_messages, -1,
                                      _('Attempt to reformat text'))
        self.editformat.SetToolTipString(
            _('If you get sometimes "compressed" messages likeTHIStext, you should be interested in this choice.'
              ))
        self.editformat.SetValue(config.Read('/Message/Format') == 'yes')
        self.sizer_messages.Add(self.editformat, pos=(r, 1), colspan=2)
        r += 1

        # options for new message
        self.new_message_panel = wx.Panel(self.notebook_messages, -1)
        self.sizer_messages.Add(self.new_message_panel,
                                pos=(r, 1),
                                colspan=2,
                                flag=wx.EXPAND)
        r += 1

        self.sizer_message_new = wx.StaticBoxSizer(
            wx.StaticBox(self.new_message_panel, -1,
                         _('Default options for new message')), wx.HORIZONTAL)
        self.new_message_panel_2 = wx.Panel(self.new_message_panel, -1)
        self.sizer_message_new.Add(self.new_message_panel_2, 1, wx.EXPAND, 0)

        self.sizer_message_new_2 = wx.lib.rcsizer.RowColSizer()

        self.sizer_message_new_2.AddGrowableCol(1)

        r2 = 0

        self.editconcat = wx.CheckBox(self.new_message_panel_2, -1,
                                      _('Concatenated'))
        self.editconcat.SetToolTipString(
            _('Create concatenated message, what allows to send longer messages.'
              ))
        self.editconcat.SetValue(config.Read('/Message/Concatenated') == 'yes')
        self.sizer_message_new_2.Add(self.editconcat, pos=(r2, 0), colspan=2)
        r2 += 1

        self.editunicode = wx.CheckBox(self.new_message_panel_2, -1,
                                       _('Create unicode message'))
        self.editunicode.SetToolTipString(
            _('Unicode messages can contain national and other special characters, check this if you use non latin-1 characters. Your messages will require more space, so you can write less characters into single message.'
              ))
        self.editunicode.SetValue(config.Read('/Message/Unicode') == 'yes')
        self.sizer_message_new_2.Add(self.editunicode, pos=(r2, 0), colspan=2)
        r2 += 1

        self.editreport = wx.CheckBox(self.new_message_panel_2, -1,
                                      _('Request delivery report by default'))
        self.editreport.SetToolTipString(
            _('Check to request delivery report for message.'))
        self.editreport.SetValue(
            config.Read('/Message/DeliveryReport') == 'yes')
        self.sizer_message_new_2.Add(self.editreport, pos=(r2, 0), colspan=2)
        r2 += 1

        self.edit16bit = wx.CheckBox(self.new_message_panel_2, -1,
                                     _('Use 16bit Id'))
        self.edit16bit.SetToolTipString(
            _('Use 16 bit Id inside message. This is safe for most cases.'))
        self.edit16bit.SetValue(config.Read('/Message/16bitId') == 'yes')
        self.sizer_message_new_2.Add(self.edit16bit, pos=(r2, 0), colspan=2)
        r2 += 1

        self.new_message_panel_2.SetAutoLayout(True)
        self.new_message_panel_2.SetSizer(self.sizer_message_new_2)
        self.sizer_message_new_2.Fit(self.new_message_panel_2)
        self.sizer_message_new_2.SetSizeHints(self.new_message_panel_2)

        self.new_message_panel.SetAutoLayout(True)
        self.new_message_panel.SetSizer(self.sizer_message_new)
        self.sizer_message_new.Fit(self.new_message_panel)
        self.sizer_message_new.SetSizeHints(self.new_message_panel)

        self.sizer_messages.AddSpacer(1, 1, pos=(r, 3))

        # size messages tab
        self.notebook_messages.SetAutoLayout(True)
        self.notebook_messages.SetSizer(self.sizer_messages)
        self.sizer_messages.Fit(self.notebook_messages)
        self.sizer_messages.SetSizeHints(self.notebook_messages)

        # view tab
        self.sizer_view = wx.lib.rcsizer.RowColSizer()

        self.sizer_view.AddGrowableCol(1)

        self.sizer_view.AddSpacer(1, 1, pos=(0, 0))
        r = 1

        v = config.Read('/Wammu/NameFormat')
        self.editnameformat = wx.Choice(
            self.notebook_view,
            choices=[
                _('Automatic'),
                _('Automatic starting with first name'),
                _('Automatic starting with last name'),
                _('Custom, use format string below')
            ],
            size=(250, -1))
        if v == 'auto':
            self.editnameformat.SetSelection(0)
        elif v == 'auto-first-last':
            self.editnameformat.SetSelection(1)
        elif v == 'auto-last-first':
            self.editnameformat.SetSelection(2)
        elif v == 'custom':
            self.editnameformat.SetSelection(3)
        self.sizer_view.Add(wx.StaticText(self.notebook_view, -1,
                                          _('Name display format')),
                            pos=(r, 1))
        self.sizer_view.Add(self.editnameformat, pos=(r, 2), flag=wx.EXPAND)
        self.Bind(wx.EVT_CHOICE, self.OnNameFormatChange, self.editnameformat)
        r += 1

        v = config.Read('/Wammu/NameFormatString')
        self.editnamestring = wx.ComboBox(
            self.notebook_view,
            -1,
            v,
            choices=[
                v,
                '%(FirstName)s %(LastName)s (%(Company)s)',
                '%(LastName)s, %(FirstName)s (%(Company)s)',
                '%(LastName)s, %(FirstName)s (%(NickName)s)',
            ])
        # l10n: The %s will be replaced by list of currently supported tags, %%(value)s should be kept intact (you can translate word value).
        self.editnamestring.SetToolTipString(
            _('Format string for name displaying. You can use %%(value)s format marks. Currently available values are: %s.'
              ) % 'Name, FirstName, LastName, NickName, FormalName, Company')
        self.sizer_view.Add(wx.StaticText(self.notebook_view, -1,
                                          _('Name format string')),
                            pos=(r, 1),
                            flag=wx.ALIGN_CENTER_VERTICAL)
        self.sizer_view.Add(self.editnamestring,
                            pos=(r, 2),
                            flag=wx.ALIGN_RIGHT | wx.EXPAND)
        r += 1

        self.sizer_view.AddSpacer(1, 1, pos=(r, 3))

        # size view tab
        self.notebook_view.SetAutoLayout(True)
        self.notebook_view.SetSizer(self.sizer_view)
        self.sizer_view.Fit(self.notebook_view)
        self.sizer_view.SetSizeHints(self.notebook_view)

        # other tab
        self.sizer_other = wx.lib.rcsizer.RowColSizer()

        self.sizer_other.AddGrowableCol(1)

        self.sizer_other.AddSpacer(1, 1, pos=(0, 0))
        r = 1

        v = config.ReadInt('/Wammu/RefreshState')
        self.editrefresh = wx.SpinCtrl(self.notebook_other,
                                       -1,
                                       str(v),
                                       style=wx.SP_WRAP | wx.SP_ARROW_KEYS,
                                       min=0,
                                       max=10000000,
                                       initial=v,
                                       size=(150, -1))
        self.editrefresh.SetToolTipString(
            _('How often refresh phone state in application status bar. Enter value in miliseconds, 0 to disable.'
              ))
        self.sizer_other.Add(wx.StaticText(self.notebook_other, -1,
                                           _('Refresh phone state')),
                             pos=(r, 1))
        self.sizer_other.Add(self.editrefresh, pos=(r, 2))
        r += 1

        self.editconfirm = wx.CheckBox(self.notebook_other, -1,
                                       _('Confirm deleting'))
        self.editconfirm.SetToolTipString(
            _('Whether to ask for confirmation when deleting entries.'))
        self.editconfirm.SetValue(config.Read('/Wammu/ConfirmDelete') == 'yes')
        self.sizer_other.Add(self.editconfirm, pos=(r, 1), colspan=2)
        r += 1

        self.taskbaricon = wx.CheckBox(self.notebook_other, -1,
                                       _('Task bar icon'))
        self.taskbaricon.SetToolTipString(_('Show icon in task bar.'))
        self.taskbaricon.SetValue(config.Read('/Wammu/TaskBarIcon') == 'yes')
        self.sizer_other.Add(self.taskbaricon, pos=(r, 1), colspan=2)
        r += 1

        dtime = config.Read('/Wammu/DefaultTime')
        try:
            times = dtime.split(':')
            th = int(times[0])
            tm = int(times[1])
            ts = int(times[2])
        except:
            th = 9
            tm = 0
            ts = 0
        self.edittime = TimeCtrl(self.notebook_other, -1, fmt24hr=True)
        Wammu.Utils.FixupMaskedEdit(self.edittime)
        self.edittime.SetValue(wx.DateTimeFromHMS(th, tm, ts))
        self.edittime.SetToolTipString(
            _('Default time to be used for newly created time fields.'))
        self.sizer_other.Add(wx.StaticText(self.notebook_other, -1,
                                           _('Default time')),
                             pos=(r, 1))
        self.sizer_other.Add(self.edittime, pos=(r, 2))
        r += 1

        v = config.ReadInt('/Wammu/DefaultDateOffset')
        self.editdate = wx.SpinCtrl(self.notebook_other,
                                    -1,
                                    str(v),
                                    style=wx.SP_WRAP | wx.SP_ARROW_KEYS,
                                    min=-10000000,
                                    max=10000000,
                                    initial=v,
                                    size=(150, -1))
        self.editdate.SetToolTipString(
            _('Default date to be used for newly created time fields. Enter amount of days from today (1=tomorrow).'
              ))
        self.sizer_other.Add(wx.StaticText(self.notebook_other, -1,
                                           _('Default date=now + x days')),
                             pos=(r, 1))
        self.sizer_other.Add(self.editdate, pos=(r, 2))
        r += 1

        v = config.ReadInt('/Wammu/DefaultEntries')
        self.editentries = wx.SpinCtrl(self.notebook_other,
                                       -1,
                                       str(v),
                                       style=wx.SP_WRAP | wx.SP_ARROW_KEYS,
                                       min=0,
                                       max=20,
                                       initial=v,
                                       size=(150, -1))
        self.editentries.SetToolTipString(
            _('How many entries will be shown in newly created item.'))
        self.sizer_other.Add(wx.StaticText(self.notebook_other, -1,
                                           _('Entries for new item')),
                             pos=(r, 1))
        self.sizer_other.Add(self.editentries, pos=(r, 2))
        r += 1

        lst = ['Auto']
        lst += Wammu.Data.InternationalPrefixes
        self.editprefix = wx.ComboBox(self.notebook_other,
                                      -1,
                                      config.Read('/Wammu/PhonePrefix'),
                                      choices=lst,
                                      size=(150, -1))
        self.editprefix.SetToolTipString(
            _('Prefix for non international phone numbers.'))
        self.sizer_other.Add(wx.StaticText(self.notebook_other, -1,
                                           _('Number prefix')),
                             pos=(r, 1))
        self.sizer_other.Add(self.editprefix, pos=(r, 2))
        r += 1

        self.sizer_other.AddSpacer(1, 1, pos=(r, 3))

        # size other tab
        self.notebook_other.SetAutoLayout(True)
        self.notebook_other.SetSizer(self.sizer_other)
        self.sizer_other.Fit(self.notebook_other)
        self.sizer_other.SetSizeHints(self.notebook_other)

        # hacks tab
        self.sizer_hacks = wx.lib.rcsizer.RowColSizer()

        self.sizer_hacks.AddGrowableCol(1)

        self.sizer_hacks.AddSpacer(1, 1, pos=(0, 0))
        r = 1

        v = config.ReadInt('/Hacks/MaxEmptyGuess')
        self.editmaxemptyguess = wx.SpinCtrl(self.notebook_hacks,
                                             -1,
                                             str(v),
                                             style=wx.SP_WRAP
                                             | wx.SP_ARROW_KEYS,
                                             min=0,
                                             max=10000000,
                                             initial=v,
                                             size=(150, -1))
        self.editmaxemptyguess.SetToolTipString(
            _('Applies only when Wammu can not find proper count of entries to read. This number limits how many empty entries will be read before reading will be stopped.'
              ))
        self.sizer_hacks.Add(wx.StaticText(
            self.notebook_hacks, -1,
            _('Maximal empty entries if total is guessed')),
                             pos=(r, 1))
        self.sizer_hacks.Add(self.editmaxemptyguess, pos=(r, 2))
        r += 1

        v = config.ReadInt('/Hacks/MaxEmptyKnown')
        self.editmaxemptyknown = wx.SpinCtrl(self.notebook_hacks,
                                             -1,
                                             str(v),
                                             style=wx.SP_WRAP
                                             | wx.SP_ARROW_KEYS,
                                             min=0,
                                             max=10000000,
                                             initial=v,
                                             size=(150, -1))
        self.editmaxemptyknown.SetToolTipString(
            _('In case phone reports wrongly number of entries, Wammu would try to read infinitely or till error. This number limits how many empty entries will be read before reading will be stopped.'
              ))
        self.sizer_hacks.Add(wx.StaticText(
            self.notebook_hacks, -1,
            _('Maximal empty entries if total is known')),
                             pos=(r, 1))
        self.sizer_hacks.Add(self.editmaxemptyknown, pos=(r, 2))
        r += 1

        self.sizer_hacks.AddSpacer(1, 1, pos=(r, 3))

        # size hacks tab
        self.notebook_hacks.SetAutoLayout(True)
        self.notebook_hacks.SetSizer(self.sizer_hacks)
        self.sizer_hacks.Fit(self.notebook_hacks)
        self.sizer_hacks.SetSizeHints(self.notebook_hacks)

        # add pages to notebook
        self.notebook.AddPage(self.notebook_gammu, _('Gammu'))
        self.notebook.AddPage(self.notebook_connection, _('Connection'))
        self.notebook.AddPage(self.notebook_messages, _('Messages'))
        self.notebook.AddPage(self.notebook_view, _('View'))
        self.notebook.AddPage(self.notebook_other, _('Other'))
        self.notebook.AddPage(self.notebook_hacks, _('Hacks'))

        # size main layout
        self.SetAutoLayout(True)
        self.SetSizer(self.sizer)
        self.sizer.Fit(self)
        self.sizer.SetSizeHints(self)

        # workaround, when sizers don't set correct size
        sz = self.GetSize()
        if sz.y < 150:
            self.SetSize((400, 400))

        # Intialise fields
        self.OnNameFormatChange()

        # event handlers
        self.Bind(wx.EVT_BUTTON, self.Okay, id=wx.ID_OK)
        self.Bind(wx.EVT_BUTTON, self.AddPhone, id=wx.ID_ADD)