mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-10 13:57:08 +01:00
Merge pull request #2002 from komoto48g/feature-shell
Fix functions of the shell
This commit is contained in:
@@ -305,7 +305,6 @@ class Shell(editwindow.EditWindow):
|
||||
|
||||
# Assign handler for the context menu
|
||||
self.Bind(wx.EVT_CONTEXT_MENU, self.OnContextMenu)
|
||||
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI)
|
||||
|
||||
# add the option to not use the stock IDs; otherwise the context menu
|
||||
# may not work on Mac without adding the proper IDs to the menu bar
|
||||
@@ -337,6 +336,14 @@ class Shell(editwindow.EditWindow):
|
||||
self.Bind(wx.EVT_MENU, lambda evt: self.Undo(), id=self.ID_UNDO)
|
||||
self.Bind(wx.EVT_MENU, lambda evt: self.Redo(), id=self.ID_REDO)
|
||||
|
||||
self.Bind(wx.EVT_UPDATE_UI, lambda evt: evt.Enable(self.CanCut()), id=self.ID_CUT)
|
||||
self.Bind(wx.EVT_UPDATE_UI, lambda evt: evt.Enable(self.CanCut()), id=self.ID_CLEAR)
|
||||
self.Bind(wx.EVT_UPDATE_UI, lambda evt: evt.Enable(self.CanCopy()), id=self.ID_COPY)
|
||||
self.Bind(wx.EVT_UPDATE_UI, lambda evt: evt.Enable(self.CanCopy()), id=frame.ID_COPY_PLUS)
|
||||
self.Bind(wx.EVT_UPDATE_UI, lambda evt: evt.Enable(self.CanPaste()), id=self.ID_PASTE)
|
||||
self.Bind(wx.EVT_UPDATE_UI, lambda evt: evt.Enable(self.CanPaste()), id=frame.ID_PASTE_PLUS)
|
||||
self.Bind(wx.EVT_UPDATE_UI, lambda evt: evt.Enable(self.CanUndo()), id=self.ID_UNDO)
|
||||
self.Bind(wx.EVT_UPDATE_UI, lambda evt: evt.Enable(self.CanRedo()), id=self.ID_REDO)
|
||||
|
||||
# Assign handler for idle time.
|
||||
self.waiting = False
|
||||
@@ -1087,7 +1094,7 @@ class Shell(editwindow.EditWindow):
|
||||
else:
|
||||
indent=previousLine[:(len(previousLine)-len(lstrip))]
|
||||
if pstrip[-1]==':' and \
|
||||
first_word in ['if','else','elif','for','while',
|
||||
first_word in ['if','else','elif','for','while','with',
|
||||
'def','class','try','except','finally']:
|
||||
indent+=' '*4
|
||||
|
||||
@@ -1416,7 +1423,8 @@ class Shell(editwindow.EditWindow):
|
||||
lstrip = line.lstrip()
|
||||
if line.strip() != '' and lstrip == line and \
|
||||
lstrip[:4] not in ['else','elif'] and \
|
||||
lstrip[:6] != 'except':
|
||||
lstrip[:6] != 'except' and \
|
||||
lstrip[:7] != 'finally':
|
||||
# New command.
|
||||
if command:
|
||||
# Add the previous command to the list.
|
||||
@@ -1510,19 +1518,6 @@ class Shell(editwindow.EditWindow):
|
||||
menu = self.GetContextMenu()
|
||||
self.PopupMenu(menu)
|
||||
|
||||
def OnUpdateUI(self, evt):
|
||||
id = evt.Id
|
||||
if id in (self.ID_CUT, self.ID_CLEAR):
|
||||
evt.Enable(self.CanCut())
|
||||
elif id in (self.ID_COPY, frame.ID_COPY_PLUS):
|
||||
evt.Enable(self.CanCopy())
|
||||
elif id in (self.ID_PASTE, frame.ID_PASTE_PLUS):
|
||||
evt.Enable(self.CanPaste())
|
||||
elif id == self.ID_UNDO:
|
||||
evt.Enable(self.CanUndo())
|
||||
elif id == self.ID_REDO:
|
||||
evt.Enable(self.CanRedo())
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user