Beispiel #1
0
def axw__init__(self,
                parent,
                ID=-1,
                pos=wx.DefaultPosition,
                size=wx.DefaultSize,
                style=0):

    # init base classes
    pywin.mfc.activex.Control.__init__(self)
    wx.Window.__init__(self, parent, -1, pos, size,
                       style | wx.NO_FULL_REPAINT_ON_RESIZE)
    self.this.own(
        False
    )  # this should be set in wx.Window.__init__ when it calls _setOORInfo, but...

    win32ui.EnableControlContainer()
    self._eventObj = self._eventObj  # move from class to instance

    # create a pythonwin wrapper around this wxWindow
    handle = self.GetHandle()
    self._wnd = win32ui.CreateWindowFromHandle(handle)

    # create the control
    sz = self.GetSize()
    self.CreateControl(self._name, WS_TABSTOP | WS_VISIBLE,
                       (0, 0, sz.width, sz.height), self._wnd, ID)

    # init the ax events part of the object
    self._eventBase.__init__(self, self._dispobj_)

    # hook some wx events
    self.Bind(wx.EVT_SIZE, self.axw_OnSize)
 def OnInitDialog(self):
     rc = dialog.Dialog.OnInitDialog(self)
     # now initialise your controls that you want to create
     # programmatically, including those which are OLE controls
     # those created directly by win32ui.Create*
     # and your "custom controls" which are subclasses/whatever
     win32ui.EnableControlContainer()
     self.slider = win32ui.CreateSliderCtrl()
     self.slider.CreateWindow(win32con.WS_TABSTOP | win32con.WS_VISIBLE,
                              (0, 0, 100, 30), self._obj_, self.IDC_SLIDER)
     return rc
Beispiel #3
0
 def InitInstance(self):
     #       win32ui.SetProfileFileName('dlgapp.ini')
     #        win32ui.LoadStdProfileSettings()
     win32ui.EnableControlContainer()
     win32ui.Enable3dControls()
     self.dlg = self.frame = self.CreateDialog()
     if self.frame is None:
         raise error("No dialog was created by CreateDialog()")
         return
     self.PreDoModal()
     self.dlg.PreDoModal()
     self.dlg.DoModal()
     self.PostDoModal()
Beispiel #4
0
    def InitInstance(self):
        # Allow "/nodde" and "/new" to optimize this!
        if ("/nodde" not in sys.argv and "/new" not in sys.argv
                and "-nodde" not in sys.argv and "-new" not in sys.argv):
            if self.InitDDE():
                return 1  # A remote DDE client is doing it for us!
        else:
            self.ddeServer = None

        win32ui.SetRegistryKey("Python %s" % (
            sys.winver, ))  # MFC automatically puts the main frame caption on!
        app.CApp.InitInstance(self)

        # Create the taskbar icon
        win32ui.CreateDebuggerThread()

        # Allow Pythonwin to host OCX controls.
        win32ui.EnableControlContainer()

        # Display the interactive window if the user wants it.
        from . import interact

        interact.CreateInteractiveWindowUserPreference()

        # Load the modules we use internally.
        self.LoadSystemModules()

        # Load additional module the user may want.
        self.LoadUserModules()

        # Load the ToolBar state near the end of the init process, as
        # there may be Toolbar IDs created by the user or other modules.
        # By now all these modules should be loaded, so all the toolbar IDs loaded.
        try:
            self.frame.LoadBarState("ToolbarDefault")
        except win32ui.error:
            # MFC sucks.  It does essentially "GetDlgItem(x)->Something", so if the
            # toolbar with ID x does not exist, MFC crashes!  Pythonwin has a trap for this
            # but I need to investigate more how to prevent it (AFAIK, ensuring all the
            # toolbars are created by now _should_ stop it!)
            pass

        # Finally process the command line arguments.
        try:
            self.ProcessArgs(sys.argv)
        except:
            # too early for printing anything.
            win32ui.DisplayTraceback(sys.exc_info(),
                                     " - error processing command line args")
Beispiel #5
0
	def InitInstance(self):
		# Use a registry path of "Python\Pythonwin Debugger
		win32ui.SetAppName(win32ui.LoadString(win32ui.IDR_DEBUGGER))
		win32ui.SetRegistryKey("Python %s" % (sys.winver,))
		# We _need_ the Scintilla color editor.
		# (and we _always_ get it now :-)

		numMRU = win32ui.GetProfileVal("Settings","Recent File List Size", 10)
		win32ui.LoadStdProfileSettings(numMRU)

		self.LoadMainFrame()

		# Display the interactive window if the user wants it.
		from pywin.framework import interact
		interact.CreateInteractiveWindowUserPreference()

		# Load the modules we use internally.
		self.LoadSystemModules()
		# Load additional module the user may want.
		self.LoadUserModules()

#		win32ui.CreateDebuggerThread()
		win32ui.EnableControlContainer()