Changeset f1cbae7 in sasview for src/sas/sasgui/perspectives


Ignore:
Timestamp:
Oct 6, 2016 1:54:59 PM (8 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
578a11d
Parents:
b2a3814
git-author:
Piotr Rozyczko <rozyczko@…> (10/06/16 13:54:00)
git-committer:
Piotr Rozyczko <rozyczko@…> (10/06/16 13:54:59)
Message:

Allow resize of the error panel. Fixed #688

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.