1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524
|
'''
====================================================================
Copyright (c) 2003-2006 Barry A Scott. All rights reserved.
This software is licensed as described in the file LICENSE.txt,
which you should have received as part of this distribution.
====================================================================
wb_dialogs.py
'''
import wx
import os
id_log_message_text = wx.NewId()
id_last_log_message = wx.NewId()
class DialogBuildingBlock(wx.Dialog):
def __init__( self, parent, title ):
wx.Dialog.__init__( self, parent, -1, title )
self.title = title
self.all_filenames = []
self.add_filename_list_field = False
self.add_log_message_field = False
self.add_force_field = False
def initControls( self ):
self.v_sizer = wx.BoxSizer( wx.VERTICAL )
self.h_sizer = wx.BoxSizer( wx.HORIZONTAL )
self.filename_list = None
if self.add_filename_list_field:
self.filename_list = wx.ListCtrl( self, -1, wx.DefaultPosition, wx.Size( 600, 200 ), wx.LC_REPORT|wx.NO_BORDER )
self.filename_list.InsertColumn( 0, "Status" )
self.filename_list.SetColumnWidth( 0, 50 )
self.filename_list.InsertColumn( 1, "Filename" )
self.filename_list.SetColumnWidth( 1, 1000 )
for index, _ in enumerate( self.all_filenames ):
self.filename_list.InsertStringItem( index, self.all_filenames[index][0] )
self.filename_list.SetStringItem( index, 1, self.all_filenames[index][1] )
self.log_message_ctrl = None
if self.add_log_message_field:
self.log_message_ctrl = wx.TextCtrl( self, id_log_message_text, size=wx.Size( 600, 200 ), style=wx.TE_MULTILINE )
self.force_checkbox_ctrl = None
if self.add_force_field:
self.force_checkbox_ctrl = wx.CheckBox( self, -1, "Force" )
self.force_checkbox_ctrl.SetValue( False )
self.button_ok = wx.Button( self, wx.ID_OK, " OK " )
self.button_cancel = wx.Button( self, wx.ID_CANCEL, " Cancel " )
self.button_ok.SetDefault()
self.initExtraButtons()
self.h_sizer.Add( (60, 20), 1, wx.EXPAND)
self.h_sizer.Add( self.button_ok, 0, wx.EXPAND|wx.EAST, 15)
self.h_sizer.Add( self.button_cancel, 0, wx.EXPAND|wx.EAST, 2 )
if self.add_filename_list_field:
self.v_sizer.Add( self.filename_list, 0, wx.EXPAND|wx.ALL, 5 )
if self.add_log_message_field:
self.v_sizer.Add( self.log_message_ctrl, 0, wx.EXPAND|wx.ALL, 5 )
if self.add_force_field:
self.v_sizer.Add( self.force_checkbox_ctrl, 0, wx.EXPAND|wx.ALL, 5 )
self.v_sizer.Add( self.h_sizer, 0, wx.EXPAND|wx.ALL, 5 )
self.SetAutoLayout( True )
self.SetSizer( self.v_sizer )
self.v_sizer.Fit( self )
self.Layout()
self.CentreOnParent()
wx.EVT_BUTTON( self, wx.ID_OK, self.OnOk )
wx.EVT_BUTTON( self, wx.ID_CANCEL, self.OnCancel )
def initExtraButtons( self ):
pass
def OnOk( self, event ):
self.EndModal( wx.ID_OK )
def OnCancel( self, event ):
self.EndModal( wx.ID_CANCEL )
def getLogMessage( self ):
return self.log_message_ctrl.GetValue()
def getForce( self ):
return self.force_checkbox_ctrl.GetValue() != 0
class ConfirmAction(DialogBuildingBlock):
def __init__( self, parent, title, all_filenames, force_field=False ):
DialogBuildingBlock.__init__( self, parent, title )
self.all_filenames = all_filenames
self.add_filename_list_field = True
self.add_force_field = force_field
self.initControls()
class LogMessage(DialogBuildingBlock):
def __init__( self, parent, title, all_filenames, message_filename=None, force_field=False ):
DialogBuildingBlock.__init__( self, parent, title )
self.all_filenames = all_filenames
self.add_filename_list_field = True
self.add_log_message_field = True
self.add_force_field = force_field
self.message_filename = message_filename
self.last_log_message_text = None
if self.message_filename is not None:
try:
self.last_log_message_text = file( self.message_filename, 'r' ).read().decode('utf-8').strip()
except EnvironmentError:
self.last_log_message_text = ''
self.initControls()
def initExtraButtons( self ):
if self.last_log_message_text is not None:
self.button_last_log_message = wx.Button( self, id_last_log_message, "Insert Last Message" )
self.button_last_log_message.Enable( len(self.last_log_message_text) > 0 )
self.h_sizer.Add( self.button_last_log_message )
self.button_ok.Enable( False )
wx.EVT_BUTTON( self, id_last_log_message, self.OnInsertLastLogMessage )
wx.EVT_TEXT( self, id_log_message_text, self.OnLogMessageChanged )
def OnInsertLastLogMessage( self, event ):
self.log_message_ctrl.WriteText( self.last_log_message_text )
self.button_ok.Enable( True )
def OnLogMessageChanged( self, event ):
self.button_ok.Enable( len( self.log_message_ctrl.GetValue().strip() ) > 0 )
def OnOk( self, event ):
self.EndModal( wx.ID_OK )
try:
file( self.message_filename, 'w' ).write( self.getLogMessage().encode('utf-8') )
except (IOError,OSError):
pass
class GetCredentials(wx.Dialog):
def __init__( self, parent, title, username, may_save ):
wx.Dialog.__init__( self, parent, -1, title )
self.g_sizer = wx.FlexGridSizer( 0, 2, 0, 0 )
self.g_sizer.AddGrowableCol( 1 )
self.border = wx.StaticBox( self, -1, 'Credentials' )
self.box = wx.StaticBoxSizer( self.border, wx.VERTICAL )
self.box.Add( self.g_sizer, 0, wx.EXPAND )
self.username_label = wx.StaticText( self, -1, 'Username:' )
self.username_ctrl = wx.TextCtrl( self, -1, username )
self.g_sizer.Add( self.username_label, 1, wx.EXPAND|wx.NORTH|wx.ALIGN_RIGHT, 3 )
self.g_sizer.Add( self.username_ctrl, 0, wx.EXPAND|wx.EAST, 5 )
self.password_label = wx.StaticText(self, -1, 'Password:' )
self.password_ctrl = wx.TextCtrl(self, -1, '', style=wx.TE_PASSWORD )
self.g_sizer.Add( self.password_label, 1, wx.EXPAND|wx.NORTH|wx.ALIGN_RIGHT, 3 )
self.g_sizer.Add( self.password_ctrl, 0, wx.EXPAND|wx.EAST, 5 )
self.save_ctrl = wx.CheckBox( self, -1, "Always uses these credentials" )
self.save_ctrl.SetValue( may_save )
self.g_sizer.Add( self.save_ctrl, 1, wx.EXPAND|wx.NORTH|wx.ALIGN_RIGHT, 3 )
self.g_sizer.Add( (1, 1) )
self.button_ok = wx.Button( self, wx.ID_OK, ' OK ' )
self.button_ok.SetDefault()
self.button_cancel = wx.Button( self, wx.ID_CANCEL, ' Cancel ' )
self.h_sizer_buttons = wx.BoxSizer( wx.HORIZONTAL )
self.h_sizer_buttons.Add( (250, 20), 1, wx.EXPAND)
self.h_sizer_buttons.Add( self.button_ok, 0, wx.EXPAND|wx.EAST, 15 )
self.h_sizer_buttons.Add( self.button_cancel, 0, wx.EXPAND|wx.EAST, 2 )
self.v_sizer = wx.BoxSizer( wx.VERTICAL )
self.v_sizer.Add( self.box, 0, wx.EXPAND|wx.ALL, 5 )
self.v_sizer.Add( self.h_sizer_buttons, 0, wx.EXPAND|wx.ALL, 5 )
self.SetAutoLayout( True )
self.SetSizer( self.v_sizer )
self.v_sizer.Fit( self )
self.Layout()
self.CentreOnParent()
wx.EVT_BUTTON( self, wx.ID_OK, self.OnOk )
wx.EVT_BUTTON( self, wx.ID_CANCEL, self.OnCancel )
def OnOk( self, event ):
self.EndModal( wx.ID_OK )
def OnCancel( self, event ):
self.EndModal( wx.ID_CANCEL )
def getUsername( self ):
return self.username_ctrl.GetValue()
def getPassword( self ):
return self.password_ctrl.GetValue()
def getSaveCredentials( self ):
return self.save_ctrl.GetValue() != 0
class GetServerTrust(wx.Dialog):
def __init__( self, parent, realm, info_list, may_save ):
wx.Dialog.__init__( self, parent, -1, 'Trust server %s' % realm )
self.g_sizer = wx.FlexGridSizer( 0, 2, 0, 0 )
self.g_sizer.AddGrowableCol( 1 )
self.border = wx.StaticBox( self, -1, 'Server Certificate' )
self.box = wx.StaticBoxSizer( self.border, wx.VERTICAL )
self.box.Add( self.g_sizer, 0, wx.EXPAND )
for key, value in info_list:
self.addRow( key, value )
self.save_ctrl = wx.CheckBox( self, -1, "Always trust this server" )
self.save_ctrl.SetValue( may_save )
self.g_sizer.Add( self.save_ctrl, 1, wx.EXPAND|wx.NORTH|wx.ALIGN_RIGHT, 3 )
self.g_sizer.Add( (1, 1) )
self.button_ok = wx.Button( self, wx.ID_OK, ' OK ' )
self.button_ok.SetDefault()
self.button_cancel = wx.Button( self, wx.ID_CANCEL, ' Cancel ' )
self.h_sizer_buttons = wx.BoxSizer( wx.HORIZONTAL )
self.h_sizer_buttons.Add( (250, 20), 1, wx.EXPAND)
self.h_sizer_buttons.Add( self.button_ok, 0, wx.EXPAND|wx.EAST, 15 )
self.h_sizer_buttons.Add( self.button_cancel, 0, wx.EXPAND|wx.EAST, 2 )
self.v_sizer = wx.BoxSizer( wx.VERTICAL )
self.v_sizer.Add( self.box, 0, wx.EXPAND|wx.ALL, 5 )
self.v_sizer.Add( self.h_sizer_buttons, 0, wx.EXPAND|wx.ALL, 5 )
self.SetAutoLayout( True )
self.SetSizer( self.v_sizer )
self.v_sizer.Fit( self )
self.Layout()
self.CentreOnParent()
wx.EVT_BUTTON( self, wx.ID_OK, self.OnOk )
wx.EVT_BUTTON( self, wx.ID_CANCEL, self.OnCancel )
def addRow( self, label, value ):
label_ctrl = wx.StaticText( self, -1, label, style=wx.ALIGN_RIGHT )
value_ctrl = wx.TextCtrl( self, -1, str(value), style=wx.TE_READONLY )
self.g_sizer.Add( label_ctrl, 1, wx.EXPAND|wx.ALL|wx.ALIGN_RIGHT, 3 )
self.g_sizer.Add( value_ctrl, 0, wx.EXPAND, 5 )
def OnOk( self, event ):
self.EndModal( wx.ID_OK )
def OnCancel( self, event ):
self.EndModal( wx.ID_CANCEL )
def getSaveTrust( self ):
return self.save_ctrl.GetValue() != 0
class AddDialog(wx.Dialog):
def __init__( self, parent, title, filename, force=None ):
wx.Dialog.__init__( self, parent, -1, title )
self.g_sizer = wx.FlexGridSizer( 0, 2, 0, 0 )
self.g_sizer.AddGrowableCol( 1 )
self.add_border = wx.StaticBox( self, -1, 'Add' )
self.add_box = wx.StaticBoxSizer( self.add_border, wx.VERTICAL )
self.add_box.Add( self.g_sizer, 0, wx.EXPAND )
self.filename_text = wx.StaticText( self, -1, 'From:' )
self.filename_ctrl = wx.StaticText( self, -1, filename )
self.g_sizer.Add( self.filename_text, 1, wx.EXPAND|wx.NORTH|wx.ALIGN_RIGHT, 3 )
self.g_sizer.Add( self.filename_ctrl, 0, wx.EXPAND|wx.EAST, 5 )
self.force_ctrl = wx.CheckBox( self, -1, "Force add" )
self.force_ctrl.SetValue( force )
self.g_sizer.Add( self.force_ctrl, 1, wx.EXPAND|wx.NORTH|wx.ALIGN_RIGHT, 3 )
self.g_sizer.Add( (1, 1) )
self.button_ok = wx.Button( self, wx.ID_OK, ' OK ' )
self.button_ok.SetDefault()
self.button_cancel = wx.Button( self, wx.ID_CANCEL, ' Cancel ' )
self.h_sizer_buttons = wx.BoxSizer( wx.HORIZONTAL )
self.h_sizer_buttons.Add( (150, 20), 1, wx.EXPAND )
self.h_sizer_buttons.Add( self.button_ok, 0, wx.EXPAND|wx.EAST, 15 )
self.h_sizer_buttons.Add( self.button_cancel, 0, wx.EXPAND|wx.EAST, 2 )
self.v_sizer = wx.BoxSizer( wx.VERTICAL )
self.v_sizer.Add( self.add_box, 0, wx.EXPAND|wx.ALL, 5 )
self.v_sizer.Add( self.h_sizer_buttons, 0, wx.EXPAND|wx.ALL, 5 )
self.SetAutoLayout( True )
self.SetSizer( self.v_sizer )
self.v_sizer.Fit( self )
self.Layout()
self.CentreOnParent()
wx.EVT_BUTTON( self, wx.ID_OK, self.OnOk )
wx.EVT_BUTTON( self, wx.ID_CANCEL, self.OnCancel )
def OnOk( self, event ):
self.EndModal( wx.ID_OK )
def OnCancel( self, event ):
self.EndModal( wx.ID_CANCEL )
def getForce( self ):
if self.force_ctrl is None:
return False
return self.force_ctrl.GetValue() != 0
class RenameFile(wx.Dialog):
def __init__( self, parent, title, old_filename, force=None ):
wx.Dialog.__init__( self, parent, -1, title )
self.g_sizer = wx.FlexGridSizer( 0, 2, 0, 0 )
self.g_sizer.AddGrowableCol( 1 )
self.rename_border = wx.StaticBox( self, -1, 'Rename' )
self.rename_box = wx.StaticBoxSizer( self.rename_border, wx.VERTICAL )
self.rename_box.Add( self.g_sizer, 0, wx.EXPAND )
self.old_filename_text = wx.StaticText( self, -1, 'From:' )
self.old_filename_ctrl = wx.StaticText( self, -1, old_filename )
self.g_sizer.Add( self.old_filename_text, 1, wx.EXPAND|wx.NORTH|wx.ALIGN_RIGHT, 3 )
self.g_sizer.Add( self.old_filename_ctrl, 0, wx.EXPAND|wx.EAST, 5 )
self.new_filename_text = wx.StaticText( self, -1, 'To:' )
self.new_filename_ctrl = wx.TextCtrl( self, -1, old_filename )
self.g_sizer.Add( self.new_filename_text, 1, wx.EXPAND|wx.NORTH|wx.ALIGN_RIGHT, 3 )
self.g_sizer.Add( self.new_filename_ctrl, 0, wx.EXPAND|wx.EAST, 5 )
if force is None:
self.force_ctrl = None
else:
self.force_ctrl = wx.CheckBox( self, -1, "Force rename" )
self.force_ctrl.SetValue( force )
self.g_sizer.Add( self.force_ctrl, 1, wx.EXPAND|wx.NORTH|wx.ALIGN_RIGHT, 3 )
self.g_sizer.Add( (1, 1) )
self.button_ok = wx.Button( self, wx.ID_OK, ' OK ' )
self.button_ok.SetDefault()
self.button_cancel = wx.Button( self, wx.ID_CANCEL, ' Cancel ' )
self.h_sizer_buttons = wx.BoxSizer( wx.HORIZONTAL )
self.h_sizer_buttons.Add( (150, 20), 1, wx.EXPAND )
self.h_sizer_buttons.Add( self.button_ok, 0, wx.EXPAND|wx.EAST, 15 )
self.h_sizer_buttons.Add( self.button_cancel, 0, wx.EXPAND|wx.EAST, 2 )
self.v_sizer = wx.BoxSizer( wx.VERTICAL )
self.v_sizer.Add( self.rename_box, 0, wx.EXPAND|wx.ALL, 5 )
self.v_sizer.Add( self.h_sizer_buttons, 0, wx.EXPAND|wx.ALL, 5 )
self.SetAutoLayout( True )
self.SetSizer( self.v_sizer )
self.v_sizer.Fit( self )
self.Layout()
self.CentreOnParent()
wx.EVT_BUTTON( self, wx.ID_OK, self.OnOk )
wx.EVT_BUTTON( self, wx.ID_CANCEL, self.OnCancel )
def OnOk( self, event ):
self.EndModal( wx.ID_OK )
def OnCancel( self, event ):
self.EndModal( wx.ID_CANCEL )
def getNewFilename( self ):
return self.new_filename_ctrl.GetValue()
def getForce( self ):
if self.force_ctrl is None:
return False
return self.force_ctrl.GetValue() != 0
class GetFilename(wx.Dialog):
def __init__( self, parent, title, border_title ):
wx.Dialog.__init__( self, parent, -1, title )
self.g_sizer = wx.FlexGridSizer( 0, 2, 0, 0 )
self.g_sizer.AddGrowableCol( 1 )
self.rename_border = wx.StaticBox( self, -1, border_title )
self.rename_box = wx.StaticBoxSizer( self.rename_border, wx.VERTICAL )
self.rename_box.Add( self.g_sizer, 0, wx.EXPAND )
self.new_filename_text = wx.StaticText( self, -1, 'Name:' )
self.new_filename_ctrl = wx.TextCtrl( self, -1, 'New Folder' )
self.g_sizer.Add( self.new_filename_text, 1, wx.EXPAND|wx.NORTH|wx.ALIGN_RIGHT, 3 )
self.g_sizer.Add( self.new_filename_ctrl, 0, wx.EXPAND|wx.EAST, 5 )
self.button_ok = wx.Button( self, wx.ID_OK, ' OK ' )
self.button_ok.SetDefault()
self.button_cancel = wx.Button( self, wx.ID_CANCEL, ' Cancel ' )
self.h_sizer_buttons = wx.BoxSizer( wx.HORIZONTAL )
self.h_sizer_buttons.Add( (150, 20), 1, wx.EXPAND )
self.h_sizer_buttons.Add( self.button_ok, 0, wx.EXPAND|wx.EAST, 15 )
self.h_sizer_buttons.Add( self.button_cancel, 0, wx.EXPAND|wx.EAST, 2 )
self.v_sizer = wx.BoxSizer( wx.VERTICAL )
self.v_sizer.Add( self.rename_box, 0, wx.EXPAND|wx.ALL, 5 )
self.v_sizer.Add( self.h_sizer_buttons, 0, wx.EXPAND|wx.ALL, 5 )
self.SetAutoLayout( True )
self.SetSizer( self.v_sizer )
self.v_sizer.Fit( self )
self.Layout()
self.CentreOnParent()
wx.EVT_BUTTON( self, wx.ID_OK, self.OnOk )
wx.EVT_BUTTON( self, wx.ID_CANCEL, self.OnCancel )
def OnOk( self, event ):
self.EndModal( wx.ID_OK )
def OnCancel( self, event ):
self.EndModal( wx.ID_CANCEL )
def getNewFilename( self ):
return self.new_filename_ctrl.GetValue()
class NewFile(wx.Dialog):
template_suffix = '.template'
def __init__( self, parent, template_dir ):
wx.Dialog.__init__( self, parent, -1, 'New File' )
self.g_sizer = wx.FlexGridSizer( 0, 2, 0, 0 )
self.g_sizer.AddGrowableCol( 1 )
self.newfile_border = wx.StaticBox( self, -1, 'New File' )
self.newfile_box = wx.StaticBoxSizer( self.newfile_border, wx.VERTICAL )
self.newfile_box.Add( self.g_sizer, 0, wx.EXPAND )
self.newfile_text = wx.StaticText( self, -1, 'New Filename:' )
self.newfile_ctrl = wx.TextCtrl( self, -1, '' )
self.g_sizer.Add( self.newfile_text, 1, wx.EXPAND|wx.NORTH|wx.ALIGN_RIGHT, 5 )
self.g_sizer.Add( self.newfile_ctrl, 0, wx.EXPAND|wx.ALL, 5 )
try:
self.template_file_list = [filename[:-len(self.template_suffix)]
for filename in os.listdir( template_dir )
if filename.lower().endswith( self.template_suffix )]
except EnvironmentError:
self.template_file_list = []
self.template_text = wx.StaticText( self, -1, 'Template:' )
self.template_list = wx.Choice( self, -1, choices=self.template_file_list )
self.template_list.SetSelection( 0 )
self.g_sizer.Add( self.template_text, 1, wx.EXPAND|wx.NORTH|wx.ALIGN_RIGHT, 5 )
self.g_sizer.Add( self.template_list, 0, wx.EXPAND|wx.ALL, 5 )
self.button_ok = wx.Button( self, wx.ID_OK, ' OK ' )
self.button_ok.SetDefault()
self.button_cancel = wx.Button( self, wx.ID_CANCEL, ' Cancel ' )
self.h_sizer_buttons = wx.BoxSizer( wx.HORIZONTAL )
self.h_sizer_buttons.Add( (150, 20), 1, wx.EXPAND )
self.h_sizer_buttons.Add( self.button_ok, 0, wx.EXPAND|wx.EAST, 15 )
self.h_sizer_buttons.Add( self.button_cancel, 0, wx.EXPAND|wx.EAST, 2 )
self.v_sizer = wx.BoxSizer( wx.VERTICAL )
self.v_sizer.Add( self.newfile_box, 0, wx.EXPAND|wx.ALL, 5 )
self.v_sizer.Add( self.h_sizer_buttons, 0, wx.EXPAND|wx.ALL, 5 )
self.SetAutoLayout( True )
self.SetSizer( self.v_sizer )
self.v_sizer.Fit( self )
self.Layout()
self.CentreOnParent()
wx.EVT_BUTTON( self, wx.ID_OK, self.OnOk )
wx.EVT_BUTTON( self, wx.ID_CANCEL, self.OnCancel )
def OnOk( self, event ):
self.EndModal( wx.ID_OK )
def OnCancel( self, event ):
self.EndModal( wx.ID_CANCEL )
def getNewFilename( self ):
return self.newfile_ctrl.GetValue()
def getTemplateFilename( self ):
index = self.template_list.GetCurrentSelection()
print 'getTemplateFilename',len(self.template_file_list),index
if index >= 0 and len(self.template_file_list) > index:
return self.template_file_list[ index ] + self.template_suffix
else:
return None
|