- Timestamp:
- Feb 28, 2015 11:12:57 PM (10 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:
- f1e80df
- Parents:
- cfe472e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/perspectives/calculator/gen_scatter_panel.py
r7a04dbb r3f5d75b 37 37 from sas.perspectives.calculator import calculator_widgets as widget 38 38 from sas.guiframe.events import NewPlotEvent 39 from sas.guiframe.documentation_window import DocumentationWindow 39 40 40 41 _BOX_WIDTH = 76 … … 80 81 return False 81 82 83 84 82 85 class CalcGen(CalcThread): 83 86 """ … … 119 122 ## Name to appear on the window title bar 120 123 window_caption = "Generic SAS " 121 ## Flag to tell the AUI manager to put this panel in the center pane122 CENTER_PANE = True123 124 124 125 def __init__(self, parent, *args, **kwds): … … 192 193 id = wx.NewId() 193 194 self.browse_button = wx.Button(self, id, "Load") 194 hint_on_browse = "Click on this button to load a data inthis panel."195 #self.browse_button.SetToolTipString(hint_on_browse)195 hint_on_browse = "Click to load data into this panel." 196 self.browse_button.SetToolTipString(hint_on_browse) 196 197 self.Bind(wx.EVT_BUTTON, self.on_load_data, id=id) 197 198 self.data_name_sizer.AddMany([(data_name_txt, 0, wx.LEFT, 15), … … 379 380 self.bt_compute.Bind(wx.EVT_BUTTON, self.on_compute) 380 381 self.bt_compute.SetToolTipString("Compute 2D Scattering Pattern.") 382 self.bt_help = wx.Button(self, wx.NewId(),'HELP') 383 self.bt_help.Bind(wx.EVT_BUTTON, self.on_help) 384 self.bt_help.SetToolTipString("Help on Scatter Calculator") 381 385 self.button_sizer.AddMany([(self.time_text , 0, wx.LEFT, 20), 382 (self.orient_combo , 0, wx.LEFT, 40), 383 (self.bt_compute, 0, wx.LEFT, 20)]) 386 (self.orient_combo , 0, wx.LEFT, 20), 387 (self.bt_compute, 0, wx.LEFT, 20), 388 (self.bt_help, 0, wx.LEFT, 5)]) 384 389 385 390 def estimate_ctime(self): … … 883 888 self.SetFocus() 884 889 890 def on_help(self, event): 891 """ 892 Bring up the General scattering Calculator Documentation whenever 893 the HELP button is clicked. 894 895 Calls DocumentationWindow with the path of the location within the 896 documentation tree (after /doc/ ....". Note that when using old 897 versions of Wx (before 2.9) and thus not the release version of 898 installers, the help comes up at the top level of the file as 899 webbrowser does not pass anything past the # to the browser when it is 900 running "file:///...." 901 902 :param evt: Triggers on clicking the help button 903 """ 904 905 _TreeLocation = "user/perspectives/calculator/sas_calculator_help.html" 906 _doc_viewer = DocumentationWindow(self, -1, \ 907 _TreeLocation,"General Scattering Calculator Help") 908 885 909 def _check_value(self): 886 910 """ … … 1198 1222 ## Name to appear on the window title bar 1199 1223 window_caption = "SLD Pixel Info " 1200 ## Flag to tell the AUI manager to put this panel in the center pane1201 CENTER_PANE = False1202 1224 1203 1225 def __init__(self, parent, *args, **kwds): … … 1527 1549 def _do_layout(self): 1528 1550 """ 1529 Draw window content 1551 Draw omf panel content, used to define sld s. 1552 1530 1553 """ 1531 1554 self._define_structure() … … 1798 1821 """ 1799 1822 def __init__(self, parent=None, manager= None, title="Generic Scattering Calculator", 1800 size=(PANEL_WIDTH * 1. 3, PANEL_HEIGHT * 1.65), *args, **kwds):1823 size=(PANEL_WIDTH * 1.4, PANEL_HEIGHT * 1.65), *args, **kwds): 1801 1824 """ 1802 1825 Init … … 1820 1843 self.Bind(wx.EVT_CLOSE, self.on_close) 1821 1844 1822 self._build_toolbar()1823 1845 1824 1846 self.build_panels() 1825 self.SetPosition((2 5, 150))1847 self.SetPosition((20, 5)) 1826 1848 self.Show(True) 1827 1828 def _build_toolbar(self):1829 """1830 Build toolbar1831 """1832 tsize = (20, 20)1833 # The legacy code doesn't work well for wx 3.01834 # but the old code produces better results with wx 2.81835 if wx.VERSION_STRING >= '3.0.0.0':1836 tb = wx.ToolBar(self, style=wx.TB_HORIZONTAL | wx.TB_FLAT)1837 sizer = wx.BoxSizer(wx.VERTICAL)1838 sizer.Add(tb, 0, wx.EXPAND)1839 self.SetSizer(sizer)1840 else:1841 tb = self.CreateToolBar(wx.TB_HORIZONTAL | wx.TB_FLAT)1842 open_bmp = wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_TOOLBAR,1843 tsize)1844 save_bmp = wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE_AS, wx.ART_TOOLBAR,1845 tsize)1846 close_bmp = wx.ArtProvider.GetBitmap(wx.ART_QUIT, wx.ART_TOOLBAR,1847 tsize)1848 help_bmp = wx.ArtProvider.GetBitmap(wx.ART_HELP, wx.ART_TOOLBAR,1849 (17, 20))1850 1851 id = wx.NewId()1852 tb.AddLabelTool(id, "Open", open_bmp, shortHelp="Open",1853 longHelp="Open sld/omf file")1854 self.Bind(wx.EVT_TOOL, self.on_open_file, id=id)1855 1856 id = wx.NewId()1857 tb.AddSimpleTool(id, save_bmp, "Save", "Save as sld file")1858 self.Bind(wx.EVT_TOOL, self.on_save_file, id=id)1859 1860 tb.AddSeparator()1861 id = wx.NewId()1862 tb.AddSimpleTool(id, close_bmp, "Quit", "Quit")1863 self.Bind(wx.EVT_TOOL, self.on_close, id=id)1864 1865 tb.AddSeparator()1866 id = wx.NewId()1867 tb.AddSimpleTool(id, help_bmp, "Help", "Help")1868 self.Bind(wx.EVT_TOOL, self.on_help, id=id)1869 1870 tb.Realize()1871 1872 def _build_menubar(self):1873 """1874 Build menubar1875 """1876 tsize = (13, 13)1877 open_bmp = wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_TOOLBAR,1878 tsize)1879 save_bmp = wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE_AS, wx.ART_TOOLBAR,1880 tsize)1881 quit_bmp = wx.ArtProvider.GetBitmap(wx.ART_QUIT, wx.ART_TOOLBAR,1882 tsize)1883 help_bmp = wx.ArtProvider.GetBitmap(wx.ART_HELP, wx.ART_TOOLBAR,1884 (13, 15))1885 1886 menu_bar = wx.MenuBar()1887 1888 menu = wx.Menu()1889 id = wx.NewId()1890 item = wx.MenuItem(menu, id, "&Open sld/omf file")1891 item.SetBitmap(open_bmp)1892 menu.AppendItem(item)1893 wx.EVT_MENU(self, id, self.on_open_file)1894 1895 id = wx.NewId()1896 item = wx.MenuItem(menu, id, "&Save as sld file")1897 item.SetBitmap(save_bmp)1898 menu.AppendItem(item)1899 wx.EVT_MENU(self, id, self.on_save_file)1900 1901 menu.AppendSeparator()1902 id = wx.NewId()1903 item = wx.MenuItem(menu, id, "&Quit")1904 item.SetBitmap(quit_bmp)1905 menu.AppendItem(item)1906 1907 menu_bar.Append(menu, "&File")1908 wx.EVT_MENU(self, id, self.on_close)1909 1910 menu_help = wx.Menu()1911 id = wx.NewId()1912 item = wx.MenuItem(menu_help, id, "&Theory and GUI")1913 item.SetBitmap(help_bmp)1914 menu_help.AppendItem(item)1915 wx.EVT_MENU(self, id, self.on_help)1916 1917 menu_bar.Append(menu_help, "&Help")1918 1919 self.SetMenuBar(menu_bar)1920 1849 1921 1850 def build_panels(self): … … 1924 1853 1925 1854 self.set_sld_data(self.sld_data) 1926 1927 1855 self._mgr.AddPane(self.panel, aui.AuiPaneInfo(). 1928 1856 Name(self.panel.window_name). … … 2108 2036 self.Destroy() 2109 2037 2110 def on_help(self, event):2111 """2112 2113 """2114 from sas.perspectives.calculator.help_panel import HelpWindow2115 # Get models help model_function path2116 import sas.perspectives.calculator as calmedia2117 2118 media = calmedia.get_data_path(media='media')2119 path = os.path.join(media,"gen_sas_help.html")2120 name = "Generic Scattering Calculator"2121 frame = HelpWindow(self, -1,2122 title=' Help: GenSAS',2123 pageToOpen=path, size=(865, 450))2124 try:2125 frame.splitter.DetachWindow(frame.lpanel)2126 # Display only the right side one2127 frame.lpanel.Hide()2128 frame.Show(True)2129 add_icon(self.parent, frame)2130 except:2131 frame.Destroy()2132 msg = 'Display Error\n'2133 info = "Info"2134 wx.MessageBox(msg, info)2038 # def on_help(self, event): 2039 # """ 2040 # Gen scatter angle help panel 2041 # """ 2042 # from sas.perspectives.calculator.help_panel import HelpWindow 2043 # # Get models help model_function path 2044 # import sas.perspectives.calculator as calmedia 2045 # 2046 # media = calmedia.get_data_path(media='media') 2047 # path = os.path.join(media,"gen_sas_help.html") 2048 # name = "Generic Scattering Calculator" 2049 # frame = HelpWindow(self, -1, 2050 # title=' Help: GenSAS', 2051 # pageToOpen=path, size=(865, 450)) 2052 # try: 2053 # frame.splitter.DetachWindow(frame.lpanel) 2054 # # Display only the right side one 2055 # frame.lpanel.Hide() 2056 # frame.Show(True) 2057 # add_icon(self.parent, frame) 2058 # except: 2059 # frame.Destroy() 2060 # msg = 'Display Error\n' 2061 # info = "Info" 2062 # wx.MessageBox(msg, info) 2135 2063 2136 2064 if __name__ == "__main__":
Note: See TracChangeset
for help on using the changeset viewer.