def OnViewOptions(self, id, code): win32ui.InitRichEdit() sheet = dialog.PropertySheet("Pythonwin Options") # Add property pages we know about that need manual work. from pywin.dialogs import ideoptions sheet.AddPage(ideoptions.OptionsPropPage()) from . import toolmenu sheet.AddPage(toolmenu.ToolMenuPropPage()) # Get other dynamic pages from templates. pages = [] for template in self.GetDocTemplateList(): try: # Dont actually call the function with the exception handler. getter = template.GetPythonPropertyPages except AttributeError: # Template does not provide property pages! continue pages = pages + getter() # Debugger template goes at the end try: from pywin.debugger import configui except ImportError: configui = None if configui is not None: pages.append(configui.DebuggerOptionsPropPage()) # Now simply add the pages, and display the dialog. for page in pages: sheet.AddPage(page) if sheet.DoModal() == win32con.IDOK: win32ui.SetStatusText("Applying configuration changes...", 1) win32ui.DoWaitCursor(1) # Tell every Window in our app that win.ini has changed! win32ui.GetMainFrame().SendMessageToDescendants( win32con.WM_WININICHANGE, 0, 0) win32ui.DoWaitCursor(0)
def OnHelpAbout(self, id, code): " Called when HelpAbout message is received. Displays the About dialog. " win32ui.InitRichEdit() dlg = AboutBox() dlg.DoModal()
# # Python GUI - Text Editor - Win32 # import win32con as wc, win32ui as ui from GUI import export from GUI.GTextEditors import TextEditor as GTextEditor from GUI.WinUtils import win_none from GUI.StdFonts import application_font PFM_TABSTOPS = 0x10 MAX_TAB_STOPS = 32 LOGPIXELSX = 88 ui.InitRichEdit() class TextEditor(GTextEditor): _pass_key_events_to_platform = True def __init__(self, scrolling = 'hv', **kwds): win_style = ui.AFX_WS_DEFAULT_VIEW #| wc.WS_HSCROLL | wc.WS_VSCROLL win = ui.CreateRichEditView() ctl = win.GetRichEditCtrl() self._win_ctl = ctl if 'h' in scrolling: win.SetWordWrap(0) # Must do before CreateWindow win.CreateWindow(win_none, 1, win_style, (0, 0, 100, 100)) #if 'v' not in scrolling: # Disabled because it doesn't work properly -- auto-scrolling is prevented