[Nvda-dev] commit r1958 - in trunk: . source source/appModules source/gui

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Nvda-dev] commit r1958 - in trunk: . source source/appModules source/gui

NVDA Subversion
Author: jteh
Date: Thu Apr 24 05:06:50 2008
New Revision: 1958

Log:
Add the Python console to the NVDA Tools menu.
When showing the console (via either the menu or script), attempt to bring it to the foreground as well. Introduce pythonConsole.activate() for convenience to do this.


Modified:
   trunk/   (props changed)
   trunk/source/appModules/_default.py
   trunk/source/gui/__init__.py
   trunk/source/pythonConsole.py

Modified: trunk/source/appModules/_default.py
==============================================================================
--- trunk/source/appModules/_default.py (original)
+++ trunk/source/appModules/_default.py Thu Apr 24 05:06:50 2008
@@ -766,4 +766,4 @@
  if not pythonConsole.consoleUI:
  pythonConsole.initialize()
  pythonConsole.consoleUI.updateNamespaceSnapshotVars()
- pythonConsole.consoleUI.Show()
+ pythonConsole.activate()

Modified: trunk/source/gui/__init__.py
==============================================================================
--- trunk/source/gui/__init__.py (original)
+++ trunk/source/gui/__init__.py Thu Apr 24 05:06:50 2008
@@ -202,6 +202,12 @@
  def onViewLogCommand(self, evt):
  logViewer.LogViewer().Show()
 
+ def onPythonConsoleCommand(self, evt):
+ import pythonConsole
+ if not pythonConsole.consoleUI:
+ pythonConsole.initialize()
+ pythonConsole.activate()
+
 class SysTrayIcon(wx.TaskBarIcon):
 
  def __init__(self, frame):
@@ -240,6 +246,8 @@
  menu_tools = wx.Menu()
  item = menu_tools.Append(wx.ID_ANY, _("View log"))
  self.Bind(wx.EVT_MENU, frame.onViewLogCommand, item)
+ item = menu_tools.Append(wx.ID_ANY, _("Python console"))
+ self.Bind(wx.EVT_MENU, frame.onPythonConsoleCommand, item)
  self.menu.AppendMenu(wx.ID_ANY, _("Tools"), menu_tools)
 
  menu_help = wx.Menu()

Modified: trunk/source/pythonConsole.py
==============================================================================
--- trunk/source/pythonConsole.py (original)
+++ trunk/source/pythonConsole.py Thu Apr 24 05:06:50 2008
@@ -156,8 +156,17 @@
 
 def initialize():
  """Initialize the NVDA Python console GUI.
- This creates a singleton instance of the console GUI. This is accessible as L{consoleUI}. This can and should be manipulated externally.
+ This creates a singleton instance of the console GUI. This is accessible as L{consoleUI}. This may be manipulated externally.
  """
  global consoleUI
  consoleUI = ConsoleUI()
  gui.topLevelWindows.append(consoleUI)
+
+def activate():
+ """Activate the console GUI.
+ This shows the GUI and brings it to the foreground if possible.
+ @precondition: L{initialize} has been called.
+ """
+ global consoleUI
+ consoleUI.Raise()
+ consoleUI.Show()