Changeset 16

Show
Ignore:
Timestamp:
06/27/07 21:00:45 (11 months ago)
Author:
nerijusb
Message:

Transition to the wx namespace - opendict now works with wx 2.8

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/config.py

    r15 r16  
    115115 
    116116      # TODO: Should not be here after removing register part from config 
    117       import wxPython.wx 
    118       self.app = wxPython.wx.wxGetApp() 
     117      import wx 
     118      self.app = wx.GetApp() 
    119119 
    120120      # 
  • trunk/lib/gui/dictaddwin.py

    r15 r16  
    2222# Module: gui.dictaddwin 
    2323 
    24 from wxPython.wx import * 
     24import wx 
    2525 
    2626from lib import misc 
    2727 
    28 _ = wxGetTranslation 
     28_ = wx.GetTranslation 
    2929 
    3030# IDs range: 6300-6310 
    31 class DictAddWindow(wxDialog): 
     31class DictAddWindow(wx.Dialog): 
    3232 
    3333    def __init__(self, parent, fname, filePath): 
    34         wxDialog.__init__(self, parent, -1,  
    35                          _("Add new dictionary"), wxDefaultPosition,  
    36                          wxDefaultSize, wxDEFAULT_DIALOG_STYLE) 
     34        wx.Dialog.__init__(self, parent, -1,  
     35                         _("Add new dictionary"), wx.DefaultPosition,  
     36                         wx.DefaultSize, wx.DEFAULT_DIALOG_STYLE) 
    3737         
    3838        self.filePath = filePath 
    39         vboxMain = wxBoxSizer(wxVERTICAL) 
     39        vboxMain = wx.BoxSizer(wx.VERTICAL) 
    4040         
    4141        msg1 = _("The file format of \"%s\" could not be \nrecognized by its" \ 
    4242                 " extention. Please select one\nfrom the list:") % fname 
    43         label1 = wxStaticText(self, -1, msg1) 
    44         vboxMain.Add(label1, 0, wxALL | wxEXPAND, 5) 
     43        label1 = wx.StaticText(self, -1, msg1) 
     44        vboxMain.Add(label1, 0, wx.ALL | wx.EXPAND, 5) 
    4545         
    4646        choices = [misc.dictFormats["zip"], # OpenDict plugin 
     
    5050                   _("\"%s\" dictionary format") % misc.dictFormats["dz"]] 
    5151         
    52         self.box = wxListBox(self, -1, wxPoint(-1, -1), 
    53                         wxSize(-1, -1), choices, wxLB_SINGLE) 
     52        self.box = wx.ListBox(self, -1, wx.Point(-1, -1), 
     53                        wx.Size(-1, -1), choices, wx.LB_SINGLE) 
    5454         
    55         vboxMain.Add(self.box, 1, wxALL | wxEXPAND, 3) 
     55        vboxMain.Add(self.box, 1, wx.ALL | wx.EXPAND, 3) 
    5656         
    57         hboxButtons = wxBoxSizer(wxHORIZONTAL) 
     57        hboxButtons = wx.BoxSizer(wx.HORIZONTAL) 
    5858         
    59         buttonOK = wxButton(self, wxID_OK, _("OK")) 
    60         hboxButtons.Add(buttonOK, 0, wxALL, 1) 
     59        buttonOK = wx.Button(self, wx.ID_OK, _("OK")) 
     60        hboxButtons.Add(buttonOK, 0, wx.ALL, 1) 
    6161         
    62         buttonCancel = wxButton(self, 6302, _("Cancel")) 
    63         hboxButtons.Add(buttonCancel, 0, wxALL, 1) 
     62        buttonCancel = wx.Button(self, 6302, _("Cancel")) 
     63        hboxButtons.Add(buttonCancel, 0, wx.ALL, 1) 
    6464         
    65         vboxMain.Add(hboxButtons, 0, wxALL | wxCENTER, 2) 
     65        vboxMain.Add(hboxButtons, 0, wx.ALL | wx.CENTER, 2) 
    6666         
    6767        self.SetSizer(vboxMain) 
    6868        self.Fit() 
    6969         
    70         EVT_BUTTON(self, wxID_OK, self.onOK) 
    71         EVT_BUTTON(self, 6302, self.onCancel) 
     70        wx.EVT_BUTTON(self, wx.ID_OK, self.onOK) 
     71        wx.EVT_BUTTON(self, 6302, self.onCancel) 
    7272     
    7373    def onOK(self, event): 
  • trunk/lib/gui/dictconnwin.py

    r15 r16  
    2020# 
    2121 
    22 from wxPython.wx import * 
    23 from wxPython.lib.rcsizer import RowColSizer 
     22import wx 
     23from wx.lib.rcsizer import RowColSizer 
    2424import traceback 
    2525 
     
    3131from lib import misc 
    3232 
    33 _ = wxGetTranslation 
     33_ = wx.GetTranslation 
    3434 
    3535CONNECTION_CHECK_INTERVAL = 400 
    3636 
    3737 
    38 class DictConnWindow(wxFrame): 
    39  
    40    def __init__(self, parent, id, title, pos=wxDefaultPosition, 
    41                 size=wxDefaultSize, style=wxDEFAULT_FRAME_STYLE): 
    42       wxFrame.__init__(self, parent, id, title, pos, size, style) 
     38class DictConnWindow(wx.Frame): 
     39 
     40   def __init__(self, parent, id, title, pos=wx.DefaultPosition, 
     41                size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE): 
     42      wx.Frame.__init__(self, parent, id, title, pos, size, style) 
    4343 
    4444      self.parent = parent 
    45       self.app = wxGetApp() 
    46  
    47       vboxMain = wxBoxSizer(wxVERTICAL) 
    48  
    49       hboxButtons = wxBoxSizer(wxHORIZONTAL) 
     45      self.app = wx.GetApp() 
     46 
     47      vboxMain = wx.BoxSizer(wx.VERTICAL) 
     48 
     49      hboxButtons = wx.BoxSizer(wx.HORIZONTAL) 
    5050      hboxServer = RowColSizer() 
    5151 
     
    5353      # Server address row 
    5454      # 
    55       hboxServer.Add(wxStaticText(self, -1, _("Server: ")), 
    56                      flag=wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 
     55      hboxServer.Add(wx.StaticText(self, -1, _("Server: ")), 
     56                     flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 
    5757                     row=0, col=0, border=1) 
    5858 
    5959      servers = ['dict.org', 'localhost'] 
    60       self.entryServer = wxComboBox(self, -1, 
    61           self.app.config.get('dictServer'), wxPoint(-1, -1), 
    62                               wxSize(-1, -1), servers, wxCB_DROPDOWN) 
    63       hboxServer.Add(self.entryServer, flag=wxEXPAND, row=0, col=1, border=1) 
    64       hboxServer.Add(wxButton(self, 1000, _("Default Server")), 
    65                      flag=wxEXPAND, row=0, col=2, border=5) 
     60      self.entryServer = wx.ComboBox(self, -1, 
     61          self.app.config.get('dictServer'), wx.Point(-1, -1), 
     62                              wx.Size(-1, -1), servers, wx.CB_DROPDOWN) 
     63      hboxServer.Add(self.entryServer, flag=wx.EXPAND, row=0, col=1, border=1) 
     64      hboxServer.Add(wx.Button(self, 1000, _("Default Server")), 
     65                     flag=wx.EXPAND, row=0, col=2, border=5) 
    6666 
    6767      # 
    6868      # Port entry row 
    6969      # 
    70       hboxServer.Add(wxStaticText(self, -1, _("Port: ")), 
    71                      flag=wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 
     70      hboxServer.Add(wx.StaticText(self, -1, _("Port: ")), 
     71                     flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 
    7272                     row=1, col=0, border=1) 
    73       hboxServer.Add(wxButton(self, 1001, _("Default Port")), 
    74                      flag=wxEXPAND, row=1, col=2, border=5) 
    75  
    76       self.entryPort = wxTextCtrl(self, -1, 
     73      hboxServer.Add(wx.Button(self, 1001, _("Default Port")), 
     74                     flag=wx.EXPAND, row=1, col=2, border=5) 
     75 
     76      self.entryPort = wx.TextCtrl(self, -1, 
    7777                                  self.app.config.get('dictServerPort')) 
    78       hboxServer.Add(self.entryPort, flag=wxEXPAND, row=1, col=1, border=1) 
     78      hboxServer.Add(self.entryPort, flag=wx.EXPAND, row=1, col=1, border=1) 
    7979 
    8080      # 
    8181      # Database selection row 
    8282      # 
    83       hboxServer.Add(wxStaticText(self, -1, _("Database: ")), 
    84                      flag=wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 
     83      hboxServer.Add(wx.StaticText(self, -1, _("Database: ")), 
     84                     flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 
    8585                     row=2, col=0, border=1) 
    8686 
    8787      self.msgSearchInAll = _("Search in all databases") 
    88       self.choiceDB = wxComboBox(self, 1002, self.msgSearchInAll, 
     88      self.choiceDB = wx.ComboBox(self, 1002, self.msgSearchInAll, 
    8989                                 choices=[self.msgSearchInAll], 
    90                                  style=wxTE_READONLY) 
     90                                 style=wx.TE_READONLY) 
    9191      self.choiceDB.SetInsertionPoint(0) 
    92       hboxServer.Add(self.choiceDB, flag=wxEXPAND, row=2, col=1, border=1) 
    93  
    94       hboxServer.Add(wxButton(self, 1003, _("Fetch List")), #size=(-1, 18)), 
    95                      flag=wxEXPAND, row=2, col=2, border=1) 
     92      hboxServer.Add(self.choiceDB, flag=wx.EXPAND, row=2, col=1, border=1) 
     93 
     94      hboxServer.Add(wx.Button(self, 1003, _("Fetch List")), #size=(-1, 18)), 
     95                     flag=wx.EXPAND, row=2, col=2, border=1) 
    9696 
    9797      # 
    9898      # Encoding selection row 
    9999      # 
    100       hboxServer.Add(wxStaticText(self, -1, _("Character encoding: ")), 
    101                      flag=wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 
     100      hboxServer.Add(wx.StaticText(self, -1, _("Character encoding: ")), 
     101                     flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 
    102102                     row=3, col=0, border=1) 
    103103 
    104       self.entryEncoding = wxComboBox(self, 1006, 
     104      self.entryEncoding = wx.ComboBox(self, 1006, 
    105105                              misc.encodings.keys()[ 
    106106                                misc.encodings.values().index( 
    107107                                    self.app.config.get('dict-server-encoding'))], 
    108                               wxPoint(-1, -1), 
    109                               wxSize(-1, -1), misc.encodings.keys(),  
    110                               wxCB_DROPDOWN | wxCB_READONLY) 
    111  
    112       hboxServer.Add(self.entryEncoding, flag=wxEXPAND, row=3, col=1, border=1) 
    113  
    114       #hboxServer.Add(wxStaticText(self, -1, _("Strategy: ")), 
    115       #               flag=wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 
     108                              wx.Point(-1, -1), 
     109                              wx.Size(-1, -1), misc.encodings.keys(),  
     110                              wx.CB_DROPDOWN | wx.CB_READONLY) 
     111 
     112      hboxServer.Add(self.entryEncoding, flag=wx.EXPAND, row=3, col=1, border=1) 
     113 
     114      #hboxServer.Add(wx.StaticText(self, -1, _("Strategy: ")), 
     115      #               flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 
    116116      #               row=3, col=0, rowspan=1, border=1) 
    117117      # 
    118       #self.choiceStrat = wxComboBox(self, 1006, #size=(-1, 20), 
     118      #self.choiceStrat = wx.ComboBox(self, 1006, #size=(-1, 20), 
    119119      #                         choices=[]) 
    120       #hboxServer.Add(self.choiceStrat, flag=wxEXPAND, row=3, col=1, 
     120      #hboxServer.Add(self.choiceStrat, flag=wx.EXPAND, row=3, col=1, 
    121121      #               rowspan=1, border=1) 
    122122      # 
    123       #hboxServer.Add(wxButton(self, 1007, _("Update")), #size=(-1, 18)), 
    124       #               flag=wxEXPAND, row=3, col=2, border=5) 
     123      #hboxServer.Add(wx.Button(self, 1007, _("Update")), #size=(-1, 18)), 
     124      #               flag=wx.EXPAND, row=3, col=2, border=5) 
    125125 
    126126      hboxServer.AddGrowableCol(1) 
    127127 
    128       vboxMain.Add(hboxServer, 1, wxALL | wxEXPAND, 4) 
    129  
    130       self.buttonOK = wxButton(self, 1004, _("Connect")) 
    131       hboxButtons.Add(self.buttonOK, 0, wxALL, 1) 
    132  
    133       self.buttonCancel = wxButton(self, 1005, _("Cancel")) 
    134       hboxButtons.Add(self.buttonCancel, 0, wxALL, 1) 
    135  
    136       vboxMain.Add(hboxButtons, 0, wxALL | wxALIGN_CENTER, 2) 
     128      vboxMain.Add(hboxServer, 1, wx.ALL | wx.EXPAND, 4) 
     129 
     130      self.buttonOK = wx.Button(self, 1004, _("Connect")) 
     131      hboxButtons.Add(self.buttonOK, 0, wx.ALL, 1) 
     132 
     133      self.buttonCancel = wx.Button(self, 1005, _("Cancel")) 
     134      hboxButtons.Add(self.buttonCancel, 0, wx.ALL, 1) 
     135 
     136      vboxMain.Add(hboxButtons, 0, wx.ALL | wx.ALIGN_CENTER, 2) 
    137137 
    138138      self.CreateStatusBar() 
     
    142142      self.SetSize((500, -1)) 
    143143 
    144       self.timerUpdateDB = wxTimer(self, 1006) 
    145       self.timerConnect = wxTimer(self, 1007) 
     144      self.timerUpdateDB = wx.Timer(self, 1006) 
     145      self.timerConnect = wx.Timer(self, 1007) 
    146146 
    147147      self.update = None 
    148148      self.connection = None 
    149149 
    150       EVT_BUTTON(self, 1000, self.onDefaultServer) 
    151       EVT_BUTTON(self, 1001, self.onDefaultPort) 
    152       EVT_BUTTON(self, 1003, self.onUpdateDB) 
    153       EVT_BUTTON(self, 1007, self.onUpdateStrats) 
    154       EVT_BUTTON(self, 1004, self.onOK) 
    155       EVT_BUTTON(self, 1005, self.onCancel) 
    156       EVT_TIMER(self, 1006, self.onTimerUpdateDB) 
    157       EVT_TIMER(self, 1007, self.onTimerConnect) 
     150      wx.EVT_BUTTON(self, 1000, self.onDefaultServer) 
     151      wx.EVT_BUTTON(self, 1001, self.onDefaultPort) 
     152      wx.EVT_BUTTON(self, 1003, self.onUpdateDB) 
     153      wx.EVT_BUTTON(self, 1007, self.onUpdateStrats) 
     154      wx.EVT_BUTTON(self, 1004, self.onOK) 
     155      wx.EVT_BUTTON(self, 1005, self.onCancel) 
     156      wx.EVT_TIMER(self, 1006, self.onTimerUpdateDB) 
     157      wx.EVT_TIMER(self, 1007, self.onTimerConnect) 
    158158 
    159159 
  • trunk/lib/gui/dicteditorwin.py

    r15 r16  
    2222# TODO: not usable yet, needs some work with encodings, gui, etc. 
    2323 
    24 from wxPython.wx import * 
    25 from wxPython.lib.rcsizer import RowColSizer 
     24from wx.lib.rcsizer import RowColSizer 
    2625import wx 
    2726import os 
     
    3736from lib import enc 
    3837 
    39 _ = wxGetTranslation 
    40  
    41  
    42 class EditWordWindow(wxFrame): 
     38_ = wx.GetTranslation 
     39 
     40 
     41class EditWordWindow(wx.Frame): 
    4342    """Word editor window""" 
    4443 
    45     def __init__(self, word, parent, id, title, pos=wxDefaultPosition, 
    46              size=wxDefaultSize, style=wxDEFAULT_FRAME_STYLE): 
    47         wxFrame.__init__(self, parent, id, title, pos, size, style) 
    48  
    49         vboxMain = wxBoxSizer(wxVERTICAL) 
    50         hboxButtons = wxBoxSizer(wxHORIZONTAL) 
     44    def __init__(self, word, parent, id, title, pos=wx.DefaultPosition, 
     45             size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE): 
     46        wx.Frame.__init__(self, parent, id, title, pos, size, style) 
     47 
     48        vboxMain = wx.BoxSizer(wx.VERTICAL) 
     49        hboxButtons = wx.BoxSizer(wx.HORIZONTAL) 
    5150        self.boxInfo = RowColSizer() 
    5251 
    5352 
    54         self.boxInfo.Add(wxStaticText(self, -1, _("Word: "), pos=(-1, -1)), 
    55                          flag=wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 
     53        self.boxInfo.Add(wx.StaticText(self, -1, _("Word: "), pos=(-1, -1)), 
     54                         flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 
    5655                         row=0, col=0, border=1) 
    5756 
    58         self.entryWord = wxTextCtrl(self, -1, word) 
     57        self.entryWord = wx.TextCtrl(self, -1, word) 
    5958        self.entryWord.Disable() 
    60         self.boxInfo.Add(self.entryWord, flag=wxEXPAND, 
     59        self.boxInfo.Add(self.entryWord, flag=wx.EXPAND, 
    6160                         row=0, col=1, border=1) 
    6261 
     
    8483 
    8584        self.boxInfo.AddGrowableCol(1) 
    86         vboxMain.Add(self.boxInfo, 1, wxALL | wxEXPAND, 2) 
     85        vboxMain.Add(self.boxInfo, 1, wx.ALL | wx.EXPAND, 2) 
    8786 
    8887        idAdd = wx.NewId() 
    89         self.buttonAdd = wxButton(self, idAdd, _("Add translation field")) 
    90         vboxMain.Add(self.buttonAdd, 0, wxALL | wxALIGN_RIGHT, 2) 
    91  
    92         self.buttonOK = wxButton(self, 6050, _("OK")) 
    93         hboxButtons.Add(self.buttonOK, 0, wxALL, 1) 
    94  
    95         self.buttonCancel = wxButton(self, 6051, _("Cancel")) 
    96         hboxButtons.Add(self.buttonCancel, 0, wxALL, 1) 
    97  
    98         vboxMain.Add(hboxButtons, 0, wxALL | wxALIGN_RIGHT, 2) 
     88        self.buttonAdd = wx.Button(self, idAdd, _("Add translation field")) 
     89        vboxMain.Add(self.buttonAdd, 0, wx.ALL | wx.ALIGN_RIGHT, 2) 
     90 
     91        self.buttonOK = wx.Button(self, 6050, _("OK")) 
     92        hboxButtons.Add(self.buttonOK, 0, wx.ALL, 1) 
     93 
     94        self.buttonCancel = wx.Button(self, 6051, _("Cancel")) 
     95        hboxButtons.Add(self.buttonCancel, 0, wx.ALL, 1) 
     96 
     97        vboxMain.Add(hboxButtons, 0, wx.ALL | wx.ALIGN_RIGHT, 2) 
    9998 
    10099        self.SetSizer(vboxMain) 
     
    110109        """Add empty translation field""" 
    111110 
    112         transLabel = wxStaticText(self, -1, _("Translation #%d: ") \ 
     111        transLabel = wx.StaticText(self, -1, _("Translation #%d: ") \ 
    113112                                              % (len(self.textEntries)+1)) 
    114113        self.transLabels[len(self.transLabels)] = transLabel 
     
    117116                         row=len(self.transLabels), col=0, border=1) 
    118117 
    119         text = wxTextCtrl(self, -1, 
     118        text = wx.TextCtrl(self, -1, 
    120119                          "", 
    121120                          size=(100, -1)) 
     
    123122        self.textEntries[len(self.textEntries)] = text 
    124123 
    125         self.boxInfo.Add(text, flag=wxEXPAND, 
     124        self.boxInfo.Add(text, flag=wx.EXPAND, 
    126125                         row=len(self.textEntries), 
    127126                         col=1, border=1) 
     
    172171 
    173172# IDs range: 6000-6200 
    174 class DictEditorWindow(wxFrame): 
     173class DictEditorWindow(wx.Frame): 
    175174 
    176175    """Built-in dictionary editor. This tool lets user create and 
     
    180179        """Window for adding new word""" 
    181180 
    182         def __init__(self, parent, id, title, pos=wxDefaultPosition, 
    183                  size=wxDefaultSize, style=wxDEFAULT_FRAME_STYLE): 
     181        def __init__(self, parent, id, title, pos=wx.DefaultPosition, 
     182                 size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE): 
    184183 
    185184            EditWordWindow.__init__(self, '', parent, id, title, pos, 
     
    230229 
    231230    # IDs range: 6000-6003 
    232     class ConfirmExitWindow(wxDialog): 
     231    class ConfirmExitWindow(wx.Dialog): 
    233232        """Save confirmation dialog""" 
    234233 
    235         def __init__(self, parent, id, title, pos=wxDefaultPosition, 
    236                  size=wxDefaultSize, style=wxDEFAULT_DIALOG_STYLE): 
    237              
    238             wxDialog.__init__(self, parent, id, title, pos, size, style) 
     234        def __init__(self, parent, id, title, pos=wx.DefaultPosition, 
     235                 size=wx.DefaultSize, style=wx.DEFAULT_DIALOG_STYLE): 
     236             
     237            wx.Dialog.__init__(self, parent, id, title, pos, size, style) 
    239238 
    240239            self.parent = self.GetParent() 
    241240             
    242             vboxMain = wxBoxSizer(wxVERTICAL) 
    243             hboxButtons = wxBoxSizer(wxHORIZONTAL) 
    244              
    245             labelMsg = wxStaticText(self, -1, 
     241            vboxMain = wx.BoxSizer(wx.VERTICAL) 
     242            hboxButtons = wx.BoxSizer(wx.HORIZONTAL) 
     243             
     244            labelMsg = wx.StaticText(self, -1, 
    246245                                    _("Dictionary \"%s\" has been changed") \ 
    247246                                    % parent.name) 
    248             vboxMain.Add(labelMsg, 1, wxALL | wxEXPAND, 15) 
    249              
    250             buttonSave = wxButton(self, 6000, _("Save")) 
    251             hboxButtons.Add(buttonSave, 0, wxALL | wxEXPAND, 3) 
    252              
    253             buttonExit = wxButton(self, 6001, _("Do not save")) 
    254             hboxButtons.Add(buttonExit, 0, wxALL | wxEXPAND, 3) 
    255              
    256             buttonCancel = wxButton(self, 6002, _("Cancel")) 
    257             hboxButtons.Add(buttonCancel, 0, wxALL | wxEXPAND, 3) 
    258              
    259             vboxMain.Add(hboxButtons, 0, wxALL | wxEXPAND, 2) 
     247            vboxMain.Add(labelMsg, 1, wx.ALL | wx.EXPAND, 15) 
     248             
     249            buttonSave = wx.Button(self, 6000, _("Save")) 
     250            hboxButtons.Add(buttonSave, 0, wx.ALL | wx.EXPAND, 3) 
     251             
     252            buttonExit = wx.Button(self, 6001, _("Do not save")) 
     253            hboxButtons.Add(buttonExit, 0, wx.ALL | wx.EXPAND, 3) 
     254             
     255            buttonCancel = wx.Button(self, 6002, _("Cancel")) 
     256            hboxButtons.Add(buttonCancel, 0, wx.ALL | wx.EXPAND, 3) 
     257             
     258            vboxMain.Add(hboxButtons, 0, wx.ALL | wx.EXPAND, 2) 
    260259             
    261260            self.SetSizer(vboxMain) 
    262261            self.Fit() 
    263262             
    264             EVT_BUTTON(self, 6000, self.onSave) 
    265             EVT_BUTTON(self, 6001, self.onExitParent) 
    266             EVT_BUTTON(self, 6002, self.onClose) 
     263            wx.EVT_BUTTON(self, 6000, self.onSave) 
     264            wx.EVT_BUTTON(self, 6001, self.onExitParent) 
     265            wx.EVT_BUTTON(self, 6002, self.onClose) 
    267266 
    268267             
     
    297296 
    298297    # ------------------------------------------------------------- 
    299     def __init__(self, parent, id, title, pos=wxDefaultPosition, 
    300                  size=wxDefaultSize, style=wxDEFAULT_FRAME_STYLE): 
    301         wxFrame.__init__(self, parent, id, title, pos, size, style) 
    302  
    303         self.app = wxGetApp() 
     298    def __init__(self, parent, id, title, pos=wx.DefaultPosition, 
     299                 size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE): 
     300        wx.Frame.__init__(self, parent, id, title, pos, size, style) 
     301 
     302        self.app = wx.GetApp() 
    304303        self.CreateStatusBar() 
    305304         
     
    310309        self.cAction = None 
    311310 
    312         vboxMain = wxBoxSizer(wxVERTICAL) 
    313         vboxDict = wxBoxSizer(wxVERTICAL) 
    314         vboxList = wxBoxSizer(wxVERTICAL) 
    315         hboxDict = wxBoxSizer(wxHORIZONTAL) 
    316         vboxEditButtons = wxBoxSizer(wxVERTICAL) 
    317         hboxButtons = wxBoxSizer(wxHORIZONTAL) 
     311        vboxMain = wx.BoxSizer(wx.VERTICAL) 
     312        vboxDict = wx.BoxSizer(wx.VERTICAL) 
     313        vboxList = wx.BoxSizer(wx.VERTICAL) 
     314        hboxDict = wx.BoxSizer(wx.HORIZONTAL) 
     315        vboxEditButtons = wx.BoxSizer(wx.VERTICAL) 
     316        hboxButtons = wx.BoxSizer(wx.HORIZONTAL) 
    318317 
    319318        # Control buttons 
    320319        self.controlButtons = [] 
    321320         
    322         self.buttonAdd = wxButton(self, 6000, _("Add")) 
     321        self.buttonAdd = wx.Button(self, 6000, _("Add")) 
    323322        self.buttonAdd.SetToolTipString(_("Add word")) 
    324323        self.controlButtons.append(self.buttonAdd) 
    325324         
    326         self.buttonEdit = wxButton(self, 6001, _("Edit")) 
     325        self.buttonEdit = wx.Button(self, 6001, _("Edit")) 
    327326        self.buttonEdit.SetToolTipString(_("Change translation")) 
    328327        self.controlButtons.append(self.buttonEdit) 
    329328 
    330         self.buttonRemove = wxButton(self, 6002, _("Remove")) 
     329        self.buttonRemove = wx.Button(self, 6002, _("Remove")) 
    331330        self.buttonRemove.SetToolTipString(_("Remove selected word")) 
    332331        self.controlButtons.append(self.buttonRemove) 
    333332 
    334         self.buttonSort = wxButton(self, 6004, _("Sort")) 
     333        self.buttonSort = wx.Button(self, 6004, _("Sort")) 
    335334        self.buttonSort.SetToolTipString(_("Sort word list")) 
    336335        self.controlButtons.append(self.buttonSort) 
    337336 
    338         self.buttonSave = wxButton(self, 6005, _("Save")) 
     337        self.buttonSave = wx.Button(self, 6005, _("Save")) 
    339338        self.buttonSave.SetToolTipString(_("Save words to file")) 
    340339        self.controlButtons.append(self.buttonSave) 
    341340 
    342         self.buttonSaveAs = wxButton(self, 6006, _("Save As...")) 
     341        self.buttonSaveAs = wx.Button(self, 6006, _("Save As...")) 
    343342        self.buttonSaveAs.SetToolTipString(_("Save with a different file name")) 
    344343        self.controlButtons.append(self.buttonSaveAs) 
     
    346345        for button in self.controlButtons: 
    347346            button.Disable() 
    348             vboxEditButtons.Add(button, 0, wxALL | wxEXPAND, 1) 
    349          
    350         panelList = wxPanel(self, -1) 
    351         sbSizerList = wxStaticBoxSizer(wxStaticBox(panelList, -1,  
     347            vboxEditButtons.Add(button, 0, wx.ALL | wx.EXPAND, 1) 
     348         
     349        panelList = wx.Panel(self, -1) 
     350        sbSizerList = wx.StaticBoxSizer(wx.StaticBox(panelList, -1,  
    352351                                                 _("Word List")), 
    353                                        wxVERTICAL) 
    354          
    355         self.list = wxListBox(panelList, 6020, 
    356                               wxPoint(-1, -1), 
    357                               wxSize(-1, -1), 
     352                                       wx.VERTICAL) 
     353         
     354        self.list = wx.ListBox(panelList, 6020, 
     355                              wx.Point(-1, -1), 
     356                              wx.Size(-1, -1), 
    358357                              [], 
    359                               wxLB_SINGLE | wxSUNKEN_BORDER) 
     358                              wx.LB_SINGLE | wx.SUNKEN_BORDER) 
    360359                               
    361         sbSizerList.Add(self.list, 1, wxALL | wxEXPAND, 0) 
     360        sbSizerList.Add(self.list, 1, wx.ALL | wx.EXPAND, 0) 
    362361        panelList.SetSizer(sbSizerList) 
    363         panelList.SetAutoLayout(true) 
     362        panelList.SetAutoLayout(True) 
    364363        sbSizerList.Fit(panelList) 
    365364 
    366         hboxDict.Add(panelList, 1, wxALL | wxEXPAND, 0) 
    367         hboxDict.Add(vboxEditButtons, 0, wxALL | wxEXPAND, 5) 
    368         vboxDict.Add(hboxDict, 1, wxALL | wxEXPAND, 0) 
    369         vboxMain.Add(vboxDict, 1, wxALL | wxEXPAND, 10) 
    370  
    371         self.buttonNew = wxButton(self, 6030, _("New...")) 
     365        hboxDict.Add(panelList, 1, wx.ALL | wx.EXPAND, 0) 
     366        hboxDict.Add(vboxEditButtons, 0, wx.ALL | wx.EXPAND, 5) 
     367        vboxDict.Add(hboxDict, 1, wx.ALL | wx.EXPAND, 0) 
     368        vboxMain.Add(vboxDict, 1, wx.ALL | wx.EXPAND, 10) 
     369 
     370        self.buttonNew = wx.Button(self, 6030, _("New...")) 
    372371        self.buttonNew.SetToolTipString(_("Start new dictionary")) 
    373         hboxButtons.Add(self.buttonNew, 0, wxALL | wxEXPAND, 1) 
    374  
    375         self.buttonOpen = wxButton(self, 6031, _("Open...")) 
     372        hboxButtons.Add(self.buttonNew, 0, wx.ALL | wx.EXPAND, 1) 
     373 
     374        self.buttonOpen = wx.Button(self, 6031, _("Open...")) 
    376375        self.buttonOpen.SetToolTipString(_("Open dictionary file")) 
    377         hboxButtons.Add(self.buttonOpen, 0, wxALL | wxEXPAND, 1) 
    378  
    379         self.buttonClose = wxButton(self, 6032, _("Close")) 
     376        hboxButtons.Add(self.buttonOpen, 0, wx.ALL | wx.EXPAND, 1) 
     377 
     378        self.buttonClose = wx.Button(self, 6032, _("Close")) 
    380379        self.buttonClose.SetToolTipString(_("Close editor window")) 
    381         hboxButtons.Add(self.buttonClose, 0, wxALL | wxEXPAND, 1) 
    382  
    383         vboxMain.Add(hboxButtons, 0, wxALL | wxALIGN_RIGHT, 2) 
    384  
    385         self.SetIcon(wxIcon(os.path.join(info.GLOBAL_HOME, 
     380        hboxButtons.Add(self.buttonClose, 0, wx.ALL | wx.EXPAND, 1) 
     381 
     382        vboxMain.Add(hboxButtons, 0, wx.ALL | wx.ALIGN_RIGHT, 2) 
     383 
     384        self.SetIcon(wx.Icon(os.path.join(info.GLOBAL_HOME, 
    386385                                        "pixmaps", 
    387386                                        "icon-24x24.png"), 
    388                             wxBITMAP_TYPE_PNG)) 
     387                            wx.BITMAP_TYPE_PNG)) 
    389388 
    390389        self.SetSizer(vboxMain) 
     
    393392        self.Bind(wx.EVT_BUTTON, self.onCreate, self.buttonNew) 
    394393 
    395         EVT_BUTTON(self, 6000, self.onAddWord) 
    396         EVT_BUTTON(self, 6001, self.onEdit) 
    397         EVT_BUTTON(self, 6002, self.onRemove) 
    398         EVT_BUTTON(self, 6003, self.onSearch) 
    399         EVT_BUTTON(self, 6004, self.onSort) 
    400         EVT_BUTTON(self, 6005, self.onSave) 
    401         EVT_BUTTON(self, 6006, self.onSaveAs) 
    402         EVT_BUTTON(self, 6031, self.onOpen) 
    403         EVT_BUTTON(self, 6032, self.onClose) 
    404         EVT_CLOSE(self, self.onClose) 
     394        wx.EVT_BUTTON(self, 6000, self.onAddWord) 
     395        wx.EVT_BUTTON(self, 6001, self.onEdit) 
     396        wx.EVT_BUTTON(self, 6002, self.onRemove) 
     397        wx.EVT_BUTTON(self, 6003, self.onSearch) 
     398        wx.EVT_BUTTON(self, 6004, self.onSort) 
     399        wx.EVT_BUTTON(self, 6005, self.onSave) 
     400        wx.EVT_BUTTON(self, 6006, self.onSaveAs) 
     401        wx.EVT_BUTTON(self, 6031, self.onOpen) 
     402        wx.EVT_BUTTON(self, 6032, self.onClose) 
     403        wx.EVT_CLOSE(self, self.onClose) 
    405404 
    406405 
     
    411410        window = self.AddWordWindow(self, -1, _("New Word"), 
    412411                                    size=(-1, -1), pos=(-1, -1), 
    413                                     style=wxDEFAULT_FRAME_STYLE) 
     412                                    style=wx.DEFAULT_FRAME_STYLE) 
    414413        window.CentreOnScreen() 
    415414        window.Show(True) 
     
    426425        window = EditWordWindow(word, self, -1, _("Edit Word"), 
    427426                                size=(-1, -1), 
    428                                 style=wxDEFAULT_FRAME_STYLE) 
     427                                style=wx.DEFAULT_FRAME_STYLE) 
    429428        window.CentreOnScreen() 
    430429        window.Show(True) 
     
    599598        wildCard = "Slowo dictionaries (*.dwa)|*.dwa" 
    600599         
    601         dialog = wxFileDialog(self, message=_("Choose dictionary file"), 
    602                               wildcard=wildCard, style=wxOPEN|wxMULTIPLE) 
    603         if dialog.ShowModal() == wxID_OK: 
     600        dialog = wx.FileDialog(self, message=_("Choose dictionary file"), 
     601                              wildcard=wildCard, style=wx.OPEN|wx.MULTIPLE) 
     602        if dialog.ShowModal() == wx.ID_OK: 
    604603            name = os.path.split(dialog.GetPaths()[0])[1] 
    605604            self.filePath = dialog.GetPaths()[0] 
  • trunk/lib/gui/errorwin.py

    r15 r16  
    2121# Module: gui.errorwin 
    2222 
    23 from wxPython.wx import * 
     23import wx 
    2424import sys 
    2525import os 
    2626import traceback 
    2727 
    28 _ = wxGetTranslation 
     28_ = wx.GetTranslation 
    2929 
    3030 
     
    3535   """Show error message dialog""" 
    3636    
    37    window = wxMessageDialog(None, 
     37   window = wx.MessageDialog(None, 
    3838                            msg,  
    3939                            title,  
    40                             wxOK | wxICON_ERROR) 
     40                            wx.OK | wx.ICON_ERROR) 
    4141   window.CenterOnScreen() 
    4242   window.ShowModal() 
     
    4747   """Show info message dialog""" 
    4848    
    49    window = wxMessageDialog(None, 
     49   window = wx.MessageDialog(None, 
    5050                            msg,  
    5151                            title,  
    52                             wxOK | wxICON_INFORMATION) 
     52                            wx.OK | wx.ICON_INFORMATION) 
    5353   window.CenterOnScreen() 
    5454   window.ShowModal() 
     
    5757    
    5858 
    59 class ErrorWindow(wxFrame): 
     59class ErrorWindow(wx.Frame): 
    6060 
    6161   """This window is shown when OpenDict can't start because 
    6262      of some error.""" 
    6363 
    64    def __init__(self, parent, id, title, error, pos=wxDefaultPosition, 
    65                 size=wxDefaultSize, style=wxCENTRE): 
    66       wxFrame.__init__(self, parent, id, title, pos, size, style) 
     64   def __init__(self, parent, id, title, error, pos=wx.DefaultPosition, 
     65                size=wx.DefaultSize, style=wx.CENTRE): 
     66      wx.Frame.__init__(self, parent, id, title, pos, size, style) 
    6767 
    6868      raise "Deprecated" 
    6969 
    70       vbox = wxBoxSizer(wxVERTICAL) 
     70      vbox = wx.BoxSizer(wx.VERTICAL) 
    7171 
    72       vbox.Add(wxStaticText(self, -1, _("An error occured:")), 0, 
    73                wxALL | wxEXPAND, 5) 
     72      vbox.Add(wx.StaticText(self, -1, _("An error occured:")), 0, 
     73               wx.ALL | wx.EXPAND, 5) 
    7474 
    75       errMsg = wxTextCtrl(self, -1, size=(-1, 200), 
    76                        style=wxTE_MULTILINE | wxTE_READONLY) 
     75      errMsg = wx.TextCtrl(self, -1, size=(-1, 200), 
     76                       style=wx.TE_MULTILINE | wx.TE_READONLY) 
    7777      errMsg.WriteText(error) 
    7878      vbox.Add(errMsg, 1, 
    79                wxALL | wxEXPAND, 10) 
     79               wx.ALL | wx.EXPAND, 10) 
    8080 
    81       vbox.Add(wxStaticText(self, -1, msg), 0, 
    82                wxALL | wxEXPAND, 5) 
     81      vbox.Add(wx.StaticText(self, -1, msg), 0, 
     82               wx.ALL | wx.EXPAND, 5) 
    8383 
    84       self.buttonClose = wxButton(self, 200, _("Close")) 
    85       vbox.Add(self.buttonClose, 0, wxALL | wxCENTRE, 2) 
     84      self.buttonClose = wx.Button(self, 200, _("Close")) 
     85      vbox.Add(self.buttonClose, 0, wx.ALL | wx.CENTRE, 2) 
    8686 
    8787 
     
    8989      self.Fit() 
    9090 
    91       EVT_CLOSE(self, self.onCloseWindow) 
    92       EVT_BUTTON(self, 200, self.onExit) 
     91      wx.EVT_CLOSE(self, self.onCloseWindow) 
     92      wx.EVT_BUTTON(self, 200, self.onExit) 
  • trunk/lib/gui/helpwin.py

    r15 r16  
    2222# Module: gui.helpwin 
    2323 
    24 from wxPython.wx import * 
    25 from wxPython.html import * 
     24#from wx import * 
     25#from wx.html import * 
    2626import wx 
    2727import os 
     
    3232from lib import info 
    3333 
    34 _ = wxGetTranslation 
    35  
    36  
    37 class LicenseWindow(wxFrame): 
     34_ = wx.GetTranslation 
     35 
     36 
     37class LicenseWindow(wx.Frame): 
    3838   """Licence window class""" 
    3939 
    40    def __init__(self, parent, id, title, pos=wxDefaultPosition, 
    41                 size=wxDefaultSize, style=wxCENTRE): 
    42       wxFrame.__init__(self, parent, id, title, pos, size, style) 
    43  
    44       vbox = wxBoxSizer(wxVERTICAL) 
     40   def __init__(self, parent, id, title, pos=wx.DefaultPosition, 
     41                size=wx.DefaultSize, style=wx.CENTRE): 
     42      wx.Frame.__init__(self, parent, id, title, pos, size, style) 
     43 
     44      vbox = wx.BoxSizer(wx.VERTICAL) 
    4545 
    4646      # 
     
    5555         data = "Error: <i>licence file not found</i>" 
    5656 
    57       scWinAbout = wxScrolledWindow(self, -1, wxPyDefaultPosition, 
    58                                     wxSize(-1, -1)) 
    59  
    60       htmlWin = wxHtmlWindow(scWinAbout, -1, style=wxSUNKEN_BORDER) 
     57      scWinAbout = wx.ScrolledWindow(self, -1, wx.PyDefaultPosition, 
     58                                    wx.Size(-1, -1)) 
     59 
     60      htmlWin = wx.HtmlWindow(scWinAbout, -1, style=wx.SUNKEN_BORDER) 
    6161      htmlWin.SetFonts('Helvetica', 'Fixed', [10]*5) 
    6262      htmlWin.SetPage(data) 
    6363       
    64       scBox = wxBoxSizer(wxVERTICAL) 
    65       scBox.Add(htmlWin, 1, wxALL | wxEXPAND, 1) 
     64      scBox = wx.BoxSizer(wx.VERTICAL) 
     65      scBox.Add(htmlWin, 1, wx.ALL | wx.EXPAND, 1) 
    6666      scWinAbout.SetSizer(scBox) 
    67       vbox.Add(scWinAbout, 1, wxALL | wxEXPAND, 5) 
    68  
    69       self.buttonClose = wxButton(self, 2002, _("Close")) 
    70       vbox.Add(self.buttonClose, 0, wxALL | wxALIGN_RIGHT, 5) 
     67      vbox.Add(scWinAbout, 1, wx.ALL | wx.EXPAND, 5) 
     68 
     69      self.buttonClose = wx.Button(self, 2002, _("Close")) 
     70      vbox.Add(self.buttonClose, 0, wx.ALL | wx.ALIGN_RIGHT, 5) 
    7171 
    7272      self.SetSizer(vbox) 
    7373 
    74       EVT_BUTTON(self, 2002, self.onClose) 
     74      wx.EVT_BUTTON(self, 2002, self.onClose) 
    7575 
    7676 
     
    8181       
    8282 
    83 class CreditsWindow(wxDialog): 
     83class CreditsWindow(wx.Dialog): 
    8484   """Credits window class""" 
    8585    
    86    def __init__(self, parent, id, title, pos=wxDefaultPosition, 
    87                 size=wxDefaultSize): 
    88       wxDialog.__init__(self, parent, id, title, pos, size) 
    89        
    90       vbox = wxBoxSizer(wxVERTICAL) 
    91        
    92       nb = wxNotebook(self, -1) 
     86   def __init__(self, parent, id, title, pos=wx.DefaultPosition, 
     87                size=wx.DefaultSize): 
     88      wx.Dialog.__init__(self, parent, id, title, pos, size) 
     89       
     90      vbox = wx.BoxSizer(wx.VERTICAL) 
     91       
     92      nb = wx.Notebook(self, -1) 
    9393       
    9494      # "Written by" panel 
    95       writePanel = wxPanel(nb, -1) 
    96       vboxWrite = wxBoxSizer(wxVERTICAL) 
     95      writePanel = wx.Panel(nb, -1) 
     96      vboxWrite = wx.BoxSizer(wx.VERTICAL) 
    9797      writtenString = unicode("Martynas Jocius <martynas.jocius@idiles.com>\n" 
    9898                              "Nerijus BaliĆ«nas <nerijusb@dtiltas.lt>\n" 
     
    100100                              "UTF-8") 
    101101      written = enc.toWX(writtenString) 
    102       labelWrite = wxStaticText(writePanel, -1, written) 
    103       vboxWrite.Add(labelWrite, 0, wxALL, 10) 
     102      labelWrite = wx.StaticText(writePanel, -1, written) 
     103      vboxWrite.Add(labelWrite, 0, wx.ALL, 10) 
    104104      writePanel.SetSizer(vboxWrite) 
    105105       
     
    107107       
    108108      # "Translations" panel 
    109       tPanel = wxPanel(nb, -1) 
    110       vboxTP = wxBoxSizer(wxVERTICAL) 
     109      tPanel = wx.Panel(nb, -1) 
     110      vboxTP = wx.BoxSizer(wx.VERTICAL) 
    111111      transString = unicode("Martynas Jocius <martynas.jocius@idiles.com>", 
    112112                            "UTF-8") 
    113113      trans = enc.toWX(transString) 
    114       labelTP = wxStaticText(tPanel, -1, trans) 
    115       vboxTP.Add(labelTP, 0, wxALL, 10) 
     114      labelTP = wx.StaticText(tPanel, -1, trans) 
     115      vboxTP.Add(labelTP, 0, wx.ALL, 10) 
    116116