⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ide.py

📁 Wxpython Implemented on Windows CE, Source code
💻 PY
📖 第 1 页 / 共 5 页
字号:
#----------------------------------------------------------------------------
# Name:         IDE.py
# Purpose:      IDE using Python extensions to the wxWindows docview framework
#
# Author:       Peter Yared
#
# Created:      5/15/03
# Copyright:    (c) 2003-2005 ActiveGrid, Inc.
# CVS-ID:       $Id: IDE.py,v 1.8 2006/04/20 06:25:59 RD Exp $
# License:      wxWindows License
#----------------------------------------------------------------------------

import wx
import wx.lib.docview
import wx.lib.pydocview
import sys
import wx.grid
import os.path
import activegrid.util.sysutils as sysutilslib
import activegrid.util.appdirs as appdirs
import shutil

# Required for Unicode support with python
# site.py sets this, but Windows builds don't have site.py because of py2exe problems
# If site.py has already run, then the setdefaultencoding function will have been deleted.
if hasattr(sys,"setdefaultencoding"):
    sys.setdefaultencoding("utf-8")

_ = wx.GetTranslation
ACTIVEGRID_BASE_IDE = False 
USE_OLD_PROJECTS = False
#----------------------------------------------------------------------------
# Helper functions for command line args
#----------------------------------------------------------------------------

# Since Windows accept command line options with '/', but this character
# is used to denote absolute path names on other platforms, we need to
# conditionally handle '/' style arguments on Windows only.
def printArg(argname):
    output = "'-" + argname + "'"
    if wx.Platform == "__WXMSW__":
        output = output + " or '/" + argname + "'"
        
    return output
        
def isInArgs(argname, argv):
    result = False
    if ("-" + argname) in argv:
        result = True
    if wx.Platform == "__WXMSW__" and ("/" + argname) in argv:
        result = True
        
    return result

# The default log action in wx is to prompt with a big message box
# which is often inappropriate (for example, if the clipboard data
# is not readable on Mac, we'll get one of these messages repeatedly)
# so just log the errors instead.
# NOTE: This does NOT supress fatal system errors. Only non-fatal ones.
class AppLog(wx.PyLog):
    def __init__(self):
        wx.PyLog.__init__(self)
        self.items = []
        
    def DoLogString(self, message, timeStamp):
        self.items.append(str(timeStamp) + u" " + message.decode())

#----------------------------------------------------------------------------
# Classes
#----------------------------------------------------------------------------

class IDEApplication(wx.lib.pydocview.DocApp):

    def __init__(self, redirect=False):
        wx.lib.pydocview.DocApp.__init__(self, redirect=redirect)

    def OnInit(self):
        global ACTIVEGRID_BASE_IDE
        global USE_OLD_PROJECTS
        args = sys.argv

        # Suppress non-fatal errors that might prompt the user even in cases
        # when the error does not impact them.
        wx.Log_SetActiveTarget(AppLog())
        
        if "-h" in args or "-help" in args or "--help" in args\
            or (wx.Platform == "__WXMSW__" and "/help" in args):
            print "Usage: ActiveGridAppBuilder.py [options] [filenames]\n"
            # Mac doesn't really support multiple instances for GUI apps
            # and since we haven't got time to test this thoroughly I'm 
            # disabling it for now.
            if wx.Platform != "__WXMAC__":
                print "    option " + printArg("multiple") + " to allow multiple instances of application."
            print "    option " + printArg("debug") + " for debug mode."
            print "    option '-h' or " + printArg("help") + " to show usage information for command."
            print "    option " + printArg("baseide") + " for base IDE mode."
            print "    [filenames] is an optional list of files you want to open when application starts."
            return False
        elif isInArgs("dev", args):
            self.SetAppName(_("ActiveGrid Application Builder Dev"))
            self.SetDebug(False)
        elif isInArgs("debug", args):
            self.SetAppName(_("ActiveGrid Application Builder Debug"))
            self.SetDebug(True)
            self.SetSingleInstance(False)
        elif isInArgs("baseide", args):
            self.SetAppName(_("ActiveGrid IDE"))
            ACTIVEGRID_BASE_IDE = True
        elif isInArgs("tools", args):
            USE_OLD_PROJECTS = True
        else:
            self.SetAppName(_("ActiveGrid Application Builder"))
            self.SetDebug(False)
        if isInArgs("multiple", args) and wx.Platform != "__WXMAC__":
            self.SetSingleInstance(False)

        if not ACTIVEGRID_BASE_IDE:
            import CmdlineOptions
            if isInArgs(CmdlineOptions.DEPLOY_TO_SERVE_PATH_ARG, args):
                CmdlineOptions.enableDeployToServePath()
            
        if not wx.lib.pydocview.DocApp.OnInit(self):
            return False

        if not ACTIVEGRID_BASE_IDE:
            self.ShowSplash(getSplashBitmap())
        else:
            self.ShowSplash(getIDESplashBitmap())

        import STCTextEditor
        import FindInDirService
        import MarkerService
        import project as projectlib
        import ProjectEditor
        import PythonEditor
        import OutlineService
        import XmlEditor
        import HtmlEditor
        import TabbedView
        import MessageService
        import Service
        import ImageEditor
        import PerlEditor
        import PHPEditor
        import wx.lib.ogl as ogl
        import DebuggerService
        import AboutDialog
        import SVNService
        import ExtensionService
##        import UpdateLogIniService
                            
        if not ACTIVEGRID_BASE_IDE:
            import activegrid.model.basedocmgr as basedocmgr
            import UpdateService
            import DataModelEditor
            import ProcessModelEditor
            import DeploymentService
            import WebServerService
            import WelcomeService
            import XFormEditor
            import PropertyService
            import WSDLEditor
            import WsdlAgEditor
            import XPathEditor
            import XPathExprEditor
            import ImportServiceWizard
            import RoleEditor
            import HelpService
            import WebBrowserService
            import SQLEditor
        _EDIT_LAYOUTS = True
        if not ACTIVEGRID_BASE_IDE:
            import BPELEditor
            if _EDIT_LAYOUTS:
                import LayoutEditor
                import SkinEditor
                        

        # This creates some pens and brushes that the OGL library uses.
        # It should be called after the app object has been created, but
        # before OGL is used.
        ogl.OGLInitialize()

        config = wx.Config(self.GetAppName(), style = wx.CONFIG_USE_LOCAL_FILE)
        if not config.Exists("MDIFrameMaximized"):  # Make the initial MDI frame maximize as default
            config.WriteInt("MDIFrameMaximized", True)
        if not config.Exists("MDIEmbedRightVisible"):  # Make the properties embedded window hidden as default
            config.WriteInt("MDIEmbedRightVisible", False)

        docManager = IDEDocManager(flags = self.GetDefaultDocManagerFlags())
        self.SetDocumentManager(docManager)

        # Note:  These templates must be initialized in display order for the "Files of type" dropdown for the "File | Open..." dialog
        
        defaultTemplate = wx.lib.docview.DocTemplate(docManager,
                _("Any"),
                "*.*",
                _("Any"),
                _(".txt"),
                _("Text Document"),
                _("Text View"),
                STCTextEditor.TextDocument,
                STCTextEditor.TextView,
                wx.lib.docview.TEMPLATE_INVISIBLE,
                icon = STCTextEditor.getTextIcon())
        docManager.AssociateTemplate(defaultTemplate)

        if not ACTIVEGRID_BASE_IDE:
            dplTemplate = DeploymentService.DeploymentTemplate(docManager,
                _("Deployment"),
                "*.dpl",
                _("Deployment"),
                _(".dpl"),
                _("Deployment Document"),
                _("Deployment View"),
                XmlEditor.XmlDocument,
                XmlEditor.XmlView,
                wx.lib.docview.TEMPLATE_INVISIBLE,
                icon = DeploymentService.getDPLIcon())
            docManager.AssociateTemplate(dplTemplate)

        htmlTemplate = wx.lib.docview.DocTemplate(docManager,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -