Changeset 16
- Timestamp:
- 06/27/07 21:00:45 (11 months ago)
- Files:
-
- trunk/lib/config.py (modified) (1 diff)
- trunk/lib/gui/dictaddwin.py (modified) (2 diffs)
- trunk/lib/gui/dictconnwin.py (modified) (4 diffs)
- trunk/lib/gui/dicteditorwin.py (modified) (16 diffs)
- trunk/lib/gui/errorwin.py (modified) (5 diffs)
- trunk/lib/gui/helpwin.py (modified) (10 diffs)
- trunk/lib/gui/mainwin.py (modified) (48 diffs)
- trunk/lib/gui/miscwin.py (modified) (6 diffs)
- trunk/lib/gui/pluginwin.py (modified) (15 diffs)
- trunk/lib/gui/prefswin.py (modified) (4 diffs)
- trunk/lib/gui/registerwin.py (modified) (3 diffs)
- trunk/lib/installer.py (modified) (3 diffs)
- trunk/lib/misc.py (modified) (2 diffs)
- trunk/lib/parser.py (modified) (2 diffs)
- trunk/opendict.py (modified) (6 diffs)
- trunk/win32/make.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/config.py
r15 r16 115 115 116 116 # TODO: Should not be here after removing register part from config 117 import wx Python.wx118 self.app = wx Python.wx.wxGetApp()117 import wx 118 self.app = wx.GetApp() 119 119 120 120 # trunk/lib/gui/dictaddwin.py
r15 r16 22 22 # Module: gui.dictaddwin 23 23 24 from wxPython.wx import * 24 import wx 25 25 26 26 from lib import misc 27 27 28 _ = wx GetTranslation28 _ = wx.GetTranslation 29 29 30 30 # IDs range: 6300-6310 31 class DictAddWindow(wx Dialog):31 class DictAddWindow(wx.Dialog): 32 32 33 33 def __init__(self, parent, fname, filePath): 34 wx Dialog.__init__(self, parent, -1,35 _("Add new dictionary"), wx DefaultPosition,36 wx DefaultSize, wxDEFAULT_DIALOG_STYLE)34 wx.Dialog.__init__(self, parent, -1, 35 _("Add new dictionary"), wx.DefaultPosition, 36 wx.DefaultSize, wx.DEFAULT_DIALOG_STYLE) 37 37 38 38 self.filePath = filePath 39 vboxMain = wx BoxSizer(wxVERTICAL)39 vboxMain = wx.BoxSizer(wx.VERTICAL) 40 40 41 41 msg1 = _("The file format of \"%s\" could not be \nrecognized by its" \ 42 42 " extention. Please select one\nfrom the list:") % fname 43 label1 = wx StaticText(self, -1, msg1)44 vboxMain.Add(label1, 0, wx ALL | wxEXPAND, 5)43 label1 = wx.StaticText(self, -1, msg1) 44 vboxMain.Add(label1, 0, wx.ALL | wx.EXPAND, 5) 45 45 46 46 choices = [misc.dictFormats["zip"], # OpenDict plugin … … 50 50 _("\"%s\" dictionary format") % misc.dictFormats["dz"]] 51 51 52 self.box = wx ListBox(self, -1, wxPoint(-1, -1),53 wx Size(-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) 54 54 55 vboxMain.Add(self.box, 1, wx ALL | wxEXPAND, 3)55 vboxMain.Add(self.box, 1, wx.ALL | wx.EXPAND, 3) 56 56 57 hboxButtons = wx BoxSizer(wxHORIZONTAL)57 hboxButtons = wx.BoxSizer(wx.HORIZONTAL) 58 58 59 buttonOK = wx Button(self, wxID_OK, _("OK"))60 hboxButtons.Add(buttonOK, 0, wx ALL, 1)59 buttonOK = wx.Button(self, wx.ID_OK, _("OK")) 60 hboxButtons.Add(buttonOK, 0, wx.ALL, 1) 61 61 62 buttonCancel = wx Button(self, 6302, _("Cancel"))63 hboxButtons.Add(buttonCancel, 0, wx ALL, 1)62 buttonCancel = wx.Button(self, 6302, _("Cancel")) 63 hboxButtons.Add(buttonCancel, 0, wx.ALL, 1) 64 64 65 vboxMain.Add(hboxButtons, 0, wx ALL | wxCENTER, 2)65 vboxMain.Add(hboxButtons, 0, wx.ALL | wx.CENTER, 2) 66 66 67 67 self.SetSizer(vboxMain) 68 68 self.Fit() 69 69 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) 72 72 73 73 def onOK(self, event): trunk/lib/gui/dictconnwin.py
r15 r16 20 20 # 21 21 22 from wxPython.wx import * 23 from wx Python.lib.rcsizer import RowColSizer22 import wx 23 from wx.lib.rcsizer import RowColSizer 24 24 import traceback 25 25 … … 31 31 from lib import misc 32 32 33 _ = wx GetTranslation33 _ = wx.GetTranslation 34 34 35 35 CONNECTION_CHECK_INTERVAL = 400 36 36 37 37 38 class DictConnWindow(wx Frame):39 40 def __init__(self, parent, id, title, pos=wx DefaultPosition,41 size=wx DefaultSize, style=wxDEFAULT_FRAME_STYLE):42 wx Frame.__init__(self, parent, id, title, pos, size, style)38 class 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) 43 43 44 44 self.parent = parent 45 self.app = wx GetApp()46 47 vboxMain = wx BoxSizer(wxVERTICAL)48 49 hboxButtons = wx BoxSizer(wxHORIZONTAL)45 self.app = wx.GetApp() 46 47 vboxMain = wx.BoxSizer(wx.VERTICAL) 48 49 hboxButtons = wx.BoxSizer(wx.HORIZONTAL) 50 50 hboxServer = RowColSizer() 51 51 … … 53 53 # Server address row 54 54 # 55 hboxServer.Add(wx StaticText(self, -1, _("Server: ")),56 flag=wx ALIGN_RIGHT | wxALIGN_CENTER_VERTICAL,55 hboxServer.Add(wx.StaticText(self, -1, _("Server: ")), 56 flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 57 57 row=0, col=0, border=1) 58 58 59 59 servers = ['dict.org', 'localhost'] 60 self.entryServer = wx ComboBox(self, -1,61 self.app.config.get('dictServer'), wx Point(-1, -1),62 wx Size(-1, -1), servers, wxCB_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)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) 66 66 67 67 # 68 68 # Port entry row 69 69 # 70 hboxServer.Add(wx StaticText(self, -1, _("Port: ")),71 flag=wx ALIGN_RIGHT | wxALIGN_CENTER_VERTICAL,70 hboxServer.Add(wx.StaticText(self, -1, _("Port: ")), 71 flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 72 72 row=1, col=0, border=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,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, 77 77 self.app.config.get('dictServerPort')) 78 hboxServer.Add(self.entryPort, flag=wx EXPAND, row=1, col=1, border=1)78 hboxServer.Add(self.entryPort, flag=wx.EXPAND, row=1, col=1, border=1) 79 79 80 80 # 81 81 # Database selection row 82 82 # 83 hboxServer.Add(wx StaticText(self, -1, _("Database: ")),84 flag=wx ALIGN_RIGHT | wxALIGN_CENTER_VERTICAL,83 hboxServer.Add(wx.StaticText(self, -1, _("Database: ")), 84 flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 85 85 row=2, col=0, border=1) 86 86 87 87 self.msgSearchInAll = _("Search in all databases") 88 self.choiceDB = wx ComboBox(self, 1002, self.msgSearchInAll,88 self.choiceDB = wx.ComboBox(self, 1002, self.msgSearchInAll, 89 89 choices=[self.msgSearchInAll], 90 style=wx TE_READONLY)90 style=wx.TE_READONLY) 91 91 self.choiceDB.SetInsertionPoint(0) 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)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) 96 96 97 97 # 98 98 # Encoding selection row 99 99 # 100 hboxServer.Add(wx StaticText(self, -1, _("Character encoding: ")),101 flag=wx ALIGN_RIGHT | wxALIGN_CENTER_VERTICAL,100 hboxServer.Add(wx.StaticText(self, -1, _("Character encoding: ")), 101 flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 102 102 row=3, col=0, border=1) 103 103 104 self.entryEncoding = wx ComboBox(self, 1006,104 self.entryEncoding = wx.ComboBox(self, 1006, 105 105 misc.encodings.keys()[ 106 106 misc.encodings.values().index( 107 107 self.app.config.get('dict-server-encoding'))], 108 wx Point(-1, -1),109 wx Size(-1, -1), misc.encodings.keys(),110 wx CB_DROPDOWN | wxCB_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 | 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, 116 116 # row=3, col=0, rowspan=1, border=1) 117 117 # 118 #self.choiceStrat = wx ComboBox(self, 1006, #size=(-1, 20),118 #self.choiceStrat = wx.ComboBox(self, 1006, #size=(-1, 20), 119 119 # choices=[]) 120 #hboxServer.Add(self.choiceStrat, flag=wx EXPAND, row=3, col=1,120 #hboxServer.Add(self.choiceStrat, flag=wx.EXPAND, row=3, col=1, 121 121 # rowspan=1, border=1) 122 122 # 123 #hboxServer.Add(wx Button(self, 1007, _("Update")), #size=(-1, 18)),124 # flag=wx EXPAND, 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) 125 125 126 126 hboxServer.AddGrowableCol(1) 127 127 128 vboxMain.Add(hboxServer, 1, wx ALL | wxEXPAND, 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 | 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) 137 137 138 138 self.CreateStatusBar() … … 142 142 self.SetSize((500, -1)) 143 143 144 self.timerUpdateDB = wx Timer(self, 1006)145 self.timerConnect = wx Timer(self, 1007)144 self.timerUpdateDB = wx.Timer(self, 1006) 145 self.timerConnect = wx.Timer(self, 1007) 146 146 147 147 self.update = None 148 148 self.connection = None 149 149 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) 158 158 159 159 trunk/lib/gui/dicteditorwin.py
r15 r16 22 22 # TODO: not usable yet, needs some work with encodings, gui, etc. 23 23 24 from wxPython.wx import * 25 from wxPython.lib.rcsizer import RowColSizer 24 from wx.lib.rcsizer import RowColSizer 26 25 import wx 27 26 import os … … 37 36 from lib import enc 38 37 39 _ = wx GetTranslation40 41 42 class EditWordWindow(wx Frame):38 _ = wx.GetTranslation 39 40 41 class EditWordWindow(wx.Frame): 43 42 """Word editor window""" 44 43 45 def __init__(self, word, parent, id, title, pos=wx DefaultPosition,46 size=wx DefaultSize, style=wxDEFAULT_FRAME_STYLE):47 wx Frame.__init__(self, parent, id, title, pos, size, style)48 49 vboxMain = wx BoxSizer(wxVERTICAL)50 hboxButtons = wx BoxSizer(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) 51 50 self.boxInfo = RowColSizer() 52 51 53 52 54 self.boxInfo.Add(wx StaticText(self, -1, _("Word: "), pos=(-1, -1)),55 flag=wx ALIGN_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, 56 55 row=0, col=0, border=1) 57 56 58 self.entryWord = wx TextCtrl(self, -1, word)57 self.entryWord = wx.TextCtrl(self, -1, word) 59 58 self.entryWord.Disable() 60 self.boxInfo.Add(self.entryWord, flag=wx EXPAND,59 self.boxInfo.Add(self.entryWord, flag=wx.EXPAND, 61 60 row=0, col=1, border=1) 62 61 … … 84 83 85 84 self.boxInfo.AddGrowableCol(1) 86 vboxMain.Add(self.boxInfo, 1, wx ALL | wxEXPAND, 2)85 vboxMain.Add(self.boxInfo, 1, wx.ALL | wx.EXPAND, 2) 87 86 88 87 idAdd = wx.NewId() 89 self.buttonAdd = wx Button(self, idAdd, _("Add translation field"))90 vboxMain.Add(self.buttonAdd, 0, wx ALL | wxALIGN_RIGHT, 2)91 92 self.buttonOK = wx Button(self, 6050, _("OK"))93 hboxButtons.Add(self.buttonOK, 0, wx ALL, 1)94 95 self.buttonCancel = wx Button(self, 6051, _("Cancel"))96 hboxButtons.Add(self.buttonCancel, 0, wx ALL, 1)97 98 vboxMain.Add(hboxButtons, 0, wx ALL | 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) 99 98 100 99 self.SetSizer(vboxMain) … … 110 109 """Add empty translation field""" 111 110 112 transLabel = wx StaticText(self, -1, _("Translation #%d: ") \111 transLabel = wx.StaticText(self, -1, _("Translation #%d: ") \ 113 112 % (len(self.textEntries)+1)) 114 113 self.transLabels[len(self.transLabels)] = transLabel … … 117 116 row=len(self.transLabels), col=0, border=1) 118 117 119 text = wx TextCtrl(self, -1,118 text = wx.TextCtrl(self, -1, 120 119 "", 121 120 size=(100, -1)) … … 123 122 self.textEntries[len(self.textEntries)] = text 124 123 125 self.boxInfo.Add(text, flag=wx EXPAND,124 self.boxInfo.Add(text, flag=wx.EXPAND, 126 125 row=len(self.textEntries), 127 126 col=1, border=1) … … 172 171 173 172 # IDs range: 6000-6200 174 class DictEditorWindow(wx Frame):173 class DictEditorWindow(wx.Frame): 175 174 176 175 """Built-in dictionary editor. This tool lets user create and … … 180 179 """Window for adding new word""" 181 180 182 def __init__(self, parent, id, title, pos=wx DefaultPosition,183 size=wx DefaultSize, style=wxDEFAULT_FRAME_STYLE):181 def __init__(self, parent, id, title, pos=wx.DefaultPosition, 182 size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE): 184 183 185 184 EditWordWindow.__init__(self, '', parent, id, title, pos, … … 230 229 231 230 # IDs range: 6000-6003 232 class ConfirmExitWindow(wx Dialog):231 class ConfirmExitWindow(wx.Dialog): 233 232 """Save confirmation dialog""" 234 233 235 def __init__(self, parent, id, title, pos=wx DefaultPosition,236 size=wx DefaultSize, style=wxDEFAULT_DIALOG_STYLE):237 238 wx Dialog.__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) 239 238 240 239 self.parent = self.GetParent() 241 240 242 vboxMain = wx BoxSizer(wxVERTICAL)243 hboxButtons = wx BoxSizer(wxHORIZONTAL)244 245 labelMsg = wx StaticText(self, -1,241 vboxMain = wx.BoxSizer(wx.VERTICAL) 242 hboxButtons = wx.BoxSizer(wx.HORIZONTAL) 243 244 labelMsg = wx.StaticText(self, -1, 246 245 _("Dictionary \"%s\" has been changed") \ 247 246 % parent.name) 248 vboxMain.Add(labelMsg, 1, wx ALL | wxEXPAND, 15)249 250 buttonSave = wx Button(self, 6000, _("Save"))251 hboxButtons.Add(buttonSave, 0, wx ALL | wxEXPAND, 3)252 253 buttonExit = wx Button(self, 6001, _("Do not save"))254 hboxButtons.Add(buttonExit, 0, wx ALL | wxEXPAND, 3)255 256 buttonCancel = wx Button(self, 6002, _("Cancel"))257 hboxButtons.Add(buttonCancel, 0, wx ALL | wxEXPAND, 3)258 259 vboxMain.Add(hboxButtons, 0, wx ALL | 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) 260 259 261 260 self.SetSizer(vboxMain) 262 261 self.Fit() 263 262 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) 267 266 268 267 … … 297 296 298 297 # ------------------------------------------------------------- 299 def __init__(self, parent, id, title, pos=wx DefaultPosition,300 size=wx DefaultSize, style=wxDEFAULT_FRAME_STYLE):301 wx Frame.__init__(self, parent, id, title, pos, size, style)302 303 self.app = wx GetApp()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() 304 303 self.CreateStatusBar() 305 304 … … 310 309 self.cAction = None 311 310 312 vboxMain = wx BoxSizer(wxVERTICAL)313 vboxDict = wx BoxSizer(wxVERTICAL)314 vboxList = wx BoxSizer(wxVERTICAL)315 hboxDict = wx BoxSizer(wxHORIZONTAL)316 vboxEditButtons = wx BoxSizer(wxVERTICAL)317 hboxButtons = wx BoxSizer(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) 318 317 319 318 # Control buttons 320 319 self.controlButtons = [] 321 320 322 self.buttonAdd = wx Button(self, 6000, _("Add"))321 self.buttonAdd = wx.Button(self, 6000, _("Add")) 323 322 self.buttonAdd.SetToolTipString(_("Add word")) 324 323 self.controlButtons.append(self.buttonAdd) 325 324 326 self.buttonEdit = wx Button(self, 6001, _("Edit"))325 self.buttonEdit = wx.Button(self, 6001, _("Edit")) 327 326 self.buttonEdit.SetToolTipString(_("Change translation")) 328 327 self.controlButtons.append(self.buttonEdit) 329 328 330 self.buttonRemove = wx Button(self, 6002, _("Remove"))329 self.buttonRemove = wx.Button(self, 6002, _("Remove")) 331 330 self.buttonRemove.SetToolTipString(_("Remove selected word")) 332 331 self.controlButtons.append(self.buttonRemove) 333 332 334 self.buttonSort = wx Button(self, 6004, _("Sort"))333 self.buttonSort = wx.Button(self, 6004, _("Sort")) 335 334 self.buttonSort.SetToolTipString(_("Sort word list")) 336 335 self.controlButtons.append(self.buttonSort) 337 336 338 self.buttonSave = wx Button(self, 6005, _("Save"))337 self.buttonSave = wx.Button(self, 6005, _("Save")) 339 338 self.buttonSave.SetToolTipString(_("Save words to file")) 340 339 self.controlButtons.append(self.buttonSave) 341 340 342 self.buttonSaveAs = wx Button(self, 6006, _("Save As..."))341 self.buttonSaveAs = wx.Button(self, 6006, _("Save As...")) 343 342 self.buttonSaveAs.SetToolTipString(_("Save with a different file name")) 344 343 self.controlButtons.append(self.buttonSaveAs) … … 346 345 for button in self.controlButtons: 347 346 button.Disable() 348 vboxEditButtons.Add(button, 0, wx ALL | wxEXPAND, 1)349 350 panelList = wx Panel(self, -1)351 sbSizerList = wx StaticBoxSizer(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, 352 351 _("Word List")), 353 wx VERTICAL)354 355 self.list = wx ListBox(panelList, 6020,356 wx Point(-1, -1),357 wx Size(-1, -1),352 wx.VERTICAL) 353 354 self.list = wx.ListBox(panelList, 6020, 355 wx.Point(-1, -1), 356 wx.Size(-1, -1), 358 357 [], 359 wx LB_SINGLE | wxSUNKEN_BORDER)358 wx.LB_SINGLE | wx.SUNKEN_BORDER) 360 359 361 sbSizerList.Add(self.list, 1, wx ALL | wxEXPAND, 0)360 sbSizerList.Add(self.list, 1, wx.ALL | wx.EXPAND, 0) 362 361 panelList.SetSizer(sbSizerList) 363 panelList.SetAutoLayout( true)362 panelList.SetAutoLayout(True) 364 363 sbSizerList.Fit(panelList) 365 364 366 hboxDict.Add(panelList, 1, wx ALL | wxEXPAND, 0)367 hboxDict.Add(vboxEditButtons, 0, wx ALL | wxEXPAND, 5)368 vboxDict.Add(hboxDict, 1, wx ALL | wxEXPAND, 0)369 vboxMain.Add(vboxDict, 1, wx ALL | wxEXPAND, 10)370 371 self.buttonNew = wx Button(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...")) 372 371 self.buttonNew.SetToolTipString(_("Start new dictionary")) 373 hboxButtons.Add(self.buttonNew, 0, wx ALL | wxEXPAND, 1)374 375 self.buttonOpen = wx Button(self, 6031, _("Open..."))372 hboxButtons.Add(self.buttonNew, 0, wx.ALL | wx.EXPAND, 1) 373 374 self.buttonOpen = wx.Button(self, 6031, _("Open...")) 376 375 self.buttonOpen.SetToolTipString(_("Open dictionary file")) 377 hboxButtons.Add(self.buttonOpen, 0, wx ALL | wxEXPAND, 1)378 379 self.buttonClose = wx Button(self, 6032, _("Close"))376 hboxButtons.Add(self.buttonOpen, 0, wx.ALL | wx.EXPAND, 1) 377 378 self.buttonClose = wx.Button(self, 6032, _("Close")) 380 379 self.buttonClose.SetToolTipString(_("Close editor window")) 381 hboxButtons.Add(self.buttonClose, 0, wx ALL | wxEXPAND, 1)382 383 vboxMain.Add(hboxButtons, 0, wx ALL | wxALIGN_RIGHT, 2)384 385 self.SetIcon(wx Icon(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, 386 385 "pixmaps", 387 386 "icon-24x24.png"), 388 wx BITMAP_TYPE_PNG))387 wx.BITMAP_TYPE_PNG)) 389 388 390 389 self.SetSizer(vboxMain) … … 393 392 self.Bind(wx.EVT_BUTTON, self.onCreate, self.buttonNew) 394 393 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) 405 404 406 405 … … 411 410 window = self.AddWordWindow(self, -1, _("New Word"), 412 411 size=(-1, -1), pos=(-1, -1), 413 style=wx DEFAULT_FRAME_STYLE)412 style=wx.DEFAULT_FRAME_STYLE) 414 413 window.CentreOnScreen() 415 414 window.Show(True) … … 426 425 window = EditWordWindow(word, self, -1, _("Edit Word"), 427 426 size=(-1, -1), 428 style=wx DEFAULT_FRAME_STYLE)427 style=wx.DEFAULT_FRAME_STYLE) 429 428 window.CentreOnScreen() 430 429 window.Show(True) … … 599 598 wildCard = "Slowo dictionaries (*.dwa)|*.dwa" 600 599 601 dialog = wx FileDialog(self, message=_("Choose dictionary file"),602 wildcard=wildCard, style=wx OPEN|wxMULTIPLE)603 if dialog.ShowModal() == wx ID_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: 604 603 name = os.path.split(dialog.GetPaths()[0])[1] 605 604 self.filePath = dialog.GetPaths()[0] trunk/lib/gui/errorwin.py
r15 r16 21 21 # Module: gui.errorwin 22 22 23 from wxPython.wx import * 23 import wx 24 24 import sys 25 25 import os 26 26 import traceback 27 27 28 _ = wx GetTranslation28 _ = wx.GetTranslation 29 29 30 30 … … 35 35 """Show error message dialog""" 36 36 37 window = wx MessageDialog(None,37 window = wx.MessageDialog(None, 38 38 msg, 39 39 title, 40 wx OK | wxICON_ERROR)40 wx.OK | wx.ICON_ERROR) 41 41 window.CenterOnScreen() 42 42 window.ShowModal() … … 47 47 """Show info message dialog""" 48 48 49 window = wx MessageDialog(None,49 window = wx.MessageDialog(None, 50 50 msg, 51 51 title, 52 wx OK | wxICON_INFORMATION)52 wx.OK | wx.ICON_INFORMATION) 53 53 window.CenterOnScreen() 54 54 window.ShowModal() … … 57 57 58 58 59 class ErrorWindow(wx Frame):59 class ErrorWindow(wx.Frame): 60 60 61 61 """This window is shown when OpenDict can't start because 62 62 of some error.""" 63 63 64 def __init__(self, parent, id, title, error, pos=wx DefaultPosition,65 size=wx DefaultSize, style=wxCENTRE):66 wx Frame.__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) 67 67 68 68 raise "Deprecated" 69 69 70 vbox = wx BoxSizer(wxVERTICAL)70 vbox = wx.BoxSizer(wx.VERTICAL) 71 71 72 vbox.Add(wx StaticText(self, -1, _("An error occured:")), 0,73 wx ALL | wxEXPAND, 5)72 vbox.Add(wx.StaticText(self, -1, _("An error occured:")), 0, 73 wx.ALL | wx.EXPAND, 5) 74 74 75 errMsg = wx TextCtrl(self, -1, size=(-1, 200),76 style=wx TE_MULTILINE | wxTE_READONLY)75 errMsg = wx.TextCtrl(self, -1, size=(-1, 200), 76 style=wx.TE_MULTILINE | wx.TE_READONLY) 77 77 errMsg.WriteText(error) 78 78 vbox.Add(errMsg, 1, 79 wx ALL | wxEXPAND, 10)79 wx.ALL | wx.EXPAND, 10) 80 80 81 vbox.Add(wx StaticText(self, -1, msg), 0,82 wx ALL | wxEXPAND, 5)81 vbox.Add(wx.StaticText(self, -1, msg), 0, 82 wx.ALL | wx.EXPAND, 5) 83 83 84 self.buttonClose = wx Button(self, 200, _("Close"))85 vbox.Add(self.buttonClose, 0, wx ALL | wxCENTRE, 2)84 self.buttonClose = wx.Button(self, 200, _("Close")) 85 vbox.Add(self.buttonClose, 0, wx.ALL | wx.CENTRE, 2) 86 86 87 87 … … 89 89 self.Fit() 90 90 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 22 22 # Module: gui.helpwin 23 23 24 from wxPython.wx import *25 from wxPython.html import *24 #from wx import * 25 #from wx.html import * 26 26 import wx 27 27 import os … … 32 32 from lib import info 33 33 34 _ = wx GetTranslation35 36 37 class LicenseWindow(wx Frame):34 _ = wx.GetTranslation 35 36 37 class LicenseWindow(wx.Frame): 38 38 """Licence window class""" 39 39 40 def __init__(self, parent, id, title, pos=wx DefaultPosition,41 size=wx DefaultSize, style=wxCENTRE):42 wx Frame.__init__(self, parent, id, title, pos, size, style)43 44 vbox = wx BoxSizer(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) 45 45 46 46 # … … 55 55 data = "Error: <i>licence file not found</i>" 56 56 57 scWinAbout = wx ScrolledWindow(self, -1, wxPyDefaultPosition,58 wx Size(-1, -1))59 60 htmlWin = wx HtmlWindow(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) 61 61 htmlWin.SetFonts('Helvetica', 'Fixed', [10]*5) 62 62 htmlWin.SetPage(data) 63 63 64 scBox = wx BoxSizer(wxVERTICAL)65 scBox.Add(htmlWin, 1, wx ALL | wxEXPAND, 1)64 scBox = wx.BoxSizer(wx.VERTICAL) 65 scBox.Add(htmlWin, 1, wx.ALL | wx.EXPAND, 1) 66 66 scWinAbout.SetSizer(scBox) 67 vbox.Add(scWinAbout, 1, wx ALL | wxEXPAND, 5)68 69 self.buttonClose = wx Button(self, 2002, _("Close"))70 vbox.Add(self.buttonClose, 0, wx ALL | 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) 71 71 72 72 self.SetSizer(vbox) 73 73 74 EVT_BUTTON(self, 2002, self.onClose)74 wx.EVT_BUTTON(self, 2002, self.onClose) 75 75 76 76 … … 81 81 82 82 83 class CreditsWindow(wx Dialog):83 class CreditsWindow(wx.Dialog): 84 84 """Credits window class""" 85 85 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(wxVERTICAL)91 92 nb = wx Notebook(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) 93 93 94 94 # "Written by" panel 95 writePanel = wx Panel(nb, -1)96 vboxWrite = wx BoxSizer(wxVERTICAL)95 writePanel = wx.Panel(nb, -1) 96 vboxWrite = wx.BoxSizer(wx.VERTICAL) 97 97 writtenString = unicode("Martynas Jocius <martynas.jocius@idiles.com>\n" 98 98 "Nerijus BaliĆ«nas <nerijusb@dtiltas.lt>\n" … … 100 100 "UTF-8") 101 101 written = enc.toWX(writtenString) 102 labelWrite = wx StaticText(writePanel, -1, written)103 vboxWrite.Add(labelWrite, 0, wx ALL, 10)102 labelWrite = wx.StaticText(writePanel, -1, written) 103 vboxWrite.Add(labelWrite, 0, wx.ALL, 10) 104 104 writePanel.SetSizer(vboxWrite) 105 105 … … 107 107 108 108 # "Translations" panel 109 tPanel = wx Panel(nb, -1)110 vboxTP = wx BoxSizer(wxVERTICAL)109 tPanel = wx.Panel(nb, -1) 110 vboxTP = wx.BoxSizer(wx.VERTICAL) 111 111 transString = unicode("Martynas Jocius <martynas.jocius@idiles.com>", 112 112 "UTF-8") 113 113 trans = enc.toWX(transString) 114 labelTP = wx StaticText(tPanel, -1, trans)115 vboxTP.Add(labelTP, 0, wx ALL, 10)114 labelTP = wx.StaticText(tPanel, -1, trans) 115 vboxTP.Add(labelTP, 0, wx.ALL, 10) 116 116
