Changes in src/sas/sasgui/guiframe/gui_manager.py [b1ec23d:8ac05a5] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/gui_manager.py
rb1ec23d r8ac05a5 46 46 from sas.sasgui.guiframe.CategoryManager import CategoryManager 47 47 from sas.sascalc.dataloader.loader import Loader 48 from sas.sascalc.file_converter.nxcansas_writer import NXcanSASWriter49 48 from sas.sasgui.guiframe.proxy import Connection 50 49 … … 1277 1276 1278 1277 wx_id = wx.NewId() 1279 self._help_menu.Append(wx_id, '&Documentation', ' ')1278 self._help_menu.Append(wx_id, '&Documentation', 'Help documentation for SasView') 1280 1279 wx.EVT_MENU(self, wx_id, self._onSphinxDocs) 1281 1280 1282 1281 if config._do_tutorial and (IS_WIN or sys.platform == 'darwin'): 1283 1282 wx_id = wx.NewId() 1284 self._help_menu.Append(wx_id, '&Tutorial', 'Software tutorial') 1283 # Pluralised both occurences of 'Tutorial' in the line below 1284 # S King, Sep 2018 1285 self._help_menu.Append(wx_id, '&Tutorials', 'Tutorials on how to use SasView') 1285 1286 wx.EVT_MENU(self, wx_id, self._onTutorial) 1287 1288 if config.marketplace_url: 1289 wx_id = wx.NewId() 1290 self._help_menu.Append(wx_id, '&Model marketplace', 'Plug-in fitting models for SasView') 1291 wx.EVT_MENU(self, wx_id, self._on_marketplace_click) 1292 1293 if config._do_release: 1294 wx_id = wx.NewId() 1295 self._help_menu.Append(wx_id, '&Release notes', 1296 'SasView release notes and known issues') 1297 wx.EVT_MENU(self, wx_id, self._onRelease) 1286 1298 1287 1299 if config._do_acknowledge: … … 1294 1306 logger.info("Doing help menu") 1295 1307 wx_id = wx.NewId() 1296 self._help_menu.Append(wx_id, '&About', ' Software information')1308 self._help_menu.Append(wx_id, '&About', 'Information about SasView') 1297 1309 wx.EVT_MENU(self, wx_id, self._onAbout) 1298 1299 if config.marketplace_url:1300 wx_id = wx.NewId()1301 self._help_menu.Append(wx_id, '&Model marketplace', '')1302 wx.EVT_MENU(self, wx_id, self._on_marketplace_click)1303 1310 1304 1311 # Checking for updates … … 2138 2145 dialog.ShowModal() 2139 2146 2147 def _onRelease(self, evt): 2148 """ 2149 Pop up the release notes 2150 2151 :param evt: menu event 2152 2153 """ 2154 # S King, Sep 2018 2155 2156 from documentation_window import DocumentationWindow 2157 _TreeLocation = "user/release.html" 2158 DocumentationWindow(self, -1, _TreeLocation, "", 2159 "SasView Documentation") 2160 2140 2161 def _onTutorial(self, evt): 2141 2162 """ … … 2145 2166 2146 2167 """ 2147 if config._do_tutorial: 2148 path = config.TUTORIAL_PATH 2149 if IS_WIN: 2150 try: 2151 from sas.sasgui.guiframe.pdfview import PDFFrame 2152 dialog = PDFFrame(None, -1, "Tutorial", path) 2153 # put icon 2154 self.put_icon(dialog) 2155 dialog.Show(True) 2156 except: 2157 logger.error("Error in _onTutorial: %s" % sys.exc_value) 2158 try: 2159 # Try an alternate method 2160 logger.error( 2161 "Could not open the tutorial pdf, trying xhtml2pdf") 2162 from xhtml2pdf import pisa 2163 pisa.startViewer(path) 2164 except: 2165 logger.error( 2166 "Could not open the tutorial pdf with xhtml2pdf") 2167 msg = "This feature requires 'PDF Viewer'\n" 2168 wx.MessageBox(msg, 'Error') 2169 else: 2170 try: 2171 command = "open '%s'" % path 2172 os.system(command) 2173 except: 2174 try: 2175 # Try an alternate method 2176 logger.error( 2177 "Could not open the tutorial pdf, trying xhtml2pdf") 2178 from xhtml2pdf import pisa 2179 pisa.startViewer(path) 2180 except: 2181 logger.error( 2182 "Could not open the tutorial pdf with xhtml2pdf") 2183 msg = "This feature requires the Preview application\n" 2184 wx.MessageBox(msg, 'Error') 2168 # Action changed from that in 2.x/3.x/4.0.x/4.1.x 2169 # Help >> Tutorial used to bring up a pdf of the 2170 # original 2.x tutorial. 2171 # Code below, implemented from 4.2.0, redirects 2172 # action to the Tutorials page of the help 2173 # documentation to give access to all available 2174 # tutorials 2175 # S King, Sep 2018 2176 2177 from documentation_window import DocumentationWindow 2178 _TreeLocation = "user/tutorial.html" 2179 DocumentationWindow(self, -1, _TreeLocation, "", 2180 "SasView Documentation") 2185 2181 2186 2182 def _onSphinxDocs(self, evt): … … 2423 2419 default_name = fname 2424 2420 wildcard = "Text files (*.txt)|*.txt|"\ 2425 "CanSAS 1D files (*.xml)|*.xml|"\ 2426 "NXcanSAS files (*.h5)|*.h5|" 2427 options = [".txt", ".xml",".h5"] 2421 "CanSAS 1D files(*.xml)|*.xml" 2422 path = None 2428 2423 dlg = wx.FileDialog(self, "Choose a file", 2429 2424 self._default_save_location, … … 2435 2430 # This is MAC Fix 2436 2431 ext_num = dlg.GetFilterIndex() 2437 2438 ext_format = options[ext_num] 2432 if ext_num == 0: 2433 ext_format = '.txt' 2434 else: 2435 ext_format = '.xml' 2439 2436 path = os.path.splitext(path)[0] + ext_format 2440 2437 mypath = os.path.basename(path) 2441 fName = os.path.splitext(path)[0] + ext_format 2442 2443 if os.path.splitext(mypath)[1].lower() == options[0]: 2438 2439 # Instantiate a loader 2440 loader = Loader() 2441 ext_format = ".txt" 2442 if os.path.splitext(mypath)[1].lower() == ext_format: 2444 2443 # Make sure the ext included in the file name 2445 2444 # especially on MAC 2445 fName = os.path.splitext(path)[0] + ext_format 2446 2446 self._onsaveTXT(data, fName) 2447 elif os.path.splitext(mypath)[1].lower() == options[1]: 2447 ext_format = ".xml" 2448 if os.path.splitext(mypath)[1].lower() == ext_format: 2448 2449 # Make sure the ext included in the file name 2449 2450 # especially on MAC 2450 # Instantiate a loader 2451 loader = Loader() 2451 fName = os.path.splitext(path)[0] + ext_format 2452 2452 loader.save(fName, data, ext_format) 2453 elif os.path.splitext(mypath)[1].lower() == options[2]:2454 nxcansaswriter = NXcanSASWriter()2455 nxcansaswriter.write([data], fName)2456 2453 try: 2457 2454 self._default_save_location = os.path.dirname(path) … … 2480 2477 if has_errors: 2481 2478 if data.dx is not None and data.dx != []: 2482 out.write("<X> \t<Y>\t<dY>\t<dX>\n")2479 out.write("<X> <Y> <dY> <dX>\n") 2483 2480 else: 2484 out.write("<X> \t<Y>\t<dY>\n")2481 out.write("<X> <Y> <dY>\n") 2485 2482 else: 2486 out.write("<X> \t<Y>\n")2483 out.write("<X> <Y>\n") 2487 2484 2488 2485 for i in range(len(data.x)): … … 2528 2525 text += 'dY_min = %s: dY_max = %s\n' % (min(data.dy), max(data.dy)) 2529 2526 text += '\nData Points:\n' 2530 text += "<index> \t<X> \t<Y> \t<dY> " 2531 text += "\t<dX>\n" if(data.dxl is not None and 2532 data.dxw is not None) else "\t<dXl> \t<dXw>\n" 2527 x_st = "X" 2533 2528 for index in range(len(data.x)): 2534 2529 if data.dy is not None and len(data.dy) > index: … … 2541 2536 dx_val = 0.0 2542 2537 if data.dxl is not None and len(data.dxl) > index: 2538 if index == 0: 2539 x_st = "Xl" 2543 2540 dx_val = data.dxl[index] 2544 if data.dxw is not None and len(data.dxw) > index: 2545 dx_val = "%s \t%s" % (data.dxl[index], data.dxw[index]) 2546 2541 elif data.dxw is not None and len(data.dxw) > index: 2542 if index == 0: 2543 x_st = "Xw" 2544 dx_val = data.dxw[index] 2545 2546 if index == 0: 2547 text += "<index> \t<X> \t<Y> \t<dY> \t<d%s>\n" % x_st 2547 2548 text += "%s \t%s \t%s \t%s \t%s\n" % (index, 2548 2549 data.x[index], … … 2561 2562 """ 2562 2563 default_name = fname 2563 wildcard = "IGOR/DAT 2D file in Q_map (*.dat)|*.DAT|"\ 2564 "NXcanSAS files (*.h5)|*.h5|" 2564 wildcard = "IGOR/DAT 2D file in Q_map (*.dat)|*.DAT" 2565 2565 dlg = wx.FileDialog(self, "Choose a file", 2566 2566 self._default_save_location, … … 2574 2574 if ext_num == 0: 2575 2575 ext_format = '.dat' 2576 elif ext_num == 1:2577 ext_format = '.h5'2578 2576 else: 2579 2577 ext_format = '' … … 2583 2581 # Instantiate a loader 2584 2582 loader = Loader() 2585 if os.path.splitext(mypath)[1].lower() == '.dat': 2583 2584 ext_format = ".dat" 2585 if os.path.splitext(mypath)[1].lower() == ext_format: 2586 2586 # Make sure the ext included in the file name 2587 2587 # especially on MAC 2588 2588 fileName = os.path.splitext(path)[0] + ext_format 2589 2589 loader.save(fileName, data, ext_format) 2590 elif os.path.splitext(mypath)[1].lower() == '.h5':2591 # Make sure the ext included in the file name2592 # especially on MAC2593 fileName = os.path.splitext(path)[0] + ext_format2594 nxcansaswriter = NXcanSASWriter()2595 nxcansaswriter.write([data], fileName)2596 2590 try: 2597 2591 self._default_save_location = os.path.dirname(path)
Note: See TracChangeset
for help on using the changeset viewer.