Changeset 45802d4 in sasview
- Timestamp:
- Apr 6, 2010 11:51:54 AM (15 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:
- f75ea4a
- Parents:
- 4e74e13
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
invariantview/perspectives/invariant/invariant_details.py
rd0cc0bbc r45802d4 2 2 import wx 3 3 import sys 4 import colorsys 4 5 5 import numpy 6 6 from sans.guiframe.utils import format_number, check_float … … 30 30 31 31 class InvariantContainer(wx.Object): 32 """ 33 This class stores some values resulting resulting from invariant 34 calculations. Given the value of total invariant, this class can also 35 determine the percentage of invariants resulting from extrapolation. 36 """ 32 37 def __init__(self): 33 38 #invariant at low range … … 101 106 This panel describes proportion of invariants 102 107 """ 103 def __init__(self, parent=None, id=-1, qstar_container=None, title="", 104 size=(PANEL_WIDTH, PANEL_HEIGHT)): 105 wx.Dialog.__init__(self, parent, id=id, title=title, size=size) 106 107 #Font size 108 self.SetWindowVariant(variant=FONT_VARIANT) 109 self.parent = parent 110 #self.qstar_container 111 self.qstar_container = qstar_container 112 #warning message 113 self.warning_msg = self.qstar_container.warning_msg 114 115 #Define scale of each bar 116 self.low_inv_percent = self.qstar_container.qstar_low_percent 117 self.low_scale = self.get_scale(percentage=self.low_inv_percent, 118 scale_name="Extrapolated at Low Q") 119 self.inv_percent = self.qstar_container.qstar_percent 120 self.inv_scale = self.get_scale(percentage=self.inv_percent, 121 scale_name="Inv in Q range") 122 self.high_inv_percent = self.qstar_container.qstar_high_percent 123 self.high_scale = self.get_scale(percentage=self.high_inv_percent, 124 scale_name="Extrapolated at High Q") 125 126 #Default color the extrapolation bar is grey 127 self.extrapolation_color_low = wx.Colour(169, 169, 168, 128) 128 self.extrapolation_color_high = wx.Colour(169, 169, 168, 128) 129 #change color of high and low bar when necessary 130 self.set_color_bar() 131 #draw the panel itself 132 self._do_layout() 133 self.set_values() 108 def __init__(self, parent=None, id=-1, qstar_container=None, 109 title="Invariant Details", 110 size=(PANEL_WIDTH, PANEL_HEIGHT)): 111 try: 112 wx.Dialog.__init__(self, parent=parent, id=id,title=title,size=size) 113 114 #Font size 115 self.SetWindowVariant(variant=FONT_VARIANT) 116 self.parent = parent 117 #self.qstar_container 118 self.qstar_container = qstar_container 119 #warning message 120 self.warning_msg = self.qstar_container.warning_msg 121 122 #Define scale of each bar 123 self.low_inv_percent = self.qstar_container.qstar_low_percent 124 self.low_scale = self.get_scale(percentage=self.low_inv_percent, 125 scale_name="Extrapolated at Low Q") 126 self.inv_percent = self.qstar_container.qstar_percent 127 self.inv_scale = self.get_scale(percentage=self.inv_percent, 128 scale_name="Inv in Q range") 129 self.high_inv_percent = self.qstar_container.qstar_high_percent 130 self.high_scale = self.get_scale(percentage=self.high_inv_percent, 131 scale_name="Extrapolated at High Q") 132 133 #Default color the extrapolation bar is grey 134 self.extrapolation_color_low = wx.Colour(169, 169, 168, 128) 135 self.extrapolation_color_high = wx.Colour(169, 169, 168, 128) 136 #change color of high and low bar when necessary 137 self.set_color_bar() 138 #draw the panel itself 139 self._do_layout() 140 self.set_values() 141 except: 142 print "error", sys.exc_value() 134 143 135 144 def _define_structure(self): … … 403 412 gc.DrawPath(path) 404 413 gc.PopState() 405 406 class InvariantDetailsWindow(wx.Dialog): 407 def __init__(self, parent, qstar_container=None, *args, **kwds): 408 kwds["size"]= (PANEL_WIDTH +100, 450) 409 wx.Dialog.__init__(self, parent, *args, **kwds) 410 self.container = qstar_container 411 if self.container is None: 412 self.container = InvariantContainer() 413 self.container.qstar_total = 1.0 414 self.container.qstar = 0.75 415 self.container.qstar_low = 0.60 416 self.container.qstar_high = 0.0049 417 self.panel = InvariantDetailsPanel(parent=self, 418 qstar_container=self.container) 419 self.Centre() 420 self.ShowModal() 421 self.Destroy() 422 423 class InvariantDetailsTest(wx.Frame): 424 def __init__(self, parent, qstar_container=None, *args, **kwds): 425 kwds["size"]= (PANEL_WIDTH , PANEL_HEIGHT) 426 wx.Frame.__init__(self, parent, *args, **kwds) 427 self.container = qstar_container 428 if self.container is None: 429 self.container = InvariantContainer() 430 self.container.qstar_total = 1.0 431 self.container.qstar = 0.75 432 self.container.qstar_low = 0.60 433 self.container.qstar_high = 0.0049 434 435 self.panel = InvariantDetailsPanel(parent=self, 436 qstar_container=self.container) 437 self.panel.ShowModal() 438 self.panel.Destroy() 439 self.Show() 440 414 415 441 416 if __name__ =="__main__": 442 417 app = wx.App() 443 444 418 container = InvariantContainer() 445 419 container.qstar_total = 100.0 … … 448 422 container.qstar_high = 100.0 449 423 container.compute_percentage() 450 451 window = InvariantDetailsTest(parent=None, id=-1,qstar_container=container, 452 title="Invariant Details") 453 window.Show() 424 dlg = InvariantDetailsPanel(qstar_container=container) 425 dlg.ShowModal() 454 426 app.MainLoop()
Note: See TracChangeset
for help on using the changeset viewer.