1 """PyAlaCarte and PyAlaMode editors."""
3 __author__
= "Patrick K. O'Brien <pobrien@orbtech.com>"
5 __revision__
= "$Revision$"[11:-2]
9 from buffer import Buffer
14 from shell
import Shell
18 class EditorFrame(frame
.Frame
):
19 """Frame containing one editor."""
21 def __init__(self
, parent
=None, id=-1, title
='PyAlaCarte',
22 pos
=wx
.DefaultPosition
, size
=(800, 600),
23 style
=wx
.DEFAULT_FRAME_STYLE | wx
.NO_FULL_REPAINT_ON_RESIZE
,
25 """Create EditorFrame instance."""
26 frame
.Frame
.__init
__(self
, parent
, id, title
, pos
, size
, style
)
28 self
.buffer = None # Current buffer.
30 self
._defaultText
= title
+ ' - the tastiest Python editor.'
31 self
._statusText
= self
._defaultText
32 self
.SetStatusText(self
._statusText
)
33 self
.Bind(wx
.EVT_IDLE
, self
.OnIdle
)
36 self
.bufferCreate(filename
)
39 """Setup prior to first buffer creation.
41 Useful for subclasses."""
44 def setEditor(self
, editor
):
46 self
.buffer = self
.editor
.buffer
47 self
.buffers
[self
.buffer.id] = self
.buffer
49 def OnAbout(self
, event
):
50 """Display an About window."""
51 title
= 'About PyAlaCarte'
52 text
= 'Another fine, flaky program.'
53 dialog
= wx
.MessageDialog(self
, text
, title
,
54 wx
.OK | wx
.ICON_INFORMATION
)
58 def OnClose(self
, event
):
59 """Event handler for closing."""
60 for buffer in self
.buffers
.values():
62 if buffer.hasChanged():
63 cancel
= self
.bufferSuggestSave()
64 if cancel
and event
.CanVeto():
69 def OnIdle(self
, event
):
70 """Event handler for idle time."""
72 if hasattr(self
, 'notebook'):
77 def _updateStatus(self
):
78 """Show current status information."""
79 if self
.editor
and hasattr(self
.editor
, 'getStatus'):
80 status
= self
.editor
.getStatus()
81 text
= 'File: %s | Line: %d | Column: %d' % status
83 text
= self
._defaultText
84 if text
!= self
._statusText
:
85 self
.SetStatusText(text
)
86 self
._statusText
= text
88 def _updateTabText(self
):
89 """Show current buffer information on notebook tab."""
91 ## notebook = self.notebook
92 ## selection = notebook.GetSelection()
93 ## if selection == -1:
95 ## text = notebook.GetPageText(selection)
96 ## window = notebook.GetPage(selection)
97 ## if window.editor and window.editor.buffer.hasChanged():
98 ## if text.endswith(suffix):
101 ## notebook.SetPageText(selection, text + suffix)
103 ## if text.endswith(suffix):
104 ## notebook.SetPageText(selection, text[:len(suffix)])
106 def _updateTitle(self
):
107 """Show current title information."""
108 title
= self
.GetTitle()
109 if self
.bufferHasChanged():
110 if title
.startswith('* '):
113 self
.SetTitle('* ' + title
)
115 if title
.startswith('* '):
116 self
.SetTitle(title
[2:])
119 """Return True if there is a current buffer."""
125 def bufferClose(self
):
127 if self
.bufferHasChanged():
128 cancel
= self
.bufferSuggestSave()
135 def bufferCreate(self
, filename
=None):
136 """Create new buffer."""
139 self
.panel
= panel
= wx
.Panel(parent
=self
, id=-1)
140 panel
.Bind (wx
.EVT_ERASE_BACKGROUND
, lambda x
: x
)
141 editor
= Editor(parent
=panel
)
142 panel
.editor
= editor
143 sizer
= wx
.BoxSizer(wx
.VERTICAL
)
144 sizer
.Add(editor
.window
, 1, wx
.EXPAND
)
145 panel
.SetSizer(sizer
)
146 panel
.SetAutoLayout(True)
148 buffer.addEditor(editor
)
149 buffer.open(filename
)
150 self
.setEditor(editor
)
151 self
.editor
.setFocus()
155 def bufferDestroy(self
):
156 """Destroy the current buffer."""
158 for editor
in self
.buffer.editors
.values():
161 del self
.buffers
[self
.buffer.id]
166 def bufferHasChanged(self
):
167 """Return True if buffer has changed since last save."""
169 return self
.buffer.hasChanged()
174 """Create new buffer."""
175 if self
.bufferHasChanged():
176 cancel
= self
.bufferSuggestSave()
183 def bufferOpen(self
):
184 """Open file in buffer."""
185 if self
.bufferHasChanged():
186 cancel
= self
.bufferSuggestSave()
190 if self
.buffer and self
.buffer.doc
.filedir
:
191 filedir
= self
.buffer.doc
.filedir
192 result
= openSingle(directory
=filedir
)
194 self
.bufferCreate(result
.path
)
198 ## def bufferPrint(self):
199 ## """Print buffer."""
202 ## def bufferRevert(self):
203 ## """Revert buffer to version of file on disk."""
206 def bufferSave(self
):
207 """Save buffer to its file."""
208 if self
.buffer.doc
.filepath
:
212 cancel
= self
.bufferSaveAs()
215 def bufferSaveAs(self
):
216 """Save buffer to a new filename."""
217 if self
.bufferHasChanged() and self
.buffer.doc
.filepath
:
218 cancel
= self
.bufferSuggestSave()
222 if self
.buffer and self
.buffer.doc
.filedir
:
223 filedir
= self
.buffer.doc
.filedir
224 result
= saveSingle(directory
=filedir
)
226 self
.buffer.saveAs(result
.path
)
232 def bufferSuggestSave(self
):
233 """Suggest saving changes. Return True if user selected Cancel."""
234 result
= messageDialog(parent
=None,
235 message
='%s has changed.\n'
236 'Would you like to save it first'
237 '?' % self
.buffer.name
,
238 title
='Save current file?')
240 cancel
= self
.bufferSave()
242 cancel
= result
.text
== 'Cancel'
245 def updateNamespace(self
):
246 """Update the buffer namespace for autocompletion and calltips."""
247 if self
.buffer.updateNamespace():
248 self
.SetStatusText('Namespace updated')
250 self
.SetStatusText('Error executing, unable to update namespace')
253 class EditorNotebookFrame(EditorFrame
):
254 """Frame containing one or more editors in a notebook."""
256 def __init__(self
, parent
=None, id=-1, title
='PyAlaMode',
257 pos
=wx
.DefaultPosition
, size
=(800, 600),
258 style
=wx
.DEFAULT_FRAME_STYLE | wx
.NO_FULL_REPAINT_ON_RESIZE
,
260 """Create EditorNotebookFrame instance."""
262 EditorFrame
.__init
__(self
, parent
, id, title
, pos
,
263 size
, style
, filename
)
265 dispatcher
.connect(receiver
=self
._editorChange
,
266 signal
='EditorChange', sender
=self
.notebook
)
269 """Setup prior to first buffer creation.
271 Called automatically by base class during init."""
272 self
.notebook
= EditorNotebook(parent
=self
)
273 intro
= 'Py %s' % version
.VERSION
275 module
= imp
.new_module('__main__')
277 module
.__dict
__['__builtins__'] = __builtin__
278 namespace
= module
.__dict
__.copy()
279 self
.crust
= crust
.Crust(parent
=self
.notebook
, intro
=intro
, locals=namespace
)
280 self
.shell
= self
.crust
.shell
281 # Override the filling so that status messages go to the status bar.
282 self
.crust
.filling
.tree
.setStatusText
= self
.SetStatusText
283 # Override the shell so that status messages go to the status bar.
284 self
.shell
.setStatusText
= self
.SetStatusText
285 # Fix a problem with the sash shrinking to nothing.
286 self
.crust
.filling
.SetSashPosition(200)
287 self
.notebook
.AddPage(page
=self
.crust
, text
='*Shell*', select
=True)
288 self
.setEditor(self
.crust
.editor
)
289 self
.crust
.editor
.SetFocus()
291 def _editorChange(self
, editor
):
292 """Editor change signal receiver."""
293 self
.setEditor(editor
)
295 def OnAbout(self
, event
):
296 """Display an About window."""
297 title
= 'About PyAlaMode'
298 text
= 'Another fine, flaky program.'
299 dialog
= wx
.MessageDialog(self
, text
, title
,
300 wx
.OK | wx
.ICON_INFORMATION
)
304 def _updateTitle(self
):
305 """Show current title information."""
307 ## title = self.GetTitle()
308 ## if self.bufferHasChanged():
309 ## if title.startswith('* '):
312 ## self.SetTitle('* ' + title)
314 ## if title.startswith('* '):
315 ## self.SetTitle(title[2:])
317 def bufferCreate(self
, filename
=None):
318 """Create new buffer."""
320 panel
= wx
.Panel(parent
=self
.notebook
, id=-1)
321 panel
.Bind(wx
.EVT_ERASE_BACKGROUND
, lambda x
: x
)
322 editor
= Editor(parent
=panel
)
323 panel
.editor
= editor
324 sizer
= wx
.BoxSizer(wx
.VERTICAL
)
325 sizer
.Add(editor
.window
, 1, wx
.EXPAND
)
326 panel
.SetSizer(sizer
)
327 panel
.SetAutoLayout(True)
329 buffer.addEditor(editor
)
330 buffer.open(filename
)
331 self
.setEditor(editor
)
332 self
.notebook
.AddPage(page
=panel
, text
=self
.buffer.name
, select
=True)
333 self
.editor
.setFocus()
335 def bufferDestroy(self
):
336 """Destroy the current buffer."""
337 selection
= self
.notebook
.GetSelection()
338 ## print "Destroy Selection:", selection
339 if selection
> 0: # Don't destroy the PyCrust tab.
341 del self
.buffers
[self
.buffer.id]
342 self
.buffer = None # Do this before DeletePage().
343 self
.notebook
.DeletePage(selection
)
346 """Create new buffer."""
351 def bufferOpen(self
):
352 """Open file in buffer."""
354 if self
.buffer and self
.buffer.doc
.filedir
:
355 filedir
= self
.buffer.doc
.filedir
356 result
= openMultiple(directory
=filedir
)
357 for path
in result
.paths
:
358 self
.bufferCreate(path
)
363 class EditorNotebook(wx
.Notebook
):
364 """A notebook containing a page for each editor."""
366 def __init__(self
, parent
):
367 """Create EditorNotebook instance."""
368 wx
.Notebook
.__init
__(self
, parent
, id=-1, style
=wx
.CLIP_CHILDREN
)
369 self
.Bind(wx
.EVT_NOTEBOOK_PAGE_CHANGING
, self
.OnPageChanging
, id=self
.GetId())
370 self
.Bind(wx
.EVT_NOTEBOOK_PAGE_CHANGED
, self
.OnPageChanged
, id=self
.GetId())
371 self
.Bind(wx
.EVT_IDLE
, self
.OnIdle
)
373 def OnIdle(self
, event
):
374 """Event handler for idle time."""
375 self
._updateTabText
()
378 def _updateTabText(self
):
379 """Show current buffer display name on all but first tab."""
383 selection
= self
.GetSelection()
386 text
= self
.GetPageText(selection
)
387 window
= self
.GetPage(selection
)
388 if not window
.editor
:
390 if text
.endswith(changed
) or text
.endswith(unchanged
):
394 if name
!= window
.editor
.buffer.name
:
395 text
= window
.editor
.buffer.name
396 if window
.editor
.buffer.hasChanged():
397 if text
.endswith(changed
):
399 elif text
.endswith(unchanged
):
400 text
= text
[:-size
] + changed
404 if text
.endswith(changed
):
405 text
= text
[:-size
] + unchanged
406 elif text
.endswith(unchanged
):
411 self
.SetPageText(selection
, text
)
412 self
.Refresh() # Needed on Win98.
414 def OnPageChanging(self
, event
):
415 """Page changing event handler."""
418 def OnPageChanged(self
, event
):
419 """Page changed event handler."""
420 new
= event
.GetSelection()
421 window
= self
.GetPage(new
)
422 dispatcher
.send(signal
='EditorChange', sender
=self
,
423 editor
=window
.editor
)
428 class EditorShellNotebookFrame(EditorNotebookFrame
):
429 """Frame containing a notebook containing EditorShellNotebooks."""
431 def __init__(self
, parent
=None, id=-1, title
='PyAlaModeTest',
432 pos
=wx
.DefaultPosition
, size
=(600, 400),
433 style
=wx
.DEFAULT_FRAME_STYLE
,
434 filename
=None, singlefile
=False):
435 """Create EditorShellNotebookFrame instance."""
436 self
._singlefile
= singlefile
437 EditorNotebookFrame
.__init
__(self
, parent
, id, title
, pos
,
438 size
, style
, filename
)
441 """Setup prior to first buffer creation.
443 Called automatically by base class during init."""
444 if not self
._singlefile
:
445 self
.notebook
= EditorNotebook(parent
=self
)
447 def OnAbout(self
, event
):
448 """Display an About window."""
449 title
= 'About PyAlaModePlus'
450 text
= 'Another fine, flaky program.'
451 dialog
= wx
.MessageDialog(self
, text
, title
,
452 wx
.OK | wx
.ICON_INFORMATION
)
456 def bufferCreate(self
, filename
=None):
457 """Create new buffer."""
460 notebook
= EditorShellNotebook(parent
=self
,
462 self
.notebook
= notebook
464 notebook
= EditorShellNotebook(parent
=self
.notebook
,
466 self
.setEditor(notebook
.editor
)
467 if not self
._singlefile
:
468 self
.notebook
.AddPage(page
=notebook
, text
=self
.buffer.name
,
470 self
.editor
.setFocus()
472 def bufferDestroy(self
):
473 """Destroy the current buffer."""
476 del self
.buffers
[self
.buffer.id]
477 self
.buffer = None # Do this before DeletePage().
479 self
.notebook
.Destroy()
482 selection
= self
.notebook
.GetSelection()
483 ## print "Destroy Selection:", selection
484 self
.notebook
.DeletePage(selection
)
487 """Create new buffer."""
488 if self
._singlefile
and self
.bufferHasChanged():
489 cancel
= self
.bufferSuggestSave()
496 def bufferOpen(self
):
497 """Open file in buffer."""
498 if self
._singlefile
and self
.bufferHasChanged():
499 cancel
= self
.bufferSuggestSave()
503 if self
.buffer and self
.buffer.doc
.filedir
:
504 filedir
= self
.buffer.doc
.filedir
506 result
= openSingle(directory
=filedir
)
508 self
.bufferCreate(result
.path
)
510 result
= openMultiple(directory
=filedir
)
511 for path
in result
.paths
:
512 self
.bufferCreate(path
)
517 class EditorShellNotebook(wx
.Notebook
):
518 """A notebook containing an editor page and a shell page."""
520 def __init__(self
, parent
, filename
=None):
521 """Create EditorShellNotebook instance."""
522 wx
.Notebook
.__init
__(self
, parent
, id=-1)
525 editorparent
= editorpanel
= wx
.Panel(self
, -1)
526 shellparent
= shellpanel
= wx
.Panel(self
, -1)
530 self
.buffer = Buffer()
531 self
.editor
= Editor(parent
=editorparent
)
532 self
.buffer.addEditor(self
.editor
)
533 self
.buffer.open(filename
)
534 self
.shell
= Shell(parent
=shellparent
, locals=self
.buffer.interp
.locals,
535 style
=wx
.CLIP_CHILDREN | wx
.SUNKEN_BORDER
)
536 self
.buffer.interp
.locals.clear()
538 self
.AddPage(page
=editorpanel
, text
='Editor', select
=True)
539 self
.AddPage(page
=shellpanel
, text
='Shell')
541 editorsizer
= wx
.BoxSizer(wx
.VERTICAL
)
542 editorsizer
.Add(self
.editor
.window
, 1, wx
.EXPAND
)
543 editorpanel
.SetSizer(editorsizer
)
544 editorpanel
.SetAutoLayout(True)
545 shellsizer
= wx
.BoxSizer(wx
.VERTICAL
)
546 shellsizer
.Add(self
.shell
, 1, wx
.EXPAND
)
547 shellpanel
.SetSizer(shellsizer
)
548 shellpanel
.SetAutoLayout(True)
550 self
.AddPage(page
=self
.editor
.window
, text
='Editor', select
=True)
551 self
.AddPage(page
=self
.shell
, text
='Shell')
552 self
.editor
.setFocus()
553 self
.Bind(wx
.EVT_NOTEBOOK_PAGE_CHANGED
, self
.OnPageChanged
, id=self
.GetId())
555 def OnPageChanged(self
, event
):
556 """Page changed event handler."""
557 selection
= event
.GetSelection()
559 self
.editor
.setFocus()
561 self
.shell
.SetFocus()
565 wx
.Notebook
.SetFocus(self
)
566 selection
= self
.GetSelection()
568 self
.editor
.setFocus()
570 self
.shell
.SetFocus()
574 """Editor having an EditWindow."""
576 def __init__(self
, parent
, id=-1, pos
=wx
.DefaultPosition
,
578 style
=wx
.CLIP_CHILDREN | wx
.SUNKEN_BORDER
):
579 """Create Editor instance."""
580 self
.window
= EditWindow(self
, parent
, id, pos
, size
, style
)
581 self
.id = self
.window
.GetId()
583 # Assign handlers for keyboard events.
584 self
.window
.Bind(wx
.EVT_CHAR
, self
.OnChar
)
585 self
.window
.Bind(wx
.EVT_KEY_DOWN
, self
.OnKeyDown
)
587 def _setBuffer(self
, buffer, text
):
588 """Set the editor to a buffer. Private callback called by buffer."""
590 self
.autoCompleteKeys
= buffer.interp
.getAutoCompleteKeys()
593 self
.emptyUndoBuffer()
597 """Destroy all editor objects."""
598 self
.window
.Destroy()
601 self
.window
.ClearAll()
603 def emptyUndoBuffer(self
):
604 self
.window
.EmptyUndoBuffer()
607 """Return (filepath, line, column) status tuple."""
609 pos
= self
.window
.GetCurrentPos()
610 line
= self
.window
.LineFromPosition(pos
) + 1
611 col
= self
.window
.GetColumn(pos
)
613 name
= self
.buffer.doc
.filepath
or self
.buffer.name
616 status
= (name
, line
, col
)
622 """Return contents of editor."""
623 return self
.window
.GetText()
625 def hasChanged(self
):
626 """Return True if contents have changed."""
627 return self
.window
.GetModify()
630 """Set the input focus to the editor window."""
631 self
.window
.SetFocus()
633 def setSavePoint(self
):
634 self
.window
.SetSavePoint()
636 def setText(self
, text
):
637 """Set contents of editor."""
638 self
.window
.SetText(text
)
640 def OnChar(self
, event
):
641 """Keypress event handler.
643 Only receives an event if OnKeyDown calls event.Skip() for the
644 corresponding event."""
646 key
= event
.KeyCode()
647 if key
in self
.autoCompleteKeys
:
648 # Usually the dot (period) key activates auto completion.
649 if self
.window
.AutoCompActive():
650 self
.window
.AutoCompCancel()
651 self
.window
.ReplaceSelection('')
652 self
.window
.AddText(chr(key
))
653 text
, pos
= self
.window
.GetCurLine()
655 if self
.window
.autoComplete
:
656 self
.autoCompleteShow(text
)
657 elif key
== ord('('):
658 # The left paren activates a call tip and cancels an
659 # active auto completion.
660 if self
.window
.AutoCompActive():
661 self
.window
.AutoCompCancel()
662 self
.window
.ReplaceSelection('')
663 self
.window
.AddText('(')
664 text
, pos
= self
.window
.GetCurLine()
666 self
.autoCallTipShow(text
)
668 # Allow the normal event handling to take place.
671 def OnKeyDown(self
, event
):
672 """Key down event handler."""
674 key
= event
.KeyCode()
675 # If the auto-complete window is up let it do its thing.
676 if self
.window
.AutoCompActive():
679 controlDown
= event
.ControlDown()
680 altDown
= event
.AltDown()
681 shiftDown
= event
.ShiftDown()
682 # Let Ctrl-Alt-* get handled normally.
683 if controlDown
and altDown
:
685 # Increase font size.
686 elif controlDown
and key
in (ord(']'),):
687 dispatcher
.send(signal
='FontIncrease')
688 # Decrease font size.
689 elif controlDown
and key
in (ord('['),):
690 dispatcher
.send(signal
='FontDecrease')
692 elif controlDown
and key
in (ord('='),):
693 dispatcher
.send(signal
='FontDefault')
697 def autoCompleteShow(self
, command
):
698 """Display auto-completion popup list."""
699 list = self
.buffer.interp
.getAutoCompleteList(command
,
700 includeMagic
=self
.window
.autoCompleteIncludeMagic
,
701 includeSingle
=self
.window
.autoCompleteIncludeSingle
,
702 includeDouble
=self
.window
.autoCompleteIncludeDouble
)
704 options
= ' '.join(list)
706 self
.window
.AutoCompShow(offset
, options
)
708 def autoCallTipShow(self
, command
):
709 """Display argument spec and docstring in a popup window."""
710 if self
.window
.CallTipActive():
711 self
.window
.CallTipCancel()
712 (name
, argspec
, tip
) = self
.buffer.interp
.getCallTip(command
)
714 dispatcher
.send(signal
='Shell.calltip', sender
=self
, calltip
=tip
)
715 if not self
.window
.autoCallTip
:
718 startpos
= self
.window
.GetCurrentPos()
719 self
.window
.AddText(argspec
+ ')')
720 endpos
= self
.window
.GetCurrentPos()
721 self
.window
.SetSelection(endpos
, startpos
)
723 curpos
= self
.window
.GetCurrentPos()
725 tippos
= curpos
- (size
+ 1)
726 fallback
= curpos
- self
.window
.GetColumn(curpos
)
727 # In case there isn't enough room, only go back to the
729 tippos
= max(tippos
, fallback
)
730 self
.window
.CallTipShow(tippos
, tip
)
731 self
.window
.CallTipSetHighlight(0, size
)
734 class EditWindow(editwindow
.EditWindow
):
735 """EditWindow based on StyledTextCtrl."""
737 def __init__(self
, editor
, parent
, id=-1, pos
=wx
.DefaultPosition
,
739 style
=wx
.CLIP_CHILDREN | wx
.SUNKEN_BORDER
):
740 """Create EditWindow instance."""
741 editwindow
.EditWindow
.__init
__(self
, parent
, id, pos
, size
, style
)
746 """DialogResults class."""
748 def __init__(self
, returned
):
749 """Create wrapper for results returned by dialog."""
750 self
.returned
= returned
751 self
.positive
= returned
in (wx
.ID_OK
, wx
.ID_YES
)
752 self
.text
= self
._asString
()
756 return str(self
.__dict
__)
759 returned
= self
.returned
760 if returned
== wx
.ID_OK
:
762 elif returned
== wx
.ID_CANCEL
:
764 elif returned
== wx
.ID_YES
:
766 elif returned
== wx
.ID_NO
:
770 def fileDialog(parent
=None, title
='Open', directory
='', filename
='',
771 wildcard
='All Files (*.*)|*.*',
772 style
=wx
.OPEN | wx
.MULTIPLE
):
773 """File dialog wrapper function."""
774 dialog
= wx
.FileDialog(parent
, title
, directory
, filename
,
776 result
= DialogResults(dialog
.ShowModal())
778 result
.paths
= dialog
.GetPaths()
785 def openSingle(parent
=None, title
='Open', directory
='', filename
='',
786 wildcard
='All Files (*.*)|*.*', style
=wx
.OPEN
):
787 """File dialog wrapper function."""
788 dialog
= wx
.FileDialog(parent
, title
, directory
, filename
,
790 result
= DialogResults(dialog
.ShowModal())
792 result
.path
= dialog
.GetPath()
799 def openMultiple(parent
=None, title
='Open', directory
='', filename
='',
800 wildcard
='All Files (*.*)|*.*',
801 style
=wx
.OPEN | wx
.MULTIPLE
):
802 """File dialog wrapper function."""
803 return fileDialog(parent
, title
, directory
, filename
, wildcard
, style
)
806 def saveSingle(parent
=None, title
='Save', directory
='', filename
='',
807 wildcard
='All Files (*.*)|*.*',
808 style
=wx
.SAVE | wx
.HIDE_READONLY | wx
.OVERWRITE_PROMPT
):
809 """File dialog wrapper function."""
810 dialog
= wx
.FileDialog(parent
, title
, directory
, filename
,
812 result
= DialogResults(dialog
.ShowModal())
814 result
.path
= dialog
.GetPath()
821 def directory(parent
=None, message
='Choose a directory', path
='', style
=0,
822 pos
=wx
.DefaultPosition
, size
=wx
.DefaultSize
):
823 """Dir dialog wrapper function."""
824 dialog
= wx
.DirDialog(parent
, message
, path
, style
, pos
, size
)
825 result
= DialogResults(dialog
.ShowModal())
827 result
.path
= dialog
.GetPath()
834 def messageDialog(parent
=None, message
='', title
='Message box',
835 style
=wx
.YES_NO | wx
.CANCEL | wx
.CENTRE | wx
.ICON_QUESTION
,
836 pos
=wx
.DefaultPosition
):
837 """Message dialog wrapper function."""
838 dialog
= wx
.MessageDialog(parent
, message
, title
, style
, pos
)
839 result
= DialogResults(dialog
.ShowModal())