Changeset 2d98490 in sasview
- Timestamp:
- Oct 20, 2011 2:16:42 PM (13 years ago)
- 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, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 07dd0b4
- Parents:
- 94078a8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansguiframe/src/sans/guiframe/gui_statusbar.py
r5f15492 r2d98490 2 2 from wx import StatusBar as wxStatusB 3 3 from wx.lib import newevent 4 import wx.richtext 4 5 import time 5 6 #numner of fields of the status bar … … 12 13 BUTTON_SIZE = 40 13 14 14 CONSOLE_WIDTH = 34015 CONSOLE_HEIGHT = 24015 CONSOLE_WIDTH = 500 16 CONSOLE_HEIGHT = 300 16 17 17 18 class ConsolePanel(wx.Panel): … … 24 25 self.parent = parent 25 26 self.sizer = wx.BoxSizer(wx.VERTICAL) 26 self.msg_txt = wx.TextCtrl(self, size=(CONSOLE_WIDTH-40, 27 CONSOLE_HEIGHT-60), 28 style=wx.TE_MULTILINE) 27 28 self.msg_txt = wx.richtext.RichTextCtrl(self, size=(CONSOLE_WIDTH-40, 29 CONSOLE_HEIGHT-60), 30 style=wx.VSCROLL|wx.HSCROLL|wx.NO_BORDER) 31 29 32 self.msg_txt.SetEditable(False) 30 33 self.msg_txt.SetValue('No message available') … … 32 35 self.SetSizer(self.sizer) 33 36 34 def set_message(self, status=""): 35 """ 36 """ 37 msg = status + "\n" 38 self.msg_txt.AppendText(str(msg)) 37 def set_message(self, status="", event=None): 38 """ 39 """ 40 status = str(status) 41 if status.strip() == "": 42 return 43 color = (0, 0, 0) #black 44 icon_bmp = wx.ArtProvider.GetBitmap(wx.ART_INFORMATION, 45 wx.ART_TOOLBAR) 46 if hasattr(event, "info"): 47 icon_type = event.info.lower() 48 if icon_type == "warning": 49 color = (0, 0, 255) # blue 50 icon_bmp = wx.ArtProvider.GetBitmap(wx.ART_WARNING, 51 wx.ART_TOOLBAR) 52 if icon_type == "error": 53 color = (255, 0, 0) # red 54 icon_bmp = wx.ArtProvider.GetBitmap(wx.ART_ERROR, 55 wx.ART_TOOLBAR) 56 if icon_type == "info": 57 icon_bmp = wx.ArtProvider.GetBitmap(wx.ART_INFORMATION, 58 wx.ART_TOOLBAR) 59 self.msg_txt.Newline() 60 self.msg_txt.WriteBitmap(icon_bmp) 61 self.msg_txt.BeginTextColour(color) 62 self.msg_txt.WriteText("\t") 63 self.msg_txt.AppendText(status) 64 self.msg_txt.EndTextColour() 65 66 39 67 40 68 class Console(wx.Frame): … … 55 83 if messages: 56 84 for status in messages: 57 self.panel.set_message(status )85 self.panel.set_message(status=status) 58 86 59 def set_message(self, message):60 """ 61 """ 62 self.panel.set_message(st r(message))87 def set_message(self, status, event=None): 88 """ 89 """ 90 self.panel.set_message(status=str(status), event=event) 63 91 64 92 def Close(self, event): … … 148 176 return self.msg_position 149 177 150 def SetStatusText(self, text="", number=MSG_POSITION ):178 def SetStatusText(self, text="", number=MSG_POSITION, event=None): 151 179 """ 152 180 """ … … 157 185 158 186 if self.frame is not None : 159 self.frame.set_message( text)187 self.frame.set_message(status=text, event=event) 160 188 161 189 def PopStatusText(self, *args, **kwds): … … 217 245 def set_icon(self, event): 218 246 """ 219 display icons related to the type of message sent to the statusbar 220 when available 221 """ 247 Display icons related to the type of message sent to the statusbar 248 when available. No icon is displayed if the message is empty 249 """ 250 if hasattr(event, "status"): 251 status = str(status) 252 if status.strip() == "": 253 return 254 else: 255 return 222 256 if not hasattr(event, "info"): 223 257 return … … 239 273 """ 240 274 if hasattr(event, "status"): 241 self.SetStatusText( str(event.status))275 self.SetStatusText(text=str(event.status), event=event) 242 276 243 277
Note: See TracChangeset
for help on using the changeset viewer.