Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/calculator/pyconsole.py

    r7673ecd rf1cbae7  
    99import wx 
    1010from wx.lib.dialogs import ScrolledMessageDialog 
     11from wx.lib import layoutf 
     12 
    1113import wx.py.editor as editor 
    1214 
     
    6365        title, icon = "Info", wx.ICON_INFORMATION 
    6466    text = "\n".join(parts) 
    65     dlg = ScrolledMessageDialog(parent, text, title, size=((550, 250))) 
     67    dlg = ResizableScrolledMessageDialog(parent, text, title, size=((550, 250))) 
    6668    fnt = wx.Font(10, wx.TELETYPE, wx.NORMAL, wx.NORMAL) 
    6769    dlg.GetChildren()[0].SetFont(fnt) 
     
    7072    dlg.Destroy() 
    7173    return errmsg is None 
     74 
     75class ResizableScrolledMessageDialog(wx.Dialog): 
     76    """ 
     77    Custom version of wx ScrolledMessageDialog, allowing border resize 
     78    """ 
     79    def __init__(self, parent, msg, caption, 
     80        pos=wx.DefaultPosition, size=(500,300), 
     81        style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER ): 
     82        # Notice, that style can be overrriden in the caller. 
     83        wx.Dialog.__init__(self, parent, -1, caption, pos, size, style) 
     84        x, y = pos 
     85        if x == -1 and y == -1: 
     86            self.CenterOnScreen(wx.BOTH) 
     87 
     88        text = wx.TextCtrl(self, -1, msg, style=wx.TE_MULTILINE | wx.TE_READONLY) 
     89        ok = wx.Button(self, wx.ID_OK, "OK") 
     90 
     91        # Mysterious constraint layouts from  
     92        # https://www.wxpython.org/docs/api/wx.lib.layoutf.Layoutf-class.html 
     93        lc = layoutf.Layoutf('t=t5#1;b=t5#2;l=l5#1;r=r5#1', (self,ok)) 
     94        text.SetConstraints(lc) 
     95        lc = layoutf.Layoutf('b=b5#1;x%w50#1;w!80;h!25', (self,)) 
     96        ok.SetConstraints(lc) 
     97 
     98        self.SetAutoLayout(1) 
     99        self.Layout() 
    72100 
    73101class PyConsole(editor.EditorNotebookFrame): 
Note: See TracChangeset for help on using the changeset viewer.