pywin32 icon indicating copy to clipboard operation
pywin32 copied to clipboard

docview.py & COM draw Framework into the machine

Open ghost opened this issue 21 years ago • 6 comments

docview.py draws the framework into the machine (e.g. py2exe creates output +1MB in size). Software uses unnecessary lots of memory.

and: now win32com/server/dispatcher.py also draws the framework/debugger !

i patched it like this ( but not very elegant because i don't overview the framework module design well; but only 2 locations changing )

# docview.py

self.MakeView=MakeView self._SetupSharedMenu_() def _SetupSharedMenu_(self): pass #to be replaced by framework! ### todo - _SetupSharedMenu_ should be moved to a framework class. ## def _SetupSharedMenu_(self): ## sharedMenu = self.GetSharedMenu() ## from pywin.framework import toolmenu ## toolmenu.SetToolsMenu(sharedMenu) ## from pywin.framework import help ## help.SetHelpMenuOtherHelp(sharedMenu)

def _CreateDocTemplate(self, resourceId): return win32ui.CreateDocTemplate(resourceId) def __del__(self):

# intpyapp.py

import dbgcommands

lastLocateFileName = ".py" # used in the "File/Locate" dialog...

# todo - _SetupSharedMenu should be moved to a framework class. def _SetupSharedMenu_(self): sharedMenu = self.GetSharedMenu() from pywin.framework import toolmenu toolmenu.SetToolsMenu(sharedMenu) from pywin.framework import help help.SetHelpMenuOtherHelp(sharedMenu) from pywin.mfc import docview docview.DocTemplate._SetupSharedMenu_=_SetupSharedMenu_

class MainFrame(app.MainFrame): def OnCreate(self, createStruct): self.closing = 0

# dispatcher.py

def __init__(self, policyClass, ob): exec "import pywin.debugger" pywin.debugger.brk()

Reported by: kxroberto

Original Ticket: "pywin32/bugs/116":https://sourceforge.net/p/pywin32/bugs/116

ghost avatar Jun 03 '04 09:06 ghost

Logged In: YES user_id=14198

You can tell py2exe to exclude them, but if you could turn your code into either a .patch or the complete files as "clean" as possible, I'd certainly consider it. Please reset the bug status to "open" when you do (or just create a new "patch")

Thanks

Original comment by: mhammond

ghost avatar Oct 09 '04 06:10 ghost

  • status: open --> pending

Original comment by: mhammond

ghost avatar Oct 09 '04 06:10 ghost

Logged In: YES user_id=972995

The 2 files in attachment. Its a quick hack of the "SetShared..." hook solution. I didn't understand the structure and execution flow on the big picture.

in win32com/server/dispatcher.py I didn't do anything. Thinke there should also be a "SetDebugger" interface to unravel.

Original comment by: kxroberto

ghost avatar Oct 09 '04 13:10 ghost

  • status: pending --> open

Original comment by: kxroberto

ghost avatar Oct 09 '04 13:10 ghost

@kxrob Is this issue still relevant?

Avasam avatar Mar 12 '24 06:03 Avasam

May be related: https://github.com/mhammond/pywin32/issues/1064

Avasam avatar Aug 24 '25 00:08 Avasam