ed_mpane.py :  » GUI » wxPython » wxPython-src-2.8.11.0 » wxPython » wx » tools » Editra » src » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » GUI » wxPython 
wxPython » wxPython src 2.8.11.0 » wxPython » wx » tools » Editra » src » ed_mpane.py
###############################################################################
# Name: ed_mpane.py                                                           #
# Purpose: Main panel containing notebook and command bar.                    #
# Author: Cody Precord <cprecord@editra.org>                                  #
# Copyright: (c) 2008 Cody Precord <staff@editra.org>                         #
# License: wxWindows License                                                  #
###############################################################################

"""
This module provides the L{MainPanel} component. That contains the editors main
notebook and command bar. 

@summary: Main Panel

"""

__author__ = "Cody Precord <cprecord@editra.org>"
__svnid__ = "$Id: ed_mpane.py 63387 2010-02-04 15:14:46Z CJP $"
__revision__ = "$Revision: 63387 $"

#-----------------------------------------------------------------------------#
# Imports
import wx

# Editra Libraries
import ed_glob
import ed_pages
import ed_cmdbar
import eclib

#-----------------------------------------------------------------------------#

class MainPanel(eclib.ControlBox):
    """Main panel view
    @todo: Add interface for registering additional commandbars.

    """
    def __init__(self, parent):
        """Initialize the panel"""
        eclib.ControlBox.__init__(self, parent)

        # Attributes
        self.nb = ed_pages.EdPages(self, wx.ID_ANY)
        self._search = None
        self._line = None
        self._cmd = None

        # Layout
        self.SetWindow(self.nb)

        self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEB)

    def OnEB(self, evt):
        """Empty method to fix notebook flashing issue on MSW"""
        pass

    def GetNotebook(self):
        """Get the main notebook control
        @return: EdPages instance

        """
        return self.nb

    def HideCommandBar(self):
        """Hide the command bar"""
        self.GetControlBar(wx.BOTTOM).Hide()
        self.Layout()

    def InitCommandBar(self):
        """Initialize the commandbar"""
        if self._search is None:
            self._search = ed_cmdbar.SearchBar(self)
            self.SetControlBar(self._search, wx.BOTTOM)

    def ShowCommandControl(self, ctrlid):
        """Change the mode of the commandbar
        @param ctrlid: CommandBar control id

        """
        cur_bar = None
        if ctrlid == ed_glob.ID_QUICK_FIND:
            cur_bar = self.ReplaceControlBar(self._search, wx.BOTTOM)
        elif ctrlid == ed_glob.ID_GOTO_LINE:
            # Lazy init
            if self._line is None:
                self._line = ed_cmdbar.GotoLineBar(self)
            cur_bar = self.ReplaceControlBar(self._line, wx.BOTTOM)
        elif ctrlid == ed_glob.ID_COMMAND :
            # Lazy init
            if self._cmd is None:
                self._cmd = ed_cmdbar.CommandEntryBar(self)
            cur_bar = self.ReplaceControlBar(self._cmd, wx.BOTTOM)
        else:
            return

        if cur_bar is not None:
            cur_bar.Hide()

        cbar = self.GetControlBar(wx.BOTTOM)
        if cbar is not None:
            cbar.Show()
            cbar.Layout()
            cbar.SetFocus()

        self.Layout()
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.